/* KDTV TV app — laid out on a fixed 1920×1080 canvas, scaled to the screen by main.js. */
:root {
  --bg: #07090f; --panel: #0f1420; --panel2: #161d2d; --line: #222b3f;
  --text: #e8ecf4; --muted: #8b95a9; --accent: #0ea5e9; --accent2: #38bdf8; --warn: #fbbf24; --star: #facc15;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: "Samsung One", "LG Smart UI", "Roboto", "Segoe UI", Arial, sans-serif; }
#root { position: absolute; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; text-align: left; cursor: pointer; outline: none; }
.muted { color: var(--muted); }

.screen { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: var(--bg); }
.overlay.dim { background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; }

.brand { display: flex; align-items: center; font-size: 38px; font-weight: 800; letter-spacing: 1px; }
.brand.big { font-size: 64px; }
.brand-mark { width: 44px; height: 32px; border: 4px solid #fff; border-radius: 7px; position: relative; }
.brand.big .brand-mark { width: 70px; height: 50px; }
.brand-mark::after { content: ""; position: absolute; left: 36%; top: 22%; border-left: 12px solid var(--accent); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.brand.big .brand-mark::after { border-left-width: 18px; border-top-width: 12px; border-bottom-width: 12px; }

.msg-title { font-size: 48px; }
.msg-detail { font-size: 30px; color: var(--muted); max-width: 1200px; }
.spinner { width: 64px; height: 64px; border: 6px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { padding: 18px 44px; border-radius: 14px; background: var(--panel2); font-size: 30px; font-weight: 600; border: 3px solid transparent; }
.btn.primary { background: var(--accent); color: #fff; }
.focused.btn, .btn.focused { border-color: #fff; transform: scale(1.06); box-shadow: 0 0 0 6px rgba(56,189,248,.35); }
.row { display: flex; }

/* Activation */
.activation { display: flex; align-items: center; justify-content: space-between; padding: 90px 140px; background: radial-gradient(1200px 700px at 80% 20%, #0c2a44 0%, var(--bg) 60%); }
.act-left { max-width: 1000px; display: flex; flex-direction: column; }
.act-left h1 { font-size: 64px; line-height: 1.1; }
.steps { font-size: 30px; line-height: 1.5; padding-left: 40px; color: #cdd5e3; }
.steps li { margin-bottom: 8px; }
.ids { display: flex; }
.id-box { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 22px 36px; }
.id-label { font-size: 22px; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; }
.id-value { font-size: 52px; font-weight: 800; letter-spacing: 3px; font-family: "Roboto Mono", Menlo, monospace; color: var(--accent2); }
.fineprint { font-size: 20px; color: #5b6478; }
.act-right { text-align: center; font-size: 26px; }
.qr { width: 460px; height: 460px; background: #fff; padding: 22px; border-radius: 24px; margin-bottom: 18px; }
.qr svg { width: 100%; height: 100%; display: block; }

/* Home */
.home { display: flex; flex-direction: column; }
.topbar { height: 120px; display: flex; align-items: center; padding: 0 56px; border-bottom: 2px solid var(--line); background: linear-gradient(#0b1120, var(--bg)); }
.tabs { display: flex; align-items: center; flex: 1; overflow: hidden; }
.tab { padding: 14px 30px; border-radius: 40px; font-size: 30px; font-weight: 600; color: var(--muted); border: 3px solid transparent; white-space: nowrap; }
.tab.small { font-size: 24px; padding: 10px 22px; }
.tab.active { color: #fff; background: var(--panel2); }
.tab.focused { border-color: #fff; color: #fff; background: var(--accent); }
.sep { width: 2px; height: 40px; background: var(--line); margin: 0 12px; }
.top-right { display: flex; align-items: center; }
.search { width: 340px; height: 64px; border-radius: 32px; border: 3px solid var(--line); background: var(--panel); color: var(--text); font-size: 26px; padding: 0 28px; outline: none; }
.search.focused, .search:focus { border-color: #fff; }
.chip { padding: 14px 24px; border-radius: 32px; background: var(--panel); font-size: 24px; border: 3px solid transparent; white-space: nowrap; }
.chip.focused { border-color: #fff; background: var(--accent); }
.trial { font-size: 22px; color: var(--warn); white-space: nowrap; }

.body { flex: 1; display: flex; min-height: 0; }
.cats { width: 420px; overflow: hidden; padding: 24px 18px 24px 40px; border-right: 2px solid var(--line); }
.cat { display: block; width: 100%; padding: 16px 24px; margin-bottom: 6px; border-radius: 12px; font-size: 27px; color: #b9c2d3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 3px solid transparent; }
.cat.active { background: var(--panel2); color: #fff; font-weight: 600; }
.cat.focused { border-color: #fff; background: var(--accent); color: #fff; }
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.grid { flex: 1; overflow: hidden; padding: 28px 40px; display: flex; flex-wrap: wrap; align-content: flex-start; }
.empty { width: 100%; padding-top: 160px; text-align: center; font-size: 32px; color: var(--muted); display: flex; flex-direction: column; align-items: center; }
.empty p { margin: 0; }

.card { position: relative; border-radius: 16px; background: var(--panel); border: 3px solid transparent; transition: transform .12s; }
.card.focused { border-color: #fff; transform: scale(1.05); box-shadow: 0 10px 40px rgba(14,165,233,.35); z-index: 2; }
.chan { width: 332px; height: 110px; display: flex; align-items: center; padding: 0 20px; }
.chan .num { font-size: 22px; color: var(--muted); width: 50px; text-align: right; flex-shrink: 0; }
.chan-logo { width: 90px; height: 64px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #0a0e18; border-radius: 10px; overflow: hidden; }
.chan-logo .logo { max-width: 100%; max-height: 100%; }
.chan .name { font-size: 25px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.poster { width: 212px; display: flex; flex-direction: column; padding-bottom: 12px; }
.poster-img { position: relative; width: 100%; height: 318px; border-radius: 13px 13px 0 0; overflow: hidden; background: linear-gradient(160deg, #1b2740, #0c111c); }
.poster-img .cover { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.poster-fallback { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; font-size: 24px; color: var(--muted); }
.poster .name { font-size: 21px; padding: 10px 12px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav { position: absolute; top: 8px; right: 10px; font-size: 26px; color: var(--star); display: none; z-index: 2; text-shadow: 0 2px 6px #000; }
.fav.on { display: block; }

.nownext { display: none; height: 140px; border-top: 2px solid var(--line); padding: 18px 44px; background: var(--panel); }
.nownext.show { display: block; }
.nn-name { font-size: 30px; font-weight: 700; margin-bottom: 8px; }
.nn-line { font-size: 25px; color: #cdd5e3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.nn-line b { color: var(--accent2); width: 80px; flex-shrink: 0; }
.nn-prog { display: inline-block; width: 160px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-left: 20px; flex-shrink: 0; }
.nn-prog span { display: block; height: 100%; background: var(--accent); }

.toast { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); background: #fff; color: #000; font-size: 28px; font-weight: 600; padding: 18px 40px; border-radius: 40px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; }

/* Series */
.series { padding: 60px 90px; display: flex; flex-direction: column; }
.series-head { display: flex; align-items: center; }
.series-head h1 { font-size: 54px; }
.series-cover { height: 200px; border-radius: 14px; }
.season-tabs { display: flex; flex-wrap: wrap; }
.episodes { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.episode { display: flex; align-items: center; padding: 20px 28px; border-radius: 14px; background: var(--panel); font-size: 28px; border: 3px solid transparent; flex-shrink: 0; }
.episode .num { color: var(--muted); width: 50px; }
.episode.focused { border-color: #fff; background: var(--accent); }
.dialog { background: var(--panel); border: 2px solid var(--line); border-radius: 24px; padding: 60px 80px; text-align: center; }
.dialog h2 { font-size: 44px; margin-bottom: 40px; }

/* Player */
.player { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #000; z-index: 100; }
.video { width: 100%; height: 100%; background: #000; }
.video::cue { font-size: 46px; background: rgba(0,0,0,.6); }
.osd { position: absolute; left: 70px; top: 60px; max-width: 1400px; background: rgba(5,8,15,.82); border-left: 6px solid var(--accent); padding: 22px 34px; font-size: 32px; line-height: 1.5; white-space: pre-line; border-radius: 10px; opacity: 0; transition: opacity .25s; }
.osd.show { opacity: 1; }
.pbar { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 80px 50px; background: linear-gradient(transparent, rgba(0,0,0,.92)); opacity: 0; transition: opacity .25s; }
.pbar.show { opacity: 1; }
.pbar-title { font-size: 36px; font-weight: 700; margin-bottom: 20px; }
.pbar-track { height: 10px; background: rgba(255,255,255,.2); border-radius: 5px; overflow: hidden; }
.pbar-fill { height: 100%; background: var(--accent); }
.pbar-time { margin-top: 16px; font-size: 26px; display: flex; justify-content: space-between; color: #cdd5e3; }
.pbar-hint { color: var(--muted); font-size: 22px; }

/* Spacing without flex "gap" (unsupported before Chromium 84, i.e. most 2019-2021 TVs). */
.center > * + *, .empty > * + * { margin-top: 28px; }
.brand-mark { margin-right: 14px; }
.row > * + * { margin-left: 24px; }
.act-left > * + * { margin-top: 34px; }
.ids > * + * { margin-left: 28px; }
.topbar > * + * { margin-left: 48px; }
.tab { margin-right: 12px; }
.season-tabs .tab { margin-bottom: 12px; }
.top-right > * + * { margin-left: 18px; }
.grid > .card { margin: 0 22px 22px 0; }
.chan > * + * { margin-left: 16px; }
.nn-line b { margin-right: 10px; }
.series > * + * { margin-top: 30px; }
.series-head > * + * { margin-left: 36px; }
.episode { margin-bottom: 10px; }
.episode > * + * { margin-left: 24px; }
