@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url(/fonts/space-grotesk-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #0A0A0A; --panel: #141414; --border: #2A2A2A; --text: #F2F2F2; --dim: #9A9A9A;
  --lime: #B4FF39; --blue: #7FB0FF; --orange: #FFA726;
  --tap: 64px; --r: 6px;
  --mono: "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --grotesk: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 20px/1.4 var(--mono); text-transform: lowercase; overflow: hidden; user-select: none; }
input { text-transform: none; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }
.lime { color: var(--lime); }
.h { color: var(--dim); margin: 0 0 12px; font-size: 18px; letter-spacing: .04em; }
.wordmark { font: 700 56px/1 var(--grotesk); text-transform: none; margin: 0 0 32px; letter-spacing: -.01em; }
.wordmark.sm { font-size: 32px; margin: 0; }
.wordmark .slash { color: var(--lime); }

/* buttons */
.btn { min-height: var(--tap); min-width: var(--tap); padding: 0 24px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); font: 700 20px var(--mono); text-transform: lowercase; cursor: pointer; }
.btn:active { background: #1E1E1E; border-color: var(--dim); }
.btn:disabled { opacity: .4; }
.btn.lime { background: var(--lime); color: #0A0A0A; border-color: var(--lime); }
.btn.lime:active { filter: brightness(.85); }
.btn.ghost { background: transparent; }
.btn.big { min-height: 72px; font-size: 22px; }

/* login */
#screen-login { align-items: center; justify-content: center; }
.login-box { width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 48px; }
.field { display: block; margin-bottom: 20px; }
.field span { display: block; color: var(--dim); margin-bottom: 8px; font-size: 18px; }
.field input, .jump input { width: 100%; min-height: var(--tap); background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); padding: 0 18px; font: 22px var(--mono); outline: none; }
.field input:focus, .jump input:focus { border-color: var(--lime); }
.check { display: flex; align-items: center; gap: 16px; min-height: var(--tap); margin-bottom: 20px; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 36px; height: 36px; border: 2px solid var(--border); border-radius: 4px; display: inline-grid; place-items: center; }
.check input:checked + .box { border-color: var(--lime); }
.check input:checked + .box::after { content: ""; width: 18px; height: 18px; background: var(--lime); border-radius: 2px; }
#login-btn { width: 100%; }
.err { color: var(--orange); min-height: 1.4em; margin: 16px 0 0; }
.online { margin: 24px 0 0; color: var(--dim); display: flex; align-items: center; gap: 12px; font-size: 18px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--dim); }
.dot.ok { background: var(--lime); box-shadow: 0 0 10px var(--lime); animation: pulse 2s infinite; }
.dot.bad { background: var(--orange); }
@keyframes pulse { 50% { opacity: .45; } }

/* live */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid var(--border); flex: none; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 24px 0; }
.pane.placeholder, #pane-status, #pane-favorites { padding-top: 24px; }
.cats { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 14px; flex: none; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: none; min-height: var(--tap); padding: 0 22px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r); color: var(--dim); font: 20px var(--mono); text-transform: lowercase; white-space: nowrap; }
.cats button.on { color: #0A0A0A; background: var(--lime); border-color: var(--lime); font-weight: 700; }
.live-main { flex: 1; min-height: 0; display: flex; gap: 24px; }
.col-list { flex: 1.35; min-width: 0; display: flex; flex-direction: column; }
.col-preview { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; padding-bottom: 16px; }
.channels { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); }
.ch { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 4px 16px; min-height: 84px; padding: 10px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ch:last-child { border-bottom: 0; }
.ch:active { background: #1C1C1C; }
.ch.on { background: #1A2410; box-shadow: inset 4px 0 0 var(--lime); }
.ch .num { color: var(--lime); font-weight: 700; font-size: 22px; grid-row: span 2; }
.ch .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; }
.ch .now { color: var(--dim); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; grid-column: 2; }
.ch .left { color: var(--dim); font-size: 16px; grid-column: 3; grid-row: 1 / span 2; white-space: nowrap; }
.ch .star { color: var(--lime); }
.empty { padding: 24px; color: var(--dim); }
.jump { display: flex; gap: 12px; align-items: center; padding: 14px 0; flex: none; }
.jump > .lime { font-size: 28px; font-weight: 700; }
.jump input { flex: 1; }
.stage { position: relative; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; flex: none; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.stage canvas, .play-stage canvas { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.preview-info { padding: 16px 2px; min-height: 120px; }
.preview-info .title { font-weight: 700; font-size: 24px; text-transform: none; }
.preview-info .title img { height: 40px; vertical-align: middle; margin-right: 12px; }
.preview-info .prog { margin-top: 10px; text-transform: none; }
.preview-info .prog .t { color: var(--dim); font-size: 16px; }
.bar { height: 4px; background: var(--border); border-radius: 2px; margin: 8px 0; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--lime); }
.preview-actions { display: flex; gap: 12px; }
.preview-actions .btn { flex: 1; }
.tabbar { display: flex; border-top: 1px solid var(--border); flex: none; background: var(--panel); padding-bottom: env(safe-area-inset-bottom, 0); }
.tabbar button { flex: 1; min-height: 72px; background: none; border: 0; color: var(--dim); font: 20px var(--mono); text-transform: lowercase; }
.tabbar button.on { color: var(--lime); font-weight: 700; }
.tabbar button.on::before { content: "["; } .tabbar button.on::after { content: "]"; }
.status { display: grid; grid-template-columns: max-content 1fr; gap: 14px 32px; margin: 0 0 24px; }
.status dt { color: var(--dim); } .status dd { margin: 0; }

/* play */
#screen-play { background: #000; }
.play-stage { position: absolute; inset: 0; }
.play-chrome { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; transition: opacity .25s; }
.play-chrome.hide { opacity: 0; }
.play-chrome.hide * { pointer-events: none !important; }
.play-top, .play-bar, .guide { pointer-events: auto; }
.play-top { display: flex; align-items: center; gap: 20px; padding: 16px 20px; background: linear-gradient(#000c, #0000); }
.play-title { flex: 1; font-weight: 700; font-size: 24px; text-transform: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; gap: 10px; }
.tag { padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 16px; background: #0A0A0Acc; }
.tag.blue { color: var(--blue); border-color: var(--blue); }
.tag.orange { color: var(--orange); border-color: var(--orange); }
.tag.good { color: var(--lime); border-color: var(--lime); }
.tag.fair { color: var(--orange); border-color: var(--orange); }
.tag.weak { color: #FF6B5B; border-color: #FF6B5B; }
.play-bar { display: flex; gap: 12px; align-items: center; padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0)); background: linear-gradient(#0000, #000d); flex-wrap: wrap; }
.play-bar .btn { background: #141414e6; }
.play-bar .btn.lime { background: var(--lime); min-width: 140px; }
.play-bar .spacer { flex: 1; }
.guide { align-self: flex-end; margin: 0 20px; width: min(640px, 90vw); background: #141414f2; border: 1px solid var(--border); border-radius: var(--r); padding: 20px; max-height: 50vh; overflow-y: auto; text-transform: none; }
.guide .row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.guide .row:last-child { border: 0; }
.guide .t { color: var(--lime); font-size: 16px; }
.play-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #141414f2; border: 1px solid var(--border); border-radius: var(--r); padding: 20px 28px; font-size: 22px; pointer-events: auto; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--lime); color: var(--text); padding: 16px 24px; border-radius: var(--r); z-index: 10; }

@media (max-width: 900px) {
  .live-main { flex-direction: column; }
  .col-preview { flex: none; order: -1; }
  .preview-info { min-height: 0; }
}
