:root {
  color-scheme: light;
  --bg: #f6f5f2; --surface: #ffffff; --surface2: #f0efeb; --line: #e2e0da; --hair: rgba(0, 0, 0, .12);
  --text: #1b1d22; --muted: #5f6674; --faint: #9aa0ab;
  --accent: #b9790c; --accent-soft: rgba(185, 121, 12, .1); --accent-ink: #ffffff;
  --ok: #1f8f5c; --ok-soft: rgba(31, 143, 92, .12); --skip: #868c98; --skip-soft: rgba(134, 140, 152, .14);
  --info: #2f73c9; --info-soft: rgba(47, 115, 201, .1); --warn: #c13d2c; --warn-soft: rgba(193, 61, 44, .1);
  --violet: #7b4fc4; --violet-soft: rgba(123, 79, 196, .1);
  --maybe: #c4621a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .06);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1014; --surface: #161920; --surface2: #1d212a; --line: #2a2f3a; --hair: rgba(255, 255, 255, .14);
    --text: #e8eaef; --muted: #99a0ae; --faint: #626977;
    --accent: #f0b44c; --accent-soft: rgba(240, 180, 76, .12); --accent-ink: #1a1406;
    --ok: #4cc18a; --ok-soft: rgba(76, 193, 138, .14); --skip: #7a8190; --skip-soft: rgba(122, 129, 144, .16);
    --info: #66adf7; --info-soft: rgba(102, 173, 247, .12); --warn: #ef6f5d; --warn-soft: rgba(239, 111, 93, .13);
    --violet: #a787e8; --violet-soft: rgba(167, 135, 232, .13);
    --maybe: #cf6f27;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1014; --surface: #161920; --surface2: #1d212a; --line: #2a2f3a; --hair: rgba(255, 255, 255, .14);
  --text: #e8eaef; --muted: #99a0ae; --faint: #626977;
  --accent: #f0b44c; --accent-soft: rgba(240, 180, 76, .12); --accent-ink: #1a1406;
  --ok: #4cc18a; --ok-soft: rgba(76, 193, 138, .14); --skip: #7a8190; --skip-soft: rgba(122, 129, 144, .16);
  --info: #66adf7; --info-soft: rgba(102, 173, 247, .12); --warn: #ef6f5d; --warn-soft: rgba(239, 111, 93, .13);
  --violet: #a787e8; --violet-soft: rgba(167, 135, 232, .13);
  --maybe: #cf6f27;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.wrap { max-width: 880px; margin: 0 auto; padding: 20px 16px 96px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 38px; height: 38px; flex: none; }
h1 { font-size: 1.3rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .86rem; }
.guide { font-size: .86rem; text-decoration: none; white-space: nowrap; color: var(--muted); }
.guide:hover { color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .88rem; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); }
.btn:focus-visible, .ib:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.quiet { background: transparent; }
.btn svg { width: 16px; height: 16px; }
.btn.small { height: 30px; padding: 0 10px; font-size: .82rem; }
.btn.danger { color: var(--warn); }

/* Gate / failure */
.gate, .fail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); }
.gate h2 { margin: 0 0 6px; font-size: 1.1rem; }
.gate p { margin: 0 0 14px; color: var(--muted); }
.gate .gform { display: flex; gap: 8px; }
/* Dots without type="password", which makes Chrome offer to save/update a password on every page change. */
.mask { -webkit-text-security: disc; }
.gate input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); }
.gate .btn { height: 38px; }
.err { color: var(--warn) !important; margin: 10px 0 0 !important; }
.fail { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fail p { margin: 0; }

/* Progress */
.progress { margin-bottom: 14px; }
.ptext { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; font-size: .9rem; color: var(--muted); }
.ptext b { color: var(--text); font-weight: 650; }
.ptext .pct { font-size: 1.05rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.pbar { display: flex; height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.pbar i { display: block; height: 100%; }
.pbar .w { background: var(--ok); }
.pbar .s { background: var(--skip); opacity: .55; }

/* Next up */
.next {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden;
}
.next::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.nlabel { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.nmain { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.next h2 { margin: 0; font-size: 1.35rem; line-height: 1.25; letter-spacing: -.01em; }
.nmeta { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.nabout { margin: 10px 0 0; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.nthen { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: .85rem; color: var(--muted); }
.nthen button { border: 0; background: none; padding: 0; color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.nthen button:hover { text-decoration-color: var(--accent); }
.done { text-align: center; padding: 10px 0; }
.done h2 { font-size: 1.15rem; }

/* Show swatch: the guide's own colours for that show */
.av {
  position: relative; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none;
  font-weight: 800; font-size: .8rem; letter-spacing: .02em; box-shadow: inset 0 0 0 1px var(--hair);
}
.av.big { width: 64px; height: 64px; border-radius: 14px; font-size: 1.15rem; }
.av sub {
  position: absolute; right: -5px; bottom: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px;
  background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); font-size: .68rem; line-height: 18px; text-align: center;
}
.av.big sub { min-width: 22px; height: 22px; line-height: 22px; font-size: .78rem; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: .72rem; font-weight: 650;
  background: var(--surface2); color: var(--muted); white-space: nowrap;
}
.chip.must { background: var(--accent-soft); color: var(--accent); }
.chip.surv { background: var(--warn-soft); color: var(--warn); }
.chip.sub { background: var(--info-soft); color: var(--info); }
.chip.dtcu { background: var(--violet-soft); color: var(--violet); }
.chip.air { background: var(--info); color: #fff; }
.chip.new { background: var(--ok); color: #fff; }
.chip.soon { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

/* Filter bar */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 0; margin-bottom: 4px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
}
.bar input[type="search"] {
  width: 240px; height: 34px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
}
.tools { display: flex; align-items: center; gap: 16px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.chk .hn { color: var(--faint); font-variant-numeric: tabular-nums; }

/* Timeline */
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.yr {
  position: relative; display: flex; align-items: baseline; gap: 10px; margin: 26px 0 8px; padding-left: 40px;
}
.yr:first-child { margin-top: 8px; }
.yr::before {
  content: ""; position: absolute; left: 7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 4px;
  background: var(--bg); box-shadow: inset 0 0 0 2px var(--faint);
}
.yr h3 { margin: 0; font-size: 1.25rem; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.yr span { font-size: .8rem; color: var(--faint); }

.item { position: relative; padding-left: 40px; margin: 4px 0; }
.node {
  position: absolute; left: 4px; top: 21px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); box-shadow: inset 0 0 0 2px var(--faint); color: #fff;
}
.node svg { width: 12px; height: 12px; }
.item.watched .node { background: var(--ok); box-shadow: none; }
.item.skip .node { background: var(--skip); box-shadow: none; }
.item.maybe .node { background: var(--maybe); box-shadow: none; }
.item.soon .node { box-shadow: inset 0 0 0 2px var(--line); }
.item.is-next .node { box-shadow: inset 0 0 0 3px var(--accent), 0 0 0 4px var(--accent-soft); }

.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 10px 10px 10px;
  border-radius: 12px; border: 1px solid transparent; cursor: pointer;
}
.row:hover { background: var(--surface); border-color: var(--line); }
.item.open .row { background: var(--surface); border-color: var(--line); border-radius: 12px 12px 0 0; border-bottom-color: transparent; }
.item.is-next .row { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.item.is-next.open .row { border-bottom-color: transparent; }
.ttl { min-width: 0; }
.ttl b { display: block; font-weight: 650; overflow-wrap: anywhere; }
.ttl small { display: block; color: var(--muted); font-size: .8rem; }
.item.watched .ttl b, .item.skip .ttl b { color: var(--muted); }
.item.skip .ttl b { text-decoration: line-through; text-decoration-color: var(--faint); }
.item.skip .av, .item.soon .av { opacity: .45; }
.item.soon .ttl b { color: var(--muted); }

.acts { display: flex; gap: 6px; }
.ib {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .82rem; font-weight: 650; white-space: nowrap;
}
.ib svg { width: 16px; height: 16px; flex: none; }
.ib:hover { color: var(--text); border-color: var(--faint); }
.ib.w[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.ib.s[aria-pressed="true"] { background: var(--skip); border-color: var(--skip); color: #fff; }
.ib.m[aria-pressed="true"] { background: var(--maybe); border-color: var(--maybe); color: #fff; }
.ib:disabled { opacity: .4; cursor: default; }

/* Details */
.det {
  background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; padding: 4px 16px 16px;
  font-size: .9rem;
}
.item.is-next .det { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.det h4 { margin: 14px 0 4px; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.det p { margin: 0 0 6px; }
.det ul, .det ol { margin: 2px 0 8px; padding-left: 20px; }
.det .hint { color: var(--faint); font-size: .78rem; }
.det .likes { display: flex; flex-wrap: wrap; gap: 5px; }
.det .likes span { padding: 2px 8px; border-radius: 99px; background: var(--surface2); font-size: .8rem; }
.det .dacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.det .when { color: var(--muted); font-size: .82rem; margin-top: 10px; }

/* Watch first: one row per show, a chip per season */
.pql { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.pq { display: grid; grid-template-columns: 18px auto 1fr; gap: 4px 8px; align-items: center; }
.pqi { font-size: .85rem; font-weight: 700; text-align: center; line-height: 1; }
.pqi.ok { color: var(--ok); }
.pqi.part { color: var(--maybe); }
.pqi.no { color: var(--faint); }
.pqi.skipped { color: var(--skip); }
.pqn {
  border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font-weight: 600; color: var(--text);
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
}
.pqn:hover { text-decoration-color: var(--accent); }
.pqs { display: flex; flex-wrap: wrap; gap: 4px; }
.sc {
  height: 22px; padding: 0 7px; border-radius: 6px; cursor: pointer; font-size: .74rem; font-weight: 650;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.sc:hover { border-color: var(--faint); color: var(--text); }
.sc.watched { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.sc.skip { border-color: transparent; color: var(--faint); text-decoration: line-through; }
.sc.maybe { border-color: var(--maybe); color: var(--maybe); }

.nwarn { margin: 10px 0 0; font-size: .86rem; color: var(--maybe); }
.nwarn button { border: 0; background: none; padding: 0; color: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Notes the guide puts beside a group of titles */
.note {
  position: relative; margin: 10px 0 6px 40px; padding: 10px 14px; border-radius: 12px; font-size: .86rem; color: var(--muted);
  background: var(--surface2); border-left: 3px solid var(--violet);
}
.note b { color: var(--text); font-weight: 600; }
.note ol { margin: 8px 0 0; padding-left: 20px; }
.note button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: .82rem; font-weight: 600; margin-top: 6px; }

.gonehead { margin: 30px 0 8px 40px; font-size: .9rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Footer, jump button, toast */
.foot { margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: .82rem; color: var(--faint); }
.foot .warn { color: var(--warn); }
.foot .fl { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.jump {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 10; height: 40px; padding: 0 16px; border-radius: 99px;
  border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; box-shadow: var(--shadow);
}
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 14px 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: .88rem; box-shadow: var(--shadow);
}
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px; }
@media (prefers-color-scheme: light) { .toast button { color: #f0b44c; } }

.flash .row { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }

@media (max-width: 640px) {
  .wrap { padding-top: 14px; }
  .guide { display: none; }
  .bar { position: static; flex-direction: column; align-items: stretch; background: none; backdrop-filter: none; }
  .bar input[type="search"] { width: 100%; }
  .tools { justify-content: flex-start; gap: 20px; }
  .ib span { display: none; }
  .ib { padding: 0; width: 36px; justify-content: center; }
  .row { gap: 10px; padding: 9px 8px; }
  .av { width: 36px; height: 36px; }
  .av.big { width: 52px; height: 52px; }
  .next { padding: 16px; }
  .next h2 { font-size: 1.15rem; }
  .nmain { gap: 12px; }
  .det { padding: 2px 12px 14px; }
}
@media (prefers-reduced-motion: reduce) { .flash .row { animation: none; } html { scroll-behavior: auto; } }
