:root {
  --ink: #29392f;
  --muted: #68756b;
  --paper: #f7f5ee;
  --white: #fffefa;
  --green: #315c47;
  --moss: #dfe8d2;
  --line: #dce1d7;
  --gold: #b57638;
  --red: #9e513f;
  --serif: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

.af-body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.62 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

button { font: inherit; cursor: pointer; }

button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #ba813b;
  outline-offset: 3px;
}

.wrap { max-width: 1180px; padding: 0 28px; margin: auto; }

.top {
  height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand { font: 700 20px var(--serif); letter-spacing: -0.04em; }
.brand b { color: var(--gold); }
.top a { font-size: 13px; color: var(--muted); text-decoration: none; }
.top a:hover { color: var(--green); }

.hero {
  padding: 58px 0 40px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 35px;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 11px;
  font-weight: 800;
  color: var(--green);
}

h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

h1 { font-size: clamp(42px, 6vw, 72px); margin: 14px 0 17px; }
h1 em { font-weight: 400; color: var(--green); }

.lead { font-size: 18px; color: var(--muted); max-width: 600px; }

.hero-card {
  background: var(--moss);
  padding: 24px 26px;
  border-radius: 14px;
}

.hero-card .phrase {
  font: italic 30px var(--serif);
  color: var(--green);
  margin: 10px 0;
}

.hero-card p { color: #596a5d; font-size: 14px; }

.btn {
  border: 0;
  background: var(--green);
  color: white;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 700;
}

.btn.secondary {
  background: transparent;
  color: var(--green);
  border: 1px solid #b7c4b5;
}

.btn.small { padding: 7px 11px; font-size: 13px; }
.btn:disabled { opacity: 0.42; cursor: default; }

.btn.secondary.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

.pill {
  border: 1px solid var(--line);
  background: #ffffffa0;
  border-radius: 30px;
  padding: 5px 10px;
  font-size: 12px;
  color: #526354;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  padding: 14px 0 60px;
  align-items: start;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 23px;
}

.song-card { padding: 25px 28px; }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.bar h2 { font-size: 28px; margin: 4px 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.speak-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.voices { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; }

.af-body.af-following {
  padding-bottom: 55vh;
}

.af-body.af-following .voices {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--white);
  padding: 8px 0;
}

.verse { padding: 17px 0; border-bottom: 1px solid #eaebe4; }
.verse:last-of-type { border: 0; }

.verse-title {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 800;
  margin-bottom: 8px;
}

.line { line-height: 2.15; }

.word {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: italic 21px var(--serif);
  padding: 1px 2px;
  border-radius: 4px;
}

.word:hover,
.word.active {
  background: var(--moss);
  color: #1e5538;
}

.af-token { font: italic 21px var(--serif); }

.verse.refrain {
  background: #f5f5ed;
  border-radius: 8px;
  margin: 10px -10px;
  padding: 8px 10px;
}

.line.now {
  border-left: 3px solid var(--gold);
  padding-left: 10px;
}

.side {
  display: grid;
  gap: 15px;
  position: sticky;
  top: 15px;
}

.detail { min-height: 244px; }
.detail h3 { font-size: 30px; margin: 6px 0; }

.pos {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.pron {
  background: #f1f3ec;
  padding: 10px 12px;
  border-radius: 7px;
  margin: 12px 0;
  color: var(--green);
}

.detail p { font-size: 14px; color: var(--muted); margin: 8px 0; }
.tiny { font-size: 12px; color: var(--muted); }

.empty { color: var(--muted); font-size: 14px; margin-top: 20px; }

.meter {
  height: 6px;
  border-radius: 10px;
  background: #e7e8df;
  margin: 8px 0;
}

.meter i {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 10px;
  width: 0;
  transition: width 0.3s;
}

.meter-alt { margin-top: 10px; }
.meter-alt i { background: var(--gold); }

.score-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.score-head strong { font-size: 17px; color: var(--green); }

.mini-stat {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  column-gap: 2px;
  row-gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--green);
  font-weight: 750;
  border-color: var(--green);
}

.activity h3 { font-size: 23px; margin: 5px 0 10px; }
.activity p { font-size: 14px; color: var(--muted); }

.answers { display: grid; gap: 8px; margin: 14px 0; }

.answer {
  background: white;
  border: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  border-radius: 7px;
  color: var(--ink);
}

.answer:hover { border-color: var(--green); }

.feedback { min-height: 23px; font-weight: 700; font-size: 13px; }
.good { color: #286341; }
.bad { color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }

.chip {
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
  padding: 6px 9px;
  font-style: italic;
  color: var(--ink);
}

.chip.used { opacity: 0.32; cursor: default; }

.built {
  min-height: 40px;
  padding: 7px;
  background: #f4f3ec;
  border-radius: 6px;
  font: italic 16px var(--serif);
}

.hint { font-size: 12px !important; margin-top: 8px; color: var(--muted); }

.footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 34px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.footer a { color: var(--green); }

.toast {
  min-height: 20px;
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
}

.af-recall-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

.card-face {
  height: 112px;
  display: grid;
  grid-template-rows: 1fr 1.35em;
  align-items: center;
  justify-items: center;
  text-align: center;
  background: var(--moss);
  border-radius: 10px;
  padding: 12px 14px 10px;
  color: var(--green);
  cursor: pointer;
  border: 0;
  width: 100%;
  overflow: hidden;
}

.card-word {
  font: italic 26px/1.15 var(--serif);
  max-width: 100%;
  max-height: 2.3em;
  overflow: hidden;
}

.card-pron {
  font: 600 12px/1.35 system-ui, sans-serif;
  font-style: normal;
  max-width: 100%;
  height: 1.35em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-pron.is-blank { visibility: hidden; }

.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card-actions .btn { white-space: nowrap; padding: 7px 8px; }

.linkish {
  background: none;
  border: 0;
  padding: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
}

.af-stats { padding: 0 0 28px; }
.af-stats h2 { font-size: 28px; margin: 0 0 8px; }
.af-stats p { color: var(--muted); margin: 0 0 12px; }
.af-stats table { width: 100%; border-collapse: collapse; font-size: 13px; }
.af-stats th,
.af-stats td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: 1fr 1fr; }
  .detail { grid-row: span 2; }
}

@media (max-width: 650px) {
  .wrap { padding: 0 16px; }
  .top { height: 62px; }
  .top a { font-size: 11px; }
  .hero { grid-template-columns: 1fr; padding: 38px 0 24px; gap: 18px; }
  .main { padding-top: 8px; }
  .side { grid-template-columns: 1fr; }
  .detail { grid-row: auto; }
  .card, .song-card { padding: 18px; }
  .bar { align-items: flex-start; flex-direction: column; }
  .line { line-height: 2; }
  .word, .af-token { font-size: 19px; }
  .hero-card .phrase { font-size: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
