@font-face {
  font-family: Atkinson Hyperlegible;
  src: url(/fonts/font-0.ttf) format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Atkinson Hyperlegible;
  src: url(/fonts/font-1.ttf) format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: IBM Plex Mono;
  src: url(/fonts/font-3.ttf) format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Instrument Serif;
  src: url(/fonts/instrument-serif.ttf) format('truetype');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f6f4eb;
  --paper: #fcfbf5;
  --white: #fffef8;
  --ink: #23332e;
  --muted: #52635b;
  --line: #d6dbcd;
  --green: #173a33;
  --green-mid: #286e61;
  --green-soft: #e5ede2;
  --green-light: #bde1cd;
  --red: #a7352f;
  --red-soft: #f9e8e1;
  --button-bg: #173a33;
  --button-text: #fffef8;
  --button-hover: #286e61;
  --preview-bg: #173a33;
  --preview-text: #fffef8;
  --preview-note: #cfdfd3;
  --outline: #960f42;
  --border-strong: #8ea29a;
  --border-accent: #668b80;
  --border-soft: #b9cbbd;
  --evidence-bg: #f7dea0;
  --evidence-text: #23332e;
  --mono: 'IBM Plex Mono', monospace;
  --heading: 'Instrument Serif', Georgia, serif;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #141b18;
  --paper: #1c2721;
  --white: #202c25;
  --ink: #edf3ec;
  --muted: #b2c2b6;
  --line: #394e43;
  --green: #cfebd9;
  --green-mid: #9fd5bc;
  --green-soft: #263c33;
  --green-light: #b9e1cc;
  --red: #ffa9a1;
  --red-soft: #482925;
  --button-bg: #bde0cb;
  --button-text: #14261e;
  --button-hover: #a2cfb4;
  --preview-bg: #254237;
  --preview-text: #f5faf5;
  --preview-note: #c3d5ca;
  --outline: #ffb1d0;
  --border-strong: #678477;
  --border-accent: #85ac99;
  --border-soft: #506f60;
  --evidence-bg: #efd98f;
  --evidence-text: #171b17;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0 clamp(18px, 4vw, 44px) 45px;
  background: var(--bg);
  color: var(--ink);
  font:
    17px/1.5 'Atkinson Hyperlegible',
    system-ui,
    sans-serif;
}
a {
  color: var(--green-mid);
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 2px solid var(--outline);
  outline-offset: 4px;
}
main {
  max-width: 1040px;
  margin: 0 auto;
  outline: none;
}
.site-header {
  max-width: 1040px;
  min-height: 75px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--green);
  text-decoration: none;
  font-weight: 700;
}
.theme-control {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}
.theme-control select {
  padding: 4px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
h1,
h2,
h3,
p,
figure,
dl,
dd {
  margin: 0;
}
h1 {
  font: 400 clamp(50px, 8vw, 95px)/0.92 var(--heading);
  letter-spacing: -0.025em;
  color: var(--green);
  margin: 8px 0 22px;
}
h2 {
  font-size: 24px;
  line-height: 1.2;
}
h3 {
  font-size: 21px;
  line-height: 1.25;
  margin: 5px 0 14px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 15px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.35;
}
button:hover {
  border-color: var(--green-mid);
  background: var(--green-soft);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button.primary {
  background: var(--button-bg);
  border-color: var(--button-bg);
  color: var(--button-text);
}
button.primary:hover {
  background: var(--button-hover);
  border-color: var(--button-hover);
}
button.secondary {
  color: var(--green);
  border-color: var(--border-strong);
}
button.small {
  padding: 6px 11px;
  font: 12px/1.4 var(--mono);
  border-radius: 20px;
}
button.active {
  background: var(--green-soft);
  border-color: var(--border-accent);
  color: var(--green);
}
.eyebrow,
.instruction {
  color: var(--green-mid);
  font: 11px/1.6 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.eyebrow {
  margin: 22px 0 12px;
}
.muted,
.audio-status,
.footer-note {
  color: var(--muted);
  font-size: 15px;
}
.footer-note {
  margin: 22px 0 0;
}
.audio-status {
  margin: 12px 0;
}
.booklet-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.85fr);
  align-items: center;
  gap: clamp(24px, 6vw, 78px);
  padding: 33px 0 35px;
}
.hero-copy .eyebrow {
  margin-top: 0;
}
.hero-description {
  max-width: 460px;
  color: var(--muted);
}
.overview {
  display: flex;
  flex-wrap: wrap;
  gap: 27px;
  margin: 23px 0 0;
}
.overview > div {
  min-width: 54px;
  padding-right: 25px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column-reverse;
}
.overview > div:last-child {
  border-right: 0;
  padding-right: 0;
}
.overview dt {
  font-size: 13px;
  color: var(--muted);
}
.overview dd {
  font: 500 21px/1.4 var(--mono);
  letter-spacing: -0.04em;
  color: var(--green);
}
.voice-preview {
  background: var(--preview-bg);
  color: var(--preview-text);
  border-radius: 15px;
  padding: clamp(20px, 4vw, 35px);
}
.voice-preview .eyebrow {
  color: var(--green-light);
  margin-top: 0;
}
.voice-preview > p {
  margin: 8px 0 0;
}
.voice-preview audio {
  display: block;
  width: 100%;
  height: 42px;
  margin: 20px 0 9px;
}
.voice-preview .voice-note {
  color: var(--preview-note);
  font-size: 13px;
}
.modes,
.drills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.mode,
.panel,
.group {
  padding: clamp(16px, 2.8vw, 26px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}
.mode.exam-card {
  background: var(--green-soft);
  border-color: var(--border-soft);
}
.mode > p {
  color: var(--muted);
}
.mode > button {
  margin-top: auto;
}
.exam-card > button {
  margin-top: auto;
}
.start-parts,
.controls,
.part-tabs,
.exam-nav,
.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.start-parts {
  padding: 2px 0;
}
.drill-section {
  margin: 25px 0 4px;
}
.drill-section h2 {
  margin-bottom: 11px;
}
.drill-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 14px 17px;
  border-radius: 10px;
}
.drill-card small {
  display: block;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
.drill-card > span:last-child {
  color: var(--green-mid);
  font-size: 20px;
}
.last-result {
  margin-top: 16px;
}

.player {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 21px;
  padding: 12px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.player-top,
.player-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.player-top {
  font-weight: 700;
}
.time {
  font: 13px/1.6 var(--mono);
  white-space: nowrap;
  color: var(--green);
}
progress {
  display: block;
  appearance: none;
  border: 0;
  height: 6px;
  width: 100%;
  margin: 7px 0 9px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
progress::-webkit-progress-bar {
  background: var(--line);
}
progress::-webkit-progress-value {
  background: var(--green-mid);
}
progress::-moz-progress-bar {
  background: var(--green-mid);
}
.controls {
  margin-bottom: 8px;
}
.controls .label {
  font-size: 13px;
  color: var(--muted);
  margin-left: 5px;
}
.controls #play-pause {
  min-width: 90px;
}
.volume {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.volume input {
  width: min(19vw, 105px);
  margin: 0;
  accent-color: var(--green-mid);
}
.exam-nav {
  gap: 13px;
  font-size: 14px;
}
.review-note {
  margin: 9px 0 0;
  padding: 8px 12px;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--border-soft);
  border-radius: 7px;
}
.error {
  color: var(--red);
  margin-top: 8px;
}
.part-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 11px;
  flex-wrap: wrap;
}
.range {
  color: var(--muted);
  font-size: 14px;
}
.badge {
  color: var(--green);
  background: var(--green-soft);
  border-radius: 20px;
  padding: 3px 8px;
  font: 12px/1.35 var(--mono);
}
.part-section {
  scroll-margin-top: 185px;
}
.group {
  margin-bottom: 14px;
}
.map-figure {
  margin: 10px 0 6px;
  max-width: 690px;
}
.map-figure a {
  display: block;
  border-radius: 10px;
}
.map-figure img {
  display: block;
  width: 100%;
  height: auto;
}
.map-figure figcaption {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px 8px;
}
@media (min-width: 800px) {
  .map-exercise {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(240px, 2fr);
    align-items: start;
    gap: 18px;
  }
  .map-exercise .map-figure {
    margin-top: 0;
  }
}
.question {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.question:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.answer-line,
.mcq-title,
.choice {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.answer-line {
  flex-wrap: wrap;
}
.q-number {
  font: 13px/1.6 var(--mono);
  color: var(--muted);
  min-width: 28px;
  flex: none;
}
.text-answer,
.question select {
  padding: 5px 9px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-bottom: 2px solid var(--green-mid);
  border-radius: 5px;
  min-height: 36px;
}
.text-answer {
  width: 220px;
  max-width: 100%;
}
.question select {
  min-width: 68px;
}
.text-answer:disabled,
.question select:disabled {
  opacity: 1;
  color: var(--ink);
}
.question.correct .text-answer,
.question.correct select {
  background: var(--green-soft);
}
.question.incorrect .text-answer,
.question.incorrect select {
  background: var(--red-soft);
  border-bottom-color: var(--red);
}
.choices {
  display: grid;
  gap: 3px;
  margin: 5px 0 0 36px;
}
.choice {
  cursor: pointer;
}
.choice input {
  accent-color: var(--green-mid);
  margin: 0;
}
.letter {
  font: 12px var(--mono);
  color: var(--muted);
  margin-right: 3px;
}
.choice.is-answer {
  color: var(--green-mid);
  font-weight: 700;
}
.options-box {
  margin: 6px 0;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
}
.option-row {
  display: flex;
  gap: 13px;
}
.option-row b {
  color: var(--green-mid);
  font: 13px/1.8 var(--mono);
}
.mark {
  font-size: 18px;
  font-weight: 700;
}
.correct .mark {
  color: var(--green-mid);
}
.incorrect .mark {
  color: var(--red);
}
.feedback {
  margin: 7px 0 0 36px;
  color: var(--muted);
  font-size: 15px;
}
.feedback strong {
  color: var(--green);
}
.check-panel,
.finish-row,
.button-row {
  margin: 15px 0;
}
.result-score {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
}
.result-score strong {
  color: var(--green);
  font: 58px/1.1 var(--heading);
}
.result-score span {
  color: var(--muted);
  font: 20px var(--mono);
}
.band {
  color: var(--green-mid);
  font: 500 27px/1.3 var(--mono);
}
.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}
.score-grid .stat {
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  color: var(--muted);
}
.stat strong {
  display: block;
  color: var(--green);
  font: 500 18px/1.5 var(--mono);
}
.summary-panel {
  margin: 18px 0;
}
.summary-panel .button-row {
  margin-bottom: 0;
}
.summary-panel textarea {
  display: block;
  width: 100%;
  min-height: 85px;
  resize: vertical;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  font-size: 15px;
}
details {
  margin: 14px 0;
}
summary {
  cursor: pointer;
  color: var(--green-mid);
  font-weight: 700;
}
details[open] > summary {
  margin-bottom: 10px;
}
.transcript {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
}
.transcript p {
  padding: 7px;
  font-size: 15px;
  border-radius: 6px;
}
.transcript p.is-speaking {
  background: var(--green-soft);
}
.transcript .speaker {
  color: var(--green);
  font-weight: 700;
}
.transcript .timestamp {
  border: 0;
  background: transparent;
  color: var(--green-mid);
  padding: 3px 4px;
  margin-right: 5px;
  font: 12px var(--mono);
  text-decoration: underline;
}
.transcript mark {
  padding: 1px;
  background: var(--evidence-bg);
  color: var(--evidence-text);
}
.band-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  max-width: 390px;
}
.band-table td,
.band-table th {
  padding: 5px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.loading {
  margin: 30px 0;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 15px;
  background: var(--preview-bg);
  color: var(--preview-text);
  border-radius: 8px;
  z-index: 50;
  width: max-content;
  max-width: calc(100% - 30px);
  display: none;
}
#toast.visible {
  display: block;
}
dialog {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 22px;
  width: min(470px, calc(100% - 30px));
}
dialog h2 {
  margin-bottom: 8px;
}
dialog .button-row {
  margin-bottom: 0;
}
dialog::backdrop {
  background: #0c211990;
}
.skip-link {
  position: absolute;
  top: -80px;
  padding: 8px;
  background: var(--white);
  z-index: 30;
}
.skip-link:focus {
  top: 0;
}
[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .site-header {
    min-height: 64px;
  }
  .booklet-intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 24px 0;
  }
  .hero-description {
    max-width: 350px;
  }
  .overview {
    margin-top: 15px;
  }
  .voice-preview audio {
    margin-top: 13px;
  }
  .modes,
  .drills {
    gap: 10px;
  }
  .player-options {
    flex-wrap: wrap;
  }
}
@media (max-width: 480px) {
  .modes,
  .drills {
    grid-template-columns: minmax(0, 1fr);
  }
  .player-top {
    font-size: 14px;
  }
  .time {
    font-size: 12px;
  }
  .part-tabs,
  .controls {
    gap: 4px;
  }
  .volume {
    margin-left: 0;
  }
  .overview {
    gap: 15px;
  }
  .overview > div {
    padding-right: 15px;
  }
  .map-figure {
    margin-left: -9px;
    margin-right: -9px;
  }
  .score-grid {
    gap: 5px;
  }
  .score-grid .stat {
    padding: 6px;
  }
}

.review-player {
  position: sticky;
  top: 8px;
  z-index: 10;
  margin-top: 8px;
}
