/* dotori-clean: 10-foot UI for a 1920x1080 OLED TV (webOS 5 = Chromium 79, Fire TV).
   Token names are fixed (tests); values are the design pass of 2026-11-02 ("quiet cinema, acorn accent").
   Chromium 79 rules: no flex `gap` (margins; `grid-gap` only on grids), no `aspect-ratio` (padding-top boxes),
   no `inset`, no :is()/:where(), no clamp(), no backdrop-filter. Motion: the focus scale only, nothing animates.
   OLED: no sticky header, no lit wordmark or chips; persistent chrome is --muted on --bg. */

/* ---------- tokens ---------- */
:root {
  --bg: #050607;
  --surface: #121519;
  --surface-2: #1b2027;
  --text: #dfe2e6;
  --muted: #7f8893;
  --accent: #e3b273;
  --ok: #6dbb8a;
  --warn: #e8a24a;
  --bad: #d96a5e;
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 32px;
  --tile-w: 320px;
  --fs-body: 28px;
  --fs-meta: 22px;
  --fs-title: 40px;
  --fs-hero: 60px;
  --focus-ring: 4px solid var(--accent);
  --pad-x: 64px;
  --on-accent: #140f07;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  /* system stack only: no web fonts, no internet requests */
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font-family: inherit; }
h1, h2 { margin: 0; }

main { padding: 0 var(--pad-x) 80px; }

/* ---------- header: one dim row + one muted status line ---------- */
.top { padding: 28px 0 0; }

.top-row {
  display: flex;
  align-items: center;
  height: 68px;
}

.top .logo {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 10px;
  margin: 0 20px 0 -10px;
  border-radius: var(--radius-sm);
}

.search { display: flex; align-items: center; margin-right: 20px; }

.search input[type="search"] {
  width: 340px;
  height: 60px;
  padding: 0 20px;
  font: inherit;
  font-size: 24px;
  color: var(--text);
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  -webkit-appearance: none;
}

.search input[type="search"]::-webkit-input-placeholder { color: var(--muted); }
.search input[type="search"]:focus { border-color: var(--accent); transform: none; outline: none; }
.search .btn { margin-left: 10px; }

.chips { display: flex; align-items: center; margin-right: auto; }

.chip {
  width: 50px;
  height: 50px;
  margin-right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--muted);
  border-radius: var(--radius-sm);
  outline: none;
}

.chip:focus, .chip.focus {
  color: var(--on-accent);
  background: var(--accent);
  outline: none;
  transform: scale(1.1);
}

.top-row .btn { margin-left: 12px; }

.meta-row {
  display: flex;
  align-items: center;
  height: 36px;
  font-size: 20px;
  color: var(--muted);
  margin-bottom: 24px;
}

.meta-row span + span { margin-left: 28px; }
.status-chip:empty { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  min-width: 120px;
  padding: 0 24px;
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface-2);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
}

.btn.primary { background: var(--accent); color: var(--on-accent); }

.btn.big {
  height: 80px;
  min-width: 260px;
  padding: 0 40px;
  font-size: 30px;
  border-radius: var(--radius);
}

/* ---------- focus (remote / keyboard): ring + scale, nothing else moves ---------- */
[data-nav]:focus, .focus {
  outline: var(--focus-ring);
  outline-offset: 3px;
  transform: scale(1.05);
  position: relative;
  z-index: 1;
}

/* ---------- sections and rows ---------- */
.source-group { margin-bottom: 20px; }

.source-title, main > .row > h2 {
  font-size: var(--fs-title);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 6px;
}

.row { margin-bottom: 24px; }

.row h2 {
  display: inline-block;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.3;
  vertical-align: baseline;
}

.row .more {
  display: inline-block;
  margin-left: 16px;
  padding: 2px 10px;
  font-size: 22px;
  color: var(--muted);
  border-radius: var(--radius-sm);
  vertical-align: baseline;
}

.row .more:focus { color: var(--text); }

.scroller {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 14px 10px 18px;
  margin: 0 -10px;
  scrollbar-width: none;
}

.scroller::-webkit-scrollbar { display: none; }
.scroller .tile { margin-right: 28px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--tile-w));
  grid-gap: 40px 32px;
  padding: 14px 10px;
  margin: 0 -10px;
}

.grid-page h1 {
  font-size: var(--fs-title);
  font-weight: 700;
  margin: 8px 0 10px;
}

.empty { color: var(--muted); font-size: var(--fs-body); margin: 16px 0; }

/* ---------- tiles: the poster is the card ---------- */
.tile {
  flex: 0 0 var(--tile-w);
  width: var(--tile-w);
  display: block;
  color: var(--text);
  outline: none;
}

/* 16:9 box without aspect-ratio (Chromium 88+): padding-top + absolute child */
.tile .poster {
  position: relative;
  height: 0;
  padding-top: 56.25%;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.tile .poster img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile .t-title {
  margin-top: 12px;
  padding: 0 4px;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile .t-meta {
  margin-top: 2px;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile .t-meta .t-sub + .t-sub::before,
.tile .t-meta .t-sub + .t-src::before,
.tile .t-meta .t-src + .t-sub::before { content: "\00b7"; margin: 0 8px; }

.tile:focus, .tile.focus {
  outline: none;
  transform: scale(1.06);
}

.tile:focus .poster, .tile.focus .poster { box-shadow: 0 0 0 4px var(--accent); }
.tile:focus .t-title, .tile.focus .t-title { color: #ffffff; }

/* ---------- live channel tiles: tinted box, name, dim initial, live dot ---------- */
.live-tile .poster { background: linear-gradient(135deg, #182229 0%, #0d1115 100%); }
.live-tile[data-src="live-ca"] .poster { background: linear-gradient(135deg, #2a1f18 0%, #14100d 100%); }

.live-poster .ch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 28px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--text);
}

.live-poster .ini {
  position: absolute;
  right: 10px;
  bottom: -28px;
  font-size: 150px;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  opacity: 0.05;
}

.live-poster .on {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bad);
}

/* ---------- series page ---------- */
.series { display: flex; align-items: flex-start; margin-top: 8px; }

.series .s-poster { flex: 0 0 360px; width: 360px; margin-right: 48px; }

.series .s-poster .poster {
  position: relative;
  height: 0;
  padding-top: 56.25%;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.series .s-poster img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.series .s-info { flex: 1; min-width: 0; }

.series h1 {
  font-size: var(--fs-hero);
  font-weight: 700;
  line-height: 1.15;
  margin: -6px 0 10px;
}

.series .s-info .meta {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-bottom: 28px;
}

.actions { display: flex; align-items: center; }
.actions .btn + .btn { margin-left: 16px; }

.eps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 14px 24px;
  padding: 10px 10px;
  margin: 36px -10px 0;
}

.eps .ep-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
  padding: 0 24px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 26px;
  font-weight: 500;
  outline: none;
}

.ep-row .ep-date { font-size: 20px; color: var(--muted); margin-left: 16px; white-space: nowrap; }

/* ---------- settings page ---------- */
.settings { max-width: 1300px; }
.settings .field { display: flex; flex-direction: column; margin: 8px 0 28px; }
.settings label { font-size: var(--fs-meta); color: var(--muted); margin-bottom: 10px; }

select.sel {
  height: 64px;
  width: 320px;
  padding: 0 20px;
  font: inherit;
  font-size: 26px;
  color: var(--text);
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
}

select.sel:focus { border-color: var(--accent); transform: none; outline: none; }

.settings .msg {
  font-size: var(--fs-meta);
  color: var(--ok);
  min-height: 1.4em;
  margin: 20px 0 0;
}

/* ---------- player page ---------- */
/* no `inset` (Chromium 87+): the webOS 5 browser would leave the player 0x0 (audio, no image) */
.player {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
}

.player video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: #000;
  transition: none;
  transform: none;
}

/* the player video never scales or animates, not even on focus */
.player video:focus,
.player video.focus {
  transform: none;
  outline: none;
}

.player .bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 20px var(--pad-x) 44px;
  background: linear-gradient(rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  font-size: 24px;
}

.player .bar .btn {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  margin-right: 24px;
}

.player .p-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.player .p-src {
  color: var(--muted);
  font-size: 20px;
  margin-left: 16px;
  white-space: nowrap;
}

.player.idle .bar { visibility: hidden; }

/* message pill: only while it has text, never a stray dot on the picture */
.p-msg {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  max-width: 80vw;
  padding: 10px 26px;
  font-size: 26px;
  color: var(--text);
  background: rgba(10, 12, 14, 0.82);
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-msg:empty { display: none; }

/* remote OSD (pause / seek / channel); no transitions (webOS 5 is slow with animated layers) */
.p-osd {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  padding: 18px 44px;
  border-radius: 999px;
  background: rgba(10, 12, 14, 0.78);
  color: var(--text);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.p-osd.on { display: block; }

.p-end {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  padding: 44px 56px;
  text-align: center;
  font-size: var(--fs-body);
  background: var(--surface);
  border-radius: var(--radius);
  white-space: nowrap;
}

.p-end p { margin: 0 0 28px; font-size: var(--fs-title); font-weight: 700; }
.p-end .btn + .btn { margin-left: 16px; }
.p-end[hidden] { display: none; }

/* VPN notice: a dark panel with an amber edge, shown 5 s (JS) */
.geo-warn {
  position: absolute;
  top: 116px;
  left: var(--pad-x);
  right: var(--pad-x);
  z-index: 3;
  padding: 18px 28px;
  font-size: 26px;
  font-weight: 500;
  color: var(--text);
  background: rgba(12, 14, 17, 0.9);
  border-left: 6px solid var(--warn);
  border-radius: var(--radius-sm);
}

.geo-warn.gone { display: none; }

/* ---------- PIN screen (keypad first; touch, pointer and remote) ---------- */
.pin {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pin h1 { font-size: 34px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
.pin-hint { font-size: 24px; color: var(--muted); margin: 0 0 28px; }
.dots { display: flex; margin-bottom: 36px; }
.dots .dot { width: 18px; height: 18px; margin: 0 12px; border-radius: 50%; border: 2px solid var(--muted); }
.dots .dot.on { background: var(--accent); border-color: var(--accent); }
.pad { display: grid; grid-template-columns: repeat(3, 112px); grid-gap: 18px; }
.pad .key {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 42px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.pad .key:focus, .pad .key.focus { outline: var(--focus-ring); outline-offset: 3px; transform: scale(1.06); }
.pad .blank { background: transparent; }
.pin-msg { min-height: 40px; font-size: 24px; color: var(--warn); margin-top: 28px; }

/* subtitles / captions (shown by default): readable from the sofa, on a dim box */
.player video::cue {
  font-size: 40px;
  line-height: 1.3;
  color: #f0f0f0;
  background: rgba(0, 0, 0, 0.65);
}

/* ---------- per-device look (설정 > 화면; class on <html>, all themes stay dark for the OLED) ---------- */
html.theme-blue { --accent: #7cb8e8; --on-accent: #06121c; }
html.theme-black { --bg: #000000; --surface: #0b0d10; --surface-2: #14181d; --text: #d2d6db; }
html.fs-l { --fs-body: 32px; --fs-meta: 26px; --fs-title: 46px; --fs-hero: 68px; }
html.fs-xl { --fs-body: 37px; --fs-meta: 30px; --fs-title: 52px; --fs-hero: 76px; }

/* ---------- settings: section headings + content status table ---------- */
.settings .set-h { font-size: var(--fs-meta); color: var(--muted); font-weight: 600; margin: 36px 0 14px; }
.status-table { border-collapse: collapse; font-size: var(--fs-meta); width: 100%; }
.status-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 18px 8px 0; }
.status-table td { padding: 10px 18px 10px 0; border-top: 1px solid var(--surface-2); }
.status-table tr.total td { color: var(--muted); }

/* ---------- series: the same show on other sources ---------- */
.also { margin-top: 24px; }
.also .also-h { display: block; font-size: var(--fs-meta); color: var(--muted); margin-bottom: 10px; }
.also .btn { margin: 0 12px 12px 0; }
/* the 초성 chips are <button>s: no browser button look (white box), same muted text as before */
button.chip { font-family: inherit; font-size: 24px; background: transparent; border: 0; padding: 0;
  color: var(--muted); cursor: pointer; -webkit-appearance: none; appearance: none; }
button.chip:focus, button.chip.focus { color: var(--on-accent); background: var(--accent); }

/* 뒤로 on every page but home (Mike 2026-11-02), left of the wordmark */
#nav-back { margin-right: 20px; }

/* header (Mike 2026-11-02: the wordmark broke into a vertical column on the TV, the row was too full): the 초성 keys get
   their own line under the search box; nothing in the top line may shrink or wrap */
.top-row { height: auto; min-height: 68px; flex-wrap: wrap; }
.top-row > * { flex-shrink: 0; white-space: nowrap; }
.top .logo { white-space: nowrap; }
.top-row .push-right { margin-left: auto; }
.top-row .chips { order: 10; flex-basis: 100%; margin: 14px 0 0; flex-wrap: wrap; }

/* top line: detected country + what plays from it (Mike 2026-11-02); muted chrome, the two lists lightly tinted */
.country-chip b { color: var(--text); font-weight: 600; }
.country-chip .geo-ok { color: var(--ok); }
.country-chip .geo-no { color: var(--bad); }
.meta-row .country-chip span + span { margin-left: 0; }
