/* Designed on a 1920×1080 grid; 1rem = 16px at 1080p and scales with the screen (see app.js). */
:root {
  --bg: #0b0f17; --panel: #121826; --panel2: #182033; --line: #243049;
  --text: #e8ecf4; --muted: #8a96ad; --accent: #2f7cf6; --accent2: #5aa0ff; --gold: #f5b83d; --err: #ff6b6b;
  --focus: 0 0 0 .19rem var(--accent2);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: "LG Smart UI", "SamsungOne", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body.use-avplay, body.use-avplay html { background: transparent; }
#av-player { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 0; }
body:not(.use-avplay) #av-player { display: none; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.screen { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1; }

/* ---------- Login ---------- */
#screen-login { display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 46rem; max-width: 94vw; background: var(--panel); border: 1px solid var(--line); border-radius: 1.25rem; padding: 2.5rem 3rem; }
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.6rem; font-weight: 600; }
.logo-dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 .3rem rgba(47,124,246,.25); }
.type-tabs { display: flex; gap: .6rem; margin: 1.4rem 0 1.2rem; }
.tab { background: var(--panel2); border: 1px solid var(--line); border-radius: 2rem; padding: .7rem 1.4rem; font-size: 1.1rem; cursor: pointer; }
.tab.on { background: var(--accent); border-color: var(--accent); }
label.f { display: block; font-size: 1rem; color: var(--muted); margin: .9rem 0 0; }
label.f input { display: block; width: 100%; margin-top: .4rem; padding: .9rem 1rem; font-size: 1.25rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: .6rem; outline: none; }
.hint { font-size: .95rem; color: var(--muted); margin: .5rem 0 0; }
.btn-row { display: flex; gap: .8rem; margin-top: 1.6rem; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: .7rem; padding: .85rem 1.8rem; font-size: 1.2rem; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.error { color: var(--err); min-height: 1.4rem; font-size: 1.05rem; }
.foot { font-size: .9rem; margin: 1.2rem 0 0; }
[data-focus].focus, .tab.focus, .btn.focus, label.f input.focus { box-shadow: var(--focus); outline: none; }

/* ---------- Activation ---------- */
#screen-activate { display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 3; }
#screen-activate.hidden { display: none; }
.act-h { font-size: 1.9rem; margin: 1.4rem 0 .4rem; font-weight: 600; }
.dev-id-box { display: flex; flex-direction: column; gap: .3rem; margin: 1.4rem 0 .6rem; padding: 1.1rem 1.4rem; background: var(--bg); border: 1px dashed var(--line); border-radius: .8rem; }
.dev-id { font-size: 2.6rem; font-weight: 700; letter-spacing: .12em; font-family: "Consolas", "Roboto Mono", monospace; }
.act-msg { min-height: 1.5rem; font-size: 1.1rem; color: var(--gold); margin: .4rem 0; }
.act-msg.ok { color: #59d98e; }
.btn-row.wrap { flex-wrap: wrap; }
.btn.free { border-color: #2c6e4f; color: #8ff0bd; }
.lic { font-size: 1rem; padding: .3rem .8rem; border-radius: 2rem; background: #12301f; color: #8ff0bd; border: 1px solid #2c6e4f; }
.lic:empty { display: none; }
.lic.warn { background: #3a2a0c; color: var(--gold); border-color: #6b4f16; }

/* ---------- Top bar ---------- */
.topbar { position: absolute; left: 0; right: 0; top: 0; height: 5.5rem; display: flex; align-items: center; gap: 2.5rem;
  padding: 0 3rem; background: var(--bg); z-index: 2; }
.tabs { display: flex; gap: .6rem; }
.tabs .tab { background: transparent; border-color: transparent; font-size: 1.25rem; }
.tabs .tab.on { background: var(--panel2); border-color: var(--line); }
.tabs .tab.focus { box-shadow: var(--focus); }
.top-right { margin-left: auto; display: flex; gap: 1.6rem; align-items: center; font-size: 1.15rem; }
#clock { font-size: 1.5rem; font-weight: 600; }
.m-back { display: none; }

/* ---------- Columns ---------- */
.cols { position: absolute; top: 5.5rem; left: 0; right: 0; bottom: 0; display: flex; gap: .75rem; padding: 0 3rem 2rem; }
.col { background: var(--panel); border-radius: 1rem; display: flex; flex-direction: column; overflow: hidden; }
.c1 { width: 14rem; } .c2 { width: 20rem; } .c3 { width: 34rem; } .c4 { flex: 1; background: transparent; }
.col-h { margin: 0; padding: 1rem 1.2rem .6rem; font-size: 1rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.list { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.list::-webkit-scrollbar { display: none; }
.vlist-spacer { position: relative; }
.row { position: absolute; left: .4rem; right: .4rem; display: flex; align-items: center; gap: .9rem; padding: 0 1rem;
  border-radius: .6rem; font-size: 1.2rem; cursor: pointer; white-space: nowrap; overflow: hidden; }
.row:hover { background: var(--panel2); }
.row.sel { background: var(--panel2); }
.row.focus { background: var(--accent); }
.row .cnt { margin-left: auto; color: var(--muted); font-size: 1rem; }
.row.focus .cnt, .row.focus .sub { color: #dce8ff; }
.row .num { width: 3.2rem; color: var(--muted); font-size: 1.05rem; text-align: right; flex: none; }
.row .logo { width: 3.6rem; height: 2.4rem; flex: none; border-radius: .35rem; background: #0e1420 center/contain no-repeat; }
.row .nm { overflow: hidden; text-overflow: ellipsis; }
.row .two { display: flex; flex-direction: column; min-width: 0; }
.row .sub { color: var(--muted); font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.row .star { color: var(--gold); margin-left: auto; }
.row .playing { color: #59d98e; font-size: .9rem; }
.empty { padding: 1.4rem; color: var(--muted); font-size: 1.1rem; }

/* ---------- Preview ---------- */
#preview { display: flex; flex-direction: column; gap: .9rem; }
#preview-video { position: relative; width: 100%; height: 0; padding-top: 56.25%; border-radius: 1rem; overflow: hidden; background: #000; flex: none; }
#preview-video #video { position: absolute; top: 0; left: 0; }
body.use-avplay #preview-video { background: transparent; }
#video { width: 100%; height: 100%; background: #000; display: block; }
.pv-msg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.2rem; pointer-events: none; }
.pv-info { background: var(--panel); border-radius: 1rem; padding: 1.2rem 1.4rem; flex: 1; overflow: hidden; }
.pv-title { display: flex; gap: .8rem; align-items: center; font-size: 1.5rem; font-weight: 600; }
#pv-num { color: var(--muted); }
.badge { font-size: .85rem; font-weight: 700; padding: .15rem .5rem; border-radius: .3rem; background: var(--gold); color: #1d1500; }
.badge:empty { display: none; }
.epg { margin-top: .8rem; font-size: 1.1rem; }
.epg .e { display: flex; gap: 1rem; padding: .35rem 0; color: var(--muted); }
.epg .e.now { color: var(--text); }
.epg .t { width: 4.2rem; flex: none; }
.epg .bar { height: .3rem; background: var(--line); border-radius: .2rem; margin: .3rem 0 .6rem; overflow: hidden; }
.epg .bar i { display: block; height: 100%; background: var(--accent); }
.epg .desc { color: var(--muted); font-size: 1rem; max-height: 4.5em; overflow: hidden; }
.movie-poster { width: 12rem; height: 18rem; border-radius: .8rem; background: #0e1420 center/cover no-repeat; float: left; margin-right: 1.4rem; }

/* ---------- Settings ---------- */
.settings { position: absolute; top: 5.5rem; left: 3rem; right: 3rem; bottom: 2rem; background: var(--panel); border-radius: 1rem; display: flex; }
.settings .list { max-width: 60rem; margin: 1rem auto; }
.row.head { color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; cursor: default; background: none !important; }
.row .val { margin-left: auto; color: var(--muted); }
.row.focus .val { color: #fff; }

/* ---------- Full screen ---------- */
body.fullscreen .screen { visibility: hidden; }
body.fullscreen #preview-video #video { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 5; visibility: visible; }
body.fullscreen #preview-video { visibility: visible; }
body.fullscreen.use-avplay #preview-video { visibility: hidden; }
#osd { position: fixed; left: 3rem; right: 3rem; bottom: 2.5rem; z-index: 10; background: rgba(11,15,23,.88); border: 1px solid var(--line);
  border-radius: 1.2rem; padding: 1.4rem 2rem; }
.osd-top { display: flex; gap: 1rem; align-items: center; font-size: 1.8rem; font-weight: 600; }
#osd-num { color: var(--muted); } #osd-clock { margin-left: auto; font-size: 1.4rem; }
.osd-now { font-size: 1.3rem; margin-top: .6rem; }
.osd-bar { height: .35rem; background: var(--line); border-radius: .2rem; margin: .8rem 0; overflow: hidden; }
#osd-prog { height: 100%; width: 0; background: var(--accent); }
.osd-next { font-size: 1.1rem; }
#numpad { position: fixed; top: 3rem; right: 3rem; z-index: 11; font-size: 3.5rem; font-weight: 700; background: rgba(11,15,23,.9); padding: .6rem 1.6rem; border-radius: 1rem; }

/* ---------- Modal / loading / toast ---------- */
#modal { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal-card { width: 40rem; max-width: 92vw; background: var(--panel); border: 1px solid var(--line); border-radius: 1.2rem; padding: 2rem 2.4rem; }
.modal-card h3 { margin: 0 0 1rem; font-size: 1.5rem; }
#modal-body { font-size: 1.15rem; color: var(--muted); }
#loading { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 30; background: rgba(11,15,23,.75); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.3rem; }
.spinner { width: 3.5rem; height: 3.5rem; border: .35rem solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; top: 2rem; transform: translateX(-50%); z-index: 40; background: var(--panel2); border: 1px solid var(--line);
  padding: .9rem 1.6rem; border-radius: .8rem; font-size: 1.15rem; max-width: 80vw; }

/* ---------- Laptop / phone web app ---------- */
body.web .tv-only { display: none; }
@media (max-width: 900px) {
  .topbar { height: 3.6rem; padding: 0 .8rem; gap: .6rem; }
  .topbar .brand { font-size: 1.1rem; }
  .topbar .brand .app-name, .top-right #pl-name, .top-right .ver, .top-right .lic { display: none; }
  .dev-id { font-size: 1.7rem; }
  .tabs .tab { font-size: .95rem; padding: .45rem .8rem; }
  #clock { font-size: 1rem; }
  .m-back { display: block; background: none; border: 0; font-size: 2rem; line-height: 1; padding: 0 .4rem; cursor: pointer; }
  .m-back.off { visibility: hidden; }
  .cols { top: 3.6rem; padding: 0 .5rem .5rem; }
  .col { display: none; width: auto !important; flex: 1; }
  .cols[data-m] #preview { display: none; }
  .cols[data-m="1"] .c1, .cols[data-m="2"] .c2, .cols[data-m="3"] .c3, .cols[data-m="4"] .c4, .cols[data-m="4"] #preview { display: flex; }
  .row .two { flex: 1; }
  .row { font-size: 1.05rem; }
  .settings { top: 3.6rem; left: .5rem; right: .5rem; bottom: .5rem; }
  .login-card { padding: 1.6rem 1.3rem; }
  .type-tabs { flex-wrap: wrap; }
  .movie-poster { width: 7rem; height: 10.5rem; }
  #osd { left: .5rem; right: .5rem; bottom: .5rem; padding: .8rem 1rem; }
}
