:root {
  --bg: #F2F0F7;
  --surface: #FFFFFF;
  --ink: #231B33;
  --muted: #6E6880;
  --line: #DCD8E6;
  --accent: #5B3FD1;
  --accent-ink: #FFFFFF;
  --soon: #0F7A70;
  --danger: #B3263E;
  --poster-bg: #D8D3E4;
  --radius-lg: 14px;
  --radius-sm: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1A1625; --surface: #242035; --ink: #EEEAF7; --muted: #A49DB8; --line: #3A3450;
    --accent: #9B85FF; --accent-ink: #1A1625; --soon: #4FD1C1; --danger: #FF7A8E; --poster-bg: #332D47;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 16px; line-height: 1.5; font-variation-settings: "opsz" 14;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
img { display: block; }

.wordmark {
  font-weight: 800; font-stretch: 78%; font-size: 2.6rem; letter-spacing: -0.02em; line-height: 1;
  margin: 0; font-variation-settings: "opsz" 96;
}
.wordmark.small { font-size: 1.35rem; }
.muted { color: var(--muted); }

.btn {
  border: 1px solid var(--line); background: var(--surface); padding: .55rem 1rem;
  border-radius: 999px; font-weight: 600; font-size: .9rem;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { background: none; border: 0; padding: .4rem; border-radius: 999px; color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { color: var(--ink); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.lede { color: var(--muted); margin: 1rem 0 2rem; max-width: 34ch; }
.auth form { display: grid; gap: 1rem; }
.auth label, .settings label:not(.toggle) { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; }
input[type=email], input[type=password] {
  font: inherit; padding: .7rem .85rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.form-error { color: var(--danger); margin: 0; min-height: 1.5em; font-size: .9rem; }
.switch { color: var(--muted); font-size: .92rem; margin-top: 1.5rem; }

/* ---------- shell ---------- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; max-width: 880px; margin: 0 auto; padding: 20px 16px 8px;
}
.tabs { display: flex; gap: .25rem; margin-right: auto; }
.tabs button {
  white-space: nowrap; background: none; border: 0; padding: .45rem .8rem; border-radius: 999px; color: var(--muted); font-weight: 600;
}
.tabs button[aria-selected="true"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.badge {
  display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; margin-left: .2rem;
}

.search-wrap { position: relative; max-width: 880px; margin: 0 auto; padding: 12px 16px 0; }
.search {
  display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 1rem; color: var(--muted);
}
.search input { flex: 1; border: 0; background: none; font: inherit; padding: .8rem 0; color: var(--ink); min-width: 0; }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--accent); }
.results {
  position: absolute; left: 16px; right: 16px; top: calc(100% + 6px); z-index: 10; list-style: none; margin: 0; padding: .4rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px -18px rgba(35, 27, 51, .35); max-height: 70vh; overflow: auto;
}
.result { display: grid; grid-template-columns: 40px 1fr auto; gap: .8rem; align-items: center; padding: .5rem; border-radius: 10px; }
.result:hover { background: var(--bg); }
.result .poster { width: 40px; }
.result-name { font-weight: 600; }
.result-meta { color: var(--muted); font-size: .85rem; }
.result-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.result-actions .btn { padding: .35rem .7rem; font-size: .82rem; }
.result-empty { padding: .8rem; color: var(--muted); }

.content { max-width: 880px; margin: 0 auto; padding: 8px 16px 48px; }
.credit { max-width: 880px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: .78rem; }

.poster {
  aspect-ratio: 2 / 3; width: 100%; border-radius: var(--radius-sm); background: var(--poster-bg); object-fit: cover;
}
div.poster {
  display: grid; place-items: center; color: var(--muted); font-weight: 800; font-stretch: 80%; font-size: 1.1rem;
  container-type: inline-size; overflow: hidden;
}

/* ---------- hero countdown: the one loud thing ---------- */
.hero { display: grid; grid-template-columns: 1fr 120px; gap: 1.5rem; align-items: end; padding: 2.25rem 0 2rem; border-bottom: 1px solid var(--line); }
.hero-count {
  font-weight: 800; font-stretch: 75%; line-height: .85; letter-spacing: -0.04em; margin: 0;
  font-size: clamp(5rem, 22vw, 11rem); color: var(--accent); font-variation-settings: "opsz" 96;
  font-variant-numeric: tabular-nums;
}
.hero-text { font-size: clamp(1.25rem, 3.5vw, 1.75rem); font-weight: 600; line-height: 1.2; margin: .6rem 0 0; max-width: 24ch; }
.hero-sub { color: var(--muted); margin: .4rem 0 0; }
.hero .poster { box-shadow: 0 20px 40px -20px rgba(35, 27, 51, .5); }
.hero.quiet .hero-text { font-size: 1.4rem; }

/* ---------- groups ---------- */
.group { margin-top: 2.25rem; }
.group h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 .25rem; letter-spacing: -0.01em; }
.group > p { color: var(--muted); margin: 0 0 .75rem; font-size: .92rem; }
.rows { list-style: none; margin: 0; padding: 0; }
.row-item {
  display: grid; grid-template-columns: 64px 52px 1fr auto; gap: 1rem; align-items: center;
  padding: .85rem 0; border-top: 1px solid var(--line);
}
.rows .row-item:first-child { border-top: 0; }
.row-item.no-date { grid-template-columns: 52px 1fr auto; }
.date-block { text-align: center; line-height: 1; }
.date-day { display: block; font-size: 1.9rem; font-weight: 800; font-stretch: 80%; font-variant-numeric: tabular-nums; }
.date-mon { display: block; font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.date-block.soon .date-day { color: var(--soon); }
.row-title { font-weight: 650; font-size: 1.05rem; line-height: 1.25; }
.row-title .year { color: var(--muted); font-weight: 400; }
.row-outlook { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.row-season { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.row-actions { display: flex; align-items: center; gap: .1rem; }
.muted-tag { white-space: nowrap; font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem; margin-left: .4rem; vertical-align: 2px; }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 200px; list-style: none; margin: 0; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 30px -14px rgba(35, 27, 51, .35);
}
.menu-list button { width: 100%; text-align: left; background: none; border: 0; padding: .5rem .7rem; border-radius: 8px; }
.menu-list button:hover { background: var(--bg); }
.menu-list button.danger { color: var(--danger); }

/* ---------- watched wall ---------- */
.wall-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 2rem 0 1rem; }
.wall-head h2 { margin: 0; font-size: 1.6rem; font-weight: 800; font-stretch: 85%; letter-spacing: -0.02em; }
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 1.5rem 1rem; list-style: none; margin: 0; padding: 0; }
.tile { position: relative; }
.tile-name { font-weight: 600; font-size: .92rem; line-height: 1.25; margin-top: .5rem; }
.tile-meta { color: var(--muted); font-size: .8rem; }
.tile-outlook { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.tile-outlook.soon { color: var(--soon); }
.tile .menu { position: absolute; top: 6px; right: 6px; }
.tile .menu > .icon-btn { background: rgba(255, 255, 255, .88); color: #231B33; }
.stars { display: flex; gap: 1px; margin-top: .2rem; }
.stars button { background: none; border: 0; padding: 0 1px; color: var(--muted); opacity: .45; font-size: .95rem; line-height: 1; }
.stars button.on { color: var(--accent); opacity: 1; }

/* ---------- updates ---------- */
.feed { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 40px 1fr; gap: .9rem; align-items: center; padding: .75rem 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed time { display: block; color: var(--muted); font-size: .82rem; }

.empty { padding: 3rem 0; max-width: 46ch; }
.empty h2 { font-size: 1.5rem; font-weight: 800; font-stretch: 85%; margin: 0 0 .5rem; }
.empty p { color: var(--muted); margin: 0; }

/* ---------- settings + toast ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); padding: 1.5rem; width: min(400px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(26, 22, 37, .45); }
.settings h2 { margin: 0; font-size: 1.3rem; }
.settings .toggle { display: flex; gap: .6rem; align-items: flex-start; margin: 1.25rem 0 1.5rem; }
.settings .toggle input { margin-top: .3rem; accent-color: var(--accent); }
.settings .row { display: flex; justify-content: space-between; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: .65rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .92rem;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .topbar { gap: .5rem; }
  .tabs button { padding: .45rem .6rem; }
  .wordmark.small { display: none; }
  .hero { grid-template-columns: 1fr 84px; gap: 1rem; padding-top: 1.5rem; }
  .row-item { grid-template-columns: 48px 44px 1fr auto; gap: .7rem; }
  .row-item.no-date { grid-template-columns: 44px 1fr auto; }
  .date-day { font-size: 1.5rem; }
  .result { grid-template-columns: 36px 1fr; }
  .result-actions { grid-column: 2; justify-content: flex-start; }
  .wall { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
