:root {
  color-scheme: light;
  --ink: #1f2524;
  --muted: #66706d;
  --line: #d9ded7;
  --paper: #f8f6f0;
  --panel: #eef1e8;
  --accent: #b13f2d;
  --accent-ink: #fff8f0;
  --active: #fff1a8;
  --active-line: #c98a1d;
  --shadow: 0 22px 55px rgba(33, 38, 35, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(49, 84, 77, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(49, 84, 77, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  color: var(--ink);
  font-family: Avenir Next, Avenir, ui-sans-serif, system-ui, sans-serif;
}

button,
select,
audio {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.panel {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 20px;
  padding: 22px;
  background: rgba(238, 241, 232, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
}

.mark {
  width: 42px;
  height: 42px;
  border: 2px solid #31544d;
  border-radius: 50%;
  background:
    linear-gradient(135deg, transparent 44%, #31544d 45% 55%, transparent 56%),
    radial-gradient(circle at 70% 30%, var(--accent) 0 5px, transparent 6px);
}

.eyebrow,
.readerHeader p {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, Times, serif;
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  line-height: 1.08;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 6px;
}

audio {
  width: 100%;
}

.speed {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.speed button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fffdf7;
  cursor: pointer;
}

.speed button.active {
  border-color: #31544d;
  color: var(--accent-ink);
  background: #31544d;
}

.toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: #31544d;
}

.meter {
  height: 10px;
  overflow: hidden;
  background: #dfe5dc;
  border-radius: 999px;
}

#progressFill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #31544d, var(--accent));
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.stats div {
  padding: 10px;
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats dd {
  margin: 3px 0 0;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.timingNote {
  margin: -6px 0 0;
  padding: 9px 10px;
  color: #31544d;
  background: rgba(49, 84, 77, 0.1);
  border: 1px solid rgba(49, 84, 77, 0.18);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
}

.reader {
  min-width: 0;
  padding: clamp(22px, 5vw, 64px);
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid rgba(217, 222, 215, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.readerHeader {
  max-width: 980px;
  margin: 0 auto 30px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--line);
}

h2 {
  margin: 0;
  font-family: Georgia, Times, serif;
  font-size: clamp(2rem, 4vw, 4.3rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: 0;
}

.transcript {
  max-width: 980px;
  margin: 0 auto;
  font-family: Georgia, Times, serif;
  font-size: clamp(1.1rem, 1.45vw, 1.4rem);
  line-height: 1.75;
}

.transcript p {
  margin: 0 0 1.15rem;
}

.unit {
  display: inline;
  appearance: none;
  -webkit-appearance: none;
  padding: 2px 3px;
  border: 0;
  border-radius: 4px;
  color: inherit;
  background: transparent;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: pointer;
  font: inherit;
  line-height: inherit;
  text-align: left;
  transition: background 120ms ease, box-shadow 120ms ease;
  white-space: normal;
}

.unit:hover {
  background: rgba(177, 63, 45, 0.12);
}

.unit.active {
  background: var(--active);
  box-shadow: inset 0 -3px 0 var(--active-line);
}

.unit.past {
  color: #747b78;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .panel {
    position: static;
  }

  .reader {
    padding: 22px 16px;
  }

  .stats {
    grid-template-columns: 1fr;
  }
}
