:root {
  color-scheme: light;
  --ink: #193d38;
  --muted: #60746d;
  --paper: #fffdf7;
  --grass: #a9d553;
  --grass-dark: #5b9f45;
  --teal: #238f86;
  --teal-dark: #12635e;
  --coral: #ee7158;
  --coral-dark: #a83f32;
  --gold: #f4c84b;
  --wood: #986034;
  --cell: 52px;
  font-family: ui-rounded, "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; min-width: 1040px; height: 100%; min-height: 680px; margin: 0; overflow: hidden; }
body { color: var(--ink); background: #dfeecf; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, .grid-cell:focus-visible { outline: 4px solid #116b91; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.park { position: relative; width: 100%; height: 100%; overflow: hidden; isolation: isolate; }
.world-art { position: absolute; z-index: -4; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.world-wash { position: absolute; z-index: -3; inset: 0; background: linear-gradient(90deg, rgba(241,248,226,.84), rgba(240,248,229,.55) 55%, rgba(224,242,218,.72)); backdrop-filter: blur(1px); }

.game-card, .ranger-card {
  border: 1px solid rgba(25,61,56,.13);
  background: rgba(255,253,247,.96);
  box-shadow: 0 18px 48px rgba(37,72,48,.2), 0 6px 0 rgba(53,105,67,.12);
  backdrop-filter: blur(10px);
}
.game-card {
  position: absolute;
  left: clamp(28px,4vw,66px);
  top: 28px;
  bottom: 28px;
  width: min(820px, calc(100vw - 390px));
  display: grid;
  grid-template-rows: auto minmax(355px,1fr) 34px auto;
  padding: 28px 42px 30px;
  border-radius: 30px;
}
.mission-copy { text-align: center; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0 0 7px; color: var(--teal-dark); font-size: 12px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.eyebrow i { opacity: .4; font-style: normal; }
.mission-copy h1 { max-width: 690px; margin: 0 auto; font-size: clamp(29px,3.2vw,43px); line-height: 1.06; letter-spacing: -.045em; }
.mission-copy > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.build-stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 18px 0 8px; }
.grid-wrap { --cols: 8; --rows: 6; --selected-w: 3; --selected-h: 2; position: relative; width: calc(var(--cols) * var(--cell)); height: calc(var(--rows) * var(--cell)); padding: 0; }
.grid-board { display: grid; grid-template-columns: repeat(8,var(--cell)); grid-template-rows: repeat(6,var(--cell)); width: 100%; height: 100%; overflow: hidden; border: 3px solid #416f61; border-radius: 18px; background: #eaf1d9; box-shadow: 0 10px 0 #b4c99e, 0 20px 38px rgba(45,80,57,.14); touch-action: none; }
.grid-cell { position: relative; border: 0; border-right: 1px solid rgba(56,102,74,.24); border-bottom: 1px solid rgba(56,102,74,.24); background: rgba(255,255,255,.28); padding: 0; cursor: default; }
.grid-cell.is-selected { background: linear-gradient(145deg,#bfe16b,#98cc4e); box-shadow: inset 0 0 0 1px rgba(255,255,255,.36); }
.grid-cell.is-selected::after { position: absolute; inset: 38% 38%; content: ""; border-radius: 50%; background: rgba(255,255,255,.35); }
.grid-board.is-buildable .grid-cell { cursor: crosshair; }
.grid-board.is-buildable .grid-cell:hover { background: #d8ec9f; }
.grid-cell.is-cut { background: repeating-linear-gradient(135deg,rgba(120,140,112,.08) 0 7px,rgba(255,255,255,.2) 7px 14px); }
.grid-cell.is-counting { animation: tile-count 620ms ease-out both; animation-delay: calc(var(--tile-index) * 45ms); }
.grid-board.is-wrong { animation: board-shake 260ms ease-out; }
.grid-board.is-correct .grid-cell.is-selected { animation: tile-pop 430ms cubic-bezier(.2,.85,.3,1.2) both; animation-delay: calc(var(--tile-index) * 22ms); }

.fence-layer { position: absolute; left: 0; top: 0; width: calc(var(--selected-w) * var(--cell)); height: calc(var(--selected-h) * var(--cell)); pointer-events: none; border: 0 solid var(--wood); border-radius: 10px; transition: width 150ms ease-out, height 150ms ease-out; }
.fence-layer.is-visible { border-width: 7px; box-shadow: inset 0 0 0 2px rgba(255,245,196,.6), 0 5px 0 rgba(81,48,27,.15); }
.fence-layer.is-snapping { animation: fence-snap 480ms cubic-bezier(.2,.9,.25,1.25); }
.fence-layer.is-counting { border-color: var(--coral); animation: fence-pulse 720ms ease-out 2; }
.dimension { position: absolute; display: grid; place-items: center; min-width: 30px; height: 26px; padding: 0 8px; border-radius: 999px; color: white; background: var(--teal-dark); box-shadow: 0 3px 0 rgba(14,70,65,.25); font-size: 13px; font-weight: 1000; transition: left 150ms ease-out, top 150ms ease-out; }
.width-dimension { left: calc(var(--selected-w) * var(--cell) / 2 - 15px); top: -34px; }
.height-dimension { left: calc(var(--selected-w) * var(--cell) + 9px); top: calc(var(--selected-h) * var(--cell) / 2 - 13px); }

.compare-stage { width: min(620px,100%); display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.compare-pen { display: grid; gap: 10px; place-items: center; padding: 20px; border: 2px solid #c5d7bd; border-radius: 22px; background: #f2f7e8; box-shadow: 0 7px 0 #dce7d2; }
.compare-pen strong { font-size: 17px; }
.mini-grid { display: grid; gap: 2px; padding: 6px; border: 5px solid var(--wood); border-radius: 10px; background: #dceab2; }
.mini-grid i { width: 26px; height: 26px; border-radius: 3px; background: #a9d553; box-shadow: inset 0 0 0 1px rgba(48,91,60,.2); }

.feedback { min-height: 34px; display: grid; place-items: center; color: var(--teal-dark); font-size: 15px; font-weight: 900; text-align: center; }
.feedback.is-error { color: var(--coral-dark); }
.choice-tray { min-height: 72px; display: flex; justify-content: center; align-items: center; gap: 13px; }
.choice-grid { width: min(640px,100%); display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.choice, .primary {
  min-height: 62px;
  padding: 11px 17px;
  border: 2px solid #c9d5cf;
  border-radius: 17px;
  background: white;
  box-shadow: 0 6px 0 #d6dfda;
  font-weight: 1000;
  transition: transform 140ms ease-out, box-shadow 140ms ease-out, border-color 140ms ease-out;
}
.choice { font-size: 24px; }
.choice.word { font-size: 16px; line-height: 1.15; }
.choice small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.choice:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 8px 0 #c5ded7; }
.choice:active { transform: translateY(4px); box-shadow: 0 2px 0 #c5ded7; }
.primary { min-width: 230px; border-color: var(--teal-dark); color: white; background: var(--teal); box-shadow: 0 6px 0 var(--teal-dark); font-size: 16px; }
.primary:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--teal-dark); }
.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--teal-dark); }
.primary.coral { border-color: var(--coral-dark); background: var(--coral); box-shadow: 0 6px 0 var(--coral-dark); }

.ranger-card { position: absolute; top: 28px; right: clamp(24px,3vw,50px); bottom: 28px; width: 286px; display: flex; flex-direction: column; padding: 19px 20px 22px; border-radius: 30px; }
.sticker-art { overflow: hidden; padding: 7px; border: 1px solid rgba(29,74,68,.1); border-radius: 26px; background: #fffdf7; box-shadow: 0 11px 28px rgba(25,62,59,.16); }
.sticker-art img { display: block; width: 100%; border-radius: 19px; }
.mascot-sticker { width: 158px; margin: -5px auto 0; transition: transform 150ms ease-out; }
.mascot-sticker.is-happy { animation: mascot-hop 560ms cubic-bezier(.2,.9,.25,1.2); }
.mascot-sticker.is-thinking { animation: mascot-think 620ms ease-out; }
.speech { position: relative; min-height: 52px; margin: 10px 2px 15px; padding: 11px 14px; border: 2px solid #d5e1cb; border-radius: 16px; background: #f2f7e8; text-align: center; font-size: 13px; font-weight: 900; line-height: 1.25; }
.speech::before { position: absolute; top: -9px; left: 50%; width: 14px; height: 14px; content: ""; transform: translateX(-50%) rotate(45deg); border-left: 2px solid #d5e1cb; border-top: 2px solid #d5e1cb; background: #f2f7e8; }
.score-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.score-row div { padding: 10px 5px; border-radius: 14px; background: #edf4e7; text-align: center; }
.score-row span, .difficulty span { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.score-row strong { display: block; margin-top: 2px; font-size: 24px; }
.difficulty { margin-top: 14px; }
.difficulty > div:first-child { display: flex; align-items: end; justify-content: space-between; }
.difficulty-track { height: 9px; margin: 8px 0 6px; overflow: hidden; border-radius: 99px; background: #dce8d5; }
.difficulty-track i { display: block; width: 18%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--gold),var(--coral)); transition: width 240ms ease-out; }
.difficulty p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.resident-card { width: 116px; margin: auto auto 12px; border-radius: 22px; transform: rotate(2deg); }
.resident-card img { border-radius: 15px; }
.mission-dots { display: flex; justify-content: center; gap: 9px; }
.mission-dots i { width: 15px; height: 15px; border: 2px solid #9eb5a4; border-radius: 50%; background: white; }
.mission-dots i.is-complete { border-color: var(--teal); background: var(--teal); box-shadow: inset 0 0 0 3px white; }
.prop-sticker { position: absolute; z-index: -1; left: calc(min(820px, calc(100vw - 390px)) - 8px); bottom: 7px; width: 122px; transform: rotate(-8deg); opacity: .9; }

.toast { position: absolute; z-index: 30; left: 50%; bottom: 23px; max-width: 70%; padding: 11px 18px; opacity: 0; transform: translate(-50%,14px); border-radius: 999px; color: white; background: var(--ink); pointer-events: none; font-size: 13px; font-weight: 900; transition: opacity 150ms ease-out, transform 150ms ease-out; }
.toast.is-showing { opacity: 1; transform: translate(-50%,0); }
.confetti, .tile-burst { position: absolute; inset: 50% auto auto 50%; pointer-events: none; }
.confetti i, .tile-burst i { position: absolute; width: 12px; height: 12px; opacity: 0; border-radius: 3px; background: var(--gold); }
.confetti i:nth-child(2n), .tile-burst i:nth-child(2n) { background: var(--coral); }
.confetti i:nth-child(3n) { background: var(--teal); }
.park.is-celebrating .confetti i, .build-stage.is-popping .tile-burst i { animation: confetti 680ms ease-out both; }
.confetti i:nth-child(1),.tile-burst i:nth-child(1){--x:-150px;--y:-130px}.confetti i:nth-child(2),.tile-burst i:nth-child(2){--x:130px;--y:-160px;animation-delay:50ms}.confetti i:nth-child(3),.tile-burst i:nth-child(3){--x:190px;--y:-30px;animation-delay:90ms}.confetti i:nth-child(4),.tile-burst i:nth-child(4){--x:-190px;--y:15px;animation-delay:130ms}.confetti i:nth-child(5),.tile-burst i:nth-child(5){--x:90px;--y:135px;animation-delay:170ms}.confetti i:nth-child(6),.tile-burst i:nth-child(6){--x:-80px;--y:140px;animation-delay:210ms}.confetti i:nth-child(7){--x:230px;--y:85px;animation-delay:110ms}.confetti i:nth-child(8){--x:-235px;--y:-80px;animation-delay:190ms}

@keyframes tile-count { 50% { transform: scale(.86); background: #ffe379; box-shadow: inset 0 0 0 4px rgba(255,255,255,.72); } }
@keyframes tile-pop { 45% { transform: scale(.78); background: #ffe174; } 100% { transform: none; } }
@keyframes board-shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes fence-snap { from { opacity: 0; transform: scale(1.12); } 65% { opacity: 1; transform: scale(.97); } }
@keyframes fence-pulse { 50% { filter: drop-shadow(0 0 8px rgba(238,113,88,.85)); } }
@keyframes mascot-hop { 45% { transform: translateY(-12px) rotate(-3deg) scale(1.04); } }
@keyframes mascot-think { 35% { transform: rotate(-3deg); } 70% { transform: rotate(3deg); } }
@keyframes confetti { 0% { opacity: 0; transform: translate(0,0) rotate(0) scale(.2); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x),var(--y)) rotate(220deg) scale(1.1); } }

@media (max-height: 760px) {
  :root { --cell: 46px; }
  .game-card,.ranger-card { top: 18px; bottom: 18px; }
  .game-card { padding-top: 21px; padding-bottom: 22px; grid-template-rows: auto minmax(310px,1fr) 30px auto; }
  .mascot-sticker { width: 128px; }.resident-card { width: 92px; }.speech { margin-bottom: 10px; }.choice,.primary { min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
