:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-2: #f3ede4;
  --line: #e7dfd3;
  --ink: #2b2a33;
  --ink-2: #6b6672;
  --accent: #d9653b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe5da;
  --green: #4f8a6e;
  --danger: #c0392b;
  --shadow: 0 1px 2px rgba(43, 42, 51, 0.06), 0 6px 20px rgba(43, 42, 51, 0.07);
  --radius: 14px;
  --sidebar: 232px;
  --player-h: 76px;
  --tabbar-h: 0px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-read: 'Literata', Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #15161c;
    --surface: #1e1f27;
    --surface-2: #262833;
    --line: #2f313d;
    --ink: #ece8e1;
    --ink-2: #a39fa8;
    --accent: #f08a5d;
    --accent-ink: #1a1214;
    --accent-soft: #3a261f;
    --green: #7dbb9c;
    --danger: #ff7b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #15161c;
  --surface: #1e1f27;
  --surface-2: #262833;
  --line: #2f313d;
  --ink: #ece8e1;
  --ink-2: #a39fa8;
  --accent: #f08a5d;
  --accent-ink: #1a1214;
  --accent-soft: #3a261f;
  --green: #7dbb9c;
  --danger: #ff7b6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
svg.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */

.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-right: 1px solid var(--line); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.brand img { width: 34px; height: 34px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 700;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.sidebar .spacer { flex: 1; }
.sidebar .me { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; }
.sidebar .me:hover { background: var(--surface-2); }
.version-link { padding: 6px 12px; font-size: 0.78rem; color: var(--ink-2); }
.version-link:hover { color: var(--accent); }

main {
  margin-left: var(--sidebar);
  padding: 28px clamp(16px, 4vw, 44px) calc(var(--player-h) + 40px);
  max-width: calc(1280px + var(--sidebar));
}
body.no-player main { padding-bottom: 40px; }

.tabbar { display: none; }

@media (max-width: 820px) {
  :root { --tabbar-h: 64px; --player-h: 64px; }
  .sidebar { display: none; }
  main { margin-left: 0; padding: 18px 16px calc(var(--player-h) + var(--tabbar-h) + 28px); }
  body.no-player main { padding-bottom: calc(var(--tabbar-h) + 28px); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.7rem; font-weight: 700; color: var(--ink-2); }
  .tabbar a.active { color: var(--accent); }
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar .greeting p { margin: 4px 0 0; }
.mobile-only { display: none !important; }
@media (max-width: 820px) { .mobile-only { display: inline-flex !important; } .desktop-only { display: none !important; } }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform 0.08s, background 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: transparent; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on { color: var(--accent); }
.icon-btn.on svg { fill: currentColor; }

input[type='text'], input[type='password'], input[type='search'], input[type='url'], textarea, select {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 120px; resize: vertical; }
label.field { display: grid; gap: 6px; font-weight: 700; font-size: 0.9rem; }
.form { display: grid; gap: 14px; max-width: 560px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.search-box { position: relative; flex: 1; max-width: 380px; min-width: 200px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2); width: 18px; height: 18px; }
.search-box input { padding-left: 38px; border-radius: 999px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 0.88rem; cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }

/* ---------- shelves & cards ---------- */

.section { margin-bottom: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head a { color: var(--accent); font-weight: 700; font-size: 0.9rem; }

.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 160px; gap: 18px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.shelf > * { scroll-snap-align: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 18px; }
@media (max-width: 560px) { .shelf { grid-auto-columns: 132px; gap: 14px; } .grid { grid-template-columns: repeat(2, 1fr); gap: 18px 14px; } }

.card { display: block; min-width: 0; }
.cover {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); box-shadow: var(--shadow);
}
.cover.tall { aspect-ratio: 2 / 3; }
.cover.wide { aspect-ratio: 16 / 9; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .gen {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px; color: #fff; font-family: var(--font-display); font-weight: 600; line-height: 1.15;
}
.cover .gen .t { font-size: 1.05rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.cover .gen svg { width: 26px; height: 26px; opacity: 0.85; }
.cover .kind-badge { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.cover .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0, 0, 0, 0.25); }
.cover .bar span { display: block; height: 100%; background: var(--accent); }
.cover .done { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.cover .done svg { width: 15px; height: 15px; stroke-width: 3; }
.cover .play-fab {
  position: absolute; right: 10px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); opacity: 0; transform: translateY(6px); transition: 0.15s;
}
.cover .play-fab svg { width: 18px; height: 18px; }
.card:hover .play-fab, .card:focus-within .play-fab { opacity: 1; transform: none; }
@media (hover: none) { .cover .play-fab { opacity: 1; transform: none; width: 38px; height: 38px; } }
.card-title { margin-top: 10px; font-weight: 800; font-size: 0.95rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-sub { font-size: 0.82rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; padding: 50px 20px; color: var(--ink-2); }
.empty svg { width: 46px; height: 46px; margin-bottom: 10px; color: var(--accent); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.hero {
  position: relative; display: flex; gap: 22px; align-items: center; padding: 22px; margin-bottom: 34px;
  border-radius: 20px; background: linear-gradient(120deg, var(--accent-soft), var(--surface-2)); overflow: hidden;
}
.hero .cover { width: 120px; flex: none; }
.hero .label { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.hero h2 { margin: 4px 0 6px; }
@media (max-width: 560px) { .hero { padding: 16px; gap: 14px; } .hero .cover { width: 88px; } .hero h2 { font-size: 1.1rem; } }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 34px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.stat .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.stat b { display: block; font-size: 1.2rem; line-height: 1; }
.stat span { font-size: 0.8rem; color: var(--ink-2); font-weight: 700; }
@media (max-width: 820px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

/* ---------- episode rows ---------- */

.list { display: grid; gap: 2px; }
.ep {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  padding: 10px; border-radius: 12px;
}
.ep:hover { background: var(--surface); }
.ep img, .ep .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.ep .title { font-weight: 800; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ep .meta { font-size: 0.8rem; color: var(--ink-2); }
.ep .meta .left { color: var(--accent); font-weight: 700; }
.ep .meta .fin { color: var(--green); font-weight: 700; }
.ep .play-round { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--accent); }
.ep .play-round svg { width: 16px; height: 16px; }
.ep .play-round:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ep.playing .title { color: var(--accent); }

/* ---------- detail page ---------- */

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 700; margin-bottom: 18px; }
.back:hover { color: var(--accent); }
.detail { display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; }
.detail .info .kind { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.detail .info h1 { margin: 6px 0 4px; }
.detail .info .by { color: var(--ink-2); font-weight: 700; margin-bottom: 18px; }
.detail .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.detail .desc { white-space: pre-wrap; color: var(--ink); max-width: 68ch; }
.detail .facts { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-2); margin-top: 18px; }
.progress-line { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; max-width: 320px; margin: -8px 0 20px; }
.progress-line span { display: block; height: 100%; background: var(--accent); }
@media (max-width: 720px) { .detail { grid-template-columns: 1fr; gap: 20px; } .detail .cover { max-width: 220px; margin: 0 auto; } .detail .info { text-align: center; } .detail .actions { justify-content: center; } .progress-line { margin-inline: auto; } }

.podcast-head { display: flex; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
.podcast-head img { width: 170px; height: 170px; border-radius: 16px; object-fit: cover; box-shadow: var(--shadow); }
.podcast-head .desc { max-width: 70ch; color: var(--ink-2); font-size: 0.92rem; max-height: 4.6em; overflow: hidden; }
@media (max-width: 640px) { .podcast-head { flex-direction: column; align-items: flex-start; } .podcast-head img { width: 130px; height: 130px; } }

/* ---------- player bar ---------- */

.player {
  position: fixed; left: var(--sidebar); right: 0; bottom: 0; height: var(--player-h); z-index: 25;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px;
  padding: 0 20px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.player .now { display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.player .now img, .player .now .thumb { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.player .now .t { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .now .a { font-size: 0.8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .center { display: flex; flex-direction: column; align-items: center; gap: 2px; width: min(520px, 42vw); }
.player .ctrls { display: flex; align-items: center; gap: 8px; }
.player .big-play { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--ink); color: var(--bg); display: grid; place-items: center; cursor: pointer; }
.player .big-play svg { width: 18px; height: 18px; }
.player .seek { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 0.72rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.player .right { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.player .speed { font-weight: 800; font-size: 0.85rem; width: auto; padding: 0 10px; border-radius: 999px; }
.player .top-bar { display: none; }

input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--line) var(--pct, 0%)); }
input[type='range']::-moz-range-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--line) var(--pct, 0%)); }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4.5px; border-radius: 50%; background: var(--accent); border: none; }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: none; }

@media (max-width: 820px) {
  .player { left: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr) auto; padding: 0 10px 0 12px; gap: 8px; }
  .player .center .seek, .player .right, .player .ctrls .skip { display: none; }
  .player .center { width: auto; }
  .player .now img, .player .now .thumb { width: 44px; height: 44px; }
  .player .top-bar { display: block; position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: var(--line); }
  .player .top-bar span { display: block; height: 100%; background: var(--accent); }
}

/* ---------- now playing sheet ---------- */

.sheet {
  position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; padding: 18px 24px 40px;
  animation: rise 0.22s ease-out;
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.sheet .sheet-top { width: 100%; max-width: 480px; display: flex; justify-content: space-between; align-items: center; }
.sheet .art { width: min(340px, 78vw); aspect-ratio: 1; border-radius: 20px; overflow: hidden; margin: 18px 0 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); background: var(--surface-2); position: relative; }
.sheet .art img { width: 100%; height: 100%; object-fit: cover; }
.sheet .meta { width: 100%; max-width: 420px; text-align: center; }
.sheet .meta h2 { font-size: 1.4rem; }
.sheet .meta p { margin: 4px 0 0; color: var(--ink-2); font-weight: 700; }
.sheet .seek { width: 100%; max-width: 420px; margin-top: 22px; }
.sheet .times { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sheet .controls { display: flex; align-items: center; gap: 26px; margin: 14px 0 24px; }
.sheet .controls .icon-btn { width: 56px; height: 56px; }
.sheet .controls .icon-btn svg { width: 30px; height: 30px; }
.sheet .controls .big-play { width: 76px; height: 76px; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; }
.sheet .controls .big-play svg { width: 30px; height: 30px; }
.sheet .extras { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.menu { position: absolute; z-index: 70; min-width: 180px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: none; background: none; border-radius: 8px; cursor: pointer; font-weight: 700; }
.menu button:hover { background: var(--surface-2); }
.menu button.on { color: var(--accent); }

/* ---------- video ---------- */

.video-wrap { background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.video-wrap video { display: block; width: 100%; max-height: 74vh; background: #000; }

/* ---------- reader ---------- */

.reader { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--paper, var(--bg)); color: var(--paper-ink, var(--ink)); }
.reader[data-paper='light'] { --paper: #fffdf9; --paper-ink: #2b2a33; --paper-line: #ece4d8; }
.reader[data-paper='sepia'] { --paper: #f4ecd8; --paper-ink: #4b3b2a; --paper-line: #e2d5b8; }
.reader[data-paper='dark'] { --paper: #17181d; --paper-ink: #d9d4cb; --paper-line: #2c2e37; }
.reader-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); border-bottom: 1px solid var(--paper-line); }
.reader-top .icon-btn { color: inherit; }
.reader-top .icon-btn:hover { background: rgba(127, 127, 127, 0.15); }
.reader-top .ttl { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-top select { width: auto; max-width: 180px; padding: 6px 10px; background: transparent; color: inherit; border-color: var(--paper-line); }
.reader-body { flex: 1; overflow-y: auto; position: relative; }
.reader-text { max-width: 680px; margin: 0 auto; padding: 40px 24px 120px; font-family: var(--font-read); font-size: var(--read-size, 20px); line-height: 1.75; }
.reader-text h1 { font-size: 1.9em; margin: 0 0 0.3em; }
.reader-text .by { color: inherit; opacity: 0.65; margin-bottom: 2em; font-family: var(--font); font-weight: 700; font-size: 0.8em; }
.reader-text h2, .reader-text h3 { margin: 1.6em 0 0.5em; }
.reader-text p { margin: 0 0 1.1em; }
.reader-text .the-end { text-align: center; margin-top: 3em; font-family: var(--font-display); font-style: italic; opacity: 0.6; }
.epub-view { position: absolute; inset: 0 48px; }
.page-btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; color: inherit; opacity: 0.55; }
.page-btn:hover { opacity: 1; background: rgba(127, 127, 127, 0.15); }
.page-btn.prev { left: 4px; } .page-btn.next { right: 4px; }
@media (max-width: 640px) { .epub-view { inset: 0 12px; } .page-btn { display: none; } }
.reader-foot { display: flex; align-items: center; gap: 12px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); font-size: 0.8rem; opacity: 0.75; border-top: 1px solid var(--paper-line); }
.reader-foot .track { flex: 1; height: 4px; border-radius: 999px; background: var(--paper-line); overflow: hidden; }
.reader-foot .track span { display: block; height: 100%; background: var(--accent); }
.reader iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.reader .loading { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0.6; }

/* ---------- admin ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 10px 16px; font-weight: 800; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.drop {
  display: grid; place-items: center; text-align: center; gap: 6px; padding: 34px 20px;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: 0.15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 38px; height: 38px; color: var(--accent); }
.drop b { font-size: 1.05rem; }
.uploads { display: grid; gap: 8px; margin-top: 14px; }
.upload-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 0.9rem; }
.upload-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.upload-row progress { width: 100%; accent-color: var(--accent); }
.upload-row .st { font-size: 0.8rem; font-weight: 800; }
.upload-row .st.ok { color: var(--green); } .upload-row .st.err { color: var(--danger); }

.table { width: 100%; border-collapse: collapse; }
.table td, .table th { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.9rem; flex: none; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; background: var(--surface-2); color: var(--ink-2); }
.pill.admin { background: var(--accent-soft); color: var(--accent); }

.search-results { display: grid; gap: 8px; margin-top: 14px; }
.result { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.result img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.result .t { font-weight: 800; line-height: 1.25; }
.result .a { font-size: 0.82rem; color: var(--ink-2); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--ink); }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 50%), var(--bg); }
.login { width: min(400px, 100%); }
.login .brand { justify-content: center; font-size: 2.4rem; padding: 0 0 6px; }
.login .brand img { width: 52px; height: 52px; }
.login .tag { text-align: center; color: var(--ink-2); margin: 0 0 26px; }
.login .panel { display: grid; gap: 14px; }
.error { color: var(--danger); font-weight: 700; font-size: 0.9rem; }

/* ---------- changelog ---------- */

.changelog h2 { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.changelog h2:first-of-type { border-top: none; padding-top: 0; margin-top: 10px; }
.changelog h3 { margin: 14px 0 6px; color: var(--accent); font-family: var(--font); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.changelog ul { margin: 0; padding-left: 20px; }
.changelog li { margin: 4px 0; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + var(--tabbar-h) + 20px); transform: translateX(-50%);
  z-index: 80; padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-weight: 700; box-shadow: var(--shadow); animation: rise 0.2s ease-out; max-width: calc(100vw - 32px);
}
.toast.err { background: var(--danger); color: #fff; }

/* ---------- v1.1: queue, profiles, stats ---------- */

.sheet { isolation: isolate; }
.sheet > * { position: relative; z-index: 1; }
.sheet > .backdrop {
  position: fixed; inset: -60px; z-index: 0; background-size: cover; background-position: center;
  filter: blur(60px) saturate(1.4); opacity: 0.38; pointer-events: none;
}
.up-next { width: 100%; max-width: 480px; margin-top: 30px; padding: 16px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--line); }
.q-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.q-row img, .q-row .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.q-row .thumb .gen .t, .q-row .thumb .gen svg, .player .thumb .gen .t { display: none; }
.q-title { border: none; background: none; text-align: left; cursor: pointer; min-width: 0; padding: 0; }
.q-title b, .q-title span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-title span { font-size: 0.8rem; color: var(--ink-2); }

.ep { grid-template-columns: 56px 1fr auto; }
.ep-actions { display: flex; align-items: center; gap: 2px; }
.icon-btn.small-btn { width: 36px; height: 36px; color: var(--ink-2); }
.icon-btn.small-btn svg { width: 18px; height: 18px; }
.icon-btn.on-green { color: var(--green); }

.pill.owner { background: var(--ink); color: var(--bg); }

.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 140px; }
.week-chart .day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week-chart .col { flex: 1; width: 100%; max-width: 38px; display: flex; align-items: flex-end; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.week-chart .col span { display: block; width: 100%; background: var(--accent); border-radius: 8px; }
.week-chart small { color: var(--ink-2); font-weight: 700; }
.leaders { display: grid; gap: 10px; }
.leader { display: grid; grid-template-columns: 34px 90px 1fr 64px; gap: 12px; align-items: center; }
.leader .lbar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.leader .lbar span { display: block; height: 100%; border-radius: 999px; }
.leader .muted { text-align: right; }

.login.wide { width: min(720px, 100%); }
.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.profile { border: none; background: none; cursor: pointer; display: grid; justify-items: center; gap: 10px; padding: 8px; border-radius: 16px; width: 120px; }
.profile:hover .avatar { transform: scale(1.06); box-shadow: 0 0 0 4px var(--accent-soft); }
.profile b { font-size: 1rem; }
.avatar.big { width: 92px; height: 92px; border-radius: 24px; font-size: 2.4rem; font-family: var(--font-display); transition: 0.15s; }
.avatar.add { background: var(--surface-2); color: var(--ink-2); border: 2px dashed var(--line); }
.avatar.add svg { width: 34px; height: 34px; }
@media (max-width: 560px) { .profile { width: 100px; } .avatar.big { width: 76px; height: 76px; font-size: 2rem; } }
