/* Wingo — wine-cellar take on the Duolingo lesson UI */

:root {
  --plum-900: #2a1420;
  --plum-700: #4a1f33;
  --wine-600: #8c1d3f;
  --wine-500: #a52a4f;
  --wine-400: #c4506f;
  --gold-500: #c9922e;
  --gold-300: #e9c877;
  --green-600: #4b8b2b;
  --green-500: #5da832;
  --green-100: #e8f5df;
  --red-600: #c8382f;
  --red-100: #fdeae8;

  --cream: #fdf8f3;
  --paper: #ffffff;
  --line: #ecdfd4;
  --line-strong: #d9c6b6;
  --ink: #2a1420;
  --ink-soft: #6c5a63;
  --ink-faint: #9c8b93;

  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 2px 0 var(--line-strong);
  --font: 'Nunito', 'Avenir Next', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font-family: inherit; }

.app { min-height: 100vh; }

/* ------------------------------------------------------------------- boot */

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--ink-soft);
  text-align: center;
  padding: 24px;
}
.boot-glass { font-size: 56px; animation: swirl 1.6s ease-in-out infinite; }
@keyframes swirl {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
.boot--error h1 { color: var(--wine-600); margin: 0; }
.boot-cmd {
  display: inline-block;
  background: var(--plum-900);
  color: var(--gold-300);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
}

/* ----------------------------------------------------------------- shared */

.screen { min-height: 100vh; display: flex; flex-direction: column; }

.btn {
  border: 0;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: none !important; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn--lg { padding: 16px 28px; font-size: 17px; }
.btn--block { width: 100%; }

.btn--primary { background: var(--wine-600); color: #fff; box-shadow: 0 4px 0 #6b1230; }
.btn--primary:hover:not(:disabled) { background: var(--wine-500); }
.btn--correct { background: var(--green-500); color: #fff; box-shadow: 0 4px 0 #3d7521; }
.btn--wrong { background: var(--red-600); color: #fff; box-shadow: 0 4px 0 #9c2a23; }
.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 2px var(--line-strong);
}
.btn--ghost:hover { color: var(--ink); }

.link-btn {
  background: none;
  border: 0;
  color: var(--wine-600);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px;
}
.link-btn--danger { color: var(--ink-faint); }
.link-btn--danger:hover { color: var(--red-600); }

.hint { color: var(--ink-faint); font-size: 14px; margin: 12px 0 0; }
.hint--select {
  color: var(--wine-600);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
  margin: -6px 0 14px;
}

.pill {
  display: inline-block;
  background: var(--line);
  color: var(--plum-700);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.pill--review { background: var(--gold-300); color: #5a4212; }
.pill--done { background: var(--green-100); color: var(--green-600); }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--paper);
  border-bottom: 2px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px;
}
.brand-mark { font-size: 24px; }
.brand-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--wine-600);
  letter-spacing: -0.5px;
}
.stats { display: flex; gap: 6px; }
.stat {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  color: var(--ink);
  font-size: 15px;
}
.stat:hover { background: var(--cream); }
.stat-icon { font-size: 17px; }

/* Sound toggle — appears in the main header and the lesson bar, so reading
   instead of listening can be chosen before any audio plays. */
.sound-btn {
  flex: 0 0 auto;
  background: none;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 5px 9px;
  font-size: 17px;
  line-height: 1.2;
  cursor: pointer;
}
.sound-btn:hover { background: var(--cream); border-color: var(--line); }
.sound-btn.is-off { background: var(--line); border-color: var(--line-strong); }
.sound-btn:focus-visible { outline: 3px solid var(--wine-500); outline-offset: 2px; }

/* ------------------------------------------------------------ path screen */

.path { flex: 1; width: min(560px, 100%); margin: 0 auto; padding: 24px 20px 60px; }

.hero { text-align: center; margin-bottom: 34px; }
.hero-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.hero-title {
  margin: 6px 0 4px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--plum-700);
}
.hero-sub { margin: 0 0 16px; color: var(--ink-soft); font-weight: 700; font-size: 14px; }
.hero-track {
  height: 14px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.hero-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--wine-500), var(--gold-500));
  transition: width 0.5s ease;
}

.block { margin-bottom: 30px; }
.block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  background: var(--plum-700);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: 0 3px 0 #33162a;
  margin-bottom: 22px;
}
.block-name { margin: 0; font-size: 17px; font-weight: 900; flex: 1; }
.block-range { font-size: 12px; font-weight: 800; opacity: 0.75; }

/* Roomy enough that a START pip never collides with the node above it. */
.nodes { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.node-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateX(calc(var(--lean) * 1px));
  max-width: 100%;
}
.node {
  position: relative;
  flex: 0 0 auto;
  width: 66px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-faint);
  box-shadow: 0 5px 0 var(--line-strong);
  cursor: pointer;
  font-size: 21px;
  font-weight: 900;
  transition: transform 0.08s ease;
}
.node:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--line-strong); }
.node.is-current {
  background: var(--wine-600);
  color: #fff;
  box-shadow: 0 5px 0 #6b1230;
}
.node.is-current::after {
  content: '';
  position: absolute;
  inset: -7px;
  border: 3px solid var(--gold-500);
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.06); }
}
.node.is-complete {
  background: var(--gold-500);
  color: #fff;
  box-shadow: 0 5px 0 #96690f;
}
.node.is-locked { cursor: not-allowed; opacity: 0.75; font-size: 18px; }
.node.is-review:not(.is-locked):not(.is-complete) { background: var(--gold-300); color: #5a4212; box-shadow: 0 5px 0 #c19c4a; }
.node.is-graduation:not(.is-locked):not(.is-complete) { background: var(--plum-700); color: #fff; box-shadow: 0 5px 0 #2a1420; }
.node-pip {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold-500);
  color: #3b2a06;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 999px;
}
.node-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.3;
}
.node.is-locked + .node-label { color: var(--ink-faint); }

.path-footer { text-align: center; padding-top: 20px; }

/* ----------------------------------------------------------- intro screen */

.intro { flex: 1; width: min(620px, 100%); margin: 0 auto; padding: 26px 20px 50px; }
.card {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 4px 0 var(--line);
}
.intro-kicker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.intro-unit {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--wine-600);
}
.intro-title {
  margin: 4px 0 10px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.8px;
  line-height: 1.15;
}
.intro-goal { margin: 0 0 22px; color: var(--ink-soft); font-size: 16px; line-height: 1.5; font-weight: 600; }

.explain {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.explain-text { margin: 0; line-height: 1.65; font-size: 16px; }
.funfact {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px dashed var(--line-strong);
}
.funfact-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold-500);
  margin-bottom: 4px;
}
.funfact p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-soft); font-style: italic; }

.intro-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-faint);
  margin-bottom: 22px;
}
.intro-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------------------------------------------------------------- lesson */

.lessonbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--paper);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.quit {
  background: none;
  border: 0;
  font-size: 22px;
  color: var(--ink-faint);
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
}
.quit:hover { color: var(--wine-600); }
.lesson-track { flex: 1; height: 15px; background: var(--line); border-radius: 999px; overflow: hidden; }
.lesson-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--wine-500), var(--gold-500));
  border-radius: 999px;
  transition: width 0.35s ease;
}
.lesson-xp {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 900;
  color: var(--gold-500);
  font-size: 16px;
}

.stage { flex: 1; padding: 26px 20px 190px; }
.panel { width: min(620px, 100%); margin: 0 auto; }
.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.type-tag {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.xp-tag {
  font-size: 12px;
  font-weight: 900;
  color: var(--gold-500);
  background: #fbf1dc;
  padding: 4px 10px;
  border-radius: 999px;
}

.prompt-label {
  margin: 0 0 18px;
  font-size: 23px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -0.4px;
}

/* choices ---------------------------------------------------------------- */

.choices { display: grid; gap: 12px; }
.choices--grid { grid-template-columns: repeat(2, 1fr); }
.choices--stacked { grid-template-columns: 1fr; }

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
  line-height: 1.45;
}
.choice:hover:not(:disabled) { background: #fffaf5; border-color: var(--line-strong); }
.choice.is-selected {
  border-color: var(--wine-500);
  background: #fdeef2;
  color: var(--wine-600);
}
.choice.is-correct {
  border-color: var(--green-500);
  background: var(--green-100);
  color: var(--green-600);
}
.choice.is-wrong { border-color: var(--red-600); background: var(--red-100); color: var(--red-600); }
.choice:disabled { cursor: default; }
.choice-text { flex: 1; }
.choice--reply { font-weight: 600; }

.checkbox {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  position: relative;
}
.choice.is-selected .checkbox { border-color: var(--wine-500); background: var(--wine-500); }
.choice.is-selected .checkbox::after {
  content: '✓';
  position: absolute;
  inset: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  display: grid;
  place-content: center;
}
.choice.is-correct .checkbox { border-color: var(--green-500); background: var(--green-500); }
.choice.is-correct .checkbox::after { content: '✓'; position: absolute; inset: 0; color: #fff; display: grid; place-content: center; font-weight: 900; }

/* fillBlank -------------------------------------------------------------- */

.fill-sentence {
  font-size: 21px;
  font-weight: 700;
  line-height: 2.1;
  margin: 0 0 26px;
}
.fill-sentence--answer { text-align: center; margin-top: -10px; }
.fill-slot {
  display: inline-block;
  min-width: 130px;
  padding: 4px 14px;
  margin: 0 4px;
  border: 0;
  border-bottom: 3px solid var(--line-strong);
  background: transparent;
  font: inherit;
  color: var(--wine-600);
  cursor: pointer;
  text-align: center;
  vertical-align: baseline;
}
.fill-slot.is-filled {
  background: #fdeef2;
  border-radius: 10px 10px 0 0;
  border-bottom-color: var(--wine-500);
}
.fill-slot.is-correct { background: var(--green-100); color: var(--green-600); border-bottom-color: var(--green-500); }
.fill-slot.is-wrong { background: var(--red-100); color: var(--red-600); border-bottom-color: var(--red-600); }

.word-bank { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.06s ease;
}
.chip:hover:not(:disabled) { background: #fffaf5; }
.chip:active:not(:disabled) { transform: translateY(2px); }
.chip.is-used { opacity: 0.28; pointer-events: none; }
.chip.is-correct { border-color: var(--green-500); color: var(--green-600); opacity: 1; }

/* match ------------------------------------------------------------------ */

.match-board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-tile {
  flex: 1;
  min-height: 62px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.25s ease;
}
.match-tile--left { font-weight: 800; }
.match-tile:hover:not(:disabled) { background: #fffaf5; }
.match-tile.is-picked { border-color: var(--wine-500); background: #fdeef2; color: var(--wine-600); }
.match-tile.is-matched {
  border-color: var(--green-500);
  background: var(--green-100);
  color: var(--green-600);
  opacity: 0.55;
  cursor: default;
}
.match-tile.is-wrong { border-color: var(--red-600); background: var(--red-100); animation: shake 0.4s; }
.match-tile.is-nudge { animation: shake 0.35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* trueFalse -------------------------------------------------------------- */

.tf-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.tf-text { flex: 1 1 200px; margin: 0; font-size: 16px; font-weight: 700; line-height: 1.45; }
.tf-buttons { display: flex; gap: 8px; }
.tf-btn {
  border: 2px solid var(--line-strong);
  border-bottom-width: 4px;
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink-soft);
}
.tf-btn.is-selected { border-color: var(--wine-500); background: var(--wine-600); color: #fff; }
.tf-row.is-correct { border-color: var(--green-500); background: var(--green-100); }
.tf-row.is-wrong { border-color: var(--red-600); background: var(--red-100); }
.tf-btn.is-answer { outline: 3px solid var(--green-500); outline-offset: 2px; }
.tf-btn:disabled { cursor: default; }

/* sorting ---------------------------------------------------------------- */

.sort-tray { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sort-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  padding: 8px 12px;
  background: #fffdfb;
}
.sort-slot.is-filled { border-style: solid; border-color: var(--line); background: var(--paper); }
.sort-slot.is-correct { border-color: var(--green-500); background: var(--green-100); }
.sort-slot.is-wrong { border-color: var(--red-600); background: var(--red-100); }
.sort-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink-soft);
  display: grid;
  place-content: center;
  font-size: 13px;
  font-weight: 900;
}
.sort-placeholder { flex: 1; }
.sort-item {
  flex: 1;
  text-align: left;
  background: none;
  border: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 0;
}
.sort-pool { display: flex; flex-wrap: wrap; gap: 10px; }
.sort-item--pool {
  flex: 0 0 auto;
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 14px;
  padding: 12px 18px;
}
.sort-item--pool.is-used { opacity: 0.28; pointer-events: none; }

.answer-reveal {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--green-100);
  border-radius: 14px;
  font-weight: 700;
  color: var(--green-600);
  font-size: 15px;
  line-height: 1.5;
}
.answer-reveal-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 900;
  margin-bottom: 4px;
  opacity: 0.8;
}

/* listenChoose ----------------------------------------------------------- */

.player { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.speaker {
  width: 88px;
  height: 78px;
  border: 0;
  border-radius: var(--radius);
  background: var(--wine-600);
  box-shadow: 0 4px 0 #6b1230;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: transform 0.06s ease;
}
.speaker:active { transform: translateY(3px); box-shadow: none; }
.speaker svg { width: 36px; height: 36px; fill: #fff; stroke: #fff; }
.speaker--slow {
  width: 60px;
  height: 62px;
  background: var(--plum-700);
  box-shadow: 0 4px 0 #2a1420;
  position: relative;
}
.speaker--slow svg { width: 24px; height: 24px; }
.speaker-slow-mark {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  font-size: 9px;
  font-weight: 900;
  color: var(--gold-300);
}
.transcript {
  background: var(--cream);
  border-left: 4px solid var(--gold-500);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  margin: 0 0 18px;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
}
.transcript.is-hidden { display: none; }

/* Silent mode: sound is off, or the browser has no speech synthesis. */
.audio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sound-toggle {
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}
.sound-toggle:hover { border-color: var(--line-strong); color: var(--ink); }
.sound-toggle.is-hidden,
.link-btn.is-hidden { display: none; }

.iact--listen.is-silent .speaker {
  background: var(--line);
  box-shadow: 0 4px 0 var(--line-strong);
  cursor: not-allowed;
}
.iact--listen.is-silent .speaker svg { fill: var(--ink-faint); stroke: var(--ink-faint); }
.iact--listen.is-silent .speaker-slow-mark { color: var(--ink-faint); }
/* Slash across the muted speaker so the state reads at a glance. */
.iact--listen.is-silent .speaker { position: relative; overflow: hidden; }
.iact--listen.is-silent .speaker::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 3px;
  background: var(--ink-faint);
  transform: rotate(-45deg);
  border-radius: 2px;
}
.iact--listen.is-silent .transcript {
  border-left-color: var(--wine-500);
  font-style: normal;
  color: var(--ink);
}

/* readChoose ------------------------------------------------------------- */

.passage {
  margin: 0 0 20px;
  padding: 20px 22px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-left: 6px solid var(--gold-500);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 17px;
  line-height: 1.65;
}
.passage p { margin: 0; }

/* imageRecognition ------------------------------------------------------- */

.image-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.image-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: var(--radius);
  padding: 20px 14px 16px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.image-tile:hover:not(:disabled) { background: #fffaf5; }
.image-glyph {
  width: 62px;
  height: 62px;
  fill: none;
  stroke: var(--plum-700);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.image-label { font-size: 14px; font-weight: 700; text-align: center; line-height: 1.35; }
.image-tile.is-selected { border-color: var(--wine-500); background: #fdeef2; }
.image-tile.is-selected .image-glyph { stroke: var(--wine-600); }
.image-tile.is-correct { border-color: var(--green-500); background: var(--green-100); }
.image-tile.is-correct .image-glyph { stroke: var(--green-600); }
.image-tile.is-wrong { border-color: var(--red-600); background: var(--red-100); }
.image-tile.is-wrong .image-glyph { stroke: var(--red-600); }

/* simulation ------------------------------------------------------------- */

.sim-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold-500);
  margin-bottom: 12px;
}
.sim-scene { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 24px; }
.sim-avatar {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--line);
  display: grid;
  place-content: center;
  font-size: 26px;
}
.sim-bubble {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 4px 18px 18px 18px;
  padding: 16px 18px;
  font-size: 17px;
  line-height: 1.55;
  font-weight: 600;
}
.sim-bubble p { margin: 0; }
.sim-bubble::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 10px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-right-color: var(--line);
}

/* --------------------------------------------------------------- actionbar */

.actionbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--paper);
  border-top: 2px solid var(--line);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  z-index: 30;
}
.actionbar > * { width: min(620px, 100%); margin: 0 auto; display: block; }
.actionbar.is-correct { background: var(--green-100); border-top-color: #cfe8bd; }
.actionbar.is-wrong { background: var(--red-100); border-top-color: #f5cdc9; }

.feedback { display: none; margin-bottom: 14px; }
.feedback.is-visible { display: block; animation: rise 0.22s ease; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.feedback-title { margin: 0 0 4px; font-size: 19px; font-weight: 900; }
.feedback-body { margin: 0; font-size: 15px; line-height: 1.5; font-weight: 600; }
.actionbar.is-correct .feedback-title,
.actionbar.is-correct .feedback-body { color: var(--green-600); }
.actionbar.is-wrong .feedback-title,
.actionbar.is-wrong .feedback-body { color: var(--red-600); }

/* -------------------------------------------------------- complete screen */

.complete {
  flex: 1;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 46px 20px 50px;
  text-align: center;
}
.burst { font-size: 76px; animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.complete-title {
  margin: 10px 0 6px;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.8px;
  color: var(--gold-500);
}
.complete-sub { margin: 0 0 28px; color: var(--ink-soft); font-weight: 700; line-height: 1.55; }

.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.score {
  border: 2px solid var(--gold-300);
  border-radius: var(--radius);
  padding: 12px 8px;
  background: var(--paper);
}
.score-label {
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold-500);
  margin-bottom: 4px;
}
.score-value { display: block; font-size: 19px; font-weight: 900; }

.badge-award {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--plum-700);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 18px;
}
.badge-award--final { background: linear-gradient(135deg, var(--wine-600), var(--plum-900)); }
.badge-medal { font-size: 38px; }
.badge-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.7;
  font-weight: 800;
}
.badge-name { font-size: 18px; font-weight: 900; }

.streak-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
  font-weight: 800;
  color: var(--ink-soft);
}
.streak-flame { font-size: 20px; }

.next-up {
  background: var(--cream);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 24px;
}
.next-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 3px;
}
.complete-actions { display: flex; flex-direction: column; gap: 10px; }

.blocks-done {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 6px;
  text-align: left;
}
.blocks-done li {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
}
.blocks-done li::before { content: '✓ '; color: var(--green-600); font-weight: 900; }

/* ----------------------------------------------------------- badge shelf */

.badges { flex: 1; width: min(760px, 100%); margin: 0 auto; padding: 28px 20px 50px; }
.badges-title { margin: 0 0 4px; font-size: 30px; font-weight: 900; letter-spacing: -0.8px; }
.badges-sub { margin: 0 0 26px; color: var(--ink-soft); font-weight: 700; }
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}
.badge-cell {
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0.55;
}
.badge-cell.is-earned { opacity: 1; border-color: var(--gold-300); }
.badge-cell-medal { font-size: 30px; }
.badge-cell-name { font-size: 15px; font-weight: 900; line-height: 1.3; }
.badge-cell-unit { font-size: 12px; color: var(--ink-faint); font-weight: 700; }
.badge-cell-score { font-size: 12px; color: var(--gold-500); font-weight: 800; margin-top: 4px; }

/* ------------------------------------------------------------------ auth */

.auth { flex: 1; display: grid; place-content: center; padding: 40px 20px; width: 100%; }
.auth-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 0 var(--line);
}
.auth-mark { font-size: 38px; }
.auth-title { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -0.6px; }
.auth-sub { margin: -6px 0 4px; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.auth-notice {
  margin: 0;
  background: var(--green-100);
  color: var(--green-600);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.auth-input {
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--cream);
  width: 100%;
}
.auth-input:focus { outline: none; border-color: var(--wine-500); background: var(--paper); }
.auth-error { margin: 0; min-height: 18px; color: var(--red-600); font-size: 14px; font-weight: 700; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.stat--who { gap: 7px; }
.role-chip {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.9px;
  background: var(--wine-600);
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
}

/* ---------------------------------------------------------------- roster */

/* ----------------------------------------------------------- design mode */

.design-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--plum-700);
  color: #fff;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 19;
}
.design-banner .link-btn { color: var(--gold-300); margin-left: auto; }
.design-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold-500);
  animation: pulse 1.8s ease-in-out infinite;
}

.design-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--plum-700);
  border-radius: 12px;
  padding: 8px 10px;
  margin-bottom: 16px;
}
.design-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.design-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
.design-btn:disabled { opacity: 0.35; cursor: default; }
.design-pos {
  color: var(--gold-300);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

/* -------------------------------------------------------- lesson summary */

.summary { text-align: left; margin-bottom: 20px; }
.summary-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.summary-head:hover { background: #fffaf5; }
.summary-title { flex: 1; font-size: 15px; font-weight: 800; }
.summary-chevron { color: var(--ink-faint); font-size: 13px; }
.summary-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.summary-list.is-hidden { display: none; }
.summary-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.summary-row:hover { border-color: var(--line-strong); }
.summary-row.is-correct { border-left: 4px solid var(--green-500); }
.summary-row.is-wrong { border-left: 4px solid var(--red-600); }
.summary-mark { font-weight: 900; font-size: 15px; }
.summary-row.is-correct .summary-mark { color: var(--green-600); }
.summary-row.is-wrong .summary-mark { color: var(--red-600); }
.summary-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.summary-type {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.summary-prompt {
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.review-feedback {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 600;
}

.page-back { margin-bottom: 10px; }
.page-back .link-btn { padding: 4px 0; font-size: 15px; }

.roster { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.roster-row {
  display: grid;
  grid-template-columns: 2fr 0.8fr 0.9fr 0.8fr 1fr;
  gap: 10px;
  align-items: center;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
}
.roster-row--head {
  background: transparent;
  border: 0;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.roster-name { font-weight: 800; }
.roster-role { font-size: 12px; font-weight: 800; color: var(--wine-600); text-transform: uppercase; }
.roster-num, .roster-date { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 700; }

.roster-row--diff { grid-template-columns: 3fr 1.1fr 0.8fr 0.8fr 0.8fr; }
.roster-name { display: flex; flex-direction: column; gap: 3px; }
.roster-prompt {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-faint);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.roster-pct {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--green-600);
}
.roster-pct.is-warn { color: var(--gold-500); }
.roster-pct.is-bad { color: var(--red-600); }

@media (max-width: 620px) {
  .roster-row, .roster-row--diff { grid-template-columns: 1fr 1fr; }
  .roster-row--head { display: none; }
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 560px) {
  .choices--grid { grid-template-columns: 1fr; }
  .prompt-label { font-size: 20px; }
  .fill-sentence { font-size: 19px; }
  .match-tile { font-size: 13px; }
  .hero-title { font-size: 28px; }
  .intro-title { font-size: 25px; }
  .card { padding: 22px 18px; }
  .node-label { font-size: 13px; }
  .node { width: 58px; height: 55px; font-size: 19px; }
  .scores { grid-template-columns: 1fr; }
}
