:root {
  --bg: #121212; --card: #1e1e1e; --row: #181818; --line: #2a2a2a;
  --text: #fff; --muted: #a7a7a7; --green: #1ed760; --green-ink: #000;
  --red: #f15e6c;
  --gutter: 16px;
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding: var(--st) calc(var(--gutter) + env(safe-area-inset-right, 0px)) calc(96px + var(--sb)) calc(var(--gutter) + env(safe-area-inset-left, 0px));
  max-width: 480px; margin: 0 auto;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
svg { width: 24px; height: 24px; fill: currentColor; }
.t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2 { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg { color: var(--muted); text-align: center; padding: 40px 0; }

.top h1 { font-size: 22px; margin: 0; padding: 16px 0 2px; }
a { color: inherit; text-decoration: none; }
.overall { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.sec { font-size: 18px; font-weight: 700; margin: 20px 0 10px; }
.pbar { display: block; height: 3px; background: #3e3e3e; border-radius: 2px; overflow: hidden; }
.pbar > span { display: block; height: 100%; background: var(--green); }

/* continue listening */
.cont { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 8px; padding: 8px 10px 8px 8px; }
.cont-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 64px; }
.cont .thumb { width: 64px; height: 64px; border-radius: 4px; background: #fff; padding: 5px; object-fit: contain; flex: none; }
.cont .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cont .cont-bar { margin-top: 6px; }
.play.small { width: 48px; height: 48px; }
.play.small svg { width: 24px; height: 24px; }

/* library grid */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 2px; background: var(--row); border-radius: 8px; padding: 10px 10px 12px; min-height: 44px; height: 100%; }
.card:active { background: #252525; }
.card-cover { position: relative; display: block; aspect-ratio: 1; background: #fff; border-radius: 6px; margin-bottom: 8px; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: contain; padding: 14%; }
.card-cover .soon { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.75); color: #fff; border-color: transparent; }
.card-title { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { display: block; }
.card-stat { color: var(--muted); font-size: 12px; margin: 4px 0 6px; margin-top: auto; padding-top: 4px; }
.soon-card .card-cover img { opacity: .4; filter: grayscale(1); }
.soon-card .card-title, .soon-card .card-sub { opacity: .6; }

/* chapter header */
.chapter { margin-bottom: 24px; }
.ch-head { position: relative; background: linear-gradient(180deg, #8a1b24 0%, var(--bg) 100%); margin: 0 calc(-1 * var(--gutter)); padding: 52px var(--gutter) 8px; }
.ch-back { position: absolute; top: 4px; left: 4px; }
.ch-back svg { width: 28px; height: 28px; }
.ch-cover { width: 168px; height: 168px; margin: 0 auto 16px; background: #fff; border-radius: 6px; padding: 14px; object-fit: contain; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.ch-kicker { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ch-title { font-size: 24px; font-weight: 800; margin: 2px 0 4px; }
.ch-meta { color: var(--muted); font-size: 13px; }
.ch-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 12px; }
.ch-progress { flex: 1; height: 4px; }
.play { width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: var(--green-ink); display: grid; place-items: center; flex: none; }
.play svg { width: 28px; height: 28px; }
.play:active { transform: scale(.96); }
.play[disabled] { opacity: .4; cursor: default; }

/* pill rows */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 0; width: 100%; text-align: left; }
.row[disabled] { opacity: .45; cursor: default; }
.row .thumb { width: 52px; height: 52px; border-radius: 4px; background: #fff; padding: 4px; object-fit: contain; flex: none; }
.row .info { flex: 1; min-width: 0; }
.row.current .t1 { color: var(--green); }
.row .side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--muted); font-size: 12px; min-width: 52px; }
.row .bar { width: 52px; height: 3px; background: #3e3e3e; border-radius: 2px; overflow: hidden; }
.row .bar span { display: block; height: 100%; background: var(--green); }
.row .done { color: var(--green); display: flex; align-items: center; gap: 2px; }
.row .done svg { width: 16px; height: 16px; }
.soon { font-size: 11px; border: 1px solid #555; border-radius: 10px; padding: 1px 7px; }

/* mini player */
.mini {
  position: fixed; left: 8px; right: 8px; bottom: calc(8px + var(--sb)); max-width: 464px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 8px 4px 10px 8px; background: #2d2d2d; border-radius: 8px;
  text-align: left; box-shadow: 0 4px 16px rgba(0,0,0,.5); z-index: 5;
}
.mini[hidden] { display: none; }
.mini img { width: 44px; height: 44px; border-radius: 4px; background: #fff; padding: 3px; object-fit: contain; flex: none; }
.mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-bar { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 2px; background: #555; border-radius: 1px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; width: 0; background: #fff; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: 50%; }
.icon-btn:active { background: rgba(255,255,255,.1); }

/* now playing */
.np {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #5c1219 0%, var(--bg) 60%);
  padding: calc(var(--st) + 4px) var(--gutter) calc(var(--sb) + 16px);
  animation: up .25s ease-out;
}
.np[hidden] { display: none; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.np-chapter { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-btn { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid #727272; font-size: 13px; font-weight: 600; }
.pill-btn[aria-pressed="true"] { background: var(--text); color: #000; border-color: var(--text); }
.np-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin: 8px 0 16px; }
.np-img { width: min(100%, 300px); aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
.np-titles .t1 { font-size: 20px; font-weight: 700; }
.np-titles .t2 { font-size: 15px; }
.np-foot { display: flex; justify-content: center; }

input[type=range] { width: 100%; margin: 14px 0 0; height: 28px; background: transparent; -webkit-appearance: none; appearance: none; --p: 0%; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, #fff var(--p), #4d4d4d var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: #4d4d4d; }
input[type=range]::-moz-range-progress { height: 4px; background: #fff; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 12px; }
.controls .icon-btn svg { width: 30px; height: 30px; }
.controls .play { width: 68px; height: 68px; }
.controls .play svg { width: 34px; height: 34px; }

/* transcript */
.transcript { list-style: none; margin: 0; padding: 0 2px; align-self: stretch; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.transcript[hidden] { display: none; }
.transcript li { background: rgba(255,255,255,.06); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.transcript .it { font-weight: 600; margin: 0 0 6px; }
.transcript .en { color: #d0d0d0; font-size: 14px; margin: 6px 0 0; }
.transcript .note { color: var(--muted); font-size: 13px; font-style: italic; margin: 0 0 6px; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .05em; padding: 2px 8px; border-radius: 4px; }
.badge.VERO { background: var(--green); color: #000; }
.badge.FALSO { background: var(--red); color: #000; }
.np.tx .np-img { display: none; }
