:root {
  --bg: #0b0c10;
  --bg-2: #14161c;
  --panel: #1b1e26;
  --panel-2: #232732;
  --line: #2c313d;
  --text: #f2f4f8;
  --text-dim: #9aa3b2;
  --text-faint: #6b7280;
  --accent: #e0b64e;
  --accent-2: #d64545;
  --radius: 14px;
  --player-h: 96px;
  --maxw: 1180px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must win over element `display` rules below
   (.chapter-panel / .now-chapter / .chip set display, which would otherwise
   override the UA [hidden]{display:none} and keep those elements visible). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1a1d27 0%, transparent 60%),
    radial-gradient(900px 500px at 0% 0%, #171a22 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

/* Header */
.site-header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 34px 24px 10px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  font-size: 26px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
}
.site-header h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.brand-sub { margin: 2px 0 0; color: var(--text-dim); font-size: 13px; }

/* Grid */
.grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  text-align: left;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #3a4151;
  box-shadow: 0 14px 40px -18px rgba(0,0,0,.8);
}
.card.active { border-color: var(--accent); }

/* Coming-soon (no audio yet): not playable. Cover shown at full brightness. */
.card.soon { cursor: default; }
.card.soon:hover { transform: none; border-color: var(--line); box-shadow: none; }
.card.soon:hover .card-art img { transform: none; }
.badge.soon { color: var(--text-dim); border-color: var(--line); background: var(--panel-2); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }

.card-art {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.card-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.card:hover .card-art img { transform: scale(1.04); }

.card-play {
  position: absolute;
  right: 12px; bottom: 12px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  display: grid; place-items: center;
  background: var(--accent);
  color: #14110a;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 22px -6px rgba(0,0,0,.7);
  transform: translateY(6px);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}
.card:hover .card-play,
.card.active .card-play { opacity: 1; transform: translateY(0); }
.card-play:hover { background: #efc766; }

.card-body { padding: 14px 15px 16px; }
.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 7px;
}
.eyebrow .cat { color: var(--accent); font-weight: 700; }
.card-title { margin: 0; font-size: 16px; line-height: 1.25; letter-spacing: -0.01em; }
.card-edition { color: var(--text-dim); font-weight: 600; }
.card-tagline { margin: 8px 0 0; color: var(--text-dim); font-size: 12.5px; line-height: 1.4; }
.card-foot {
  margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 12px; color: var(--text-faint);
}
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text-dim);
}
.badge.chapters { color: var(--accent); border-color: #3a3421; background: #241f10; }

/* Equalizer (playing indicator) */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2){ animation-delay:.2s } .eq i:nth-child(3){ animation-delay:.4s } .eq i:nth-child(4){ animation-delay:.1s }
@keyframes eq { 0%,100%{ height:3px } 50%{ height:12px } }

/* Player */
.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(16,18,24,.9);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 50;
}
.player-row {
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--player-h);
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 2.2fr) minmax(120px, 1fr);
  align-items: center;
  gap: 18px;
}

.now-playing { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now-cover { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.now-meta { min-width: 0; }
.now-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.controls { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.transport { display: flex; align-items: center; justify-content: center; gap: 14px; }
.play-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--text); color: #0b0c10; font-size: 15px;
  cursor: pointer; display: grid; place-items: center;
  transition: transform .12s ease;
}
.play-btn:hover { transform: scale(1.06); }
.icon-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 15px; cursor: pointer; padding: 4px; line-height: 1;
  transition: color .12s ease;
}
.icon-btn:hover { color: var(--text); }
.icon-btn:disabled { color: var(--text-faint); opacity: .4; cursor: default; }

.scrubber { display: flex; align-items: center; gap: 10px; }
.time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 38px; text-align: center; }
.track {
  position: relative; flex: 1; height: 16px; display: flex; align-items: center;
}
.track::before {
  content: ""; position: absolute; left: 0; right: 0; height: 4px; border-radius: 3px;
  background: var(--panel-2);
}
.fill {
  position: absolute; left: 0; height: 4px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #efc766);
  width: 0%;
}
.markers { position: absolute; left: 0; right: 0; height: 16px; pointer-events: none; }
.marker {
  position: absolute; top: 50%; width: 2px; height: 9px; transform: translate(-1px,-50%);
  background: rgba(255,255,255,.35); border-radius: 2px; pointer-events: auto; cursor: pointer;
}
.marker.past { background: rgba(224,182,78,.9); }
.marker:hover { height: 14px; background: #fff; }
.seek {
  position: absolute; left: 0; right: 0; width: 100%; margin: 0;
  height: 16px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%; background: #fff;
  border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.seek::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2px solid var(--accent);
}

.right-controls { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 999px; padding: 6px 11px; font-size: 12px; cursor: pointer;
  transition: color .12s, border-color .12s;
}
.chip:hover { color: var(--text); }
.chip.on { color: var(--accent); border-color: #3a3421; }
.volume { display: flex; align-items: center; gap: 7px; }
.vol-icon { font-size: 13px; color: var(--text-dim); }
.volume input[type=range] { width: 78px; accent-color: var(--accent); }

/* Now-chapter strip */
.now-chapter {
  max-width: var(--maxw); margin: 0 auto;
  padding: 7px 20px; display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-dim); border-bottom: 1px solid var(--line);
}
.now-chapter .nc-idx { color: var(--accent); font-variant-numeric: tabular-nums; }
.now-chapter .nc-title { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Chapter panel */
.chapter-panel {
  position: absolute; bottom: 100%; right: 20px; width: min(420px, calc(100vw - 40px));
  max-height: 52vh; margin-bottom: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.9); overflow: hidden;
  display: flex; flex-direction: column;
}
.chapter-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 15px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600;
}
.chapter-list { overflow-y: auto; padding: 6px; }
.chapter-item {
  display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--text-dim);
}
.chapter-item:hover { background: var(--panel-2); color: var(--text); }
.chapter-item.active { background: #241f10; color: var(--text); }
.chapter-item.active .ci-idx { color: var(--accent); }
.ci-idx { font-size: 12px; text-align: center; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ci-title { font-size: 13px; line-height: 1.3; }
.ci-time { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .player-row { grid-template-columns: 1fr auto; grid-auto-rows: auto; height: auto; padding: 12px 16px; gap: 12px; }
  .controls { grid-column: 1 / -1; order: 3; }
  .right-controls { justify-content: flex-end; }
  :root { --player-h: 150px; }
  .site-header { padding-top: 24px; }
}
