@font-face {
  font-family: 'AnonymicePro';
  src: url('/static/fonts/AnonymicePro-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg-0: #050608;
  --bg-1: #0a0d13;
  --bg-2: #0f1521;
  --panel: #101723;
  --panel-2: #0d141f;
  --line: #243147;
  --line-soft: #1a2538;
  --text: #e7eefb;
  --muted: #95a5c6;
  --accent: #ffb05a;
  --accent-2: #ffe0bc;
  --ok: #56d0a0;
  --bad: #ff6f7d;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: 'AnonymicePro', monospace;
  background:
    radial-gradient(1000px 500px at 12% -8%, rgba(255, 176, 90, .18), transparent 55%),
    radial-gradient(780px 420px at 88% -12%, rgba(112, 149, 236, .14), transparent 48%),
    linear-gradient(180deg, var(--bg-2), var(--bg-0));
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 30px 30px;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(500px 180px at 50% 0%, rgba(255, 176, 90, .18), transparent 70%),
    radial-gradient(800px 260px at 50% 100%, rgba(92, 126, 197, .10), transparent 78%);
}

.scanline {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .08) 0px,
    rgba(255, 255, 255, .08) 1px,
    transparent 1px,
    transparent 3px
  );
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 17, .84);
  backdrop-filter: blur(8px);
}

.brand {
  display: grid;
  gap: 2px;
}

.brand a {
  color: var(--accent);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.brand span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.topbar nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  letter-spacing: .05em;
  text-transform: uppercase;
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(23, 33, 50, .64), rgba(13, 19, 30, .64));
  padding: 8px 10px;
  border-radius: 10px;
  transition: border-color .14s ease, color .14s ease, transform .14s ease;
}

.topbar nav a:hover {
  border-color: #4d6590;
  color: var(--accent-2);
  transform: translateY(-1px);
}

.container {
  max-width: 1680px;
  margin: 26px auto;
  padding: 0 18px 46px;
  animation: fade-in .35s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel {
  position: relative;
  background: linear-gradient(160deg, rgba(17, 24, 37, .96), rgba(11, 16, 26, .98));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .03);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 176, 90, .11);
  pointer-events: none;
}

h1, h2, h3 {
  margin-top: 0;
  letter-spacing: .06em;
  text-transform: uppercase;
}

h1 {
  font-size: 23px;
  color: var(--accent-2);
}

h2 { font-size: 18px; }
h3 { font-size: 15px; }

.narrow {
  max-width: 560px;
  margin-inline: auto;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #0d141f, #0a1019);
  color: var(--text);
  padding: 11px 12px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #4f6b9a;
  box-shadow: 0 0 0 3px rgba(79, 107, 154, .25);
}

button, .button {
  border: 1px solid #8a663b;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffc98f, #dc9a58);
  color: #26170a;
  text-decoration: none;
  padding: 10px 14px;
  display: inline-block;
  cursor: pointer;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: transform .14s ease, filter .14s ease;
}

button:hover, .button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.muted { color: var(--muted); }

.alert {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(16, 22, 35, .9);
}

.alert.success {
  border-color: rgba(86, 208, 160, .45);
  color: #9ef0ca;
}

.alert.error {
  border-color: rgba(255, 111, 125, .45);
  color: #ffb4bc;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar {
  margin-bottom: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mono {
  font-size: 22px;
  margin: 0;
  color: var(--accent-2);
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.status-board {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(12, 17, 27, .85);
  line-height: 1.6;
}

.busy-chip {
  display: inline-block;
  border: 1px solid rgba(255, 111, 125, .5);
  color: #ffb4bc;
  background: rgba(255, 111, 125, .12);
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}

.time-picker {
  padding: 14px;
}

.time-picker h3 {
  margin-bottom: 10px;
}

.time-scale-wrap {
  position: relative;
  padding: 10px 2px 8px;
}

.time-scale {
  position: relative;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  overflow: hidden;
  background: #0a1019;
  touch-action: none;
  user-select: none;
}

.scale-base {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #121a2a, #0a1019);
}

.segments-layer {
  position: absolute;
  inset: 0;
}

.seg-available,
.seg-busy,
.seg-selected {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 999px;
}

.seg-available {
  background: rgba(86, 208, 160, 0.18);
}

.seg-busy {
  background: rgba(165, 171, 183, 0.45);
}

.seg-selected {
  background: rgba(255, 176, 90, 0.55);
  border-left: 1px solid rgba(255, 176, 90, 0.9);
  border-right: 1px solid rgba(255, 176, 90, 0.9);
  top: 3px;
  bottom: 3px;
  z-index: 4;
}

.selection-range {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 176, 90, .68), rgba(219, 146, 67, .78));
  border: 1px solid rgba(255, 218, 179, .55);
  box-shadow: inset 0 0 0 1px rgba(42, 24, 6, .26);
  cursor: grab;
  z-index: 5;
}

.time-scale.is-dragging .selection-range {
  cursor: grabbing;
}

.time-handle {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid #f2b671;
  background: #ffe1ba;
  box-shadow: 0 0 0 3px rgba(255, 176, 90, .18);
  z-index: 6;
  cursor: pointer;
  padding: 0;
}

.time-handle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(242, 182, 113, .45);
}

.time-handle:hover {
  filter: brightness(1.05);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 33, 50, .88), rgba(16, 23, 35, .9));
  padding: 14px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.game-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 346px;
  border-radius: 14px;
  border: 1px solid #29354e;
  background: #11192a;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.game-art {
  position: relative;
  width: 100%;
  height: 95%;
  overflow: hidden;
}

.game-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  filter: saturate(1.05) contrast(1.03);
  transition: transform .34s ease, filter .34s ease;
}

.game-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, .30) 100%);
}

.game-name {
  height: 5%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-2);
  letter-spacing: .05em;
  text-transform: uppercase;
  font-size: 13px;
  text-align: center;
  padding: 6px 10px;
  border-top: 1px solid #29354e;
  background: linear-gradient(180deg, #152036, #101a2b);
}

.game-tile:hover {
  transform: translateY(-3px);
  border-color: #556f9f;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 176, 90, .14);
}

.game-tile:hover .game-art img {
  transform: scale(1.045);
  filter: saturate(1.14) contrast(1.07);
}

.reveal {
  animation: reveal .52s ease both;
  animation-delay: var(--delay, 0ms);
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 8px;
  text-align: left;
}

th {
  color: var(--accent-2);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

pre {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b111c;
  padding: 10px;
  overflow: auto;
}

.qr {
  max-width: 240px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.hidden { display: none; }
.hidden-field { display: none !important; }

#qrVideo {
  max-width: 380px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.widget-wrap {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .topbar {
    padding: 10px 12px;
    align-items: start;
    gap: 10px;
    flex-direction: column;
  }

  .topbar nav {
    width: 100%;
    gap: 8px;
  }

  .topbar nav a {
    font-size: 12px;
    padding: 7px 8px;
  }
}

@media (max-width: 700px) {
  .container {
    padding: 0 10px 28px;
    margin-top: 16px;
  }

  .panel {
    padding: 14px;
    border-radius: 12px;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .game-tile {
    height: 220px;
    border-radius: 12px;
  }

  .game-name {
    min-height: 34px;
    font-size: 11px;
  }
}

@media (min-width: 1280px) {
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1700px) {
  .game-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
