:root {
  --ink: #172344;
  --blue: #2457c5;
  --sky: #59c7f2;
  --yellow: #ffd54a;
  --green: #37b56c;
  --red: #ef5b5b;
  --paper: rgba(255, 255, 255, 0.94);
  --shadow: 0 18px 46px rgba(22, 48, 92, 0.22);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  background: #74d7f5;
}

button { font: inherit; }

button:focus-visible {
  outline: 5px solid #161616;
  outline-offset: 4px;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(180deg, rgba(90, 199, 242, .24), rgba(19, 78, 155, .18)),
    url("transport-town-bg.png");
  background-size: cover;
  background-position: center;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(7,45,93,.15));
}

.shell {
  min-height: 100vh;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px clamp(18px, 3vw, 50px) 24px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
}

.brand {
  border: 0;
  border-radius: 18px;
  padding: 8px 18px 8px 10px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 7px 18px rgba(18,60,109,.18);
  color: var(--blue);
  font-weight: 900;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--yellow);
  font-size: 1.8rem;
}

.top-actions { display: flex; gap: 10px; }

.icon-btn {
  width: 54px;
  height: 54px;
  border: 3px solid rgba(255,255,255,.84);
  border-radius: 16px;
  background: rgba(23,35,68,.78);
  color: white;
  cursor: pointer;
  font-size: 1.55rem;
  box-shadow: 0 6px 15px rgba(10,44,87,.22);
}

.screen { display: none; flex: 1; }
.screen.active { display: flex; }

.home-screen {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: clamp(18px, 3vh, 32px);
  padding: 18px 0 8px;
}

.home-copy {
  text-align: center;
  color: white;
  text-shadow: 0 4px 14px rgba(18,61,109,.42);
}

.eyebrow {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--yellow);
  color: #273157;
  font-weight: 900;
  letter-spacing: .1em;
  font-size: .88rem;
  text-shadow: none;
}

.home-copy h1 {
  margin: 12px 0 6px;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: .98;
  letter-spacing: -.035em;
}

.home-copy p {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.05rem, 2vw, 1.5rem);
}

.mode-grid {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mode-card {
  min-height: 120px;
  border: 5px solid rgba(255,255,255,.88);
  border-radius: 26px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 76px 1fr 30px;
  align-items: center;
  gap: 15px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transform: translateY(0);
  transition: transform .16s ease, filter .16s ease;
}

.mode-card:hover { transform: translateY(-5px); filter: brightness(1.04); }
.mode-card:active { transform: translateY(1px) scale(.99); }
.mode-card.yellow { background: #ffd54a; }
.mode-card.green { background: #72dc91; }
.mode-card.blue { background: #83d8ff; }
.mode-card.purple { background: #cbb8ff; }
.mode-card.red { background: #ff8a7e; }

.mode-icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.74);
  border-radius: 22px;
  font-size: 3rem;
}

.mode-text { display: flex; flex-direction: column; gap: 5px; }
.mode-text strong { font-size: clamp(1.3rem, 2.1vw, 2rem); line-height: 1.05; }
.mode-text small { font-size: clamp(.9rem, 1.35vw, 1.12rem); font-weight: 800; opacity: .78; }
.mode-arrow { font-size: 3.2rem; line-height: 1; font-weight: 900; }

.home-parade {
  display: flex;
  gap: clamp(12px, 3vw, 38px);
  font-size: clamp(2rem, 4vw, 4rem);
  filter: drop-shadow(0 7px 6px rgba(19,54,99,.24));
}

.home-parade span { animation: bob 2.4s ease-in-out infinite; }
.home-parade span:nth-child(2) { animation-delay: -.4s; }
.home-parade span:nth-child(3) { animation-delay: -.8s; }
.home-parade span:nth-child(4) { animation-delay: -1.2s; }
.home-parade span:nth-child(5) { animation-delay: -1.6s; }
.home-parade span:nth-child(6) { animation-delay: -2s; }

.game-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0 0;
}

.game-status {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 15px;
  align-items: center;
  color: white;
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(20,51,95,.5);
}

.round-label { font-size: 1.1rem; }
.back-menu-btn {
  min-height: 42px;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 13px;
  padding: 6px 13px;
  background: rgba(23,35,68,.82);
  color: white;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(18,52,95,.2);
}
.progress-track { height: 18px; border: 4px solid white; border-radius: 999px; background: rgba(20,47,91,.28); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: var(--yellow); transition: width .35s ease; }
.score-pill { background: white; color: var(--ink); text-shadow: none; border-radius: 999px; padding: 8px 16px; font-size: 1.2rem; }

.game-card {
  width: min(1040px, 100%);
  min-height: min(670px, calc(100vh - 160px));
  background: var(--paper);
  border: 7px solid rgba(255,255,255,.72);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.prompt-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mode-badge { border-radius: 999px; padding: 7px 13px; background: #dce7ff; color: var(--blue); font-weight: 900; letter-spacing: .08em; font-size: .83rem; }

.listen-btn {
  min-height: 48px;
  border: 0;
  border-radius: 15px;
  background: var(--blue);
  color: white;
  padding: 8px 18px;
  font-weight: 900;
  cursor: pointer;
}

.game-card h2 {
  margin: 10px 0 2px;
  text-align: center;
  font-size: clamp(2rem, 4.2vw, 3.9rem);
  letter-spacing: -.025em;
  line-height: 1.06;
}

.question-helper { margin: 4px 0 8px; text-align: center; font-size: clamp(.95rem, 1.5vw, 1.18rem); font-weight: 700; color: #54617e; }

.vehicle-stage {
  flex: 1;
  min-height: 215px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.vehicle-emoji {
  position: relative;
  z-index: 2;
  font-size: clamp(7rem, 15vh, 11.5rem);
  line-height: 1;
  filter: drop-shadow(0 12px 8px rgba(25,46,77,.18));
  animation: arrive .4s cubic-bezier(.18,.9,.28,1.2);
}

.vehicle-emoji.vehicle-picture {
  width: min(480px, 78vw);
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 0;
  background-color: #f7fbff;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 18px;
  filter: none;
}

.game-card[data-mode="identify"] {
  min-height: 0;
}

.game-card[data-mode="identify"] .vehicle-stage {
  flex: 0 0 clamp(190px, 27vh, 260px);
  min-height: 0;
  margin: 2px 0 8px;
}

.vehicle-name {
  z-index: 2;
  margin-top: 8px;
  color: var(--blue);
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  font-weight: 1000;
  letter-spacing: .1em;
}

.vehicle-definition {
  display: none;
  z-index: 2;
  width: min(720px, 92%);
  margin: 10px 0 0;
  color: #43516f;
  text-align: center;
  font-size: clamp(1rem, 1.55vw, 1.2rem);
  font-weight: 700;
  line-height: 1.35;
}

.vehicle-definition.visible { display: block; }

.vehicle-shadow { position: absolute; bottom: 42px; width: 190px; height: 25px; border-radius: 50%; background: rgba(32,57,91,.15); filter: blur(5px); }

.sound-rings { position: absolute; inset: 0; display: none; place-items: center; }
.sound-rings.playing { display: grid; }
.sound-rings i { position: absolute; width: 130px; height: 130px; border: 9px solid #53b9ea; border-radius: 50%; animation: ring 1.15s ease-out infinite; opacity: 0; }
.sound-rings i:nth-child(2) { animation-delay: .25s; }
.sound-rings i:nth-child(3) { animation-delay: .5s; }

.answers {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.answer-btn {
  min-height: 104px;
  border: 4px solid #d8e1f0;
  border-bottom-width: 8px;
  border-radius: 22px;
  background: white;
  color: var(--ink);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 900;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.answer-photo-icon {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.answer-btn:hover { transform: translateY(-3px); border-color: #8da9df; }
.answer-btn:active { transform: translateY(2px); border-bottom-width: 4px; }
.answer-btn .answer-icon { font-size: clamp(2.2rem, 4vw, 3.6rem); line-height: 1; }
.answer-btn.correct { border-color: #218c51; background: #d9f7e4; animation: pop .35s ease; }
.answer-btn.wrong { border-color: #d23e49; background: #ffe0e0; animation: shake .35s ease; }
.answer-btn:disabled { cursor: default; }

.feedback {
  min-height: 44px;
  margin-top: 10px;
  text-align: center;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 1000;
}

.feedback.good { color: #147843; }
.feedback.try { color: #b52d3c; }

.next-btn { min-width: 230px; min-height: 52px; border: 0; border-radius: 16px; background: var(--green); color: white; font-weight: 1000; font-size: 1.2rem; cursor: pointer; box-shadow: 0 6px 0 #167442; }

.teacher-strip { border-radius: 13px; padding: 7px 14px; background: rgba(16,37,78,.76); color: rgba(255,255,255,.9); font-size: .82rem; display: flex; gap: 7px; align-items: center; }
kbd { min-width: 24px; padding: 2px 6px; border-radius: 5px; color: #273157; background: white; box-shadow: 0 2px 0 #aeb8c9; font: 800 .75rem system-ui, sans-serif; text-align: center; }
.separator { opacity: .55; }

.results-screen { align-items: center; justify-content: center; }
.results-card { width: min(720px, 100%); border: 7px solid rgba(255,255,255,.78); border-radius: 36px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); padding: clamp(30px, 6vw, 64px); text-align: center; }
.result-burst { font-size: 6rem; animation: pop .5s ease; }
.results-card h2 { margin: 12px 0 5px; font-size: clamp(2.2rem, 5vw, 4.3rem); line-height: 1; }
.big-stars { margin: 20px 0 8px; font-size: clamp(3rem, 7vw, 5.5rem); letter-spacing: .08em; filter: drop-shadow(0 5px 3px rgba(107,75,0,.2)); }
.result-score { font-size: 1.5rem; margin: 12px 0 5px; }
.results-card > p:last-of-type { font-size: 1.2rem; margin: 0 0 28px; color: #53617d; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.primary-btn, .secondary-btn { min-height: 58px; border-radius: 17px; padding: 12px 24px; font-weight: 1000; font-size: 1.12rem; cursor: pointer; }
.primary-btn { border: 0; background: var(--blue); color: white; box-shadow: 0 6px 0 #173b8b; }
.secondary-btn { border: 3px solid #cbd7ea; background: white; color: var(--ink); }

.confetti { pointer-events: none; position: fixed; inset: 0; z-index: 20; overflow: hidden; }
.confetti-piece { position: absolute; top: -30px; width: 13px; height: 25px; border-radius: 3px; animation: fall 1.7s ease-in forwards; }

@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes arrive { from { transform: translateX(-80px) scale(.7); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }
@keyframes ring { 0% { transform: scale(.45); opacity: .8; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes pop { 0% { transform: scale(.75); } 65% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-9px); } 75% { transform: translateX(9px); } }
@keyframes fall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(760deg); } }

@media (max-width: 760px) {
  .shell { padding: 10px 12px 16px; }
  .topbar { min-height: 58px; }
  .brand { padding: 5px 12px 5px 6px; }
  .brand-mark { width: 40px; height: 40px; }
  .icon-btn { width: 46px; height: 46px; }
  .mode-grid { grid-template-columns: 1fr; gap: 11px; }
  .mode-card { min-height: 88px; grid-template-columns: 58px 1fr 24px; border-width: 4px; border-radius: 20px; padding: 10px 14px; }
  .mode-icon { width: 58px; height: 58px; font-size: 2.3rem; border-radius: 16px; }
  .home-parade { display: none; }
  .game-status { grid-template-columns: auto 1fr auto; gap: 8px; }
  .back-menu-btn { grid-column: 1 / -1; justify-self: start; min-height: 36px; }
  .round-label { font-size: .8rem; }
  .game-card { min-height: calc(100vh - 135px); padding: 14px; border-radius: 25px; border-width: 4px; }
  .answers { grid-template-columns: 1fr; gap: 8px; }
  .answer-btn { min-height: 66px; }
  .vehicle-stage { min-height: 165px; }
  .teacher-strip { display: none; }
}

@media (max-height: 820px) and (min-width: 761px) {
  .shell { padding-top: 6px; padding-bottom: 8px; }
  .topbar { min-height: 52px; }
  .brand-mark { width: 40px; height: 40px; }
  .icon-btn { width: 46px; height: 46px; }
  .game-screen { gap: 8px; padding-top: 6px; }
  .game-card { min-height: 0; padding-block: 14px; }
  .game-card h2 { margin-top: 6px; font-size: clamp(1.8rem, 3.6vw, 3.05rem); }
  .question-helper { margin-block: 2px 4px; }
  .vehicle-stage { flex: 0 0 170px; min-height: 0; }
  .game-card[data-mode="identify"] .vehicle-stage { flex-basis: clamp(145px, 21vh, 175px); }
  .vehicle-emoji { font-size: 7rem; }
  .answer-btn { min-height: 78px; padding-block: 8px; }
  .feedback { min-height: 38px; margin-top: 6px; }
  .teacher-strip { padding-block: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition: none !important; }
}
