:root {
  --ink: #0b1019;
  --ink-soft: #18202d;
  --cream: #f7f1e8;
  --paper: #fffdf8;
  --red: #e3222a;
  --red-dark: #b91620;
  --yellow: #ffd43b;
  --blue: #78b7ff;
  --muted: #66707e;
  --line: rgba(11, 16, 25, 0.12);
  --shadow: 0 24px 60px rgba(11, 16, 25, 0.14);
  --radius-lg: 30px;
  --radius-md: 20px;
  --radius-sm: 12px;
  --nav-height: 74px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1.5rem);
}

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 16%, rgba(227, 34, 42, 0.06) 0 3px, transparent 4px) 0 0 / 34px 34px,
    var(--cream);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

::selection {
  color: var(--ink);
  background: var(--yellow);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  color: var(--ink);
  background: var(--yellow);
  font-weight: 800;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.65rem;
  color: var(--red);
  font-family: "Fredoka", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow span {
  display: inline-grid;
  min-width: 2rem;
  min-height: 2rem;
  place-items: center;
  padding: 0.2rem 0.45rem;
  border: 1px solid currentColor;
  border-radius: 999px;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem 1.2rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 5px 0 #b59417;
}

.button-primary:hover {
  box-shadow: 0 7px 0 #b59417;
}

.button-primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #b59417;
}

.button-icon {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-size: 0.64rem;
}

.button-ghost {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.button-ghost:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.button-dark {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
}

/* Hero */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: min(760px, 90vh);
  grid-template-columns: minmax(0, 0.88fr) minmax(420px, 1.12fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 7rem);
  overflow: hidden;
  padding: clamp(4.5rem, 8vw, 7.5rem) max(1.5rem, calc((100vw - 1180px) / 2));
  color: #fff;
  background: var(--ink);
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(118deg, transparent 0 62%, rgba(227, 34, 42, 0.18) 62% 64%, transparent 64% 100%),
    radial-gradient(circle at 76% 45%, rgba(227, 34, 42, 0.25), transparent 36%),
    linear-gradient(110deg, #0b1019 0%, #111b28 58%, #080c12 100%);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -3rem;
  right: -3rem;
  width: 27rem;
  height: 14rem;
  opacity: 0.1;
  background:
    conic-gradient(from 90deg at 1px 1px, transparent 90deg, #fff 0) 0 0 / 44px 44px;
  transform: rotate(-8deg);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 38rem;
}

.hero-eyebrow {
  color: #fff;
}

.hero-eyebrow span {
  border-color: var(--yellow);
  color: var(--ink);
  background: var(--yellow);
}

.hero h1 {
  max-width: 9ch;
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(3.4rem, 7vw, 6.7rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.88;
}

.hero h1 em {
  color: var(--red);
  font-style: normal;
}

.hero-lead {
  max-width: 34rem;
  margin: 1.6rem 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(1.05rem, 1.7vw, 1.24rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.hero-note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.55rem 0 0;
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-note span {
  color: #58d68d;
  font-size: 0.62rem;
}

.hero-visual {
  position: relative;
  min-width: 0;
}

.hero-photo-wrap {
  position: relative;
  z-index: 2;
  overflow: hidden;
  border: 8px solid #fff;
  border-radius: 8px 42px 8px 42px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg);
}

.hero-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 56%, rgba(11, 16, 25, 0.72));
  pointer-events: none;
}

.hero-photo-wrap img {
  display: block;
  width: 100%;
  height: clamp(330px, 39vw, 540px);
  object-fit: cover;
  object-position: 61% center;
}

.hero-photo-tag {
  position: absolute;
  z-index: 2;
  right: 1.25rem;
  bottom: 1.1rem;
  display: flex;
  flex-direction: column;
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
}

.hero-photo-tag span {
  margin-bottom: 0.2rem;
  color: var(--yellow);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-number {
  position: absolute;
  z-index: 1;
  top: -6rem;
  left: -3.5rem;
  color: transparent;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(11rem, 22vw, 20rem);
  font-weight: 700;
  letter-spacing: -0.08em;
  line-height: 1;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.09);
}

.hero-sticker {
  position: absolute;
  z-index: 3;
  top: -2rem;
  right: -1.4rem;
  display: grid;
  width: 6.6rem;
  height: 6.6rem;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 0 0 4px var(--yellow);
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  transform: rotate(9deg);
}

/* Sticky navigation */
.nav-shell {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  min-height: var(--nav-height);
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2rem;
  padding: 0 max(1rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(11, 16, 25, 0.09);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 8px 28px rgba(11, 16, 25, 0.08);
  backdrop-filter: blur(16px);
}

.garage-mark {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
}

.garage-mark-badge {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border-radius: 10px 3px 10px 3px;
  color: #fff;
  background: var(--red);
  box-shadow: 3px 3px 0 var(--yellow);
  font-family: "Fredoka", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
}

.garage-mark-copy {
  display: flex;
  flex-direction: column;
  font-family: "Fredoka", sans-serif;
  line-height: 0.95;
  text-transform: uppercase;
}

.garage-mark-copy strong {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.garage-mark-copy small {
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.toc {
  display: flex;
  min-width: 0;
  justify-content: flex-end;
  gap: 0.25rem;
}

.toc a {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: #4b5563;
  font-family: "Fredoka", sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.toc a:hover {
  color: var(--ink);
  background: rgba(11, 16, 25, 0.05);
}

.toc a[aria-current="location"] {
  color: #fff;
  background: var(--ink);
}

.scroll-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  background: rgba(11, 16, 25, 0.07);
}

.scroll-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--yellow));
  transform: scaleX(var(--scroll-progress, 0));
  transform-origin: left;
}

/* Global section layout */
main {
  padding: 0 1.25rem 6rem;
}

.quick-stats,
.section {
  width: min(100%, 1180px);
  margin-right: auto;
  margin-left: auto;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
}

.stat {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 1.5rem;
  border-right: 1px solid var(--line);
}

.stat:first-child {
  padding-left: 0;
}

.stat:last-child {
  border-right: 0;
}

.stat strong {
  color: var(--red);
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1;
}

.stat span {
  max-width: 8rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.section {
  padding: clamp(4.75rem, 9vw, 7.75rem) 0;
}

.section-heading {
  max-width: 47rem;
  margin-bottom: 2.25rem;
}

.section-heading h2,
.quiz-intro h2 {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(2.4rem, 5vw, 4.7rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.section-heading > p:last-child,
.quiz-intro > p:not(.eyebrow) {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.section-heading-light h2 {
  color: #fff;
}

.section-heading-light > p:last-child {
  color: rgba(255, 255, 255, 0.65);
}

/* Generation explorer */
.roar-section {
  margin-top: 1rem;
  padding: clamp(3.4rem, 6vw, 5.5rem);
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 85% 0%, rgba(227, 34, 42, 0.24), transparent 28%),
    var(--ink);
  box-shadow: var(--shadow);
}

.generation-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.generation-chip {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.72);
  background: #151e2a;
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.generation-chip:hover {
  border-color: rgba(255, 212, 59, 0.68);
  transform: translateY(-3px);
}

.generation-chip img {
  display: block;
  width: 100%;
  height: 4.8rem;
  object-fit: cover;
  filter: saturate(0.72) brightness(0.72);
  transition: filter 160ms ease, transform 220ms ease;
}

.generation-chip > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem;
  padding: 0.55rem 0.6rem 0.65rem;
}

.generation-chip strong {
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-size: 0.95rem;
}

.generation-chip small {
  overflow: hidden;
  font-size: 0.58rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-chip.is-stingray::after {
  content: "S";
  position: absolute;
  top: 0.42rem;
  right: 0.42rem;
  display: grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--yellow);
  font-family: "Fredoka", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

.generation-chip.is-active {
  border-color: var(--yellow);
  color: #fff;
  background: var(--red);
  box-shadow: 0 0 0 2px rgba(255, 212, 59, 0.15);
}

.generation-chip.is-active img {
  filter: none;
  transform: scale(1.04);
}

.engine-lab {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.55fr);
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

.car-stage {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

.car-stage-image {
  position: relative;
  overflow: hidden;
  background: #d8dde4;
}

.car-stage-image::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 -80px 80px -80px rgba(11, 16, 25, 0.7);
  pointer-events: none;
}

.car-stage-image img {
  display: block;
  width: 100%;
  height: clamp(300px, 38vw, 470px);
  object-fit: cover;
  object-position: center;
}

.car-stage-pill {
  position: absolute;
  z-index: 2;
  top: 1rem;
  left: 1rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--ink);
  background: var(--yellow);
  font-family: "Fredoka", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.car-stage figcaption {
  min-height: 11.7rem;
  padding: 1.5rem 1.65rem 1.7rem;
}

.car-years {
  margin: 0;
  color: var(--red);
  font-family: "Fredoka", sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.car-stage h3 {
  margin: 0.2rem 0 0.45rem;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  letter-spacing: -0.03em;
  line-height: 1;
}

.car-stage figcaption > p:last-child {
  max-width: 39rem;
  margin: 0;
  color: #4d5664;
}

.sound-console {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 1.6rem;
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 24px 100%,
    var(--red-dark);
}

.sound-console-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.console-label {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-light {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
}

.live-light i {
  display: block;
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #72ed9a;
  box-shadow: 0 0 0 4px rgba(114, 237, 154, 0.14);
}

.sound-wave {
  display: flex;
  height: 5rem;
  align-items: center;
  justify-content: center;
  gap: 0.36rem;
  margin: 1rem 0 0.8rem;
}

.sound-wave span {
  width: 0.38rem;
  height: 22%;
  border-radius: 999px;
  background: var(--yellow);
  transform-origin: center;
}

.sound-wave span:nth-child(2),
.sound-wave span:nth-child(8) { height: 44%; }
.sound-wave span:nth-child(3),
.sound-wave span:nth-child(7) { height: 72%; }
.sound-wave span:nth-child(4),
.sound-wave span:nth-child(6) { height: 54%; }
.sound-wave span:nth-child(5) { height: 92%; }

.sound-console.is-playing .sound-wave span {
  animation: sound-bounce 420ms ease-in-out infinite alternate;
}

.sound-console.is-playing .sound-wave span:nth-child(2n) { animation-delay: -180ms; }
.sound-console.is-playing .sound-wave span:nth-child(3n) { animation-delay: -300ms; }

@keyframes sound-bounce {
  from { transform: scaleY(0.35); opacity: 0.55; }
  to { transform: scaleY(1.1); opacity: 1; }
}

.sound-copy h3 {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: 1.55rem;
  line-height: 1.1;
}

.sound-copy p {
  margin: 0.55rem 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  line-height: 1.5;
}

.roar-button {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  margin-top: 1.35rem;
  padding: 0.65rem;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 5px 0 rgba(86, 63, 0, 0.55);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.roar-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 rgba(86, 63, 0, 0.55);
}

.roar-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(86, 63, 0, 0.55);
}

.roar-button-icon {
  display: grid;
  flex: 0 0 3.25rem;
  height: 3.25rem;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
}

.roar-button-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}

.roar-button-copy strong {
  font-family: "Fredoka", sans-serif;
  font-size: 1rem;
}

.roar-button-copy small {
  margin-top: 0.18rem;
  font-size: 0.66rem;
  font-weight: 700;
  opacity: 0.68;
}

.sound-console.is-playing .roar-button {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.5);
}

.sound-console.is-playing .roar-button-icon {
  color: var(--ink);
  background: var(--yellow);
}

.sound-credit {
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.67rem;
  line-height: 1.45;
}

.sound-credit a {
  color: #fff;
  font-weight: 700;
}

/* Time machine */
.milestone-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.milestone-card {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(150px, 0.72fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(11, 16, 25, 0.08);
}

.milestone-card figure {
  min-height: 100%;
  margin: 0;
  overflow: hidden;
}

.milestone-card img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  transition: transform 300ms ease;
}

.milestone-card:hover img {
  transform: scale(1.035);
}

.milestone-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem;
}

.milestone-year {
  align-self: flex-start;
  padding: 0.3rem 0.55rem;
  border-radius: 7px;
  color: #fff;
  background: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

.milestone-copy h3 {
  margin: 0.75rem 0 0.45rem;
  font-family: "Fredoka", sans-serif;
  font-size: 1.45rem;
  line-height: 1.05;
}

.milestone-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.5;
}

.milestone-card-red .milestone-year {
  background: var(--red);
}

.milestone-card-yellow .milestone-year {
  color: var(--ink);
  background: var(--yellow);
}

.stingray-story {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  overflow: hidden;
  margin-top: 1.25rem;
  padding: clamp(2.2rem, 5vw, 4.5rem);
  border-radius: var(--radius-md);
  background: var(--yellow);
}

.stingray-story::after {
  content: "";
  position: absolute;
  right: -3rem;
  bottom: -7rem;
  width: 17rem;
  height: 17rem;
  border: 2px solid rgba(11, 16, 25, 0.1);
  border-radius: 50%;
  box-shadow: 0 0 0 2rem rgba(11, 16, 25, 0.035), 0 0 0 4rem rgba(11, 16, 25, 0.02);
}

.stingray-mark {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -0.07em;
  line-height: 0.66;
  transform: rotate(-5deg);
}

.stingray-mark strong {
  margin-left: 1.2em;
  color: var(--red);
  font-size: 1.18em;
}

.stingray-story > div:last-child {
  position: relative;
  z-index: 1;
}

.stingray-story .eyebrow {
  color: var(--ink);
}

.stingray-story h3 {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.stingray-story > div:last-child > p:last-child {
  max-width: 39rem;
  margin: 1rem 0 0;
}

.all-generations {
  margin-top: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.all-generations summary {
  position: relative;
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 4rem 1rem 1.35rem;
  cursor: pointer;
  list-style: none;
}

.all-generations summary::-webkit-details-marker {
  display: none;
}

.all-generations summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 1.3rem;
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 1.4rem;
  font-weight: 600;
  transform: translateY(-50%);
}

.all-generations[open] summary::after {
  content: "−";
}

.all-generations summary span {
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.all-generations summary small {
  color: var(--muted);
}

.generation-map {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.6rem;
  padding: 0 1.25rem 1.35rem;
}

.generation-map > div {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem;
  border-radius: 12px;
  background: #f1ede6;
}

.generation-map strong {
  font-family: "Fredoka", sans-serif;
  font-size: 1.3rem;
}

.generation-map span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
}

.generation-map small {
  margin-top: 0.5rem;
  color: var(--ink);
  font-size: 0.68rem;
  line-height: 1.25;
}

.generation-map .map-stingray {
  color: #fff;
  background: var(--red);
}

.generation-map .map-stingray span,
.generation-map .map-stingray small {
  color: rgba(255, 255, 255, 0.76);
}

/* Tiny cars */
.tiny-section {
  width: min(100%, 1280px);
}

.tiny-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(3rem, 7vw, 7rem);
}

.tiny-photo {
  position: relative;
  margin: 0;
}

.tiny-photo::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -1rem 2rem 1rem -1rem;
  border-radius: 28px 8px 28px 8px;
  background: var(--red);
  transform: rotate(-3deg);
}

.tiny-photo-frame {
  overflow: hidden;
  border: 7px solid var(--paper);
  border-radius: 8px 30px 8px 30px;
  background: #fff;
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
}

.tiny-photo img {
  display: block;
  width: 100%;
  height: auto;
}

.tiny-photo figcaption {
  position: absolute;
  right: -1rem;
  bottom: -1.2rem;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  transform: rotate(-2deg);
}

.tiny-copy .section-heading {
  margin-bottom: 1.4rem;
}

.challenge-list {
  display: grid;
  gap: 0.65rem;
}

.challenge-list article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.challenge-list article > span {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

.challenge-list article:nth-child(2) > span {
  background: var(--red);
}

.challenge-list article:nth-child(3) > span {
  color: var(--ink);
  background: var(--yellow);
}

.challenge-list h3 {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: 1rem;
}

.challenge-list p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.pit-stop {
  margin-top: 0.8rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(11, 16, 25, 0.06);
  font-size: 0.84rem;
}

.pit-stop summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  cursor: pointer;
  font-weight: 800;
}

.pit-stop p {
  margin: 0.65rem 0 0;
  color: var(--muted);
}

/* Coloring studio */
.coloring-section {
  padding: clamp(3.4rem, 6vw, 5.5rem);
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 8% 18%, rgba(255, 212, 59, 0.15), transparent 18%),
    linear-gradient(135deg, #b91620 0%, #e3222a 55%, #bd131c 100%);
  box-shadow: var(--shadow);
}

.coloring-section .eyebrow {
  color: var(--yellow);
}

.coloring-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 1.25rem;
}

.coloring-preview-card {
  min-width: 0;
  overflow: hidden;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 22px 54px rgba(75, 3, 8, 0.28);
}

.coloring-preview-paper {
  padding: clamp(0.75rem, 2vw, 1.5rem);
  background:
    linear-gradient(90deg, rgba(11, 16, 25, 0.035) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(rgba(11, 16, 25, 0.035) 1px, transparent 1px) 0 0 / 18px 18px,
    #eae6dd;
}

.coloring-preview-paper img {
  display: block;
  width: 100%;
  height: clamp(320px, 46vw, 590px);
  border: 1px solid rgba(11, 16, 25, 0.12);
  background: #fff;
  box-shadow: 0 8px 28px rgba(11, 16, 25, 0.14);
  object-fit: contain;
}

.coloring-preview-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 1.4rem;
  color: var(--ink);
}

.coloring-label {
  margin: 0;
  color: var(--red);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.coloring-preview-copy h3 {
  margin: 0.15rem 0 0.25rem;
  font-family: "Fredoka", sans-serif;
  font-size: 1.55rem;
  line-height: 1;
}

.coloring-preview-copy > div:first-child > p:last-child {
  max-width: 27rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.coloring-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.coloring-actions .button {
  min-height: 44px;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
}

.text-link {
  color: var(--red-dark);
  font-size: 0.73rem;
  font-weight: 800;
}

.coloring-chooser-wrap {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  background: rgba(11, 16, 25, 0.26);
}

.coloring-chooser-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.coloring-chooser-head h3 {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: 1rem;
}

.surprise-button {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
}

.surprise-button:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.coloring-chooser {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  overflow-y: auto;
  padding: 0.15rem;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.coloring-thumb {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-align: left;
}

.coloring-thumb img {
  display: block;
  width: 100%;
  height: 5.2rem;
  padding: 0.2rem;
  background: #fff;
  object-fit: contain;
  opacity: 0.82;
}

.coloring-thumb span {
  display: block;
  overflow: hidden;
  padding: 0.42rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coloring-thumb:hover {
  border-color: rgba(255, 212, 59, 0.5);
}

.coloring-thumb.is-active {
  border-color: var(--yellow);
  color: var(--ink);
  background: var(--yellow);
}

.coloring-thumb.is-active img {
  opacity: 1;
}

/* Game garage */
.games-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(3.4rem, 6vw, 5.5rem);
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 212, 59, 0.18), transparent 24%),
    linear-gradient(145deg, #111b28 0%, var(--ink) 58%, #15151c 100%);
  box-shadow: var(--shadow);
}

.games-section::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.075;
  background:
    linear-gradient(90deg, #fff 1px, transparent 1px) 0 0 / 38px 38px,
    linear-gradient(#fff 1px, transparent 1px) 0 0 / 38px 38px;
  pointer-events: none;
  transform: perspective(420px) rotateX(58deg) scale(1.35) translateY(24%);
  transform-origin: center bottom;
}

.games-section .section-heading {
  position: relative;
  z-index: 1;
}

.games-section .section-heading h2 {
  color: #fff;
}

.games-section .section-heading > p:last-child {
  color: rgba(255, 255, 255, 0.68);
}

.games-section .eyebrow {
  color: var(--yellow);
}

.game-tabs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.055);
}

.game-tab {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border: 2px solid transparent;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  cursor: pointer;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  line-height: 1.15;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.game-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.game-tab.is-active {
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 4px 0 #a9870d;
}

.game-tab-icon {
  display: grid;
  flex: 0 0 2.15rem;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-size: 1.05rem;
  line-height: 1;
}

.game-tab.is-active .game-tab-icon {
  color: #fff;
  background: var(--red);
}

.game-tab > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  text-align: left;
}

.game-tab strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-tab small {
  margin-top: 0.1rem;
  font-family: "Nunito", sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  opacity: 0.7;
}

.game-panels {
  position: relative;
  z-index: 1;
}

.game-panel {
  display: none;
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.game-panel.is-active {
  display: block;
  animation: game-panel-in 260ms ease both;
}

.game-panel[hidden] {
  display: none !important;
}

@keyframes game-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.game-card-head h3 {
  margin: 0.12rem 0 0;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.game-card-head p:not(.game-kicker):not(.game-difficulty) {
  max-width: 38rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.game-kicker {
  margin: 0;
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.game-difficulty {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.42rem 0.68rem;
  border-radius: 999px;
  color: var(--ink);
  background: #ece7df;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.game-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  line-height: 1.1;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.game-button:hover {
  color: #fff;
  background: var(--ink);
  transform: translateY(-2px);
}

.game-button:active {
  transform: translateY(1px);
}

.game-button-primary {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
  box-shadow: 0 4px 0 var(--red-dark);
}

.game-button-primary:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
  box-shadow: 0 6px 0 #870f17;
}

.game-button:disabled,
.game-button:disabled:hover {
  border-color: #b8b2aa;
  color: #858b93;
  background: #dedad3;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.game-status {
  min-height: 1.6rem;
  margin: 0.85rem 0 0;
  color: var(--red-dark);
  font-family: "Fredoka", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.game-stats > * {
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  color: #4d5664;
  background: #f0ece5;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.25;
}

.game-stats strong {
  color: var(--red-dark);
}

.game-tab:focus-visible,
.game-button:focus-visible,
.puzzle-tile:focus-visible,
.car-part:focus-visible,
.build-slot:focus-visible,
.build-reset:focus-visible {
  position: relative;
  z-index: 12;
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(11, 16, 25, 0.72);
}

/* Photo puzzle */
.puzzle-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.52fr) minmax(300px, 1fr);
  align-items: start;
  gap: clamp(1.2rem, 4vw, 3rem);
}

.puzzle-reference {
  min-width: 0;
  margin: 0;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f1ede6;
}

.puzzle-reference img {
  display: block;
  width: 100%;
  aspect-ratio: 40 / 21;
  border-radius: 12px;
  background: #d9dde2;
  object-fit: cover;
}

.puzzle-reference figcaption,
.puzzle-reference > p {
  margin: 0.65rem 0.2rem 0.1rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
}

.puzzle-board {
  position: relative;
  isolation: isolate;
  display: grid;
  width: min(100%, 34rem);
  aspect-ratio: 40 / 21;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 4px;
  justify-self: center;
  overflow: hidden;
  padding: 4px;
  border: 4px solid var(--ink);
  border-radius: 18px;
  background: var(--ink);
  box-shadow: 0 13px 30px rgba(11, 16, 25, 0.18);
}

.puzzle-tile {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background-color: #d9dde2;
  background-image: url("images/c8-stingray.jpg");
  background-repeat: no-repeat;
  background-size: 300% 300%;
  cursor: pointer;
  transition: filter 130ms ease, transform 130ms ease;
}

.puzzle-tile:hover {
  z-index: 1;
  filter: saturate(1.12) brightness(1.05);
  transform: scale(0.965);
}

.puzzle-blank {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.13) 0 2px, transparent 3px) 0 0 / 15px 15px,
    #202b39;
  cursor: default;
}

.puzzle-blank:hover {
  filter: none;
  transform: none;
}

.puzzle-board::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 4px;
  border-radius: 10px;
  background: #d9dde2 url("images/c8-stingray.jpg") center / 100% 100% no-repeat;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.puzzle-board.is-peeking::after,
.puzzle-board.is-solved::after {
  opacity: 1;
  transform: scale(1);
}

.puzzle-board.is-peeking::after {
  pointer-events: auto;
}

.puzzle-board.is-solved {
  border-color: #1f9d55;
  box-shadow: 0 0 0 6px rgba(31, 157, 85, 0.18), 0 16px 34px rgba(11, 16, 25, 0.2);
  animation: puzzle-finish 520ms ease both;
}

.puzzle-board.is-solved .puzzle-tile {
  filter: saturate(1.12) brightness(1.04);
}

@keyframes puzzle-finish {
  50% { transform: scale(1.018) rotate(0.25deg); }
}

.puzzle-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Build-a-Stingray */
.build-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.45fr) minmax(360px, 1fr);
  align-items: stretch;
  gap: clamp(1.2rem, 3vw, 2rem);
}

.parts-tray {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f1ede6;
}

.car-part {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border: 2px solid transparent;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 0 #d4cec4;
  cursor: pointer;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  text-align: left;
  transition: border-color 150ms ease, color 150ms ease, opacity 150ms ease, transform 150ms ease;
}

.car-part:hover {
  border-color: rgba(227, 34, 42, 0.45);
  transform: translateY(-2px);
}

.car-part.is-selected {
  border-color: var(--red);
  color: var(--red-dark);
  background: #fff5f5;
  box-shadow: 0 3px 0 rgba(185, 22, 32, 0.24);
}

.car-part.is-installed {
  opacity: 0.48;
  cursor: default;
  text-decoration: line-through;
  transform: none;
}

.car-part.is-installed::after {
  content: "✓";
  display: grid;
  flex: 0 0 1.55rem;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  margin-left: auto;
  border-radius: 50%;
  color: #fff;
  background: #1f9d55;
  font-size: 0.78rem;
  text-decoration: none;
}

.car-part > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.15;
}

.car-part small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-family: "Nunito", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
}

.part-icon {
  position: relative;
  display: block;
  flex: 0 0 3.1rem;
  width: 3.1rem;
  height: 2.25rem;
  color: var(--ink);
}

.part-icon-chassis::before {
  content: "";
  position: absolute;
  right: 0.2rem;
  bottom: 0.7rem;
  left: 0.2rem;
  height: 0.55rem;
  border: 3px solid currentColor;
  border-radius: 4px;
  background: var(--yellow);
}

.part-icon-chassis::after {
  content: "";
  position: absolute;
  right: 0.35rem;
  bottom: 0.28rem;
  left: 0.35rem;
  height: 0.45rem;
  border-right: 0.48rem solid currentColor;
  border-left: 0.48rem solid currentColor;
}

.part-icon-engine::before {
  content: "";
  position: absolute;
  inset: 0.42rem 0.52rem 0.28rem;
  border: 3px solid currentColor;
  border-radius: 5px;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 5px, #f2b91e 5px 8px);
  box-shadow: 0.42rem -0.28rem 0 -0.13rem currentColor;
}

.part-icon-engine::after {
  content: "";
  position: absolute;
  top: 0.08rem;
  left: 0.65rem;
  width: 1.35rem;
  height: 0.55rem;
  border: 3px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}

.part-icon-front-wheel::before,
.part-icon-rear-wheel::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.9rem;
  height: 1.9rem;
  border: 0.48rem solid currentColor;
  border-radius: 50%;
  background: #d8dde3;
  box-shadow: inset 0 0 0 3px #788391;
  transform: translate(-50%, -50%);
}

.part-icon-front-wheel::after,
.part-icon-rear-wheel::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--red);
  transform: translate(-50%, -50%);
}

.part-icon-rear-wheel::before {
  width: 2.08rem;
  height: 2.08rem;
}

.part-icon-body::before {
  content: "";
  position: absolute;
  inset: 0.38rem 0.08rem 0.35rem;
  border-radius: 8px;
  background: var(--red);
  clip-path: polygon(0 70%, 12% 43%, 38% 36%, 49% 5%, 70% 8%, 84% 38%, 100% 53%, 96% 82%, 3% 86%);
}

.part-icon-body::after {
  content: "";
  position: absolute;
  top: 0.57rem;
  left: 1.37rem;
  width: 1.08rem;
  height: 0.58rem;
  background: #9dd0ef;
  clip-path: polygon(15% 0, 78% 6%, 100% 100%, 0 100%);
}

.assembly-bay {
  position: relative;
  isolation: isolate;
  min-height: 390px;
  overflow: hidden;
  border: 3px solid #c9c3ba;
  border-radius: 20px;
  background:
    linear-gradient(90deg, transparent 0 49.5%, rgba(11, 16, 25, 0.055) 49.5% 50.5%, transparent 50.5%),
    linear-gradient(rgba(11, 16, 25, 0.055) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(145deg, #e6e2db, #f7f4ee 66%);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.assembly-bay::before {
  content: "ASSEMBLY BAY";
  position: absolute;
  z-index: 10;
  top: 0.8rem;
  left: 0.9rem;
  padding: 0.32rem 0.52rem;
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  font-family: "Fredoka", sans-serif;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.assembly-bay::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -9%;
  bottom: -34%;
  width: 55%;
  aspect-ratio: 1;
  border: 2px solid rgba(11, 16, 25, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 1.25rem rgba(11, 16, 25, 0.028), 0 0 0 2.5rem rgba(11, 16, 25, 0.018);
}

.assembly-instruction {
  position: absolute;
  z-index: 10;
  top: 0.72rem;
  right: 0.85rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.assembly-bay.is-complete {
  border-color: #1f9d55;
  box-shadow: 0 0 0 5px rgba(31, 157, 85, 0.16), 0 18px 38px rgba(11, 16, 25, 0.16);
  animation: assembly-finish 560ms ease both;
}

@keyframes assembly-finish {
  50% { transform: scale(1.015) rotate(-0.35deg); }
}

.assembly-car {
  position: absolute;
  top: 23%;
  right: 6%;
  bottom: 10%;
  left: 6%;
}

.assembly-piece {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px) scale(0.94);
  transition: opacity 220ms ease, transform 300ms cubic-bezier(0.2, 0.85, 0.32, 1.25);
}

.assembly-chassis {
  z-index: 2;
  right: 12%;
  bottom: 24%;
  left: 12%;
  height: 16%;
  border: 4px solid var(--ink);
  border-radius: 9px 18px 12px 9px;
  background: #7e8994;
  box-shadow: inset 0 -8px 0 #5e6873;
}

.assembly-chassis::after {
  content: "";
  position: absolute;
  right: 5%;
  bottom: -0.52rem;
  left: 5%;
  height: 0.42rem;
  border-right: 1.3rem solid var(--ink);
  border-left: 1.3rem solid var(--ink);
}

.assembly-engine {
  z-index: 3;
  right: 23%;
  bottom: 37%;
  width: 21%;
  height: 25%;
  border: 4px solid var(--ink);
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 9px, #e8ab16 9px 13px);
  box-shadow: inset 0 -8px 0 rgba(129, 91, 0, 0.22);
}

.assembly-engine::before {
  content: "";
  position: absolute;
  top: -31%;
  left: 11%;
  width: 54%;
  height: 37%;
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}

.assembly-front-wheel,
.assembly-rear-wheel {
  z-index: 5;
  bottom: 10%;
  width: 19%;
  max-width: 7.2rem;
  aspect-ratio: 1;
  border: clamp(9px, 1.5vw, 16px) solid var(--ink);
  border-radius: 50%;
  background: #b7c1ca;
  box-shadow: inset 0 0 0 6px #586472, inset 0 0 0 11px #dce2e7;
}

.assembly-front-wheel::after,
.assembly-rear-wheel::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: var(--red);
}

.assembly-front-wheel {
  right: 11%;
}

.assembly-rear-wheel {
  left: 14%;
}

.assembly-body {
  z-index: 4;
  top: 10%;
  right: 5%;
  left: 5%;
  height: 57%;
  border-bottom: 6px solid var(--ink);
  border-radius: 15px;
  background: linear-gradient(155deg, #ff4a51, var(--red) 54%, #a70e17);
  clip-path: polygon(0 75%, 6% 54%, 31% 47%, 44% 9%, 68% 6%, 82% 43%, 95% 51%, 100% 72%, 97% 90%, 3% 91%);
  filter: drop-shadow(0 9px 0 rgba(11, 16, 25, 0.22));
}

.assembly-body::after {
  content: "";
  position: absolute;
  top: 12%;
  left: 44%;
  width: 34%;
  height: 39%;
  border: 3px solid var(--ink);
  border-radius: 7px 12px 3px 3px;
  background: linear-gradient(145deg, #d7f2ff, #78b7ff);
  clip-path: polygon(7% 0, 68% 1%, 100% 100%, 0 100%);
}

.assembly-bay.has-chassis .assembly-chassis,
.assembly-bay.has-engine .assembly-engine,
.assembly-bay.has-front-wheel .assembly-front-wheel,
.assembly-bay.has-rear-wheel .assembly-rear-wheel,
.assembly-bay.has-body .assembly-body,
.assembly-piece.is-installed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.build-slot {
  position: absolute;
  z-index: 8;
  display: grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0.25rem;
  border: 2px dashed rgba(11, 16, 25, 0.38);
  border-radius: 12px;
  color: rgba(11, 16, 25, 0.64);
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, opacity 150ms ease, transform 150ms ease;
}

.build-slot:hover {
  border-color: var(--red);
  color: var(--red-dark);
  background: rgba(255, 255, 255, 0.84);
  transform: scale(1.035);
}

.build-slot.is-drag-over {
  border-color: var(--yellow);
  color: var(--ink);
  background: rgba(255, 212, 59, 0.9);
  box-shadow: 0 0 0 5px rgba(255, 212, 59, 0.24);
  transform: scale(1.045);
}

.build-slot[data-part="chassis"],
.build-slot[data-slot="chassis"],
.build-slot-chassis {
  right: 16%;
  bottom: 26%;
  left: 16%;
  height: 12%;
}

.build-slot[data-part="engine"],
.build-slot[data-slot="engine"],
.build-slot-engine {
  right: 26%;
  bottom: 35%;
  width: 19%;
  height: 18%;
}

.build-slot[data-part="front-wheel"],
.build-slot[data-slot="front-wheel"],
.build-slot-front-wheel {
  right: 16%;
  bottom: 17%;
  width: 17%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.build-slot[data-part="rear-wheel"],
.build-slot[data-slot="rear-wheel"],
.build-slot-rear-wheel {
  bottom: 17%;
  left: 18%;
  width: 17%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.build-slot[data-part="body"],
.build-slot[data-slot="body"],
.build-slot-body {
  z-index: 7;
  top: 30%;
  right: 10%;
  left: 10%;
  height: 31%;
}

.build-slot.is-installed {
  border-color: transparent;
  color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: default;
  opacity: 0;
  pointer-events: none;
}

.build-slot.is-wrong {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
  animation: build-slot-wrong 340ms ease;
}

@keyframes build-slot-wrong {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.build-reset {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin-top: 0.8rem;
  padding: 0.6rem 0.85rem;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.build-reset:hover {
  color: var(--red-dark);
}

/* Start-light race */
.race-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(210px, 0.45fr);
  align-items: stretch;
  gap: clamp(1rem, 3vw, 2rem);
}

.race-stage {
  position: relative;
  isolation: isolate;
  min-height: 360px;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 19px;
  background:
    radial-gradient(circle at 82% 16%, rgba(255, 255, 255, 0.95) 0 5%, transparent 5.5%),
    linear-gradient(#82c8f7 0 58%, #8bca60 58% 65%, transparent 65%),
    #343942;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.race-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 34%;
  left: 0;
  height: 25%;
  opacity: 0.38;
  background:
    linear-gradient(135deg, transparent 0 45%, #366d3f 46% 57%, transparent 58%) 0 100% / 22% 100% repeat-x;
}

.traffic-light {
  position: absolute;
  z-index: 7;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.42rem;
  padding: 0.5rem;
  border: 3px solid #535d68;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
}

.traffic-light span {
  display: block;
  width: 1.55rem;
  height: 1.55rem;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: #313945;
  box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.4);
  transition: background 120ms ease, box-shadow 120ms ease;
}

.traffic-light.is-red span:nth-child(1),
.traffic-light .is-red {
  background: #ff3943;
  box-shadow: 0 0 0 4px rgba(255, 57, 67, 0.2), 0 0 18px #ff3943;
}

.traffic-light.is-yellow span:nth-child(2),
.traffic-light .is-yellow {
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 212, 59, 0.2), 0 0 18px var(--yellow);
}

.traffic-light.is-green span:nth-child(3),
.traffic-light .is-green {
  background: #54df84;
  box-shadow: 0 0 0 4px rgba(84, 223, 132, 0.2), 0 0 18px #54df84;
}

.traffic-light.is-false-start span {
  background: #ff3943;
  box-shadow: 0 0 0 4px rgba(255, 57, 67, 0.22), 0 0 18px #ff3943;
  animation: false-start-light 180ms ease 2 alternate;
}

@keyframes false-start-light {
  to { opacity: 0.3; }
}

.race-lane {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 42%;
  border-top: 5px solid #f2f2ef;
  background:
    linear-gradient(90deg, var(--red) 0 50%, #fff 50%) 0 0 / 42px 8px repeat-x,
    #343942;
}

.race-road-lines {
  position: absolute;
  top: 49%;
  right: 0;
  left: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, transparent 0 30px, var(--yellow) 30px 72px);
  transform: translateY(-50%);
}

.finish-flag {
  position: absolute;
  z-index: 4;
  top: -52%;
  right: 8%;
  width: 3.4rem;
  height: 5.1rem;
  border: 3px solid #fff;
  color: transparent;
  background: conic-gradient(#fff 25%, #111 0 50%, #fff 0 75%, #111 0) 0 0 / 1.15rem 1.15rem;
  box-shadow: 0 0 0 2px var(--ink), 0 5px 12px rgba(0, 0, 0, 0.25);
  font-size: 0;
}

.finish-flag::after {
  content: "";
  position: absolute;
  top: -0.2rem;
  right: -0.55rem;
  width: 0.3rem;
  height: 11.5rem;
  border-radius: 999px;
  background: #e1e5e8;
  box-shadow: 2px 0 0 #747f8b;
}

.race-car {
  position: absolute;
  z-index: 5;
  bottom: 11%;
  left: 4%;
  display: grid;
  width: clamp(5.1rem, 13vw, 8.2rem);
  height: clamp(2.7rem, 7vw, 4.3rem);
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 55% 48% 22% 24% / 58% 52% 30% 32%;
  color: transparent;
  background: linear-gradient(165deg, #ff4b52, var(--red) 65%, var(--red-dark));
  box-shadow:
    -0.55rem 0.16rem 0 -0.26rem var(--yellow),
    inset -0.55rem -0.45rem 0 rgba(111, 3, 10, 0.3),
    0 8px 10px rgba(0, 0, 0, 0.25);
  transform-origin: center bottom;
}

.race-car::before {
  content: "";
  position: absolute;
  top: -25%;
  left: 25%;
  width: 50%;
  height: 45%;
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 65% 70% 0 0;
  background: var(--blue);
  transform: skewX(-13deg);
}

.race-car::after {
  content: "";
  position: absolute;
  right: 8%;
  bottom: -29%;
  left: 8%;
  height: 42%;
  border-right: clamp(1.05rem, 2.5vw, 1.7rem) solid var(--ink);
  border-left: clamp(1.05rem, 2.5vw, 1.7rem) solid var(--ink);
  filter: drop-shadow(0 0.22rem 0 #98a2ad);
}

.race-car.is-racing {
  animation: corvette-race var(--race-duration, 2.35s) cubic-bezier(0.15, 0.68, 0.23, 1) forwards;
}

.race-car.is-false-start {
  animation: false-start-car 320ms ease;
}

@keyframes false-start-car {
  20% { transform: translateX(8px) rotate(-2deg); }
  45% { transform: translateX(-5px) rotate(2deg); }
  70% { transform: translateX(4px) rotate(-1deg); }
}

@keyframes corvette-race {
  0% { left: 4%; transform: rotate(0); }
  13% { transform: rotate(-2deg) translateY(-3px); }
  28% { transform: rotate(1deg) translateY(0); }
  84% { left: calc(88% - clamp(5.1rem, 13vw, 8.2rem)); transform: rotate(-1deg); }
  100% { left: calc(88% - clamp(5.1rem, 13vw, 8.2rem)); transform: rotate(0); }
}

.race-controls {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f1ede6;
}

.race-controls .game-button {
  width: 100%;
}

.race-scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.race-scoreboard > * {
  min-width: 0;
  padding: 0.75rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  background: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.race-scoreboard strong,
.race-scoreboard output {
  display: block;
  overflow: hidden;
  margin-top: 0.2rem;
  color: var(--yellow);
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Quiz */
.quiz-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: clamp(2.5rem, 7vw, 7rem);
}

.quiz-intro {
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
}

.garage-badge {
  display: flex;
  width: 11rem;
  height: 11rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
  border: 6px double rgba(11, 16, 25, 0.18);
  border-radius: 50%;
  color: var(--ink);
  background: #ded9d0;
  box-shadow: inset 0 0 0 8px #ebe7df, 0 10px 30px rgba(11, 16, 25, 0.14);
  font-family: "Fredoka", sans-serif;
  line-height: 1;
  opacity: 0.58;
  transform: rotate(-6deg) scale(0.95);
  transition: transform 350ms ease, opacity 350ms ease, background 350ms ease;
}

.garage-badge span,
.garage-badge em {
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.garage-badge strong {
  margin: 0.18rem 0;
  color: #6c727b;
  font-size: 1.35rem;
  text-transform: uppercase;
}

.garage-badge.is-earned {
  opacity: 1;
  background: var(--yellow);
  transform: rotate(4deg) scale(1);
}

.garage-badge.is-earned strong {
  color: var(--red);
}

.quiz-card {
  padding: clamp(1.2rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.quiz-card fieldset {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 1.2rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.quiz-card fieldset:first-child {
  padding-top: 0;
}

.quiz-card legend {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  margin-bottom: 0.55rem;
  font-family: "Fredoka", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.quiz-card legend span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-size: 0.72rem;
}

.quiz-card label {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f2eee7;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
}

.quiz-card label:hover {
  border-color: rgba(227, 34, 42, 0.35);
}

.quiz-card label:has(input:checked) {
  border-color: var(--red);
  color: var(--red-dark);
  background: #fff3f3;
}

.quiz-card input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--red);
}

.quiz-card fieldset.is-correct {
  border-left: 4px solid #1f9d55;
  padding-left: 0.8rem;
}

.quiz-card fieldset.is-wrong {
  border-left: 4px solid var(--red);
  padding-left: 0.8rem;
}

.quiz-button {
  width: 100%;
  margin-top: 1.35rem;
  border: 0;
  cursor: pointer;
}

.quiz-result {
  min-height: 1.6rem;
  margin: 1rem 0 0;
  color: var(--red-dark);
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  text-align: center;
}

/* Footer */
.footer {
  padding: clamp(3rem, 6vw, 5rem) max(1.25rem, calc((100vw - 1180px) / 2));
  color: rgba(255, 255, 255, 0.7);
  background: var(--ink);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.footer-logo {
  margin: 0;
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}

.footer-logo strong {
  color: var(--red);
}

.footer-top > div > p:last-child {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
}

.button-footer {
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.button-footer:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.credits {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.75rem;
}

.credits summary {
  min-height: 44px;
  cursor: pointer;
  color: #fff;
  font-weight: 800;
}

.credits-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  padding-top: 1rem;
}

.credits h3 {
  margin: 0;
  color: var(--yellow);
  font-family: "Fredoka", sans-serif;
  font-size: 0.85rem;
}

.credits p {
  margin: 0.45rem 0 0;
}

.credits a {
  color: #fff;
}

.credits-note {
  opacity: 0.7;
}

.back-to-top {
  position: fixed;
  z-index: 40;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  box-shadow: 0 8px 24px rgba(11, 16, 25, 0.2);
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(1rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.noscript {
  position: fixed;
  z-index: 80;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  margin: 0;
  padding: 1rem;
  border-radius: 12px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: var(--shadow);
  font-weight: 800;
  text-align: center;
}

/* Responsive layouts */
@media (max-width: 1080px) {
  .hero {
    min-height: auto;
    grid-template-columns: minmax(0, 0.8fr) minmax(380px, 1.2fr);
  }

  .generation-picker {
    grid-template-columns: repeat(4, 1fr);
  }

  .generation-chip img {
    height: 5.5rem;
  }

  .engine-lab {
    grid-template-columns: minmax(0, 1.25fr) minmax(270px, 0.75fr);
  }

  .milestone-card {
    grid-template-columns: 1fr;
  }

  .milestone-card img {
    min-height: 220px;
    max-height: 260px;
  }

  .generation-map {
    grid-template-columns: repeat(4, 1fr);
  }

  .coloring-studio {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.45fr);
  }
}

@media (max-width: 860px) {
  :root {
    --nav-height: 66px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 3.5rem;
    padding-top: 5rem;
    padding-bottom: 5rem;
  }

  .hero-copy {
    max-width: 46rem;
  }

  .hero h1 {
    max-width: 10ch;
  }

  .hero-visual {
    width: min(100%, 46rem);
    margin: 0 auto;
  }

  .hero-photo-wrap img {
    height: clamp(300px, 65vw, 480px);
  }

  .hero-number {
    top: -5rem;
  }

  .garage-mark-copy {
    display: none;
  }

  .nav-shell {
    gap: 0.65rem;
  }

  .toc {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0.45rem 0;
    scrollbar-width: none;
  }

  .toc::-webkit-scrollbar {
    display: none;
  }

  .engine-lab {
    grid-template-columns: 1fr;
  }

  .car-stage-image img {
    height: clamp(300px, 61vw, 470px);
  }

  .car-stage figcaption {
    min-height: 0;
  }

  .sound-console {
    min-height: 360px;
  }

  .tiny-layout,
  .coloring-studio,
  .quiz-section {
    grid-template-columns: 1fr;
  }

  .puzzle-layout {
    grid-template-columns: minmax(160px, 0.42fr) minmax(300px, 1fr);
  }

  .build-layout,
  .race-layout {
    grid-template-columns: 1fr;
  }

  .parts-tray {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .car-part {
    min-height: 92px;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.15;
    text-align: center;
  }

  .race-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 0.62fr);
    align-items: center;
  }

  .race-controls .game-status {
    grid-column: 1 / -1;
    margin: 0;
  }

  .tiny-photo {
    width: min(100%, 40rem);
    margin: 0 auto;
  }

  .coloring-chooser {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: none;
  }

  .quiz-intro {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 2rem;
  }

  .quiz-intro .eyebrow,
  .quiz-intro h2,
  .quiz-intro > p:not(.eyebrow) {
    grid-column: 1;
  }

  .garage-badge {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin-top: 0;
  }
}

@media (max-width: 680px) {
  main {
    padding-right: 0.8rem;
    padding-left: 0.8rem;
  }

  .quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat {
    padding: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .stat:first-child {
    padding-left: 1rem;
  }

  .stat:nth-child(2) {
    border-right: 0;
  }

  .stat:nth-child(3),
  .stat:nth-child(4) {
    border-bottom: 0;
  }

  .section {
    padding-top: 4.6rem;
    padding-bottom: 4.6rem;
  }

  .roar-section,
  .coloring-section,
  .games-section {
    padding: 3.4rem 1rem 1rem;
    border-radius: 22px;
  }

  .game-tabs {
    display: flex;
    gap: 0.55rem;
    overflow-x: auto;
    margin-right: -1rem;
    margin-left: -1rem;
    padding: 0.55rem 1rem 0.75rem;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    scroll-snap-type: x proximity;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  }

  .game-tab {
    flex: 0 0 10rem;
    scroll-snap-align: start;
  }

  .game-panel {
    padding: 1rem;
    border-radius: 18px;
  }

  .puzzle-layout,
  .build-layout,
  .race-layout {
    grid-template-columns: 1fr;
  }

  .puzzle-reference {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 0.85rem;
  }

  .puzzle-reference img {
    grid-row: 1 / span 2;
  }

  .puzzle-reference figcaption,
  .puzzle-reference > p {
    margin: 0;
  }

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

  .car-part {
    min-height: 68px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.55rem;
    font-size: 0.72rem;
    text-align: left;
  }

  .car-part.is-installed::after {
    position: static;
    align-self: auto;
    margin: 0 0 0 auto;
  }

  .part-icon {
    flex-basis: 2.65rem;
    width: 2.65rem;
    transform: scale(0.88);
  }

  .assembly-bay {
    min-height: 340px;
  }

  .race-controls {
    display: flex;
  }

  .race-stage {
    min-height: 320px;
  }

  .generation-picker {
    display: flex;
    gap: 0.55rem;
    overflow-x: auto;
    margin-right: -1rem;
    margin-left: -1rem;
    padding: 0.2rem 1rem 0.8rem;
    scroll-snap-type: x proximity;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
  }

  .generation-chip {
    flex: 0 0 7.3rem;
    scroll-snap-align: start;
  }

  .generation-chip img {
    height: 4.9rem;
  }

  .engine-lab,
  .coloring-preview-card {
    border-radius: 17px;
  }

  .sound-console {
    min-height: 340px;
  }

  .milestone-grid {
    grid-template-columns: 1fr;
  }

  .milestone-card {
    grid-template-columns: minmax(120px, 0.74fr) minmax(0, 1fr);
  }

  .milestone-card img {
    min-height: 245px;
    max-height: none;
  }

  .milestone-copy {
    padding: 1.15rem;
  }

  .stingray-story {
    grid-template-columns: 1fr;
    gap: 2.8rem;
  }

  .stingray-mark {
    width: max-content;
  }

  .generation-map {
    grid-template-columns: repeat(2, 1fr);
  }

  .coloring-preview-copy {
    align-items: stretch;
    flex-direction: column;
  }

  .coloring-actions {
    align-items: stretch;
  }

  .coloring-chooser {
    display: flex;
    overflow-x: auto;
    margin-right: -1.15rem;
    margin-left: -1.15rem;
    padding: 0.15rem 1.15rem 0.8rem;
    scroll-snap-type: x proximity;
  }

  .coloring-thumb {
    flex: 0 0 7.2rem;
    scroll-snap-align: start;
  }

  .quiz-intro {
    display: block;
  }

  .garage-badge {
    width: 8.5rem;
    height: 8.5rem;
    margin-top: 1.5rem;
  }

  .garage-badge strong {
    font-size: 1.08rem;
  }

  .footer-top,
  .credits-grid {
    align-items: flex-start;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .footer-top {
    display: flex;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 4.5rem 1.15rem 4rem;
  }

  .hero h1 {
    font-size: clamp(3rem, 15vw, 4.3rem);
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-photo-wrap {
    border-width: 5px;
  }

  .hero-photo-wrap img {
    height: 300px;
  }

  .hero-sticker {
    top: -1.7rem;
    right: -0.35rem;
    width: 5.2rem;
    height: 5.2rem;
    font-size: 0.82rem;
  }

  .hero-number {
    left: -1.2rem;
    font-size: 10rem;
  }

  .garage-mark-badge {
    width: 2.3rem;
    height: 2.3rem;
  }

  .toc a {
    padding-right: 0.7rem;
    padding-left: 0.7rem;
    font-size: 0.78rem;
  }

  .section-heading h2,
  .quiz-intro h2 {
    font-size: clamp(2.35rem, 12vw, 3.4rem);
  }

  .car-stage-image img {
    height: 260px;
  }

  .milestone-card {
    grid-template-columns: 1fr;
  }

  .milestone-card img {
    min-height: 210px;
    max-height: 230px;
  }

  .tiny-photo figcaption {
    right: 0;
    max-width: 80%;
  }

  .coloring-preview-paper img {
    height: 300px;
  }

  .coloring-chooser-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .games-section .section-heading {
    margin-bottom: 1.5rem;
  }

  .game-tab {
    flex-basis: 8.75rem;
    min-height: 54px;
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
  }

  .game-tab-icon {
    flex-basis: 1.9rem;
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.9rem;
  }

  .game-card-head {
    flex-direction: column;
    gap: 0.65rem;
  }

  .game-difficulty {
    align-self: flex-start;
  }

  .puzzle-reference {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .puzzle-board {
    gap: 2px;
    padding: 2px;
    border-width: 3px;
    border-radius: 14px;
  }

  .puzzle-board::after {
    inset: 2px;
  }

  .puzzle-controls {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .puzzle-controls .game-button {
    flex: 1 1 8rem;
  }

  .parts-tray {
    gap: 0.45rem;
    padding: 0.55rem;
  }

  .car-part {
    min-height: 60px;
    padding: 0.4rem;
  }

  .car-part.is-installed::after {
    display: none;
  }

  .assembly-bay {
    min-height: 285px;
  }

  .assembly-bay::before {
    top: 0.55rem;
    left: 0.55rem;
  }

  .build-slot {
    overflow: hidden;
    font-size: 0;
  }

  .build-slot::after {
    content: "+";
    font-size: 1rem;
  }

  .build-slot.is-installed::after {
    content: "";
  }

  .race-stage {
    min-height: 275px;
  }

  .traffic-light {
    top: 0.7rem;
    left: 0.7rem;
  }

  .traffic-light span {
    width: 1.3rem;
    height: 1.3rem;
  }

  .finish-flag {
    right: 7%;
    width: 2.7rem;
    height: 4.1rem;
    background-size: 0.9rem 0.9rem;
  }

  .finish-flag::after {
    height: 9.5rem;
  }

  .quiz-card {
    padding: 1rem;
    border-radius: 20px;
  }

  .quiz-card legend {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .game-panel.is-active,
  .puzzle-board.is-solved,
  .assembly-bay.is-complete,
  .build-slot.is-wrong,
  .traffic-light.is-false-start span,
  .race-car.is-false-start,
  .race-car.is-racing {
    animation: none;
  }

  .race-car.is-racing {
    left: calc(88% - clamp(5.1rem, 13vw, 8.2rem));
  }
}
