@font-face { font-family: "Lilita One"; src: url("../fonts/LilitaOne-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/Nunito-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/Nunito-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/Nunito-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
  --bg: #070d24;          /* deep navy, low glare in a dim hall */
  --panel: #0f1a42;
  --panel-2: #16245a;
  --line: #24356f;
  --text: #e8ecf8;
  --muted: #93a0c8;
  --gold: #f5b82e;
  --gold-soft: rgba(245, 184, 46, .18);
  --live: #ff5a4f;
  --ok: #3ccf7a;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 "Nunito", system-ui, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, .display { font-family: "Lilita One", "Nunito", sans-serif; font-weight: 400; letter-spacing: .01em; }

/* ---------- Control window ---------- */
.control { display: grid; grid-template-rows: auto auto 1fr; height: 100vh; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar img { height: 36px; width: auto; }
.topbar h1 { font-size: 20px; margin: 0; color: var(--gold); white-space: nowrap; }
.topbar .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: rgba(60,207,122,.4); }
.chip.warn { color: var(--gold); border-color: rgba(245,184,46,.5); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn:focus-visible, .tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: var(--gold); color: #1a1300; border-color: var(--gold); }
.btn.big { padding: 10px 18px; font-size: 16px; }
.btn[disabled] { opacity: .45; cursor: default; }

.stage { display: grid; grid-template-columns: auto auto minmax(240px, 1fr); gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pane { width: calc(34vh * 16 / 9); max-width: 42vw; }
.pane + .pane { width: calc(26vh * 16 / 9); max-width: 30vw; }
.pane + .pane .screen { width: 100%; }
.pane h2 { font-size: 15px; margin: 0 0 6px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pane h2 .live { color: var(--live); font-family: "Nunito"; font-weight: 800; font-size: 11px; letter-spacing: .12em; }
.screen { position: relative; aspect-ratio: 16 / 9; width: min(100%, calc(34vh * 16 / 9)); background: #000; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--line); }
.screen.live-border { border-color: var(--live); }
.screen video, .screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.screen .badge { position: absolute; left: 8px; top: 8px; z-index: 5; background: rgba(0,0,0,.65); padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 12px; }
.screen .status { position: absolute; right: 8px; bottom: 8px; z-index: 5; background: rgba(0,0,0,.7); padding: 2px 8px; border-radius: 6px; font-size: 12px; color: var(--gold); display: none; }
.screen .status.show { display: block; }
.now { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.now .num { font-family: "Lilita One"; font-size: 40px; color: var(--gold); line-height: 1; }
.now .title { font-family: "Lilita One"; font-size: 22px; line-height: 1.15; }
.now .section { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.now .row { display: flex; gap: 8px; flex-wrap: wrap; }
.now .goto { color: var(--muted); font-size: 13px; }
.now .goto kbd, .help kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-family: inherit; font-size: 12px; color: var(--text); }
.digits { font-family: "Lilita One"; font-size: 18px; color: var(--gold); min-height: 22px; }

.gridwrap { overflow: auto; padding: 10px 16px 24px; }
.gridwrap.hidden { display: none; }
.section-label { font-family: "Lilita One"; color: var(--gold); font-size: 16px; margin: 14px 0 6px; }
.section-label:first-child { margin-top: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 0; overflow: hidden; text-align: left; }
.tile img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.tile .cap { display: flex; gap: 6px; align-items: baseline; padding: 5px 7px 6px; font-size: 12px; font-weight: 700; line-height: 1.2; }
.tile .cap b { color: var(--gold); font-family: "Lilita One"; font-weight: 400; font-size: 14px; }
.tile:hover { border-color: #5b6fb0; }
.tile.current { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.tile.current::after { content: "LIVE"; position: absolute; top: 6px; right: 6px; background: var(--live); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .1em; padding: 1px 6px; border-radius: 4px; }
.tile.next { border-color: #5b6fb0; }

/* settings drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: none; }
.drawer-bg.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 51; padding: 18px 20px; overflow: auto; transform: translateX(105%); transition: transform .2s; }
.drawer.open { transform: none; }
.drawer h2 { margin: 0 0 4px; color: var(--gold); font-size: 22px; }
.drawer h3 { margin: 20px 0 8px; font-size: 17px; }
.drawer p { color: var(--muted); margin: 6px 0; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 700; }
.seg button.on { background: var(--gold); color: #1a1300; }
.progress { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); margin: 10px 0 4px; }
.progress > div { height: 100%; width: 0; background: var(--gold); transition: width .2s; }
.help { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; color: var(--muted); }
.banner { display: none; gap: 10px; align-items: center; padding: 8px 16px; background: rgba(245,184,46,.12); color: var(--gold); border-bottom: 1px solid rgba(245,184,46,.4); font-weight: 700; font-size: 14px; }
.banner.show { display: flex; }

/* small 13" screens */
@media (max-width: 1180px) {
  .topbar .sub { display: none; }
  .now .title { font-size: 18px; }
}
@media (max-width: 1000px) {
  .stage { grid-template-columns: auto auto; }
  .stage .now { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .topbar .chip { display: none; }
}
@media (max-height: 760px) {
  .stage { padding: 10px 16px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .now .num { font-size: 32px; }
}

/* ---------- Output window ---------- */
.output { background: #000; overflow: hidden; cursor: none; }
.output .stagefull { position: fixed; inset: 0; background: #000; }
.output .stagefull video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.output .hint { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 20; background: rgba(15,26,66,.92); color: var(--text); border: 1px solid var(--gold); border-radius: 10px; padding: 10px 18px; font-weight: 700; cursor: pointer; transition: opacity .4s; }
.output .hint.gone { opacity: 0; pointer-events: none; }
.output .overlay { position: fixed; inset: 0; z-index: 30; background: rgba(7,13,36,.96); overflow: auto; padding: 20px 28px; display: none; cursor: default; }
.output .overlay.open { display: block; }
.output .digits-out { position: fixed; right: 20px; top: 16px; z-index: 25; font-family: "Lilita One"; font-size: 40px; color: var(--gold); text-shadow: 0 2px 8px #000; }
.output .err { position: fixed; left: 16px; bottom: 16px; z-index: 25; color: var(--gold); font-weight: 700; background: rgba(0,0,0,.7); padding: 6px 10px; border-radius: 6px; display: none; }
.output .err.show { display: block; }
