:root {
  --orange: #ff7818;
  --orange-dark: #d95800;
  --orange-soft: #fff0dd;
  --cream: #fffaf0;
  --paper: #fffefb;
  --berry: #9b174c;
  --green: #719c2f;
  --ink: #282321;
  --muted: #6e625c;
  --line: #eadfd6;
  --shadow: 0 20px 60px rgba(94, 47, 12, .12);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 4px solid rgba(155, 23, 76, .32); outline-offset: 4px; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: #fff;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.22rem;
  font-weight: 900;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 20px rgba(111, 50, 9, .12);
}
.header-cta, .primary-button, .game-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--berry);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(155, 23, 76, .2);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.header-cta { padding: 0 21px; }
.primary-button { padding: 0 24px; }
.primary-button:hover, .header-cta:hover, .game-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(155, 23, 76, .26);
}

.hero {
  position: relative;
  min-height: 780px;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(360px, .8fr);
  align-items: center;
  gap: clamp(34px, 7vw, 100px);
  padding: 125px max(28px, calc((100vw - 1180px) / 2)) 80px;
  background:
    radial-gradient(circle at 9% 20%, rgba(255,255,255,.85) 0 7%, transparent 7.2%),
    radial-gradient(circle at 92% 16%, rgba(255,255,255,.52) 0 10%, transparent 10.2%),
    linear-gradient(135deg, #fff8e9 0%, #ffe0b5 48%, #ffc677 100%);
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 48px;
  background: var(--cream);
  clip-path: polygon(0 76%, 8% 55%, 18% 78%, 30% 42%, 41% 70%, 53% 35%, 67% 68%, 80% 42%, 92% 72%, 100% 50%, 100% 100%, 0 100%);
}
.hero-copy { position: relative; z-index: 2; max-width: 620px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--berry);
  font-size: .8rem;
  font-weight: 950;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3 { line-height: 1.06; letter-spacing: -.035em; }
h1 { margin: 0; font-size: clamp(3.25rem, 7vw, 6.7rem); }
h1 span { display: block; color: var(--orange-dark); }
.hero-text {
  max-width: 570px;
  margin: 24px 0 30px;
  color: #554a44;
  font-size: clamp(1.05rem, 1.7vw, 1.28rem);
}
.hero-sparkles { position: absolute; inset: 0; pointer-events: none; }
.hero-sparkles span { position: absolute; color: var(--orange); opacity: .55; }
.hero-sparkles span:nth-child(1) { left: 4%; top: 31%; font-size: 2.6rem; }
.hero-sparkles span:nth-child(2) { left: 45%; top: 17%; font-size: 1.2rem; }
.hero-sparkles span:nth-child(3) { right: 4%; top: 42%; font-size: 2rem; color: var(--berry); }
.hero-sparkles span:nth-child(4) { right: 42%; bottom: 16%; font-size: 1.8rem; }

.portrait-wrap {
  position: relative;
  z-index: 2;
  width: min(100%, 475px);
  margin: 0 auto;
}
.portrait-halo {
  position: absolute;
  inset: 7% -9% 11%;
  border: 3px dashed rgba(255,255,255,.8);
  border-radius: 50%;
  animation: slow-spin 40s linear infinite;
}
.portrait-wrap picture { display: block; position: relative; }
.portrait-wrap img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 12px solid rgba(255,255,255,.92);
  border-radius: 48% 48% 44% 44% / 36% 36% 42% 42%;
  box-shadow: 0 30px 90px rgba(116, 54, 10, .25);
  transform: rotate(2deg);
}
.portrait-wrap figcaption {
  position: absolute;
  right: -20px;
  bottom: 8%;
  padding: 12px 18px;
  border-radius: 999px;
  background: #fff;
  font-size: .9rem;
  font-weight: 850;
  box-shadow: 0 12px 30px rgba(92, 40, 5, .17);
  transform: rotate(-3deg);
}
@keyframes slow-spin { to { transform: rotate(360deg); } }

.story-strip {
  width: min(1040px, calc(100% - 36px));
  margin: 40px auto 110px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.story-strip > div {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(86, 47, 22, .05);
}
.story-strip div > span { grid-row: 1 / 3; align-self: center; font-size: 2rem; }
.story-strip strong { font-size: .98rem; }
.story-strip small { color: var(--muted); }

.games-section {
  padding: 0 max(18px, calc((100vw - 1100px) / 2)) 110px;
  scroll-margin-top: 24px;
}
.section-heading { max-width: 700px; margin: 0 auto 38px; text-align: center; }
.section-heading h2 { margin: 0 0 14px; font-size: clamp(2.25rem, 5vw, 4.2rem); }
.section-heading > p:last-child { color: var(--muted); font-size: 1.08rem; }
.game-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}
.game-tab {
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
}
.game-tab.is-active {
  border-color: var(--orange);
  background: var(--orange);
  color: #301503;
  box-shadow: 0 8px 20px rgba(255, 120, 24, .25);
}
.game-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.game-panel { padding: clamp(22px, 5vw, 48px); }
.game-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.game-kicker { margin: 0; color: var(--orange-dark); font-size: .77rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.game-intro h3 { margin: 4px 0 8px; font-size: clamp(2rem, 4vw, 3.2rem); }
.game-intro p:last-child { margin: 0; color: var(--muted); }
.scoreboard {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.scoreboard span {
  min-width: 82px;
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--orange-soft);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}
.scoreboard strong { display: block; color: var(--ink); font-size: 1.45rem; line-height: 1.05; }

.carrot-field {
  position: relative;
  min-height: 350px;
  overflow: hidden;
  border: 2px solid #cfe1a9;
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 15% 92%, #86b446 0 6%, transparent 6.5%),
    radial-gradient(ellipse at 86% 95%, #86b446 0 9%, transparent 9.5%),
    linear-gradient(#dff4ff 0 69%, #c9e690 69%);
}
.carrot-field::before, .carrot-field::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.65);
  filter: blur(1px);
}
.carrot-field::before { left: 10%; top: 18%; }
.carrot-field::after { right: 12%; top: 31%; transform: scale(.7); }
.field-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  text-align: center;
}
.field-message span { font-size: 4rem; }
.field-message strong { font-size: 1.35rem; }
.field-message small { color: var(--muted); }
.carrot-target {
  position: absolute;
  z-index: 3;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  font-size: 2.6rem;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(69, 90, 23, .22);
  cursor: pointer;
  user-select: none;
}
.carrot-target.pop { animation: carrot-pop .18s ease; }
@keyframes carrot-pop { 50% { transform: scale(1.24) rotate(12deg); } }
.game-button { min-width: 170px; margin: 24px auto 0; padding: 0 26px; }
.game-button.secondary { background: #756861; box-shadow: none; }

.memory-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  max-width: 850px;
  margin: 0 auto;
  perspective: 800px;
}
.memory-card {
  position: relative;
  aspect-ratio: .82;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .38s ease;
}
.memory-card.is-flipped, .memory-card.is-matched { transform: rotateY(180deg); }
.memory-card.is-matched { cursor: default; }
.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 19px;
  backface-visibility: hidden;
}
.card-back {
  border: 2px solid #ffb265;
  background: repeating-linear-gradient(45deg, #ff8a2e 0 12px, #ff9e4f 12px 24px);
  color: #fff;
  font-size: 2rem;
  text-shadow: 0 2px 0 rgba(0,0,0,.08);
}
.card-front {
  border: 2px solid var(--line);
  background: #fff;
  font-size: clamp(2rem, 5vw, 3.4rem);
  transform: rotateY(180deg);
}
.memory-card.is-matched .card-front { border-color: #90bd50; background: #f0fadf; }

.color-recipe { display: flex; align-items: center; gap: 8px; }
.paint-slot, .paint-result {
  display: grid;
  width: 54px;
  aspect-ratio: 1;
  place-items: center;
  border: 2px dashed #cdbfb5;
  border-radius: 50%;
  background: #fff;
  font-weight: 900;
  color: #8a7d74;
}
.paint-result { width: 68px; border-style: solid; }
.paint-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 760px;
  margin: 0 auto 28px;
}
.paint-palette button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 14px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #f5eee8;
  font-weight: 800;
  cursor: pointer;
}
.paint-palette button.is-picked { border-color: var(--berry); background: #fff; }
.paint-palette span { width: 32px; aspect-ratio: 1; border: 2px solid rgba(40,35,33,.12); border-radius: 50%; background: var(--paint); }
.mix-stage {
  display: grid;
  min-height: 230px;
  place-content: center;
  justify-items: center;
  border-radius: 24px;
  background: #f4efe9;
  text-align: center;
}
.mix-blob {
  width: 110px;
  height: 100px;
  border-radius: 50% 45% 55% 40%;
  background: #ded5ce;
  box-shadow: inset -12px -15px 0 rgba(0,0,0,.05);
  transform: rotate(-8deg);
  transition: background .4s ease, transform .4s ease;
}
.mix-blob.is-mixed { transform: rotate(8deg) scale(1.14); }
.mix-stage p { margin: 18px 0 0; font-size: 1.2rem; font-weight: 850; }

.goodbye {
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(1100px, calc(100% - 36px));
  margin: 0 auto 70px;
  padding: clamp(24px, 5vw, 48px);
  border-radius: 30px;
  background: var(--ink);
  color: #fff;
}
.goodbye-icon { font-size: 4rem; }
.goodbye .eyebrow { color: #ffb96f; }
.goodbye h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 3rem); }
.goodbye a { margin-left: auto; white-space: nowrap; color: #ffc27e; font-weight: 850; }
footer { padding: 26px; color: var(--muted); text-align: center; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 850px) {
  .hero { min-height: auto; grid-template-columns: 1fr; padding-top: 130px; text-align: center; }
  .hero-copy { margin: 0 auto; }
  .hero-text { margin-left: auto; margin-right: auto; }
  .portrait-wrap { width: min(82vw, 440px); }
  .portrait-wrap figcaption { right: -6px; }
  .story-strip { grid-template-columns: 1fr; max-width: 520px; }
  .memory-grid { grid-template-columns: repeat(4, 1fr); }
  .paint-palette { grid-template-columns: repeat(2, 1fr); }
  .goodbye { align-items: flex-start; flex-wrap: wrap; }
  .goodbye a { width: 100%; margin-left: 0; }
}

@media (max-width: 620px) {
  .site-header { width: calc(100% - 28px); padding-top: 16px; }
  .header-cta { min-height: 42px; padding: 0 15px; font-size: .84rem; }
  .brand { font-size: 1rem; }
  .brand-mark { width: 36px; }
  .hero { padding-inline: 18px; padding-bottom: 68px; }
  h1 { font-size: clamp(3rem, 15vw, 4.8rem); }
  .portrait-wrap img { border-width: 8px; }
  .story-strip { margin-bottom: 80px; }
  .game-tabs { justify-content: flex-start; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .game-tabs::-webkit-scrollbar { display: none; }
  .game-tab { flex: 0 0 auto; scroll-snap-align: start; }
  .game-shell { border-radius: 24px; }
  .game-intro { display: block; }
  .scoreboard { justify-content: flex-start; margin-top: 18px; }
  .scoreboard span { flex: 1; }
  .carrot-field { min-height: 310px; }
  .carrot-target { width: 66px; height: 66px; font-size: 2.25rem; }
  .memory-grid { gap: 8px; }
  .card-face { border-radius: 13px; }
  .color-recipe { margin-top: 18px; justify-content: center; }
  .paint-palette { grid-template-columns: 1fr 1fr; gap: 8px; }
  .paint-palette button { min-width: 0; padding: 7px 9px; font-size: .8rem; }
  .goodbye-icon { display: none; }
}

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