@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Fredoka:wght@400;500;600;700&family=Nunito+Sans:wght@500;700;900&display=swap");

:root {
  color-scheme: light;
  --ink: #24301f;
  --muted: #68695e;
  --cream: #fff8ea;
  --paper: #fffdf6;
  --green: #28583e;
  --red: #b53f36;
  --red-soft: #fff0ee;
  --gold: #f2c94c;
  --gold-soft: #fff7cf;
  --line: rgba(87, 65, 42, 0.18);
  --shadow: 0 18px 42px rgba(62, 45, 28, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(40, 88, 62, 0.12), transparent 38%),
    linear-gradient(35deg, rgba(181, 63, 54, 0.1), transparent 45%),
    var(--cream);
  color: var(--ink);
  font-family: "Fredoka", system-ui, sans-serif;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  padding: 10px 18px;
  font-family: "Nunito Sans", "Fredoka", system-ui, sans-serif;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  background: #1f4631;
}

button:focus-visible,
audio:focus-visible,
input:focus-visible + span,
.transcript-sentence:focus-visible {
  outline: 3px solid rgba(242, 201, 76, 0.78);
  outline-offset: 3px;
}

.secondary {
  border: 1px solid rgba(40, 88, 62, 0.26);
  background: transparent;
  color: var(--green);
}

.secondary:hover {
  background: rgba(40, 88, 62, 0.08);
}

.app {
  width: min(940px, calc(100% - 34px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  padding: 22px 0 26px;
}

.back-link {
  color: var(--green);
  font-family: "Nunito Sans", "Fredoka", system-ui, sans-serif;
  font-weight: 900;
  text-decoration: none;
}

.eyebrow,
.panel-label {
  margin: 18px 0 8px;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-label {
  margin-top: 0;
}

h1,
h2 {
  margin: 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  line-height: 1.04;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(28px, 5vw, 34px);
}

h2 {
  font-size: clamp(23px, 4vw, 30px);
}

.lede {
  max-width: 580px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 20px;
  font-weight: 600;
}

.listening-panel,
.quiz-panel,
.transcript-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.listening-panel {
  overflow: hidden;
}

.audio-card,
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
}

audio {
  width: min(360px, 100%);
}

.transcript-panel {
  margin: 0 22px 22px;
  padding: 20px;
  background: #fffaf0;
  box-shadow: none;
}

.transcript p {
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid rgba(87, 65, 42, 0.13);
}

.transcript p:first-child {
  border-top: 0;
}

.transcript-sentence {
  display: inline;
  min-height: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  padding: 1px 2px;
  font-family: inherit;
  font-weight: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(40, 88, 62, 0.28);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.transcript-sentence:hover,
.transcript-sentence.is-showing-translation {
  background: rgba(242, 201, 76, 0.22);
  color: var(--ink);
}

.translation {
  display: block;
  margin: 5px 0 3px;
  border-left: 3px solid rgba(40, 88, 62, 0.38);
  padding-left: 10px;
  color: var(--green);
  font-family: "Nunito Sans", "Fredoka", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 800;
}

.is-hidden {
  display: none;
}

.quiz-panel {
  margin-top: 22px;
  padding-bottom: 22px;
}

.score {
  min-width: 84px;
  margin: 0;
  border: 2px solid rgba(40, 88, 62, 0.18);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--green);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}

.questions {
  display: grid;
  gap: 14px;
  padding: 0 22px;
}

.question {
  position: relative;
  margin: 0;
  border: 1px solid rgba(87, 65, 42, 0.18);
  border-radius: 8px;
  background: #fffaf0;
  padding: 18px;
}

.question.is-wrong::after {
  content: "×";
  position: absolute;
  top: 12px;
  right: 16px;
  color: var(--red);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

.question.is-correct {
  border-color: rgba(40, 88, 62, 0.36);
}

.question.is-wrong,
.question.is-unanswered {
  border-color: rgba(181, 63, 54, 0.45);
}

legend {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 0;
  font-family: "Nunito Sans", "Fredoka", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 900;
}

.question-number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--gold-soft);
  color: #6f5211;
}

.answers {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.answer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid rgba(87, 65, 42, 0.16);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  cursor: pointer;
}

.answer input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--green);
}

.answer.is-answer {
  border-color: rgba(40, 88, 62, 0.48);
  background: rgba(40, 88, 62, 0.1);
  box-shadow: inset 4px 0 0 var(--green);
}

.answer.is-wrong-choice {
  border-color: rgba(181, 63, 54, 0.52);
  background: var(--red-soft);
  box-shadow: inset 4px 0 0 var(--red);
}

.result-line {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-family: "Nunito Sans", "Fredoka", system-ui, sans-serif;
  font-weight: 800;
}

.is-wrong .result-line,
.is-unanswered .result-line {
  color: var(--red);
}

.is-correct .result-line {
  color: var(--green);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 22px 0;
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 24px, 940px);
  }

  .audio-card,
  .quiz-head {
    align-items: stretch;
    flex-direction: column;
  }

  audio {
    width: 100%;
  }

  .score {
    align-self: flex-start;
  }
}
