:root {
  color-scheme: light;
  --bg: #0d1320;
  --paper: #ffffff;
  --ink: #111111;
  --muted: #52606d;
  --line: rgba(0, 0, 0, 0.14);
  --blue: #4f63dc;
  --blue-dark: #3345aa;
  --green: #2b8a3e;
  --amber: #f59e0b;
  --wrong: #c92a2a;
  --right-bg: #eaf7ee;
  --wrong-bg: #ffecec;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(1000px 500px at 28% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
    linear-gradient(180deg, #0d1320, #111827);
  color: #e5e7eb;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.menu-screen {
  min-height: calc(100vh - 36px);
  display: block;
  margin: -18px;
  padding: 16px clamp(14px, 4vw, 44px) 34px;
  background: #0f1117;
}

.menu-top {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.menu-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.menu-title-row h1 {
  color: #f5f7fb;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 1.1;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cfd5e1;
  font-weight: 800;
}

.search-box {
  width: min(100%, 520px);
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #171923;
  color: #f5f7fb;
  padding: 0 14px;
  outline: none;
}

.search-box::placeholder {
  color: #8d95a5;
}

.level-list {
  display: grid;
  gap: 42px;
  padding-top: 30px;
}

.level-section {
  display: grid;
  gap: 20px;
}

.level-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}

.level-heading h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
}

.level-heading span {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #dce2ee;
  font-size: 0.82rem;
  font-weight: 800;
}

.level-easy .level-heading {
  border-color: #4ade80;
}

.level-intermediate .level-heading {
  border-color: #fbbf24;
}

.level-difficult .level-heading {
  border-color: #fb7185;
}

.vinyl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: clamp(28px, 4vw, 48px);
}

.vinyl-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #f5f7fb;
  cursor: pointer;
  text-align: center;
}

.record-cover {
  position: relative;
  display: block;
  width: min(100%, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 8px;
  background:
    repeating-radial-gradient(circle, #161922 0 5px, #222633 6px 8px),
    #111;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.44);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.record-cover img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid rgba(255, 255, 255, 0.12);
}

.record-centre {
  position: absolute;
  inset: 50%;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border: 9px solid rgba(15, 17, 23, 0.88);
  border-radius: 50%;
  background: #f7f0d9;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.record-centre::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #0f1117;
}

.vinyl-card:hover .record-cover {
  transform: translateY(-5px) rotate(-2deg);
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.55);
}

.vinyl-title {
  width: 100%;
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1.2;
}

.vinyl-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cfd5e1;
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-menu {
  margin: 0;
  color: #cfd5e1;
  font-weight: 800;
}

.activity-screen {
  height: calc(100vh - 36px);
  width: min(100%, 1260px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(260px, 34vh) minmax(0, 1fr);
  gap: 12px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #f5f7fb;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.menu-back-button {
  width: fit-content;
}

[hidden] {
  display: none !important;
}

.listening-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.topic-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px clamp(14px, 3vw, 24px);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.topic-tab {
  border: 2px solid rgba(0, 0, 0, 0.14);
  background: #f8f8f8;
  color: var(--ink);
  min-height: 44px;
  padding: 0 16px;
  border-radius: 16px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.topic-tab[aria-selected="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.media-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 40%) 1fr;
  gap: clamp(16px, 2.4vw, 28px);
  padding: clamp(16px, 2.2vw, 24px);
  align-items: stretch;
  background: #ffffff;
}

.topic-visual {
  margin: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topic-visual img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  display: block;
}

.player-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 13px;
}

.eyebrow {
  margin: 0;
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: "Comic Sans MS", "Comic Sans", Arial, sans-serif;
  font-size: clamp(2rem, 4.2vw, 3.7rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.prompt {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

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

.speed-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 720px);
}

.speed-button {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 70px;
  padding: 6px 10px 7px;
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-radius: 14px;
  background: #f8f8f8;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.speed-icon {
  font-size: 2rem;
  line-height: 1.1;
}

.speed-label {
  font-size: 0.78rem;
  line-height: 1;
}

.speed-button:hover {
  background: #fff;
  transform: translateY(-1px);
}

.speed-button.is-active {
  border-color: var(--blue);
  background: #eef2ff;
  color: var(--blue-dark);
  box-shadow: 0 0 0 2px rgba(79, 99, 220, 0.14);
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button {
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-radius: 16px;
  min-height: 48px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10);
}

.primary-button {
  background: linear-gradient(180deg, #6d7cff, var(--blue));
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.secondary-button {
  background: #f8f8f8;
  color: var(--ink);
}

.primary-button:hover,
.secondary-button:hover,
.topic-tab:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.14);
}

.transcript {
  max-height: 135px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
  padding: 12px 14px;
  border-left: 4px solid var(--amber);
  background: #fff7e8;
  border-radius: 12px;
}

.questions-panel {
  min-height: 0;
  overflow: auto;
  padding: clamp(16px, 2.2vw, 24px);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.questions-panel.is-entering {
  animation: questions-enter 450ms ease-out both;
}

@keyframes questions-enter {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .questions-panel.is-entering {
    animation: none;
  }
}

.question-header > div {
  width: 100%;
}

.easy-listening {
  height: auto;
  min-height: calc(100vh - 36px);
  grid-template-rows: auto auto minmax(0, 1fr);
}

.easy-listening .topic-visual {
  max-height: 340px;
}

.easy-listening.waiting-for-audio {
  min-height: 0;
  grid-template-rows: auto auto;
}

.easy-listening .speed-controls {
  display: flex;
  flex-wrap: wrap;
}

.easy-listening .speed-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 14px;
  box-shadow: none;
}

.easy-listening .speed-icon {
  font-size: 1.5rem;
}

.easy-listening .speed-label {
  font-size: 0.9rem;
}

.activity-progress {
  width: 100%;
  height: 18px;
  overflow: hidden;
  border: 2px solid rgba(79, 99, 220, 0.35);
  border-radius: 999px;
  background: #eef2ff;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.activity-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #7667ee);
  transition: width 0.3s ease;
}

.score-banner {
  display: none;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #eef2ff;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
}

.score-banner.is-visible {
  display: block;
}

.question-list {
  display: grid;
  gap: 14px;
}

.activity-card,
.question-card {
  border: 2px solid rgba(0, 0, 0, 0.14);
  border-radius: 18px;
  padding: clamp(14px, 1.8vw, 20px);
  background: #fff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.08);
}

.activity-card.is-correct,
.question-card.is-correct {
  background: var(--right-bg);
  border-color: #8cc9ad;
}

.activity-card.is-wrong,
.question-card.is-wrong {
  background: var(--wrong-bg);
  border-color: #e09a9f;
}

.question-text {
  margin: 0 0 12px;
  font-family: "Comic Sans MS", "Comic Sans", Arial, sans-serif;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 900;
  line-height: 1.35;
}

.instruction-text {
  margin: 0 0 14px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  font-weight: 800;
  line-height: 1.35;
}

.option-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 12px;
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-radius: 16px;
  background: #f8f8f8;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  transition: transform 0.06s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.option:hover {
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.option:active {
  transform: translateY(1px);
}

.option:has(input:checked) {
  border-color: var(--blue);
  background: #eef2ff;
}

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-button:disabled,
.word-chip:disabled {
  cursor: default;
}

.choice-button.correct,
.word-chip.correct,
.drop-zone.correct {
  border-color: rgba(43, 138, 62, 0.55);
  background: #eaf7ee;
}

.choice-button.wrong,
.drop-zone.wrong {
  border-color: rgba(201, 42, 42, 0.55);
  background: #ffecec;
}

.dialogue-gap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 14px;
  padding: 14px;
  border-radius: 18px;
  background: #f8f8f8;
  font-family: "Comic Sans MS", "Comic Sans", Arial, sans-serif;
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.drop-zone {
  min-width: 150px;
  min-height: 54px;
  border: 3px dashed rgba(79, 99, 220, 0.55);
  border-radius: 16px;
  background: #eef2ff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.drop-zone.filled {
  border-style: solid;
  background: #fff;
}

.word-bank {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.word-chip {
  min-height: 54px;
  padding: 12px;
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-radius: 16px;
  background: #f8f8f8;
  color: var(--ink);
  cursor: grab;
  font-size: 1.08rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.answer-with-speaker {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

.answer-with-speaker > .choice-button,
.answer-with-speaker > .word-chip {
  flex: 1;
  min-width: 0;
}

.speaker-button {
  flex: 0 0 44px;
  align-self: center;
  width: 44px;
  height: 44px;
  padding: 4px;
  border: 2px solid #6672b4;
  border-radius: 10px;
  background: #eef2ff;
  cursor: pointer;
  font-size: 1.35rem;
  vertical-align: middle;
}

.question-text > .speaker-button {
  margin-right: 12px;
}

.speaker-button:hover {
  background: #dce4ff;
}

.speaker-button:focus-visible {
  outline: 3px solid #253a9b;
  outline-offset: 3px;
}

.speaker-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.has-answer-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.answer-image {
  display: block;
  width: 100%;
  max-width: 180px;
  height: clamp(90px, 12vw, 140px);
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  pointer-events: none;
}

.answer-numeral {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: clamp(90px, 12vw, 140px);
  font-family: system-ui, sans-serif;
  font-size: clamp(3.5rem, 7vw, 6rem);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
}

.word-chip.selected {
  border-color: var(--blue);
  background: #eef2ff;
}

.gap-continue {
  min-width: 190px;
}

.feedback {
  margin: 12px 0 0;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.feedback:empty {
  margin: 0;
}

.is-correct .feedback,
.is-wrong .feedback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding-top: 10px;
}

.finish-card {
  text-align: center;
}

.finish-score {
  margin: 8px 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
}

.final-transcript {
  margin-top: 16px;
  text-align: left;
}

.final-transcript .instruction-text {
  text-align: center;
}

.final-transcript-text {
  max-height: min(30vh, 260px);
  margin-top: 8px;
  color: var(--ink);
}

.finish-button {
  min-width: 180px;
  margin-top: 16px;
}

/* Smartboard listening is a class player; students complete a separate worksheet. */
.worksheet-download {
  display: none;
  text-decoration: none;
}

.smartboard-mode .worksheet-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.smartboard-mode .activity-screen {
  width: min(100%, 1500px);
  grid-template-rows: auto minmax(0, 1fr);
}

.smartboard-mode .questions-panel {
  display: none;
}

.smartboard-mode .listening-panel {
  grid-template-rows: minmax(0, 1fr);
}

.smartboard-mode .media-layout {
  grid-template-columns: minmax(420px, 58%) minmax(300px, 1fr);
  align-items: center;
}

.smartboard-mode .topic-visual {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 2;
  align-self: center;
}

.smartboard-mode .topic-visual img {
  object-fit: contain;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .menu-screen {
    margin: -10px;
    padding: 14px 14px 28px;
  }

  .vinyl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 14px;
  }

  .record-cover {
    width: min(100%, 174px);
  }

  .activity-screen {
    grid-template-rows: auto auto 1fr;
    gap: 10px;
  }

  .media-layout {
    grid-template-columns: 1fr;
  }

  .smartboard-mode .media-layout {
    grid-template-columns: 1fr;
  }

  .topic-visual img {
    min-height: 180px;
    max-height: 240px;
  }

  .option-list {
    grid-template-columns: 1fr;
  }

  .speed-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .word-bank {
    grid-template-columns: 1fr;
  }

  .question-header {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

video { width:100%; max-height:65vh; background:#111; border-radius:12px; }
video[hidden], audio[hidden], figure[hidden] { display:none; }
#addListening { margin:12px 0; }
#uploadListening { width:min(640px,94vw); max-height:90vh; border:0; border-radius:18px; padding:24px; overflow:auto; }
#uploadListening::backdrop { background:#0009; }
#listeningUploadForm { display:grid; gap:14px; }
#listeningUploadForm label { display:grid; gap:6px; font-weight:600; }
#listeningUploadForm input, #listeningUploadForm select, #listeningUploadForm textarea { width:100%; padding:10px; border:1px solid #aaa; border-radius:8px; font:inherit; box-sizing:border-box; }
