:root {
  /* Neutrals: white + grays */
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --line: #E3E5E8;
  --line-soft: #EEF0F2;
  --well: #F1F2F4;
  --tile: #F1F2F4;
  --hover: #F7F8F9;
  --ink: #16181D;
  --ink-2: #3C4048;
  --muted: #676C75;
  --faint: #767B84;
  --tag: #F1F2F4;
  --sage: #F1F2F4;
  /* Your color (set in Settings). Default: baby blue.
     --accent = fills, --on-accent = text on top of it, --accent-strong = lines/text on white */
  --accent: #89CFF0;
  --on-accent: #0B2A3F;
  --accent-strong: #1A6BA0;
  --accent-ink: var(--accent-strong);
  --display: 'Fraunces', Georgia, serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --nav-h: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease;
}
a { color: var(--accent-strong); }
a:hover { color: var(--ink); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─── Shell ─────────────────────────────────────────────── */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1; padding: 0 20px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 26px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 20px 6px; }
.topbar.sub { padding: 12px 10px 4px; justify-content: flex-start; }
.wordmark { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 30px; letter-spacing: -.5px; color: var(--ink); text-decoration: none; }
.page-title { font-family: var(--display); font-weight: 600; font-size: 30px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 22px; border: 0; background: transparent; color: var(--ink); text-decoration: none; }
.icon-btn.boxed { background: var(--card); border: 1px solid var(--line); }
.icon-btn:hover { color: var(--ink); background: var(--well); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { max-width: 560px; margin: 0 auto; height: var(--nav-h); display: flex; justify-content: space-around; align-items: flex-start; padding-top: 8px; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 76px; min-height: 48px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 700; }
.tab .dot { width: 4px; height: 4px; border-radius: 2px; background: transparent; }
.tab.on .dot { background: var(--accent-strong); }

/* ─── Type & sections ───────────────────────────────────── */
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.h2 { font-family: var(--display); font-weight: 600; font-size: 21px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent-ink); }
.label { font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }

/* ─── Cards & lists ─────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.card.pad { padding: 16px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.row:last-child { border-bottom: 0; }
.row:hover { color: var(--ink); background: var(--hover); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-weight: 600; font-size: 15px; }
.row-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tag { font-size: 12px; color: var(--accent-strong); font-weight: 600; }
.rank { width: 18px; font-family: var(--display); font-size: 16px; color: var(--muted); flex-shrink: 0; }
.chev { color: var(--faint); flex-shrink: 0; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ─── Poster ────────────────────────────────────────────── */
.poster { flex-shrink: 0; border-radius: 8px; overflow: hidden; border: 1px solid rgba(17,19,24,.08); background: var(--tile); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; color: var(--ink); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster.sm { width: 46px; height: 69px; font-size: 16px; }
.poster.md { width: 56px; height: 84px; font-size: 18px; border-radius: 10px; }
.poster.lg { width: 112px; height: 168px; font-size: 26px; border-radius: 12px; }

/* ─── Controls ──────────────────────────────────────────── */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--muted); }
.search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); min-width: 0; }
.search input::placeholder { color: var(--faint); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 0 20px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.chip .count { opacity: .7; font-weight: 500; margin-left: 4px; }

.seg { display: grid; gap: 4px; padding: 4px; background: var(--well); border-radius: 14px; }
.seg.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg button { min-height: 44px; padding: 4px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 700; line-height: 1.15; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(17,19,24,.12); }

.btn { height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--ink); background: var(--ink); color: var(--card); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { color: var(--card); opacity: .92; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.accent:hover { color: var(--on-accent); }
.btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { color: var(--ink); background: var(--well); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { border: 0; background: none; padding: 8px 0; color: var(--accent-strong); font-weight: 700; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 16px; outline: none; }
.input:focus, .textarea:focus { border-color: var(--ink-2); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }

.stars { display: flex; gap: 2px; }
.star { width: 40px; height: 40px; padding: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--accent-strong); }
.stars.sm .star { width: 30px; height: 30px; }

.notice { padding: 12px 14px; border-radius: 14px; background: var(--sage); font-size: 13.5px; line-height: 1.45; }
.notice.warn { background: #FFF4DC; }
.error { color: #C4261D; font-size: 14px; }
.saved { font-size: 12.5px; color: var(--muted); }

/* ─── Explore: editor picks ─────────────────────────────── */
.picks { display: flex; gap: 12px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; }
.picks::-webkit-scrollbar { display: none; }
.pick { flex-shrink: 0; width: 200px; height: 150px; padding: 16px; border-radius: 18px; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; }
.pick:hover { color: var(--ink); filter: brightness(.98); }
.pick-title { font-family: var(--display); font-size: 20px; line-height: 1.15; font-weight: 600; }
.pick-sub { font-size: 12px; color: var(--ink-2); }

/* ─── Show page ─────────────────────────────────────────── */
.backdrop { height: 180px; margin: 0 -20px; background: var(--tile) center / cover no-repeat; }
.show-head { display: flex; gap: 16px; align-items: flex-end; }
.show-head.over { margin-top: -84px; }
.show-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-bottom: 2px; }
.show-title { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.05; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 9px; border-radius: 10px; background: var(--tag); font-size: 11.5px; font-weight: 600; }
.overview { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }

/* ─── Login ─────────────────────────────────────────────── */
.welcome { min-height: 100vh; min-height: 100dvh; max-width: 440px; margin: 0 auto; padding: 48px 24px 32px; display: flex; flex-direction: column; gap: 28px; }
.welcome .wordmark { font-size: 56px; }
.welcome-tag { font-family: var(--display); font-size: 22px; line-height: 1.3; color: var(--ink-2); }

.swatches { display: flex; gap: 14px 10px; flex-wrap: wrap; }
.swatch { width: 62px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.swatch i { display: block; width: 44px; height: 44px; border-radius: 22px; border: 1px solid #D4D7DC; }
.swatch.on i { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent-strong); animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } body { transition: none; } }

.credit { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ─── Stage 2: tabs, seasons, episodes, chat ─────────────── */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { height: 46px; padding: 0; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 15px; font-weight: 500; white-space: nowrap; }
.tabs button.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent-strong); }

.chip.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 16px; }
.chip:disabled { opacity: .45; cursor: default; }
.about-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.select-wrap select { height: 32px; padding: 0 28px 0 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23676C75' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; -webkit-appearance: none; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.composer { display: flex; flex-direction: column; gap: 10px; }

.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.comment { display: flex; gap: 10px; }
.avatar { flex-shrink: 0; width: 36px; height: 36px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ink); }
.comment-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.ref { padding: 2px 8px; border-radius: 8px; background: var(--tag); font-size: 11px; font-weight: 700; color: var(--ink-2); }
.comment-body { margin: 0; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.spoiler { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px dashed #D4D7DC; background: var(--well); color: var(--ink-2); font-size: 13.5px; }
.link-btn.tiny { padding: 0; font-size: 12px; font-weight: 600; color: var(--muted); margin-left: auto; }

.progress { height: 6px; border-radius: 3px; background: var(--well); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 3px; background: var(--accent-strong); transition: width .2s ease; }

.ep-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 14px; border-bottom: 1px solid var(--line-soft); }
.ep-row:last-child { border-bottom: 0; }
.ep-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 52px; text-decoration: none; color: var(--ink); }
.ep-link:hover { color: var(--ink); }
.ep-num { width: 34px; flex-shrink: 0; font-family: var(--display); font-size: 15px; color: var(--muted); }
.ep-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-btn { flex-shrink: 0; width: 44px; height: 44px; border-radius: 22px; border: 1.5px solid #C9CDD3; background: transparent; color: transparent; display: flex; align-items: center; justify-content: center; }
.check-btn.half { border-color: var(--accent-strong); color: var(--accent-strong); }
.check-btn.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

.still { height: 190px; margin: 0 -20px; background: var(--tile) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--faint); }
.crumbs { font-size: 13px; font-weight: 600; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.pager { display: flex; justify-content: space-between; gap: 10px; }
.pager .btn { height: 44px; font-size: 14px; }
.switch { flex-shrink: 0; position: relative; width: 52px; height: 32px; padding: 0; border: 0; border-radius: 16px; background: #C9CDD3; transition: background .15s ease; }
.switch i { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 12px; background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s ease; }
.switch.on { background: var(--accent); }
.switch.on i { left: 24px; }

/* ─── Stage 3: friends & feed ─────────────────────────── */
.badge { position: absolute; top: -5px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; line-height: 1; }
.person-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.person-row:last-child { border-bottom: 0; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.person-main:hover { color: var(--ink); }
.btn.sm { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 19px; }
.feed-item { display: flex; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.feed-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.feed-text { font-size: 14.5px; line-height: 1.45; }
.feed-text a { color: var(--ink); font-weight: 700; text-decoration: none; }
.feed-text a:hover { text-decoration: underline; }
.posters { display: flex; gap: 12px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; }
.posters::-webkit-scrollbar { display: none; }
.poster-card { flex-shrink: 0; width: 104px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.poster-card:hover { color: var(--ink); }
.poster.xl { width: 104px; height: 156px; font-size: 24px; border-radius: 10px; }
.live-card { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--ink); color: var(--card); border-radius: 18px; text-decoration: none; }
.live-card:hover { color: var(--card); opacity: .95; }
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(17,19,24,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.mention { color: var(--accent-strong); font-weight: 700; text-decoration: none; }
.genres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.genre { height: 64px; padding: 0 14px; border-radius: 14px; display: flex; align-items: center; font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--ink); text-decoration: none; }
.genre:hover { color: var(--ink); filter: brightness(.98); }
.feed-item > a, .person-row > a { text-decoration: none; }

/* ─── Stage 4: songs, report menu, group chats ─────────── */
.songs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.songs li { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; }
.vote { flex-shrink: 0; min-width: 52px; height: 36px; padding: 0 10px; border-radius: 18px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); font-size: 13px; font-weight: 700; }
.vote.on { border-color: var(--accent-strong); color: var(--ink); background: var(--tag); }
.menu { position: absolute; right: 0; top: 34px; z-index: 20; min-width: 210px; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(17,19,24,.14); padding: 6px 0; }
.menu button { text-align: left; border: 0; background: none; padding: 10px 14px; font-size: 14px; color: var(--ink); min-height: 40px; }
.menu button:hover { background: var(--bg); }
.group-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.group-row:last-child { border-bottom: 0; }
.group-row:hover { color: var(--ink); background: var(--hover); }
.group-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.unread { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; gap: 3px; max-width: 82%; align-self: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 10px 13px; border-radius: 18px 18px 18px 6px; background: var(--card); border: 1px solid var(--line); font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { border-radius: 18px 18px 6px 18px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.show-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); min-width: 220px; }
.show-card:hover { color: var(--ink); }
.composer-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 9; background: var(--card); border-top: 1px solid var(--line); }
.composer-bar > div { max-width: 560px; margin: 0 auto; padding: 10px 14px; display: flex; gap: 8px; align-items: flex-end; }
.composer-bar textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; outline: none; }
