:root {
  --bg: #14110f;
  --bg2: #1b1714;
  --card: #221d19;
  --card2: #2a2420;
  --line: #3a312b;
  --text: #f4ece4;
  --muted: #a8998c;
  --accent: #e8743b;
  --accent-ink: #1a0f08;
  --ok: #8ccf8c;
  --hue: 20;
  --tint: hsl(var(--hue) 70% 55%);
  --radius: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-b: env(safe-area-inset-bottom);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(120% 60% at 50% -10%, hsl(var(--hue) 45% 16%) 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  transition: background 0.6s;
}
body.locked { overflow: hidden; }
svg { width: 1.25em; height: 1.25em; flex: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.accent { color: var(--tint); }

#app { padding: env(safe-area-inset-top) 16px calc(110px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.top { display: flex; align-items: center; gap: 10px; padding: 16px 0 6px; }
.brand { display: flex; align-items: center; gap: 8px; flex: 1; }
.brand .logo { width: 30px; height: 30px; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -0.3px; font-weight: 800; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: #3b2516; color: #ffb48a; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--text); }
.icon-btn:active { background: #ffffff14; }
.icon-btn svg { width: 24px; height: 24px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px; border-radius: 14px; background: var(--card2); font-weight: 600; transition: transform 0.15s var(--ease); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.wide { width: 100%; }

/* ---------- login ---------- */
.login { min-height: 70dvh; display: grid; place-items: center; }
.login form { width: 100%; max-width: 360px; text-align: center; }
.login-art { width: 96px; height: 96px; margin-bottom: 8px; }
.login h2 { margin: 0 0 4px; font-size: 24px; }
.login p { color: var(--muted); margin: 0 0 20px; }
.login input { width: 100%; font: inherit; font-size: 18px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); margin-bottom: 12px; }
.error { color: #ff9a6a; min-height: 1.4em; margin-top: 10px !important; }

/* ---------- hero ---------- */
.hero { position: relative; margin: 10px 0 22px; border-radius: 24px; overflow: hidden; background: var(--card); box-shadow: 0 20px 50px -20px #000; }
.hero-cover { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.hero-cover svg { position: absolute; inset: -25% 0 auto; width: 100%; height: auto; }
.hero-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, var(--card) 100%); }
.hero-body { position: relative; padding: 0 18px 18px; margin-top: -54px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--tint); }
.hero h2 { margin: 4px 0 6px; font-size: 24px; line-height: 1.15; }
.hero .meta { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.hero .row { display: flex; gap: 10px; align-items: center; }
.hero .row .btn.primary { flex: 1; height: 54px; font-size: 17px; }
.hero .btn.primary svg { width: 22px; height: 22px; }
.bar { height: 4px; border-radius: 4px; background: #ffffff1a; overflow: hidden; margin-bottom: 14px; }
.bar i { display: block; height: 100%; background: var(--tint); border-radius: 4px; }

.section-title { font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); margin: 8px 2px 10px; font-weight: 700; }

/* ---------- list ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.series { border-radius: var(--radius); background: #ffffff06; padding: 10px; border: 1px solid #ffffff0d; }
.series-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 6px 8px; }
.series-head b { font-size: 16px; }
.series .ep { background: transparent; padding: 8px 6px; }
.series .ep + .ep { border-top: 1px solid #ffffff0d; border-radius: 0; }
.ep { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 10px; border-radius: var(--radius); background: var(--card); transition: background 0.2s, transform 0.15s var(--ease); position: relative; }
.ep:active { transform: scale(0.985); }
.ep.current { box-shadow: inset 0 0 0 1.5px var(--accent); }
.ep .thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; position: relative; }
.ep .thumb svg { width: 100%; height: 100%; display: block; }
.ep .thumb .eq { position: absolute; inset: 0; background: #0008; display: grid; place-items: center; }
.ep .info { min-width: 0; text-align: left; }
.ep .title { font-weight: 650; font-size: 16px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ep .sub { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ep .sub .dot::before { content: "·"; margin-right: 6px; }
.ep .sub .ok { color: var(--ok); display: inline-flex; align-items: center; gap: 3px; }
.ep .sub .ok svg { width: 14px; height: 14px; }
.ep .mini-bar { grid-column: 2; height: 3px; border-radius: 3px; background: #ffffff14; overflow: hidden; margin-top: 7px; }
.ep .mini-bar i { display: block; height: 100%; background: var(--accent); }
.ep .open { all: unset; position: absolute; inset: 0; border-radius: inherit; cursor: pointer; }
.ep .open:focus-visible { outline: 2px solid var(--accent); }
.ep .actions { display: flex; gap: 2px; position: relative; z-index: 1; }
.ring { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; position: relative; color: var(--muted); }
.ring svg.prog { position: absolute; inset: 4px; width: 36px; height: 36px; transform: rotate(-90deg); }
.ring svg.prog circle { fill: none; stroke-width: 3; }
.ring svg.prog .track { stroke: #ffffff1c; }
.ring svg.prog .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.ring.saved { color: var(--ok); }
.ring > svg:not(.prog) { width: 20px; height: 20px; }
.ring .stop { width: 10px; height: 10px; background: var(--accent); border-radius: 2px; }
.desc { grid-column: 1 / -1; font-size: 14px; color: #d3c7bc; margin: 0; }

/* equalizer bars on the current episode's thumb */
.eq-bars { display: flex; gap: 3px; height: 18px; align-items: flex-end; }
.eq-bars i { width: 4px; background: #fff; border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq-bars i:nth-child(2) { animation-delay: -0.3s; }
.eq-bars i:nth-child(3) { animation-delay: -0.6s; }
.eq-bars.paused i { animation-play-state: paused; height: 30%; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* ---------- mini player ---------- */
.mini {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 10;
  display: grid; grid-template-columns: 48px 1fr 52px; gap: 12px; align-items: center;
  padding: 8px 8px 8px 8px; border-radius: 18px; text-align: left;
  background: color-mix(in srgb, hsl(var(--hue) 35% 18%) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 12px 40px -10px #000, inset 0 0 0 1px #ffffff12; overflow: hidden;
  max-width: 620px; margin: 0 auto;
  animation: rise 0.35s var(--ease);
}
@keyframes rise { from { transform: translateY(120%); } }
.mini-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: #ffffff14; }
.mini-bar i { display: block; height: 100%; background: var(--accent); }
.mini-cover { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; }
.mini-cover svg { width: 100%; height: 100%; display: block; }
.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-text b, .mini-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text small { color: var(--muted); font-size: 13px; }
.mini-play { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--bg); }
.mini-play svg { width: 22px; height: 22px; }

/* ---------- full player ---------- */
.full { position: fixed; inset: 0; z-index: 20; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); animation: slide-up 0.38s var(--ease); }
.full.closing { animation: slide-down 0.28s ease-in forwards; }
@keyframes slide-up { from { transform: translateY(100%); } }
@keyframes slide-down { to { transform: translateY(100%); } }
.full-bg { position: fixed; inset: 0; background: radial-gradient(100% 70% at 50% 0%, hsl(var(--hue) 60% 28%) 0%, var(--bg) 75%); pointer-events: none; }
.full-inner { position: relative; max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 6px) 20px calc(30px + var(--safe-b)); }
.full-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: center; }
.full-top .small { flex: 1; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.full-cover { position: relative; margin: 14px auto 22px; width: min(100%, 46dvh); aspect-ratio: 1; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 60px -20px #000; transition: transform 0.4s var(--ease); touch-action: manipulation; }
.full-cover svg { width: 100%; height: 100%; display: block; }
.full.paused .full-cover { transform: scale(0.9); }
.tap-hint { position: absolute; top: 50%; translate: 0 -50%; font-weight: 800; font-size: 22px; padding: 14px 18px; border-radius: 99px; background: #000a; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.tap-hint.left { left: 14px; }
.tap-hint.right { right: 14px; }
.tap-hint.show { opacity: 1; transition: none; }
.full-meta h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.full-meta p { margin: 6px 0 0; min-height: 1.4em; font-weight: 600; }

.seek { margin: 22px 0 6px; }
.seek-track { position: relative; height: 34px; touch-action: none; cursor: pointer; }
.seek-track::before { content: ""; position: absolute; left: 0; right: 0; top: 15px; height: 4px; border-radius: 4px; background: #ffffff22; }
.seek-fill { position: absolute; left: 0; top: 15px; height: 4px; border-radius: 4px; background: var(--text); width: 0; }
.seek-ticks i { position: absolute; top: 12px; width: 2px; height: 10px; background: var(--bg); border-radius: 1px; }
.seek-thumb { position: absolute; top: 9px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--text); box-shadow: 0 2px 8px #0008; transition: transform 0.15s; left: 0; }
.seek-track.drag .seek-thumb { transform: scale(1.5); }
.seek-track.drag .seek-fill, .seek-track.drag .seek-thumb { background: var(--accent); }
.seek-times { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seek-label { color: var(--accent); font-weight: 600; max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.controls { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 18px; }
.ctl { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; transition: transform 0.15s var(--ease), background 0.2s; }
.ctl:active { transform: scale(0.88); background: #ffffff12; }
.ctl svg { width: 32px; height: 32px; }
.ctl.play { width: 84px; height: 84px; background: var(--text); color: var(--bg); box-shadow: 0 10px 30px -8px #000; }
.ctl.play svg { width: 38px; height: 38px; }
.ctl.play.buffering { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 99px; background: #ffffff12; font-size: 14px; font-weight: 600; }
.pill svg { width: 18px; height: 18px; }
.pill[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chapters { list-style: none; padding: 0; margin: 18px 0 0; border-radius: var(--radius); background: #00000040; overflow: hidden; }
.chapters li button { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 14px 16px; text-align: left; }
.chapters li + li { border-top: 1px solid #ffffff0d; }
.chapters li .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.chapters li .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.chapters li.on button { color: var(--tint); font-weight: 650; }
.chapters li.done .name { opacity: 0.55; }

/* ---------- car mode ---------- */
.car { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(20px + var(--safe-b)); gap: 16px; }
.car-top { display: flex; gap: 12px; align-items: flex-start; }
.car-top div { flex: 1; min-width: 0; }
.car-top b { display: block; font-size: 22px; line-height: 1.2; }
.car-top small { display: block; color: var(--accent); font-size: 18px; margin-top: 4px; font-weight: 600; }
.icon-btn.big { width: 60px; height: 60px; background: #ffffff14; }
.car-time { text-align: center; font-size: clamp(40px, 13vw, 80px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -1px; color: #fff; }
.car-time small { display: block; font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.car-controls { flex: 1; display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 12px; min-height: 0; }
.car-btn { border-radius: 28px; background: #1c1c1c; display: grid; place-items: center; color: #fff; transition: transform 0.12s, background 0.2s; }
.car-btn:active { transform: scale(0.95); background: #2a2a2a; }
.car-btn svg { width: 56px; height: 56px; }
.car-btn.main { background: var(--accent); color: #000; }
.car-btn.main svg { width: 80px; height: 80px; }
.car-bar { height: 8px; border-radius: 8px; background: #222; overflow: hidden; }
.car-bar i { display: block; height: 100%; background: var(--accent); }
@media (orientation: landscape) { .car-controls { grid-template-columns: 1fr 2fr 1fr; } .car-time { font-size: 44px; } }

/* ---------- sheet & toast ---------- */
.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; background: var(--bg2); color: var(--text); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px #000; }
.sheet[open] { animation: slide-up 0.3s var(--ease); }
.sheet::backdrop { background: #000a; backdrop-filter: blur(2px); }
.sheet-body-wrap { padding: 10px 16px calc(18px + var(--safe-b)); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #ffffff30; margin: 0 auto 12px; }
.sheet h3 { margin: 4px 6px 4px; font-size: 18px; }
.sheet .hint { margin: 0 6px 12px; color: var(--muted); font-size: 14px; }
.sheet .item { width: 100%; display: flex; align-items: center; gap: 14px; padding: 15px 10px; border-radius: 12px; text-align: left; font-size: 16px; }
.sheet .item:active { background: #ffffff10; }
.sheet .item.danger { color: #ff8f6b; }
.sheet .item svg { width: 22px; height: 22px; color: var(--muted); }
.sheet .item .grow { flex: 1; }
.sheet .item small { display: block; color: var(--muted); font-size: 13px; }
.switch { width: 50px; height: 30px; border-radius: 99px; background: #ffffff22; position: relative; transition: background 0.2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.speeds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 4px 6px 8px; }
.speeds button { height: 52px; border-radius: 14px; background: #ffffff10; font-weight: 700; font-size: 16px; }
.speeds button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.storage-bar { height: 8px; border-radius: 8px; background: #ffffff14; margin: 4px 6px 14px; overflow: hidden; }
.storage-bar i { display: block; height: 100%; background: var(--accent); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(92px + var(--safe-b)); z-index: 40; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: #f4ece4; color: #1a120d; font-weight: 600; box-shadow: 0 16px 40px -10px #000; animation: rise 0.3s var(--ease); }
.toast span { flex: 1; }
.toast button { font-weight: 800; color: #b4471a; padding: 6px 4px; }
.toast .count { font-variant-numeric: tabular-nums; }

.skeleton { height: 84px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, var(--card2) 50%, var(--card) 100%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
