:root {
  --paper: #f7eed8;
  --paper-deep: #ebdcb8;
  --paper-light: #fcf6e7;
  --ink: #243c31;
  --ink-muted: #596859;
  --frame: #263f43;
  --frame-deep: #1e3033;
  --sage: #a5b873;
  --sage-deep: #607545;
  --sun: #e0ac43;
  --sun-light: #f4d47f;
  --clay: #b65e32;
  --clay-deep: #843e24;
  --sky: #4a8690;
  --success: #547b48;
  --danger: #a14738;
  --line: rgba(57, 54, 38, 0.23);
  --paper-shadow: 0 18px 40px rgba(48, 39, 22, 0.2), 0 2px 4px rgba(48, 39, 22, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", Arial, sans-serif;
  background: #d6c296;
  background-image:
    radial-gradient(circle at 14% 16%, rgba(255, 243, 207, 0.8), transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(79, 101, 62, 0.17), transparent 30%),
    linear-gradient(135deg, #d9c59d, #bdab86);
}

.paper-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.19;
  mix-blend-mode: multiply;
  background-image:
    repeating-linear-gradient(12deg, rgba(59, 48, 27, 0.11) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(95deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 7px);
}

.celebrations {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

.header,
.shell,
footer {
  position: relative;
  z-index: 1;
}

.header {
  flex: 0 0 clamp(52px, 7vh, 76px);
  height: clamp(52px, 7vh, 76px);
  margin: 0 18px;
  padding: 0 clamp(18px, 4vw, 38px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(52, 53, 39, 0.19);
  background: rgba(249, 240, 216, 0.93);
  box-shadow: 0 2px 10px rgba(57, 45, 23, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-leaf {
  width: 13px;
  height: 28px;
  border-radius: 100% 0;
  background: var(--sage-deep);
  transform: rotate(-34deg);
  position: relative;
}

.brand-leaf::after {
  content: "";
  position: absolute;
  left: 11px;
  bottom: -6px;
  width: 10px;
  height: 22px;
  border-radius: 100% 0;
  background: #879b5e;
  transform: rotate(54deg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  font-size: clamp(1.85rem, 3vw, 2.45rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.brand p {
  padding-left: 21px;
  border-left: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.94rem;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px;
  border: 1px dashed rgba(60, 74, 50, 0.2);
  border-radius: 999px;
  background: rgba(241, 229, 197, 0.5);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

.quiet {
  border: 2px dashed rgba(36, 60, 49, 0.37);
  border-radius: 12px;
  padding: 9px 17px;
  color: var(--ink);
  background: var(--paper-light);
  font-weight: 700;
}

.audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid rgba(36, 60, 49, 0.2);
  border-radius: 999px;
  color: var(--ink-muted);
  background: var(--paper-light);
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 140ms ease, color 140ms ease;
}

.audio-toggle span {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-light);
  background: var(--sage-deep);
  font-size: 0.69rem;
}

.audio-toggle[aria-pressed="false"] {
  color: rgba(70, 77, 65, 0.73);
  background: rgba(230, 219, 194, 0.55);
}

.audio-toggle[aria-pressed="false"] span {
  background: rgba(89, 104, 89, 0.55);
}

.audio-toggle.playing span {
  animation: audio-beat 950ms ease-in-out infinite;
}

@keyframes audio-beat {
  50% {
    transform: scale(1.12);
    background: var(--clay);
  }
}

.language-selector {
  padding: 9px 13px;
  border: 1px solid rgba(36, 60, 49, 0.2);
  border-radius: 999px;
  color: var(--ink-muted);
  background: var(--paper-light);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: background 140ms ease, color 140ms ease;
}

.language-selector:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

.language-selector option {
  background: var(--paper);
  color: var(--ink);
}

.shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 1390px;
  margin: 0 auto;
  padding: clamp(6px, 1.8vh, 22px) clamp(8px, 1.6vw, 22px);
}

.panel {
  border-radius: 20px;
}

.start {
  height: 100%;
  min-height: 0;
  padding: clamp(34px, 7vw, 82px);
  display: grid;
  grid-template-columns: minmax(350px, 0.92fr) minmax(380px, 1.08fr);
  gap: 42px;
  align-items: center;
  border: 2px solid rgba(55, 47, 30, 0.22);
  background: var(--paper);
  box-shadow: var(--paper-shadow);
  overflow: hidden;
}

.hero-copy h2 {
  max-width: 470px;
  margin-bottom: 18px;
  font-size: clamp(3rem, 5.7vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.hero-copy > p {
  max-width: 475px;
  color: var(--ink-muted);
  font-size: 1.08rem;
  line-height: 1.68;
}

.name-field {
  display: grid;
  gap: 9px;
  max-width: 310px;
  margin-top: 36px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

input {
  width: 100%;
  padding: 14px 15px;
  border: 2px solid rgba(62, 62, 43, 0.3);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: inset 0 2px 6px rgba(75, 61, 31, 0.07);
}

.launch,
.next {
  position: relative;
  border-radius: 13px;
  color: #fff7e5;
  background: var(--clay);
  box-shadow: inset 0 0 0 2px rgba(255, 228, 170, 0.23), 0 4px 0 var(--clay-deep), 0 11px 18px rgba(91, 44, 23, 0.18);
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.launch {
  margin-top: 25px;
  padding: 15px 27px;
}

.launch::after {
  content: " \2192";
  padding-left: 7px;
  font-size: 1.15rem;
}

.launch:hover,
.next:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 2px rgba(255, 228, 170, 0.23), 0 6px 0 var(--clay-deep), 0 14px 22px rgba(91, 44, 23, 0.2);
}

.welcome-back {
  margin: 18px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--clay-deep, #5b2c17);
}

#startGame.quiet {
  margin-top: 10px;
  padding: 9px 18px;
  font-weight: 500;
  font-size: 0.95rem;
}

.rover-scene {
  min-height: min(535px, 45vh);
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
}

.rover-scene::before {
  content: "";
  position: absolute;
  bottom: 42px;
  width: min(500px, 98%);
  height: 186px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse, rgba(50, 69, 47, 0.16), transparent 66%),
    repeating-linear-gradient(-12deg, rgba(96, 117, 69, 0.13) 0 2px, transparent 2px 15px);
}

.hero-byte {
  position: relative;
  z-index: 1;
  width: min(470px, 90%);
  object-fit: contain;
  animation: hero-float 3.5s ease-in-out infinite;
}

.speech {
  position: absolute;
  top: 48px;
  right: 10px;
  z-index: 2;
  max-width: 208px;
  padding: 16px 17px;
  border: 2px solid rgba(54, 55, 39, 0.24);
  border-radius: 14px 14px 14px 2px;
  color: var(--ink);
  background: var(--paper-light);
  font-size: 0.93rem;
  line-height: 1.45;
  box-shadow: 0 4px 10px rgba(52, 42, 26, 0.1);
}

.game {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: clamp(6px, 1vh, 14px);
  padding: clamp(5px, 0.7vh, 10px);
  border-radius: 24px;
  background: var(--frame);
  box-shadow: 0 20px 42px rgba(32, 31, 22, 0.27);
  animation: enter 280ms ease-out both;
}

.drawer-close,
.journey-toggle,
.dashboard-scrim {
  display: none;
}

.dashboard {
  position: relative;
  padding: 20px 16px 18px;
  border-radius: 16px;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgba(233, 219, 178, 0.88), rgba(227, 214, 175, 0.95)),
    repeating-linear-gradient(36deg, rgba(59, 81, 45, 0.08) 0 1px, transparent 1px 9px);
}

.dashboard::before {
  content: "";
  position: absolute;
  top: 235px;
  bottom: 130px;
  left: 47px;
  border-left: 3px dotted rgba(75, 83, 52, 0.42);
}

.pilot {
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px dashed rgba(72, 82, 52, 0.3);
  border-radius: 11px;
  background: rgba(250, 240, 213, 0.44);
}

.companion {
  position: relative;
  width: 78px;
  height: 85px;
  border-radius: 8px;
  background: var(--paper-light);
  box-shadow: 0 2px 7px rgba(59, 47, 23, 0.2);
  transform: rotate(-2deg);
  animation: pet-hover 3s ease-in-out infinite;
}

.pilot .companion {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.companion img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
}

.companion::after {
  content: "";
  position: absolute;
  right: -8px;
  bottom: -9px;
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-light);
  background: transparent;
  font-size: 15px;
  font-weight: bold;
}

.companion[data-stage="1"]::after {
  content: "\2713";
  background: var(--sage-deep);
}

.companion[data-stage="2"]::after {
  content: "\2605";
  background: var(--sun);
}

.companion[data-stage="3"]::after,
.companion[data-stage="4"]::after {
  content: "\2605";
  background: var(--clay);
}

.companion-copy {
  padding-top: 0;
}

.kicker,
.side-heading,
.round {
  color: var(--sage-deep);
  font-family: "Avenir Next", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.companion-copy strong {
  display: block;
  margin: 4px 0 5px;
  font-family: Georgia, serif;
  font-size: 1.45rem;
}

.companion-copy small {
  display: block;
  color: var(--ink-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.explorer-name {
  margin: 13px 0 13px;
  padding: 8px 12px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  border: 1px dashed rgba(72, 82, 52, 0.26);
  border-radius: 9px;
  background: rgba(250, 240, 213, 0.36);
}

.explorer-name .kicker {
  flex-shrink: 0;
}

.explorer-name strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.scoreboard {
  margin: 0 0 24px;
  padding: 11px 8px 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  border-radius: 9px;
  background: rgba(250, 240, 213, 0.54);
}

.scoreboard div {
  display: grid;
  justify-items: center;
  gap: 2px;
  border-right: 1px solid rgba(72, 82, 52, 0.18);
}

.scoreboard div:last-child {
  border-right: 0;
}

.scoreboard span {
  color: var(--ink-muted);
  font-size: 0.77rem;
  font-weight: 700;
}

.scoreboard strong {
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 1.45rem;
}

.side-heading {
  margin: 0 0 12px;
}

.mission-map {
  position: relative;
  display: grid;
  gap: 16px;
  padding-bottom: 18px;
}

.map-card {
  width: 100%;
  min-height: 51px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 4px 20px 20px 4px;
  color: var(--ink-muted);
  background: rgba(250, 239, 208, 0.66);
  transform: rotate(-0.8deg);
  text-align: left;
  transition: background 140ms ease, transform 140ms ease;
}

.map-card:nth-child(even) {
  transform: rotate(0.8deg);
}

.map-card span {
  position: relative;
  z-index: 1;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 2px solid var(--ink-muted);
  border-radius: 50%;
  background: var(--paper-light);
  font-family: Georgia, serif;
  font-weight: bold;
}

.map-card strong {
  display: block;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 1.05rem;
}

.map-card small {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.map-card.active {
  background: var(--sage);
  box-shadow: 0 2px 0 rgba(56, 69, 35, 0.25);
}

.map-card.active span,
.map-card.complete span {
  border-color: var(--sage-deep);
  color: var(--paper-light);
  background: var(--sage-deep);
}

.map-card.complete {
  background: rgba(166, 183, 116, 0.33);
}

.map-card:not(.active):not(:disabled):hover {
  transform: translateX(3px) rotate(0deg);
  background: rgba(250, 239, 208, 0.95);
}

.map-card.paused {
  cursor: default;
  opacity: 0.62;
}

.notebook {
  margin-top: 8px;
  padding: 15px 14px;
  border: 1px dashed rgba(51, 57, 39, 0.3);
  background: rgba(249, 239, 211, 0.75);
  transform: rotate(-1deg);
}

.notebook p {
  color: var(--ink-muted);
  font-size: 0.83rem;
  line-height: 1.5;
}

.play {
  min-height: 0;
  overflow: hidden;
  padding: clamp(10px, 2vh, 28px) clamp(18px, 4vw, 56px) clamp(8px, 1.8vh, 22px);
  border-radius: 15px;
  background:
    radial-gradient(circle at 14% 20%, rgba(255, 255, 255, 0.54), transparent 34%),
    var(--paper);
  box-shadow: inset 3px 0 4px rgba(95, 73, 34, 0.12), inset -2px 0 4px rgba(95, 73, 34, 0.1);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-wrap span {
  padding: clamp(5px, 0.9vh, 8px) 19px;
  border-radius: 3px;
  color: var(--ink);
  background: var(--sage);
  transform: rotate(-1deg);
}

.progress {
  flex: 1;
  height: 3px;
  overflow: hidden;
  background: rgba(60, 74, 50, 0.17);
}

#progressBar {
  height: 100%;
  width: 0;
  background: var(--sage-deep);
  transition: width 350ms ease;
}

.mission-head {
  position: relative;
  margin: clamp(6px, 1.2vh, 22px) 0 clamp(6px, 1.2vh, 20px);
  padding-right: clamp(84px, 14vh, 150px);
  min-height: clamp(62px, 12vh, 123px);
  text-align: left;
}

.mission-icon {
  display: none;
}

.mission-head .kicker {
  margin-bottom: clamp(4px, 0.8vh, 10px);
}

.mission-head h2 {
  display: inline-block;
  position: relative;
  margin-bottom: clamp(5px, 0.9vh, 13px);
  font-size: clamp(1.8rem, min(5vw, 5.5vh), 4.1rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.mission-head h2::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -20px;
  bottom: -8px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage-deep);
  opacity: 0.85;
}

.mission-head p:not(.kicker) {
  max-width: 560px;
  color: var(--ink-muted);
  font-size: clamp(0.88rem, 1.4vh, 1.06rem);
  line-height: 1.5;
}

.mission-head::after {
  content: "";
  position: absolute;
  right: 0;
  top: -17px;
  width: clamp(72px, 12vh, 135px);
  height: clamp(72px, 12vh, 135px);
  background: url("assets/byte-companion.webp") center / contain no-repeat;
  animation: pet-hover 3.5s ease-in-out infinite;
}

.byte-coach {
  position: absolute;
  z-index: 2;
  right: 52px;
  top: -78px;
  width: min(355px, calc(100% - 520px));
  min-width: 290px;
  padding: 14px 17px 14px 18px;
  border: 2px solid rgba(96, 117, 69, 0.28);
  border-radius: 19px;
  background: var(--paper-light);
  box-shadow: 0 4px 9px rgba(48, 39, 22, 0.08);
}

.byte-coach::before {
  content: "";
  position: absolute;
  right: 42px;
  bottom: -15px;
  width: 25px;
  height: 23px;
  background: var(--paper-light);
  border-right: 2px solid rgba(96, 117, 69, 0.28);
  border-bottom: 2px solid rgba(96, 117, 69, 0.28);
  transform: rotate(45deg) skew(-9deg);
}

.byte-coach-label {
  margin-bottom: 7px !important;
  color: var(--sage-deep) !important;
  font-size: 0.7rem !important;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.byte-coach strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
}

.byte-coach #byteCoachText {
  max-width: none;
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.43;
}

.byte-coach.speaking {
  animation: coach-arrives 360ms ease-out both;
}

.mission-head.byte-is-teaching {
  min-height: clamp(148px, 30vh, 315px);
}

.mission-head.byte-is-teaching::after {
  top: auto;
  bottom: 6px;
  right: 25px;
}

.mission-head.byte-is-teaching .byte-coach {
  top: 0;
  right: 0;
}

.mission-head.byte-is-teaching .byte-coach::before {
  right: 80px;
}

.challenge,
.briefing {
  max-width: 850px;
  padding: 0;
  background: transparent;
  animation: enter 250ms ease-out both;
}

.briefing h3 {
  margin-bottom: clamp(6px, 1vh, 16px);
  font-size: clamp(1.35rem, min(2.7vw, 2.8vh), 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.briefing-definition {
  max-width: 680px;
  margin-bottom: clamp(8px, 1.4vh, 18px);
  color: var(--ink);
  font-size: clamp(0.9rem, 1.5vh, 1.1rem);
  line-height: 1.55;
}

.lesson-cards {
  display: grid;
  gap: clamp(10px, 1.6vh, 19px);
}

.lesson-card {
  position: relative;
  min-height: clamp(54px, 10vh, 98px);
  padding: clamp(18px, 2.5vh, 26px) 28px clamp(12px, 1.8vh, 19px);
  border-radius: 5px 18px 18px 6px;
  color: var(--ink);
  background: rgba(169, 187, 122, 0.3);
  line-height: 1.6;
}

.example-card {
  display: grid;
  grid-template-columns: minmax(215px, 0.92fr) minmax(245px, 1.08fr);
  gap: 23px;
  align-items: center;
  min-height: 0;
  padding: 20px 22px 17px;
}

.lesson-visual {
  margin: 0;
}

.lesson-visual img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  border: 6px solid var(--paper-light);
  border-radius: 7px;
  box-shadow: 0 3px 9px rgba(48, 39, 22, 0.15);
  max-height: min(18vh, 180px);
}

.lesson-visual figcaption {
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.lesson-card span {
  position: absolute;
  left: 18px;
  top: -13px;
  padding: 5px 15px;
  color: var(--ink);
  background: var(--sage);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: rotate(-1.5deg);
}

.lesson-card.remember {
  margin-top: 3px;
  margin-right: 54px;
  margin-left: 36px;
  background: rgba(229, 185, 76, 0.25);
}

.lesson-card.remember span {
  background: var(--sun-light);
}

.lesson-button {
  margin: clamp(8px, 1.4vh, 20px) auto 0;
  display: block;
  min-width: 245px;
  font-size: 1.04rem;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 43, 39, 0.5);
  backdrop-filter: blur(2px);
}

.travel-note {
  width: min(460px, 100%);
  padding: 30px 31px 27px;
  border: 2px solid rgba(55, 47, 30, 0.23);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: var(--paper-shadow);
  transform: rotate(-0.7deg);
}

.travel-note h2 {
  margin: 11px 0 13px;
  font-size: clamp(1.65rem, 5vw, 2rem);
}

.travel-note > p:not(.round) {
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.travel-actions {
  margin-top: 25px;
  display: flex;
  justify-content: flex-end;
  gap: 11px;
}

.travel-confirm {
  padding: 10px 18px;
  border-radius: 11px;
  color: var(--paper-light);
  background: var(--clay);
  font-weight: 700;
}

.round {
  margin-bottom: clamp(8px, 1.4vh, 19px);
}

.challenge h3 {
  max-width: 690px;
  margin-bottom: clamp(10px, 1.8vh, 24px);
  font-size: clamp(1.2rem, min(2.5vw, 2.8vh), 1.9rem);
  line-height: 1.36;
  letter-spacing: -0.018em;
}

.choices {
  display: grid;
  gap: clamp(6px, 1vh, 12px);
}

.choice {
  width: 100%;
  padding: clamp(10px, 1.4vh, 16px) 21px;
  border: 2px solid rgba(52, 61, 43, 0.17);
  border-radius: 10px;
  text-align: left;
  color: var(--ink);
  background: rgba(252, 246, 231, 0.92);
  font-size: 1rem;
  line-height: 1.45;
  transition: border-color 130ms ease, transform 130ms ease, background 130ms ease;
  animation: option-in 240ms ease-out both;
}

.choice:nth-child(2) {
  animation-delay: 45ms;
}

.choice:nth-child(3) {
  animation-delay: 90ms;
}

.choice:hover:not(:disabled) {
  transform: translateX(4px);
  border-color: var(--sage-deep);
  background: #fff8e8;
}

.choice:disabled {
  cursor: default;
  opacity: 0.6;
}

.choice.correct {
  opacity: 1;
  border-color: var(--success);
  background: rgba(163, 188, 116, 0.35);
  animation: correct-pulse 420ms ease-out;
}

.choice.incorrect {
  opacity: 1;
  border-color: var(--danger);
  background: rgba(180, 92, 69, 0.12);
  animation: shake 360ms ease-out;
}

.feedback {
  margin-top: clamp(8px, 1.4vh, 17px);
  padding: clamp(10px, 1.4vh, 17px) 19px;
  border-left: 5px solid var(--sage-deep);
  color: var(--ink-muted);
  background: rgba(166, 184, 116, 0.18);
  line-height: 1.55;
  animation: enter 240ms ease-out both;
}

.feedback strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.next {
  margin-top: clamp(8px, 1.4vh, 20px);
  padding: clamp(9px, 1.2vh, 14px) 24px;
}

.finish {
  height: 100%;
  min-height: 0;
  padding: clamp(36px, 6vw, 64px);
  border: 2px solid rgba(55, 47, 30, 0.22);
  background: var(--paper);
  box-shadow: var(--paper-shadow);
  text-align: center;
  animation: enter 360ms ease-out both;
}

.trophy {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-light);
  background: var(--clay);
  font-size: 25px;
  animation: trophy 1.1s ease-in-out infinite alternate;
}

.graduate-pet {
  width: 185px;
  height: 188px;
  margin: 0 auto 17px;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.graduate-pet::after {
  right: 14px;
  bottom: 24px;
}

.pill {
  color: var(--sage-deep);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.finish h2 {
  margin: 15px auto 10px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.045em;
}

.finish > p:not(.pill) {
  color: var(--ink-muted);
}

.badge-rack {
  max-width: 720px;
  margin: 34px auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.badge {
  padding: 18px 8px;
  border: 1px dashed rgba(69, 68, 43, 0.3);
  border-radius: 8px;
  background: var(--paper-light);
  animation: badge-in 400ms ease-out both;
}

.badge:nth-child(2) {
  animation-delay: 80ms;
}

.badge:nth-child(3) {
  animation-delay: 160ms;
}

.badge:nth-child(4) {
  animation-delay: 240ms;
}

.badge b {
  display: block;
  margin-bottom: 7px;
  color: var(--clay);
  font-size: 1.8rem;
}

.badge span {
  color: var(--ink-muted);
  font-size: 0.86rem;
}

.final-tips {
  max-width: 630px;
  margin: 0 auto;
  padding: 19px;
  background: rgba(164, 183, 113, 0.2);
}

.final-tips h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.final-tips p {
  color: var(--ink-muted);
  line-height: 1.55;
}

footer {
  display: none;
  padding: 0 20px 23px;
  color: rgba(47, 53, 39, 0.7);
  text-align: center;
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

.score-pop {
  animation: score-pop 360ms ease;
}

.companion.happy {
  animation: pet-cheer 680ms ease-out;
}

.companion.level-up {
  animation: pet-level-up 900ms ease-out;
}

.companion.launching {
  opacity: 0;
}

.flying-companion {
  position: fixed;
  z-index: 3;
  width: 145px;
  height: 150px;
  border: 0;
  background: transparent;
  box-shadow: none;
  animation: victory-flight 1.42s cubic-bezier(0.42, 0, 0.25, 1) both;
  filter: drop-shadow(0 8px 7px rgba(53, 43, 24, 0.28));
}

.particle {
  position: absolute;
  display: block;
  pointer-events: none;
  background: var(--color);
  animation-delay: var(--delay);
}

.spark {
  left: var(--x);
  top: var(--y);
  height: 11px;
  width: 11px;
  border-radius: 50%;
  animation: spark-burst 720ms ease-out both;
}

.confetti {
  top: -20px;
  left: var(--x);
  width: 11px;
  height: 18px;
  border-radius: 2px;
  animation: confetti-fall 2.2s ease-in both;
}

.flight-trail {
  position: fixed;
  z-index: 2;
  height: 10px;
  width: 10px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: -12px 7px 0 -2px var(--sage), 10px 8px 0 -2px var(--clay);
  animation: trail-fade 650ms ease-out both;
}

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

@keyframes coach-arrives {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.97) rotate(-1deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(-1deg);
  }
}

@keyframes hero-float {
  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

@keyframes pet-hover {
  50% {
    transform: translateY(-3px) rotate(-1deg);
  }
}

@keyframes pet-cheer {
  28% {
    transform: translateY(-13px) rotate(-6deg) scale(1.03);
  }
  62% {
    transform: translateY(-4px) rotate(5deg);
  }
}

@keyframes pet-level-up {
  28% {
    transform: translateY(-14px) scale(1.12);
    filter: drop-shadow(0 5px 8px rgba(181, 95, 50, 0.45));
  }
}

@keyframes correct-pulse {
  50% {
    transform: translateX(4px) scale(1.008);
  }
}

@keyframes shake {
  25% {
    transform: translateX(-5px);
  }
  55% {
    transform: translateX(5px);
  }
  80% {
    transform: translateX(-2px);
  }
}

@keyframes option-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes score-pop {
  50% {
    color: var(--clay);
    transform: scale(1.14);
  }
}

@keyframes badge-in {
  from {
    opacity: 0;
    transform: rotate(-3deg) scale(0.92);
  }
}

@keyframes trophy {
  to {
    transform: rotate(4deg) scale(1.05);
  }
}

@keyframes victory-flight {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0) scale(0.94);
  }
  8% {
    opacity: 1;
    transform: translate(18px, -22px) rotate(-8deg) scale(1.07);
  }
  32% {
    transform: translate(var(--fly-across), 64px) rotate(9deg) scale(1.16);
  }
  53% {
    transform: translate(var(--fly-across), var(--fly-down)) rotate(175deg) scale(1.09);
  }
  77% {
    transform: translate(190px, var(--fly-down)) rotate(355deg) scale(1.14);
  }
  100% {
    opacity: 0;
    transform: translate(0, 0) rotate(360deg) scale(0.97);
  }
}

@keyframes trail-fade {
  to {
    opacity: 0;
    transform: translateY(17px) scale(0);
  }
}

@keyframes spark-burst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0);
  }
  22% {
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(0.35) rotate(var(--turn));
  }
}

@keyframes confetti-fall {
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--sway), var(--fall)) rotate(var(--turn));
  }
}

@media (min-width: 931px) {
  .lesson-cards {
    grid-template-columns: minmax(340px, 1.6fr) minmax(200px, 0.9fr);
    align-items: stretch;
  }

  .lesson-card.remember {
    margin: 0;
  }

  .example-card {
    grid-template-columns: clamp(140px, 18vw, 200px) 1fr;
  }
}

@media (max-width: 930px) {
  .header {
    flex: 0 0 64px;
    height: auto;
    min-height: 64px;
    padding-block: 8px;
  }

  .brand p {
    display: none;
  }

  .header-actions {
    gap: 6px;
  }

  .audio-toggle {
    padding: 8px 10px;
  }

  .start {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(18px, 4vw, 30px);
    min-height: 0;
  }

  .rover-scene {
    position: absolute;
    right: 22px;
    bottom: 18px;
    width: 150px;
    min-height: 130px;
    opacity: 0.92;
    pointer-events: none;
  }

  .rover-scene::before {
    bottom: 0;
    height: 50px;
  }

  .hero-byte {
    width: 140px;
  }

  .speech {
    display: none;
  }

  .game {
    display: flex;
    flex-direction: column;
    animation: none;
  }

  .dashboard {
    position: fixed;
    z-index: 42;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(88vw, 370px);
    margin: 0;
    padding: 48px 12px 12px;
    border-radius: 0 18px 18px 0;
    overflow: hidden;
    box-shadow: 14px 0 30px rgba(30, 48, 51, 0.27);
    transform: translateX(calc(-100% - 18px));
    visibility: hidden;
    transition: transform 230ms ease, visibility 0s linear 230ms;
  }

  .dashboard::before {
    display: none;
  }

  .game.journey-open .dashboard {
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .dashboard-scrim {
    position: fixed;
    z-index: 41;
    inset: 0;
    display: block;
    border: 0;
    opacity: 0;
    pointer-events: none;
    background: rgba(29, 47, 48, 0.42);
    transition: opacity 200ms ease;
  }

  .game.journey-open .dashboard-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .drawer-close {
    position: absolute;
    top: 17px;
    right: 16px;
    display: inline-flex;
    padding: 7px 13px;
    border: 1px dashed rgba(36, 60, 49, 0.36);
    border-radius: 999px;
    color: var(--ink-muted);
    background: var(--paper-light);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .pilot {
    max-width: 340px;
    padding: 7px;
  }

  .mission-map {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding-bottom: 10px;
  }

  .map-card {
    min-height: 47px;
    padding: 6px 8px;
    gap: 8px;
  }

  .map-card span {
    width: 29px;
    height: 29px;
  }

  .map-card strong {
    font-size: 0.92rem;
  }

  .notebook {
    margin-top: 3px;
    padding: 10px;
  }

  .play {
    flex: 1 1 auto;
    min-height: 0;
  }

  .journey-toggle {
    margin: 0 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px 9px 10px;
    border: 1px dashed rgba(36, 60, 49, 0.3);
    border-radius: 999px;
    color: var(--ink);
    background: rgba(169, 187, 122, 0.27);
    font-size: 0.85rem;
    font-weight: 700;
  }

  .journey-toggle span {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: var(--paper-light);
    background: var(--sage-deep);
  }

  .mission-head.byte-is-teaching {
    min-height: 190px;
  }

  .mission-head.byte-is-teaching #missionIntro {
    visibility: hidden;
  }
}

@media (max-width: 620px), (max-width: 930px) and (max-height: 720px) {
  .header {
    flex: 0 0 56px;
    height: 56px;
    min-height: 56px;
    margin-inline: 4px;
    padding-inline: 10px;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .brand {
    gap: 7px;
  }

  .brand-leaf {
    width: 9px;
    height: 19px;
  }

  .brand-leaf::after {
    left: 7px;
    width: 7px;
    height: 16px;
  }

  h1 {
    font-size: 1.46rem;
  }

  .header-actions {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .audio-toggle {
    gap: 0;
    padding: 6px;
    font-size: 0;
  }

  .audio-toggle span {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }

  .quiet {
    padding: 8px 9px;
    font-size: 0.71rem;
  }

  .shell {
    padding: 6px;
  }

  .start {
    justify-content: flex-start;
    padding: max(20px, 7vh) 20px 15px;
  }

  .start .hero-copy h2 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 10vw, 2.35rem);
  }

  .hero-copy > p {
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .name-field {
    margin-top: 13px;
    gap: 5px;
  }

  input {
    padding: 10px 12px;
  }

  .start .launch {
    margin-top: 13px;
    padding: 11px 19px;
  }

  .rover-scene {
    right: 10px;
    bottom: 6px;
    width: 90px;
    min-height: 90px;
    margin: 0;
  }

  .hero-byte {
    width: 88px;
  }

  .speech {
    display: none;
  }

  .mission-map {
    grid-template-columns: 1fr;
  }

  .finish {
    padding: 18px 20px 16px;
    overflow-y: auto;
  }

  .trophy {
    width: 38px;
    height: 38px;
    margin-bottom: 6px;
    font-size: 18px;
  }

  .graduate-pet {
    width: 100px;
    height: 104px;
    margin-bottom: 8px;
  }

  .finish h2 {
    margin: 8px auto 6px;
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .finish > p:not(.pill) {
    font-size: 0.85rem;
  }

  .badge-rack {
    grid-template-columns: 1fr 1fr;
    margin: 16px auto;
    gap: 8px;
  }

  .badge {
    padding: 10px 6px;
  }

  .final-tips {
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .final-tips h3 {
    font-size: 0.95rem;
    margin-bottom: 4px;
  }

  .final-tips p {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .play {
    padding: 10px 13px;
  }

  .game {
    padding: 5px;
    border-radius: 16px;
  }

  .journey-toggle {
    margin-bottom: 7px;
    padding: 5px 10px 5px 6px;
    font-size: 0.75rem;
  }

  .journey-toggle span {
    width: 20px;
    height: 20px;
  }

  .progress-wrap {
    gap: 9px;
    font-size: 0.73rem;
  }

  .progress-wrap span {
    padding: 6px 11px;
  }

  .mission-head {
    margin: 10px 0 10px;
    padding-right: 0;
    min-height: 74px;
  }

  .mission-head::after {
    width: 66px;
    height: 66px;
    top: -2px;
    opacity: 0.38;
  }

  .mission-head .kicker {
    margin-bottom: 5px;
    font-size: 0.62rem;
  }

  .mission-head h2 {
    margin-bottom: 7px;
    font-size: 2.05rem;
  }

  .mission-head p:not(.kicker) {
    max-width: calc(100% - 72px);
    font-size: 0.81rem;
    line-height: 1.25;
  }

  .mission-head.byte-is-teaching {
    min-height: 176px;
  }

  .mission-head.byte-is-teaching::after {
    top: -2px;
    right: 0;
  }

  .byte-coach {
    position: absolute;
    top: 78px;
    left: 0;
    right: auto;
    width: calc(100% - 42px);
    min-width: 0;
    margin: 0;
    padding: 9px 11px 9px;
  }

  .byte-coach::before {
    top: -15px;
    right: 18px;
    bottom: auto;
    transform: rotate(-135deg) skew(-9deg);
  }

  .mission-head.byte-is-teaching .byte-coach {
    position: absolute;
    top: 78px;
    left: 0;
    right: auto;
  }

  .mission-head.byte-is-teaching .byte-coach::before {
    right: 18px;
  }

  .byte-coach-label {
    margin-bottom: 3px !important;
    font-size: 0.58rem !important;
  }

  .byte-coach strong {
    margin-bottom: 2px;
    font-size: 0.78rem;
  }

  .byte-coach #byteCoachText {
    font-size: 0.7rem;
    line-height: 1.28;
  }

  .briefing h3 {
    margin-bottom: 7px;
    font-size: 1.16rem;
    line-height: 1.15;
  }

  .briefing-definition {
    margin-bottom: 9px;
    font-size: 0.76rem;
    line-height: 1.32;
  }

  .round {
    margin-bottom: 7px;
    font-size: 0.6rem;
  }

  .lesson-card.remember {
    margin-inline: 0;
    padding: 15px 12px 9px;
    min-height: 0;
    font-size: 0.73rem;
    line-height: 1.3;
  }

  .example-card {
    grid-template-columns: 103px 1fr;
    gap: 10px;
    padding: 16px 10px 8px;
    font-size: 0.72rem;
    line-height: 1.3;
  }

  .lesson-visual {
    margin: 0;
  }

  .lesson-visual img {
    border-width: 3px;
    max-height: 79px;
  }

  .lesson-visual figcaption {
    display: none;
  }

  .lesson-card span {
    top: -8px;
    left: 10px;
    padding: 3px 9px;
    font-size: 0.56rem;
  }

  .lesson-cards {
    gap: 9px;
  }

  .lesson-button {
    min-width: 0;
    margin-top: 10px;
    padding: 9px 18px;
    font-size: 0.83rem;
  }

  .challenge h3 {
    margin-bottom: 10px;
    font-size: 1.06rem;
    line-height: 1.25;
  }

  .choices {
    gap: 7px;
  }

  .choice {
    padding: 10px 12px;
    font-size: 0.79rem;
    line-height: 1.28;
  }

  .feedback {
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 0.72rem;
  }

  .next {
    margin-top: 9px;
    padding: 9px 15px;
    font-size: 0.8rem;
  }

  .travel-note {
    padding: 26px 21px 22px;
  }

  .travel-actions {
    display: grid;
  }
}

@media (max-width: 620px) and (max-height: 700px) {
  .finish {
    padding: 10px 16px 12px;
  }

  .trophy {
    width: 30px;
    height: 30px;
    margin-bottom: 4px;
    font-size: 14px;
  }

  .graduate-pet {
    width: 72px;
    height: 76px;
    margin-bottom: 4px;
  }

  .finish h2 {
    margin: 4px auto 4px;
    font-size: 1.4rem;
  }

  .badge-rack {
    margin: 10px auto;
    gap: 6px;
  }

  .badge {
    padding: 7px 4px;
    font-size: 0.75rem;
  }

  .final-tips {
    padding: 8px 12px;
    margin-bottom: 8px;
  }
}

@media (min-width: 931px) and (max-height: 1100px) {
  .header {
    flex-basis: 58px;
    height: 58px;
  }

  .shell {
    padding: 12px;
  }

  .game {
    grid-template-columns: 280px minmax(0, 1fr);
    padding: 8px;
    gap: 10px;
  }

  .dashboard {
    padding: 12px;
  }

  .pilot {
    padding: 7px;
    grid-template-columns: 64px 1fr;
  }

  .companion {
    width: 62px;
    height: 68px;
  }

  .explorer-name {
    margin: 8px 0;
    padding: 6px 9px;
  }

  .scoreboard {
    margin-bottom: 12px;
    padding: 7px 5px;
  }

  .scoreboard strong {
    font-size: 1.18rem;
  }

  .side-heading {
    margin-bottom: 7px;
  }

  .mission-map {
    gap: 8px;
    padding-bottom: 8px;
  }

  .map-card {
    min-height: 44px;
    padding: 5px 9px;
    gap: 8px;
  }

  .map-card span {
    width: 29px;
    height: 29px;
  }

  .map-card strong {
    font-size: 0.91rem;
  }

  .map-card small {
    font-size: 0.65rem;
  }

  .notebook {
    margin-top: 2px;
    padding: 9px 10px;
  }

  .notebook p {
    font-size: 0.72rem;
    line-height: 1.32;
  }

  .play {
    padding: 15px 42px 14px;
  }

  .progress-wrap span {
    padding: 6px 14px;
  }

  .mission-head {
    margin: 11px 0 12px;
    min-height: 82px;
  }

  .mission-head::after {
    width: 88px;
    height: 88px;
    top: -5px;
  }

  .mission-head .kicker {
    margin-bottom: 5px;
  }

  .mission-head h2 {
    margin-bottom: 8px;
    font-size: 2.65rem;
  }

  .mission-head p:not(.kicker) {
    font-size: 0.88rem;
  }

  .round {
    margin-bottom: 7px;
  }

  .briefing h3 {
    margin-bottom: 8px;
    font-size: 1.48rem;
  }

  .briefing-definition {
    margin-bottom: 10px;
    font-size: 0.87rem;
    line-height: 1.4;
  }

  .lesson-cards {
    grid-template-columns: minmax(450px, 1.7fr) minmax(215px, 0.9fr);
    align-items: stretch;
    gap: 12px;
  }

  .example-card {
    grid-template-columns: 180px 1fr;
    gap: 15px;
    padding: 17px 14px 11px;
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .lesson-visual img {
    border-width: 4px;
    max-height: 136px;
  }

  .lesson-visual figcaption {
    font-size: 0.67rem;
  }

  .lesson-card span {
    top: -9px;
    padding: 3px 10px;
    font-size: 0.62rem;
  }

  .lesson-card.remember {
    margin: 0;
    padding: 22px 13px 10px;
    font-size: 0.79rem;
    line-height: 1.42;
  }

  .lesson-button {
    margin-top: 12px;
    padding: 10px 19px;
    min-width: 185px;
    font-size: 0.88rem;
  }

  .challenge h3 {
    max-width: 720px;
    margin-bottom: 13px;
    font-size: 1.36rem;
  }

  .choices {
    gap: 8px;
  }

  .choice {
    padding: 11px 15px;
    font-size: 0.86rem;
  }

  .next {
    margin-top: 10px;
    padding: 10px 18px;
  }

  .mission-head.byte-is-teaching {
    min-height: 162px;
  }

  .mission-head.byte-is-teaching::after {
    width: 74px;
    height: 74px;
    top: auto;
    bottom: 4px;
    right: 12px;
  }

  .mission-head.byte-is-teaching .byte-coach {
    top: 0;
    right: 4px;
    width: 310px;
    min-width: 0;
    padding: 10px 12px;
  }

  .mission-head.byte-is-teaching .byte-coach::before {
    right: 49px;
  }

  .byte-coach strong {
    font-size: 0.83rem;
  }

  .byte-coach #byteCoachText {
    font-size: 0.73rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
