:root {
  --paper: #f4efe6;
  --paper-strong: #fffdf8;
  --ink: #261f1b;
  --muted: #6b625c;
  --line: #d8cec1;
  --brand: #7a3225;
  --brand-dark: #572219;
  --gold: #bf8b3d;
  --shadow: 0 18px 50px rgb(43 31 24 / 12%);
  --shadow-soft: 0 10px 30px rgb(43 31 24 / 8%);
  --radius: 18px;
  --radius-small: 12px;
  --font-reading: Georgia, 'Times New Roman', serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    sans-serif;
  --motion-fast: 180ms;
  --motion-calm: 320ms;
  color-scheme: light;
}

[data-theme='dark'] {
  --paper: #12100f;
  --paper-strong: #1d1916;
  --ink: #f5eadb;
  --muted: #b9aa9a;
  --line: #3d332c;
  --brand: #d07a58;
  --brand-dark: #f0a16f;
  --gold: #d7a854;
  --shadow: 0 18px 50px rgb(0 0 0 / 28%);
  --shadow-soft: 0 10px 30px rgb(0 0 0 / 20%);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: radial-gradient(circle at 15% 10%, rgb(191 139 61 / 12%), transparent 28rem),
    repeating-linear-gradient(90deg, transparent 0 79px, rgb(72 49 36 / 2%) 80px), var(--paper);
  color: var(--ink);
  font-family: var(--font-reading);
  line-height: 1.55;
}

[data-theme='dark'] body {
  background: radial-gradient(circle at 12% 8%, rgb(208 122 88 / 16%), transparent 28rem),
    repeating-linear-gradient(90deg, transparent 0 79px, rgb(255 239 215 / 3%) 80px), var(--paper);
}

button,
input,
select {
  font: inherit;
}
button,
select,
label[for='import-bookmarks'] {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none !important;
  box-shadow: none !important;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: white;
}
.skip-link:focus {
  top: 1rem;
}

.site-header,
main,
footer {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-nav {
  position: sticky;
  top: 0.75rem;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  width: min(720px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-strong) 90%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}
.app-nav a {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.app-nav a:hover,
.app-nav a:focus-visible {
  background: rgb(122 50 37 / 9%);
  color: var(--brand);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.icon-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-strong);
  color: var(--ink);
  box-shadow: 0 8px 20px rgb(43 31 24 / 8%);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.icon-toggle:hover {
  transform: translateY(-2px) rotate(-8deg);
  border-color: var(--brand);
}
.icon-toggle span {
  display: inline-block;
  line-height: 1;
}

.brand {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}
.brand::after {
  content: '◆';
  margin-left: 0.7rem;
  color: var(--gold);
  font-size: 0.65rem;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr;
  align-items: center;
  gap: clamp(2rem, 8vw, 7rem);
  min-height: 620px;
  padding: 4rem 3rem;
  overflow: hidden;
  border-radius: 28px;
  background: radial-gradient(circle at 78% 20%, rgb(191 139 61 / 20%), transparent 28%),
    linear-gradient(145deg, #17100d, #382720 55%, #1d1512);
  color: #fffaf2;
  box-shadow: var(--shadow);
}
.hero::before {
  content: '1899';
  position: absolute;
  right: -0.04em;
  bottom: -0.24em;
  color: rgb(255 255 255 / 3%);
  font-size: clamp(10rem, 28vw, 24rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 1rem;
  border: 1px solid rgb(191 139 61 / 30%);
  border-radius: 20px;
  pointer-events: none;
}
.hero-copy,
.cover-wrap {
  min-width: 0;
  z-index: 1;
}

.cover-wrap {
  position: relative;
}
.cover-wrap::before {
  content: '';
  position: absolute;
  inset: 8% -9% -5% 9%;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 6px;
}

#cover {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 13;
  object-fit: cover;
  border-radius: 5px;
  box-shadow: 0 28px 60px rgb(0 0 0 / 40%);
  animation: coverFloat 7s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--gold);
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.status-pill {
  display: inline-flex;
  margin: 0 0 0.9rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgb(191 139 61 / 42%);
  border-radius: 999px;
  background: rgb(255 250 242 / 10%);
  color: #f4d7aa;
  font-family: system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}
h1 {
  max-width: 11ch;
  margin-bottom: 0.4rem;
  font-size: clamp(4rem, 7vw, 5.5rem);
  line-height: 0.9;
  text-shadow: 0 8px 40px rgb(0 0 0 / 35%);
}
h2 {
  margin-bottom: 0;
  font-size: 2.15rem;
  line-height: 1.1;
}
.author {
  color: #d9c9b6;
  font-size: 1.2rem;
  font-style: italic;
}
.summary {
  max-width: 56ch;
  color: #e9dfd2;
  font-size: 1.08rem;
}
.signature {
  margin-top: 1.8rem;
  color: #d9c9b6;
  font-size: 0.88rem;
}
.signature strong {
  color: white;
}
.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}
.feature-list span {
  padding: 0.45rem 0.75rem;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 999px;
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.25rem;
}
.hero .button-secondary {
  border-color: rgb(255 255 255 / 28%);
  color: #fffaf2;
}
.text-button {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--brand);
  padding: 0.2rem 0;
  font-family: system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 750;
}
.hero .text-button {
  color: #f4d7aa;
}

.about-app,
.player-card,
.panel {
  margin-top: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-strong);
  box-shadow: 0 8px 30px rgb(43 31 24 / 6%);
}
.player-card {
  position: relative;
  overflow: hidden;
  scroll-margin-top: 5.5rem;
}
.player-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--gold), var(--brand));
  background-size: 200% 100%;
  animation: gildedLine 5s linear infinite;
}
.about-app {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(320px, 1.3fr);
  gap: clamp(1.25rem, 4vw, 2.5rem);
  align-items: start;
  background: linear-gradient(135deg, rgb(122 50 37 / 7%), transparent 45%), var(--paper-strong);
}
.about-app h2 {
  max-width: 14ch;
}
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.about-grid article {
  min-height: 100%;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 48%);
  transition: transform var(--motion-calm) ease, box-shadow var(--motion-calm) ease;
}
.about-grid article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
}
[data-theme='dark'] .about-grid article {
  background: rgb(255 255 255 / 4%);
}
.about-grid h3 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}
.about-grid p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
}
.demo-label {
  position: relative;
  z-index: 1;
  width: fit-content;
  margin: 0 0 1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgb(191 139 61 / 45%);
  border-radius: 999px;
  background: #fff8ed;
  color: var(--brand);
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 750;
}
[data-theme='dark'] .demo-label {
  background: rgb(208 122 88 / 10%);
  color: #ffd8bd;
}

.now-playing,
.section-heading,
.time-row,
.player-options,
.bookmark-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-dashboard {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 0.25rem;
}
.section-dashboard div {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgb(191 139 61 / 10%), transparent 60%),
    rgb(255 255 255 / 35%);
}
[data-theme='dark'] .section-dashboard div {
  background: rgb(255 255 255 / 4%);
}
.metric-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-dashboard strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
}

.status,
.completion {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
}
.playback-meta {
  text-align: right;
}
.listening-time {
  margin: 0.25rem 0 0;
  color: var(--brand);
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
}
.sound-visual {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 1rem 0 -0.5rem;
  opacity: 0.25;
  transition: opacity 180ms ease;
}
.sound-visual.active {
  opacity: 1;
}
.sound-visual span {
  width: 3px;
  height: 10px;
  border-radius: 9px;
  background: linear-gradient(var(--gold), var(--brand));
  transform-origin: center;
}
.sound-visual.active span {
  animation: soundBar 900ms ease-in-out infinite alternate;
}
.sound-visual span:nth-child(2n) {
  animation-delay: -300ms;
}
.sound-visual span:nth-child(3n) {
  animation-delay: -600ms;
}
.progress-group {
  margin: 2rem 0 1.2rem;
}
.progress {
  width: 100%;
  accent-color: var(--brand);
}
.time-row {
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 3vw, 1.5rem);
}
.icon-button,
.play-button {
  min-width: 46px;
  min-height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 35%);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgb(38 31 27 / 8%);
}
[data-theme='dark'] .icon-button,
[data-theme='dark'] .play-button {
  background: rgb(255 255 255 / 6%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 10%);
}
.play-button {
  width: 68px;
  height: 68px;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: white;
  font-size: 1.4rem;
  position: relative;
  box-shadow: 0 12px 30px rgb(122 50 37 / 24%), 0 0 0 0 rgb(122 50 37 / 35%);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.play-button:hover {
  transform: scale(1.08);
  box-shadow: 0 16px 35px rgb(122 50 37 / 26%), 0 0 0 12px rgb(122 50 37 / 10%);
}
.play-button:active,
.icon-button:active,
.button:active {
  transform: translateY(1px) scale(0.98);
}
.icon-button {
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.icon-button:hover {
  background: #eee3d4;
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 1px rgb(122 50 37 / 16%), 0 8px 18px rgb(43 31 24 / 8%);
}
[data-theme='dark'] .icon-button:hover {
  background: rgb(255 255 255 / 8%);
}
.player-options {
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
}
.player-more {
  margin-top: 1.25rem;
  font-family: var(--font-ui);
}
.player-more summary {
  width: fit-content;
  margin-inline: auto;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 750;
}
.player-more[open] summary {
  color: var(--brand);
}
select,
input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0.55rem 0.7rem;
}
[data-theme='dark'] select,
[data-theme='dark'] input {
  background: #171310;
}
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.volume-control input {
  width: 110px;
  min-height: auto;
  padding: 0;
  accent-color: var(--brand);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  text-decoration: none;
}
.button {
  position: relative;
  overflow: hidden;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgb(255 255 255 / 30%) 50%, transparent 80%);
  transform: translateX(-130%);
  transition: transform 450ms ease;
}
.button:disabled::after {
  display: none;
}
.button:not(:disabled):hover::after {
  transform: translateX(130%);
}
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgb(43 31 24 / 10%);
}
.button-primary {
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: white;
  box-shadow: 0 10px 22px rgb(122 50 37 / 16%);
}
.button-secondary {
  border-color: var(--line);
  background: rgb(255 255 255 / 28%);
  color: var(--ink);
}
[data-theme='dark'] .button-secondary {
  background: rgb(255 255 255 / 4%);
}
.button:hover {
  border-color: var(--brand);
}
.button[aria-pressed='true'],
.icon-toggle[aria-pressed='true'] {
  border-color: var(--brand);
  background: rgb(122 50 37 / 10%);
  color: var(--brand-dark);
}
[data-theme='dark'] .button[aria-pressed='true'],
[data-theme='dark'] .icon-toggle[aria-pressed='true'] {
  background: rgb(208 122 88 / 14%);
  color: #ffd8bd;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
  gap: 1.5rem;
}
.import-panel {
  grid-column: 1 / -1;
  scroll-margin-top: 5.5rem;
}
.library-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: end;
  margin-top: 1.5rem;
  font-family: system-ui, sans-serif;
}
.library-form label {
  align-self: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.library-form input[type='file'] {
  min-width: 0;
  background: #faf7f1;
}
[data-theme='dark'] .library-form input[type='file'] {
  background: #171310;
}
.privacy-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.panel-intro {
  max-width: 70ch;
  margin: 1rem 0 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
}
.transcript-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid rgb(191 139 61 / 45%);
  border-radius: 12px;
  background: rgb(191 139 61 / 9%);
  font-family: system-ui, sans-serif;
}
.transcript-notice p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.import-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin: 1rem 0 0;
  padding: 0;
  color: var(--muted);
  list-style: none;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
}
.import-steps strong {
  color: var(--brand);
}
.field-help {
  grid-column: 1 / -1;
  margin: -0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.import-preview {
  grid-column: 1 / -1;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 32%);
}
[data-theme='dark'] .import-preview {
  background: rgb(255 255 255 / 3%);
}
.import-preview p {
  margin-bottom: 0.65rem;
  font-weight: 750;
}
.import-preview ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.import-preview li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}
.import-preview li span {
  color: var(--muted);
  text-align: right;
}
.import-preview .match-success {
  color: #397347;
}
[data-theme='dark'] .import-preview .match-success {
  color: #8bd39b;
}
.import-preview .match-warning {
  color: var(--brand);
}
.local-library {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.local-library h3 {
  margin: 0;
  font-size: 1.5rem;
}
.storage-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.storage-summary > div {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgb(191 139 61 / 6%);
}
.storage-summary strong {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
.local-book-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 1rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.local-book-item {
  position: relative;
  display: grid;
  min-height: 190px;
  align-content: space-between;
  gap: 1rem;
  overflow: hidden;
  padding: 1.15rem 1.15rem 1.15rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgb(191 139 61 / 10%), transparent 45%), var(--paper-strong);
  box-shadow: var(--shadow-soft);
  transition: transform var(--motion-calm) ease, box-shadow var(--motion-calm) ease;
}
.local-book-item::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(var(--gold), var(--brand));
}
.local-book-item:hover {
  transform: translateY(-5px) rotate(-0.25deg);
  box-shadow: var(--shadow);
}
.local-book-item > div:first-child {
  display: grid;
  gap: 0.4rem;
}
.local-book-item strong {
  font-size: 1.2rem;
}
.local-book-item span,
.local-book-item small {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
}
.local-book-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.book-progress {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.book-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}
.local-library-empty {
  grid-column: 1 / -1;
  padding: 1.25rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-small);
  font-family: var(--font-ui);
}
.chapter-list,
.bookmark-list {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.chapter-item {
  border-top: 1px solid var(--line);
}
.chapter-button {
  width: 100%;
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  gap: 0.8rem;
  align-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 1rem 0.55rem;
  text-align: left;
  transition: background 180ms ease, transform 180ms ease, color 180ms ease;
}
.chapter-button:hover,
.chapter-button[aria-current='true'] {
  background: rgb(122 50 37 / 7%);
  color: var(--brand);
  transform: translateX(3px);
}
[data-theme='dark'] .chapter-button:hover,
[data-theme='dark'] .chapter-button[aria-current='true'] {
  background: rgb(208 122 88 / 12%);
}
.chapter-number,
.chapter-progress {
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}
.chapter-unavailable {
  color: var(--muted);
  font-style: italic;
}
.section-card-copy {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}
.section-title {
  font-weight: 700;
}
.section-card-meta {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.76rem;
}

.transcript-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}
.transcript-panel {
  scroll-margin-top: 5.5rem;
}
.transcript-panel .section-heading {
  align-items: flex-start;
  flex-direction: column;
}
.transcript-tools {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.transcript-tools .transcript-search {
  margin-left: auto;
}
.reading-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / 26%);
}
.reading-controls button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.3rem 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 750;
}
.reading-controls button:hover,
.reading-controls button[aria-pressed='true'] {
  background: rgb(122 50 37 / 10%);
  color: var(--brand);
}
.transcript-search input {
  width: min(220px, 48vw);
}
.transcript {
  --transcript-scale: 1;
  max-height: 520px;
  margin-top: 1.5rem;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-right: 0.25rem;
  font-size: calc(1rem * var(--transcript-scale));
  line-height: 1.75;
}
.cue {
  width: 100%;
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.8rem;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 1rem 0.7rem;
  text-align: left;
}
.cue:hover,
.cue.active {
  background: #f4eadb;
}
[data-theme='dark'] .cue:hover,
[data-theme='dark'] .cue.active {
  background: rgb(208 122 88 / 13%);
}
.cue.active {
  box-shadow: inset 3px 0 0 var(--gold);
}
.cue-untimed {
  display: block;
  margin: 0;
  line-height: 1.75;
  cursor: default;
}
.cue-untimed:hover {
  background: transparent;
}
.cue-time {
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}
.empty {
  padding: 2rem 0;
  color: var(--muted);
}

.bookmark-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1.5rem;
  font-family: system-ui, sans-serif;
}
.bookmark-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.bookmark-jump {
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.bookmark-meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}
.remove {
  border: 0;
  background: transparent;
  color: var(--brand);
}
.bookmark-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.bookmarks-panel {
  scroll-margin-top: 5.5rem;
}

.mini-player[hidden] {
  display: none;
}
.mini-player {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 12;
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto auto auto;
  width: min(680px, calc(100% - 2rem));
  min-height: 72px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper-strong) 92%, transparent);
  box-shadow: 0 18px 55px rgb(38 23 17 / 22%);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
  animation: miniPlayerIn 300ms ease both;
}
.mini-cover {
  width: 42px;
  height: 54px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: var(--line);
  box-shadow: 0 8px 18px rgb(38 23 17 / 20%);
}
.mini-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mini-cover.local {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  color: white;
}
.mini-cover.local::after {
  content: '♪';
  font-size: 1.15rem;
}
.mini-copy {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}
.mini-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-copy > span {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.72rem;
}
.mini-progress {
  display: block;
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.mini-progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}
.mini-action,
.mini-play {
  display: grid;
  min-width: 40px;
  min-height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
}
.mini-play {
  background: var(--brand);
  color: white;
}

footer {
  padding: 3rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
footer p {
  margin-bottom: 0.25rem;
}
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: min(390px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}
[data-theme='dark'] .toast {
  background: #f5eadb;
  color: #18110e;
}
.reset-panel {
  max-width: 760px;
  margin: 10vh auto;
  padding: 2rem;
}

.help-dialog {
  width: min(620px, calc(100% - 2rem));
  border: 0;
  border-radius: 16px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}
.help-dialog::backdrop {
  background: rgb(18 14 11 / 62%);
  backdrop-filter: blur(3px);
}
.help-panel {
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgb(191 139 61 / 9%), transparent 50%), var(--paper-strong);
  box-shadow: 0 24px 80px rgb(0 0 0 / 28%);
}
.help-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.help-heading h2 {
  font-size: 1.8rem;
}
.help-steps {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.help-steps li {
  display: grid;
  gap: 0.25rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 255 255 / 42%);
}
[data-theme='dark'] .help-steps li {
  background: rgb(255 255 255 / 4%);
}
.help-steps strong {
  color: var(--brand-dark);
}
[data-theme='dark'] .help-steps strong {
  color: #ffd8bd;
}
.help-steps span,
.help-privacy {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
}
.welcome-dialog {
  width: min(760px, calc(100% - 2rem));
}
.welcome-panel > h2 {
  max-width: 20ch;
  margin-bottom: 1.5rem;
  font-size: clamp(2rem, 5vw, 3rem);
}
.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.welcome-steps article {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.welcome-steps article > span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-family: system-ui, sans-serif;
  font-weight: 800;
}
.welcome-steps h3 {
  margin: 0.75rem 0 0.25rem;
}
.welcome-steps p,
.welcome-note,
.guide-grid p,
.guide-footnote {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}
.welcome-note {
  margin: 1rem 0;
  padding: 0.9rem;
  border-left: 3px solid var(--gold);
  background: rgb(191 139 61 / 8%);
}
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.transcript-guide {
  width: min(900px, calc(100% - 2rem));
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.guide-grid section {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.guide-grid h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.guide-grid p {
  margin: 0;
}
.guide-grid pre {
  margin: 0.6rem 0 0;
  padding: 0.7rem;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}
.guide-footnote {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.help-privacy {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.focus-mode .site-header,
.focus-mode .hero,
.focus-mode .about-app,
.focus-mode .import-panel,
.focus-mode footer {
  display: none;
}
.focus-mode main {
  padding-top: 1.25rem;
}
.focus-mode .player-card {
  margin-top: 0;
}
.focus-mode .content-grid {
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
}
.focus-mode .bookmarks-panel {
  display: none;
}

@media (max-width: 1024px) {
  .hero {
    grid-template-columns: minmax(190px, 280px) 1fr;
    gap: clamp(1.5rem, 5vw, 3.5rem);
    min-height: 560px;
    padding: 3rem 2rem;
  }
  h1 {
    font-size: clamp(3.8rem, 8vw, 5.4rem);
  }
  .section-dashboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 5.5rem;
  }
  main,
  .site-header,
  footer {
    width: min(100% - 1rem, 1120px);
  }
  .app-nav {
    position: fixed;
    inset: auto 0.5rem 0.5rem;
    z-index: 14;
    width: auto;
    margin: 0;
    border-radius: 18px;
  }
  .app-nav a {
    min-width: 0;
    flex-direction: column;
    gap: 0;
    font-size: 0.65rem;
  }
  .app-nav a span {
    font-size: 0.9rem;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 1rem;
    min-height: auto;
    padding: 1.35rem 1.4rem 1.75rem;
  }
  .cover-wrap {
    width: min(44vw, 176px);
    margin-inline: auto;
  }
  h1 {
    max-width: none;
    font-size: 3.1rem;
    line-height: 0.96;
  }
  h2 {
    font-size: 1.75rem;
  }
  .author {
    margin-bottom: 0.8rem;
    font-size: 1.02rem;
  }
  .summary {
    font-size: 0.98rem;
  }
  .signature {
    margin-top: 1rem;
  }
  .feature-list {
    margin-top: 1rem;
  }
  .hero-actions .button {
    flex: 1 1 10rem;
  }
  .about-app {
    grid-template-columns: 1fr;
  }
  .about-app h2 {
    max-width: none;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .content-grid {
    grid-template-columns: 1fr;
  }
  .library-form {
    grid-template-columns: 1fr;
  }
  .transcript-notice {
    align-items: flex-start;
    flex-direction: column;
  }
  .import-preview li {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }
  .import-preview li span {
    text-align: left;
  }
  .welcome-steps,
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .now-playing,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .bookmark-form {
    grid-template-columns: 1fr;
  }
  .player-options {
    align-items: stretch;
    flex-direction: column;
  }
  .player-more summary {
    margin-inline: 0;
  }
  .section-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .storage-summary {
    grid-template-columns: 1fr;
  }
  .local-book-list {
    grid-template-columns: 1fr;
  }
  .transcript-tools {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }
  .transcript-tools .transcript-search {
    margin-left: 0;
  }
  .reading-controls {
    width: fit-content;
  }
  .transcript {
    max-height: min(62vh, 620px);
  }
  .transcript-search {
    width: 100%;
  }
  .transcript-search input {
    flex: 1;
    width: auto;
  }
  .chapter-button {
    grid-template-columns: 2.2rem 1fr;
  }
  .chapter-progress {
    grid-column: 2;
  }
  .focus-mode .content-grid {
    grid-template-columns: 1fr;
  }
  .mini-player {
    bottom: 5rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    width: calc(100% - 1rem);
    min-height: 66px;
    gap: 0.55rem;
    border-radius: 16px;
  }
  .mini-action {
    display: none;
  }
  .mini-play {
    min-width: 44px;
    min-height: 44px;
  }
  .toast {
    bottom: 9.5rem;
  }
}

@media (max-width: 420px) {
  .site-header {
    gap: 0.75rem;
  }
  .header-actions {
    gap: 0.55rem;
  }
  .hero {
    padding-inline: 1rem;
  }
  .cover-wrap {
    width: min(46vw, 170px);
  }
  h1 {
    font-size: clamp(2.6rem, 14vw, 3.25rem);
  }
  .button {
    padding-inline: 0.75rem;
  }
  .help-heading h2 {
    font-size: 1.55rem;
  }
  .section-dashboard {
    gap: 0.5rem;
  }
  .section-dashboard div {
    padding: 0.7rem;
  }
  .player-controls {
    gap: 0.35rem;
  }
  .icon-button {
    min-width: 42px;
    min-height: 42px;
  }
}

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

@keyframes coverFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-12px) rotate(1deg);
  }
}
@keyframes gildedLine {
  to {
    background-position: 200% 0;
  }
}
@keyframes soundBar {
  from {
    transform: scaleY(0.6);
  }
  to {
    transform: scaleY(3.2);
  }
}
@keyframes miniPlayerIn {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}
