:root {
  --bg: #161616; --surface: #232323; --surface2: #2e2e2e; --text: #fff; --muted: #9a9a9a;
  --accent: #f43e37; --line: #2a2a2a; --tabbar: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { max-width: 560px; margin: 0 auto; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
.screen { padding-bottom: calc(var(--tabbar) + var(--safe-b) + 16px); }
.header { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(var(--safe-t) + 14px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.header h1 { font-size: 28px; margin: 0; font-weight: 700; }
.header .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.icon-btn.on { color: var(--accent); }
.icon-btn svg, .tab svg { width: 24px; height: 24px; fill: currentColor; }

.progress { height: 4px; background: var(--surface2); border-radius: 2px; margin: 0 16px 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }

.season-head { display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 14px 16px; background: var(--bg); border-bottom: 1px solid var(--line); text-align: left; }
.season-head b { font-size: 18px; }
.season-head small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.season-head svg { width: 22px; height: 22px; fill: var(--muted); transition: transform .15s; }
.season.collapsed .season-head svg { transform: rotate(-90deg); }
.season.collapsed .rows { display: none; }

.row { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:active { background: var(--surface); }
.row.done .title, .row.done .meta { opacity: .5; }
.art { flex: none; width: 56px; height: 56px; border-radius: 6px; display: grid; place-items: center; overflow: hidden;
  font-weight: 800; font-size: 13px; line-height: 1.1; text-align: center; color: rgba(255,255,255,.92); background-size: cover; background-position: center; }
.art span { text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.row .info { flex: 1; min-width: 0; }
.row .title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .meta { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.check { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); }
.check svg { width: 26px; height: 26px; }
.check .ring { fill: none; stroke: currentColor; stroke-width: 2; }
.check.on { color: var(--accent); }
.check.on .ring { fill: currentColor; stroke: currentColor; }
.check .tick { fill: none; stroke: var(--bg); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.check.on .tick { opacity: 1; }

.empty { text-align: center; color: var(--muted); padding: 48px 24px; }
.link { color: var(--accent); }

/* episode page */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; padding: calc(var(--safe-t) + 8px) 8px 4px; background: linear-gradient(var(--bg), transparent); }
.hero { padding: 8px 24px 0; }
.hero .art { width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 12px; font-size: 40px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.hero h2 { font-size: 24px; margin: 20px 0 6px; line-height: 1.2; }
.hero .meta { color: var(--muted); font-size: 14px; }
.actions { display: flex; gap: 10px; padding: 18px 24px 4px; }
.btn { flex: 1; padding: 13px 16px; border-radius: 10px; background: var(--surface2); font-weight: 600; text-align: center; }
.btn.primary { background: var(--accent); }
.btn:disabled { opacity: .5; }
.summary { padding: 14px 24px; color: #ddd; white-space: pre-line; }
.player { margin: 6px 24px; padding: 12px; background: var(--surface); border-radius: 12px; }
.player audio { width: 100%; }
.player .note { color: var(--muted); font-size: 14px; text-align: center; padding: 8px; }

/* profile + auth */
.card { margin: 8px 16px; background: var(--surface); border-radius: 12px; }
.card .line { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card .line:last-child { border-bottom: 0; }
.switch { width: 48px; height: 28px; border-radius: 14px; background: var(--surface2); position: relative; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--accent); } .switch.on::after { transform: translateX(20px); }
.auth { padding: calc(var(--safe-t) + 48px) 24px 24px; }
.auth .logo { width: 72px; height: 72px; border-radius: 16px; display: block; margin: 0 auto 16px; }
.auth h1 { text-align: center; margin: 0 0 28px; font-size: 26px; }
.field { width: 100%; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 12px; }
.field:focus { outline: 2px solid var(--accent); border-color: transparent; }
.err { color: #ff7a75; min-height: 22px; margin: 0 0 8px; font-size: 14px; }
.auth .switch-mode { text-align: center; margin-top: 18px; color: var(--muted); }

.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; height: calc(var(--tabbar) + var(--safe-b));
  padding-bottom: var(--safe-b); display: flex; background: #1d1d1d; border-top: 1px solid var(--line); z-index: 10; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tab.active { color: var(--accent); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + var(--safe-b) + 12px); background: #000; border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; z-index: 20; font-size: 14px; }

/* player */
.player { margin: 6px 24px; padding: 14px 12px 10px; background: var(--surface); border-radius: 12px; }
.seek { width: 100%; accent-color: var(--accent); margin: 0; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; padding: 2px 2px 0; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 28px; padding-top: 6px; }
.icon-btn.big { width: 52px; height: 52px; color: var(--text); }
.icon-btn.big svg { width: 34px; height: 34px; }
.play-btn { width: 68px; height: 68px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.play-btn svg { width: 36px; height: 36px; fill: #fff; }
.resume { color: var(--accent); font-weight: 600; }

.mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + var(--safe-b)); width: 100%; max-width: 560px;
  background: var(--surface); border-top: 1px solid var(--line); z-index: 9; }
.mini[hidden] { display: none; }
.mini-bar { height: 2px; background: var(--surface2); }
.mini-bar i { display: block; height: 100%; background: var(--accent); }
.mini-main { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; cursor: pointer; }
.mini .art { width: 44px; height: 44px; font-size: 11px; }
.mini .info { flex: 1; min-width: 0; }
.mini .title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mini .icon-btn { color: var(--text); width: 48px; height: 48px; }
.mini .icon-btn svg { width: 30px; height: 30px; fill: currentColor; }
.has-mini .screen { padding-bottom: calc(var(--tabbar) + var(--safe-b) + 16px + 62px); }
.has-mini .toast { bottom: calc(var(--tabbar) + var(--safe-b) + 74px); }

.day-head { padding: 18px 16px 6px; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
