/* Design tokens from docs/design (dark, warm). */
:root {
  --bg: #14110f;
  --surface: #1e1a17;
  --chip: #2a2420;
  --line: #3a322c;
  --line-soft: #2a2420;
  --text: #f3ece4;
  --text-2: #d6cabd;
  --muted: #a89c90;
  --accent: #f0a43a;
  --accent-bg: #3a2a12;
  --on-accent: #1a1209;
  --danger: #ff8a7a;
  --display: "Space Grotesk", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
input::placeholder { color: var(--muted); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.screen.with-nav { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill { height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; cursor: pointer; }
.round { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; padding: 0; }
h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1; }
.sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.muted { color: var(--muted); }

/* Bottom nav */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(76px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); z-index: 5; }
nav.tabs > div { display: contents; }
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
nav.tabs a[aria-current="page"], nav.tabs a[aria-current="true"] { color: var(--accent); font-weight: 600; }
nav.tabs a span { max-width: 100%; padding: 0 4px; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.tabs a.group-tab { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@media (min-width: 481px) { nav.tabs { left: 50%; transform: translateX(-50%); width: 480px; } }

/* Search */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--muted); }
.searchbox { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); }
.searchbox:focus-within { border-color: var(--accent); }
.searchbox input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 17px; }
.searchbox .clear { width: 44px; height: 44px; margin-right: -10px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; cursor: pointer; }
.results { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.result { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.thumb { flex: none; width: 44px; height: 64px; border-radius: 6px; background: var(--chip); object-fit: cover; }
.result .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.result .name { font-size: 16px; font-weight: 600; }
.meta { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.badge { flex: none; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 12px; background: var(--accent-bg); color: var(--accent); }
.badge.quiet { background: var(--chip); color: var(--text-2); }
.empty { padding: 24px 0; color: var(--muted); font-size: 14px; }

/* Chips and menus */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { flex: none; height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; }
.chip[aria-pressed="true"], .chip.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.menu { position: absolute; z-index: 20; min-width: 200px; max-width: calc(100vw - 32px); padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.menu button { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; font-size: 15px; }
.menu button:hover, .menu button:focus-visible { background: var(--chip); outline: 0; }
.menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }

/* Backlog table */
.grid { display: grid; grid-template-columns: 28px minmax(0, 1fr) 28px 52px 72px; column-gap: 8px; align-items: center; }
.thead { padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.row { min-height: 56px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.row .t { font-size: 15px; font-weight: 600; line-height: 1.25; }
.row .d { font-size: 13px; color: var(--muted); }
.who { width: 28px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.svcs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.svc { flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; }
.svc.sm { width: 22px; height: 22px; font-size: 11px; }
.svc.md { width: 28px; height: 28px; font-size: 12px; }

/* Detail */
.detail-top { display: flex; gap: 16px; }
.poster { flex: none; width: 140px; height: 210px; border-radius: 10px; background: var(--chip); object-fit: cover; display: flex; align-items: flex-end; padding: 12px; font-family: var(--display); font-size: 16px; font-weight: 700; line-height: 1.15; }
.detail-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.detail-info h1 { font-size: 26px; }
.genre { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 12px; background: var(--chip); color: var(--text-2); }
.synopsis { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.scores { display: flex; gap: 12px; }
.score { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.score .v { font-family: var(--display); font-size: 24px; font-weight: 700; }
.score .v small { font-size: 14px; font-weight: 500; color: var(--muted); }
h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.where { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.where .n { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.where .m { font-size: 13px; font-weight: 400; color: var(--muted); }
.play { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 22px; border: 1.5px solid var(--accent); background: var(--accent-bg); color: var(--accent); cursor: pointer; padding: 0; }
.play:disabled { opacity: .5; }
.sbars { display: flex; flex-direction: column; gap: 8px; }
.srow { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.srow .sname { width: 104px; flex: none; display: flex; flex-direction: column; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.srow .sname .m { font-size: 12px; font-weight: 400; color: var(--muted); }
.sbar { position: relative; flex: 1; min-width: 40px; height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; }
.sbar .seg { position: absolute; top: 0; bottom: 0; background: var(--accent); border-left: 1px solid var(--surface); }
.srow .srange { flex: none; min-width: 36px; text-align: right; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.upnext { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.upnext label { font-size: 15px; font-weight: 600; }
.pill-select { height: 40px; padding: 0 14px; border-radius: 20px; background: var(--chip); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 15px; font-weight: 600; }
.upnext-rows { display: flex; flex-direction: column; gap: 8px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.panel label { font-size: 14px; font-weight: 600; }
.panel input { height: 48px; padding: 0 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 16px; outline: 0; }
.panel input:focus { border-color: var(--accent); }
.btn { height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 26px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 600; cursor: pointer; padding: 0 16px; }
.btn.outline { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.btn.danger { background: transparent; border: 1.5px solid var(--line); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.notice { padding: 10px 14px; border-radius: 12px; background: var(--accent-bg); color: var(--accent); font-size: 14px; }
.credit { font-size: 12px; color: var(--muted); line-height: 1.4; }
.error { color: var(--danger); font-size: 14px; }

/* Sign-in and placeholders */
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; z-index: 30; }

/* History */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.btn.small { height: 44px; padding: 0 14px; border-radius: 22px; font-size: 14px; gap: 6px; flex: none; }
.hlist { border-top: 1px solid var(--line); }
.hrow { position: relative; border-bottom: 1px solid var(--line-soft); }
.hrow-link { display: flex; flex-direction: column; gap: 6px; padding: 12px 48px 12px 0; color: inherit; text-decoration: none; }
.hrow .more { position: absolute; top: 4px; right: -6px; }
.round.more { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.hrow .season, .t .season, .pick-title .season { color: var(--muted); font-weight: 500; }
.viewing-head { display: flex; align-items: flex-start; gap: 8px; }
.viewing-head .more { margin: -8px -6px 0 0; flex: none; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.hrow-top { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.hrow .t { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; color: var(--text); }
.rchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rchip { height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 4px; border-radius: 14px; font-size: 13px; font-weight: 600; }
.rchip.pos { background: #3a2a12; color: #f0a43a; }
.rchip.neg { background: #1c2a3a; color: #8fbcf0; }
.rchip.zero { background: #2a2420; color: #c4b8ab; }
.who.sm { width: 20px; height: 20px; border-radius: 10px; font-size: 11px; }
.rchip-btn { border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 14px; min-height: 44px; display: inline-flex; align-items: center; }
.rate-btn { height: 36px; font-size: 13px; color: var(--accent); border-color: var(--accent); }
.picker { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { min-width: 52px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; padding: 0 10px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text-2); cursor: pointer; font-weight: 600; }
.pick.pos { color: #f0a43a; } .pick.neg { color: #8fbcf0; }
.pick[aria-checked="true"].pos { background: #3a2a12; border-color: #f0a43a; }
.pick[aria-checked="true"].neg { background: #1c2a3a; border-color: #8fbcf0; }
.pick[aria-checked="true"].zero { background: #2a2420; border-color: #c4b8ab; color: var(--text); }
.pick.clear-pick { color: var(--muted); font-weight: 500; }
.viewing { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.viewing-actions { display: flex; align-items: center; gap: 12px; }
.viewing-actions .btn.small { height: 40px; }
.linkish { border: 0; background: transparent; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }
.round.current { border-color: var(--accent); color: var(--accent); }
.panel select, .panel input[type="date"] { height: 48px; padding: 0 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 16px; color: var(--text); }
.chip[role="radio"][aria-checked="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* Settings (Settings.dc.html) */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-size: 15px; }
.select { height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 22px; background: var(--bg); border: 1px solid var(--line); font-size: 15px; font-weight: 600; cursor: pointer; max-width: 60%; }
.select span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { font-size: 13px; line-height: 1.4; color: var(--muted); }
.chip.country { min-width: 56px; justify-content: center; font-weight: 600; }
.chip.country[aria-pressed="false"] { color: var(--text-2); }
.chip.dashed { background: transparent; border-style: dashed; border-color: #6b5f54; color: var(--text-2); }
.chip:disabled { opacity: .5; }
.svc-list { display: flex; flex-direction: column; }
.svc-row { display: flex; align-items: center; gap: 8px; min-height: 52px; border-top: 1px solid var(--line-soft); background: var(--surface); position: relative; transition: transform .12s ease; }
.svc-row.dragging { z-index: 2; transition: none; box-shadow: 0 8px 24px rgba(0,0,0,.45); border-radius: 12px; }
.svc-row .n { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-row .rank { width: 16px; font-size: 14px; color: var(--muted); }
.handle { width: 44px; height: 44px; margin-left: -10px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; cursor: grab; touch-action: none; }
.icon-btn { flex: none; width: 44px; height: 44px; margin-right: -10px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; cursor: pointer; }
.note { min-height: 32px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 10px; border: 0; background: var(--accent-bg); color: var(--accent); cursor: pointer; }
.note.empty { background: transparent; color: var(--muted); font-weight: 500; }
.note-input { width: 84px; height: 36px; padding: 0 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--accent); font-size: 14px; color: var(--text); outline: 0; }
.add-streamer { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.member { display: flex; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--line-soft); }
.member .who { width: 32px; height: 32px; border-radius: 16px; font-size: 14px; }
.member .n { flex: 1; font-size: 15px; font-weight: 500; }
.menu { max-height: min(60vh, 420px); overflow-y: auto; }
.toast:has(.toast-btn) { display: flex; align-items: center; gap: 12px; padding-right: 8px; }
.toast-btn { height: 36px; padding: 0 12px; border-radius: 18px; border: 0; background: var(--bg); color: var(--accent); font-weight: 600; cursor: pointer; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 85vh; display: flex; flex-direction: column; gap: 12px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: var(--surface); border: 1px solid var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-list { overflow-y: auto; display: flex; flex-direction: column; min-height: 120px; }
.sheet-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 4px; border: 0; border-top: 1px solid var(--line-soft); background: transparent; text-align: left; font-size: 15px; cursor: pointer; }
.sheet-row .n { flex: 1; }
.sheet-row[aria-pressed="true"] { color: var(--accent); font-weight: 600; }
.sheet-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
/* A service reached by VPN: a small ring-and-dot in the badge's corner. */
.svc.vpn { position: relative; }
/* No service has it now: an empty circle, struck through. */
.svc.none { position: relative; background: transparent; border: 1.5px solid var(--muted); box-sizing: border-box; }
.svc.none::after { content: ""; position: absolute; left: 50%; top: 50%; width: 120%; height: 1.5px; background: var(--muted); transform: translate(-50%, -50%) rotate(-45deg); }
.svc.vpn::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

/* Pick (Pick.dc.html) */
.reel { position: relative; height: 320px; flex: none; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.reel-strip { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; will-change: transform; }
.reel.spinning .reel-strip { filter: blur(1.5px); }
.reel-card { flex: none; width: 140px; height: 210px; box-sizing: border-box; border-radius: 10px; object-fit: cover; display: flex; align-items: flex-end; padding: 12px; font-family: var(--display); font-size: 16px; font-weight: 700; line-height: 1.15; color: var(--text); background: var(--chip); }
img.reel-card { padding: 0; }
.reel-frame { position: absolute; left: 50%; top: 55px; width: 156px; height: 210px; margin-left: -78px; box-sizing: border-box; border: 2px solid var(--accent); border-radius: 14px; }
.reel-frame:not([href]) { pointer-events: none; }
.reel-frame:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.reel-marks { position: absolute; left: 16px; right: 16px; top: 159px; height: 2px; display: flex; justify-content: space-between; pointer-events: none; }
.reel-marks span { width: 44px; height: 2px; background: var(--accent); }
.pick-result { display: flex; flex-direction: column; gap: 4px; min-height: 84px; }
.pick-title { font-family: var(--display); font-size: 24px; font-weight: 700; line-height: 1.15; }
.pick-meta { font-size: 14px; }
.svc-line { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.pick-actions { display: flex; gap: 12px; }
.pick-actions .btn { flex: 1; }
.linkish.reset { min-height: 44px; padding: 0 10px; color: var(--accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .reel-strip { transition: none !important; } .reel.spinning .reel-strip { filter: none; } }
.linkish.reset { text-decoration: none; font-size: 14px; }
.rank-pill { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent-bg); color: var(--accent); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pick-actions .btn[aria-disabled="true"] { opacity: .4; cursor: default; }
.pick-result:focus { outline: 0; }
.btn.quiet { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 500; font-size: 14px; }
.btn.quiet.danger-text { color: var(--danger); }
.round.plain { background: transparent; border: 0; color: var(--muted); }
.menu button.danger { color: var(--danger); }
.split-even { display: flex; gap: 8px; padding-top: 4px; }
.split-even .btn { flex: 1; height: 48px; }
.invite-box { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.invite-ready { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.invite-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.invite-text .t { font-size: 14px; font-weight: 600; }
.invite-url { font-size: 13px !important; }
.open-invites { display: flex; flex-direction: column; gap: 2px; }
.open-invite { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.passkey { display: flex; align-items: center; gap: 12px; min-height: 56px; border-top: 1px solid var(--line-soft); }
.passkey .pk-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.passkey .n { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.passkey .muted { font-size: 13px; }
.install-hint { gap: 6px; border-color: var(--accent); }
