:root {
  color-scheme: light;
  --ink: #253b3d;
  --muted: #607579;
  --paper: #fffaf0;
  --cream: #fff1c9;
  --teal: #087f7a;
  --teal-dark: #075552;
  --coral: #ef654d;
  --coral-dark: #9f3228;
  --gold: #f5bd3e;
  --gold-dark: #9a5c12;
  --wood: #8c4c28;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; min-width: 900px; min-height: 620px; overflow: hidden; }
body { margin: 0; color: var(--ink); background: #f4c86b; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid #063f66; 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; }

.lesson { height: 100%; padding: 14px; }
.market-world { position: relative; height: 100%; min-height: 590px; overflow: hidden; isolation: isolate; border: 2px solid #9b5d2f; border-radius: 25px; background: #eac374 url("art/market-backdrop-01.webp") center / cover no-repeat; box-shadow: 0 8px 0 #8c572d, 0 22px 48px rgba(57,34,20,.24); }
.market-world::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(180deg,rgba(31,52,48,.08),rgba(22,45,44,.22)); }

.market-hud { position: absolute; z-index: 20; left: 20px; right: 20px; top: 17px; height: 68px; display: grid; grid-template-columns: 190px minmax(220px,1fr) minmax(230px,330px) auto; align-items: center; gap: 14px; }
.mission-card,.stall-track,.difficulty-card,.scoreboard { border: 2px solid rgba(83,49,22,.25); background: rgba(255,250,237,.95); box-shadow: 0 5px 0 rgba(91,52,24,.26); backdrop-filter: blur(8px); }
.mission-card { height: 68px; display: grid; align-content: center; padding: 10px 15px; border-radius: 15px; }
.mission-card span,.difficulty-card span,.scoreboard span,.speech-bubble span,.challenge-copy > span,.tray-heading span,.till-total span,.price-tag span,.set-label { color: var(--muted); font-size: 10px; font-weight: 1000; letter-spacing: .1em; text-transform: uppercase; }
.mission-card strong { margin-top: 3px; font-size: 17px; }
.stall-track { height: 50px; display: flex; align-items: center; justify-content: center; padding: 7px 10px; border-radius: 15px; }
.stall-track b { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border: 2px solid #b3a890; border-radius: 50%; color: #857a68; background: white; font-size: 9px; }
.stall-track b.is-active { border-color: var(--teal-dark); color: white; background: var(--teal); box-shadow: 0 0 0 4px rgba(20,148,138,.18); }
.stall-track b.is-done { border-color: #9b6612; color: #613c07; background: var(--gold); }
.stall-track i { width: min(16px,1.1vw); min-width: 3px; height: 3px; background: #d8cdb8; }
.difficulty-card { height: 60px; display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 5px 12px; padding: 8px 13px; border-radius: 15px; }
.difficulty-card span b { color: var(--ink); font-size: 15px; }.difficulty-card strong { font-size: 11px; }
.difficulty-card > i { grid-column: 1 / -1; height: 8px; overflow: hidden; border-radius: 999px; background: #e7dcc4; }
.difficulty-card > i b { display: block; width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--gold),var(--coral)); transition: width 220ms ease-out; }
.scoreboard { height: 68px; display: flex; align-items: stretch; padding: 7px; border-radius: 15px; }
.scoreboard > div { min-width: 65px; display: grid; place-content: center; padding: 0 9px; text-align: center; }
.scoreboard > div + div { border-left: 1px solid #ded1b8; }
.scoreboard strong { display: block; margin-top: 2px; font-size: 21px; line-height: 1; }.scoreboard strong i { color: #d17c0f; font-style: normal; font-size: 14px; }

.game-shell { position: absolute; z-index: 3; left: 20px; right: 20px; top: 104px; bottom: 20px; display: grid; grid-template-columns: 260px minmax(620px,1fr); gap: 17px; }
.mascot-stage { position: relative; overflow: hidden; border: 2px solid rgba(75,48,25,.3); border-radius: 21px; background: linear-gradient(180deg,rgba(255,247,214,.84),rgba(239,196,103,.75)); box-shadow: 0 7px 0 rgba(89,49,20,.32),0 15px 32px rgba(58,38,23,.14); }
.speech-bubble { position: absolute; z-index: 5; left: 14px; right: 14px; top: 14px; min-height: 94px; display: grid; align-content: center; padding: 13px 15px; border: 2px solid #d9b86c; border-radius: 17px 17px 17px 5px; background: rgba(255,253,243,.96); box-shadow: 0 5px 0 rgba(114,70,25,.16); }
.speech-bubble::after { position: absolute; left: 26px; bottom: -15px; content: ""; border-top: 16px solid #fffdf3; border-right: 17px solid transparent; }
.speech-bubble span { color: var(--coral-dark); }.speech-bubble strong { margin-top: 5px; font-size: 15px; line-height: 1.22; }
.mascot { position: absolute; z-index: 3; left: 24px; bottom: 32px; width: 218px; max-height: 68%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 8px 6px rgba(47,29,14,.28)); transform-origin: 50% 90%; transition: transform 180ms ease-out,filter 180ms ease-out; }
.goods-prop { position: absolute; z-index: 4; left: -21px; bottom: -23px; width: 145px; filter: drop-shadow(0 6px 4px rgba(47,29,14,.25)); transform: rotate(2deg); }
.mascot-stage.is-cheering .mascot { animation: mascot-cheer 680ms cubic-bezier(.2,.8,.25,1.2); }
.mascot-stage.is-thinking .mascot { animation: mascot-think 1.3s ease-in-out infinite; }
.mascot-stage.is-oops .mascot { animation: mascot-oops 420ms ease-out; }

.till-card { position: relative; display: grid; grid-template-rows: auto minmax(125px,1fr) auto 34px auto; align-content: stretch; padding: 19px 27px 22px; overflow: hidden; border: 2px solid #c8a668; border-radius: 21px; background: rgba(255,250,239,.97); box-shadow: 0 8px 0 rgba(87,50,21,.33),0 18px 38px rgba(53,34,20,.2); }
.till-card::before { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; content: ""; background: repeating-linear-gradient(90deg,var(--teal) 0 45px,#0f6967 45px 48px); }
.challenge-copy { text-align: center; }
.challenge-copy > span { color: var(--coral-dark); }
.challenge-copy h1 { margin: 4px 0 4px; font-size: clamp(27px,3vw,41px); line-height: 1; letter-spacing: -.045em; }
.challenge-copy p { margin: 0; color: var(--muted); font-size: 14px; }

.order-stage { min-height: 125px; display: flex; align-items: center; justify-content: center; gap: 22px; padding: 12px 6px 8px; }
.featured-coin { transform: scale(1.42); }
.coin-set { display: flex; align-items: center; justify-content: center; gap: 13px; padding: 17px 22px; border: 2px dashed #c2a76f; border-radius: 19px; background: #fff4d8; }
.coin-set-wrap { display: grid; justify-items: center; gap: 8px; }.coin-set-wrap .set-label { color: var(--teal-dark); }
.order-card { min-width: 260px; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 12px 20px; border: 2px solid #e1c27d; border-radius: 19px; background: linear-gradient(145deg,#fff9e8,#ffedbd); box-shadow: 0 6px 0 rgba(133,85,25,.14); }
.order-card img { width: 108px; height: 97px; object-fit: contain; filter: drop-shadow(0 5px 3px rgba(59,35,15,.2)); }
.price-tag { min-width: 119px; padding: 10px 14px; transform: rotate(1deg); border: 3px solid #71441c; border-radius: 12px; color: #4d2c10; background: #ffe16d; box-shadow: inset 0 0 0 3px rgba(255,255,255,.35),0 4px 0 #9a5a17; text-align: center; }
.price-tag strong { display: block; margin-top: 1px; font-size: 32px; line-height: 1; }.price-tag small { display: block; margin-top: 5px; color: #70451d; font-size: 11px; font-weight: 900; }
.change-bridge { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-radius: 13px; background: #e4f6f1; color: var(--teal-dark); font-size: 13px; font-weight: 1000; }.change-bridge b { font-size: 20px; }

.coin { --coin-size: 58px; position: relative; width: var(--coin-size); height: var(--coin-size); display: grid; place-items: center; flex: 0 0 auto; padding: 0; border: 3px solid #725a32; border-radius: 50%; color: #422d12; background: radial-gradient(circle at 32% 25%,#fff4a7 0 8%,#f3c343 35%,#bd791c 78%); box-shadow: inset 0 0 0 4px rgba(255,255,255,.28),inset 0 -5px rgba(108,58,12,.14),0 5px 0 #855016,0 8px 11px rgba(61,39,17,.18); font-size: 15px; font-weight: 1000; line-height: 1; transition: transform 130ms ease-out,filter 130ms ease-out,box-shadow 130ms ease-out; }
.coin::after { position: absolute; inset: 7px; content: ""; border: 1px dashed rgba(80,48,14,.46); border-radius: inherit; }
.coin.is-copper { border-color: #773f2f; background: radial-gradient(circle at 32% 25%,#ffd0aa 0 8%,#d97a4e 36%,#9b462d 78%); box-shadow: inset 0 0 0 4px rgba(255,255,255,.2),inset 0 -5px rgba(83,31,17,.15),0 5px 0 #6f3425,0 8px 11px rgba(61,39,17,.18); }
.coin.is-silver { border-color: #667478; background: radial-gradient(circle at 32% 25%,#fff 0 8%,#d9e2df 36%,#89999b 78%); box-shadow: inset 0 0 0 4px rgba(255,255,255,.4),inset 0 -5px rgba(51,69,72,.14),0 5px 0 #667578,0 8px 11px rgba(61,39,17,.18); }
.coin.is-pound { border-color: #72602b; background: radial-gradient(circle at 32% 25%,#fff9ae 0 8%,#dcc044 36%,#8d7b28 78%); }
.coin.is-note { width: 91px; height: 50px; border-color: #365f55; border-radius: 9px; color: #173f38; background: linear-gradient(145deg,#d5f1d8,#7bc4a0); box-shadow: inset 0 0 0 4px rgba(255,255,255,.28),0 5px 0 #397362,0 8px 11px rgba(61,39,17,.18); font-size: 18px; }
.coin.is-note::after { border-radius: 5px; }.coin span { position: relative; z-index: 1; }
button.coin:hover { transform: translateY(-4px) rotate(-2deg); filter: brightness(1.05); }button.coin:active { transform: translateY(3px) scale(.96); box-shadow: inset 0 0 0 4px rgba(255,255,255,.25),0 2px 0 #71451a; }

.coin-tray-wrap { position: relative; min-height: 114px; display: grid; grid-template-columns: 1fr 116px; grid-template-rows: 29px 1fr; gap: 5px 12px; margin: 0 auto 4px; width: min(730px,100%); padding: 11px 13px 12px; border: 3px solid #6e3e25; border-radius: 16px; background: linear-gradient(180deg,#985c36,#754027); box-shadow: inset 0 5px 0 rgba(255,255,255,.12),0 6px 0 #4e2b1d; }
.tray-heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }.tray-heading span { color: #ffeac3; }
.clear-tray { min-height: 29px; padding: 2px 10px; border: 1px solid #f1d7aa; border-radius: 999px; color: #fff6e4; background: rgba(47,25,16,.35); font-size: 11px; font-weight: 900; }
.coin-tray { min-height: 67px; display: flex; align-items: center; gap: 10px; padding: 6px 10px; overflow: hidden; border: 2px solid #4c2e21; border-radius: 11px; background: #40271e; box-shadow: inset 0 6px 12px rgba(12,7,4,.35); }
.coin-tray .coin { --coin-size: 47px; animation: coin-drop 260ms cubic-bezier(.25,.8,.3,1.2) both; }.coin-tray .coin.is-note { width: 76px; height: 42px; }
.empty-tray { width: 100%; color: #c8a98e; font-size: 12px; font-weight: 900; text-align: center; }
.till-total { display: grid; place-content: center; border: 2px solid #3e3f32; border-radius: 11px; background: #d7e5a9; box-shadow: inset 0 3px 7px rgba(50,63,40,.18); text-align: center; }.till-total span { color: #596247; }.till-total strong { font-family: ui-monospace,SFMono-Regular,monospace; font-size: 25px; }

.feedback { min-height: 34px; display: grid; place-items: center; padding: 2px 8px 0; color: var(--teal-dark); font-size: 14px; font-weight: 900; text-align: center; }.feedback.is-error { color: #a02b29; }
.action-area { min-height: 68px; display: flex; align-items: end; justify-content: center; gap: 11px; }
.answer-grid,.coin-palette { width: min(730px,100%); display: flex; align-items: end; justify-content: center; gap: 13px; }
.coin-palette { padding-bottom: 3px; }
.answer,.primary { min-height: 59px; border: 2px solid #075754; border-radius: 16px; color: white; background: linear-gradient(180deg,#119b91,#08736f); box-shadow: inset 0 2px rgba(255,255,255,.2),0 6px 0 #07514e; font-weight: 1000; transition: transform 130ms ease-out,box-shadow 130ms ease-out,filter 130ms ease-out; }
.answer { min-width: 132px; padding: 8px 18px; font-size: 24px; }.answer small { display: block; margin-top: 3px; color: #d8fffa; font-size: 10px; }
.answer:hover,.primary:hover { transform: translateY(-3px); filter: brightness(1.07); box-shadow: inset 0 2px rgba(255,255,255,.2),0 8px 0 #07514e; }.answer:active,.primary:active { transform: translateY(4px); box-shadow: inset 0 2px rgba(255,255,255,.2),0 2px 0 #07514e; }
.primary { min-width: 245px; padding: 0 24px; font-size: 16px; }.primary.is-gold { border-color: #8b5716; color: #50300b; background: linear-gradient(180deg,#ffda68,#f2ae2f); box-shadow: inset 0 2px white,0 6px 0 #9a5a16; }.primary.is-coral { border-color: #9d3529; background: linear-gradient(180deg,#f5785e,#d84d3a); box-shadow: inset 0 2px rgba(255,255,255,.25),0 6px 0 #963326; }

.confetti { position: absolute; z-index: 30; left: 50%; top: 48%; width: min(650px,55vw); opacity: 0; transform: translate(-50%,-50%) scale(.65); pointer-events: none; }
.market-world.is-celebrating .confetti { animation: confetti-pop 760ms ease-out both; }
.market-world.is-miss .till-card { animation: gentle-shake 390ms ease-out; }
.toast { position: absolute; z-index: 40; left: 50%; bottom: 27px; max-width: 75%; padding: 11px 18px; opacity: 0; transform: translate(-50%,12px); border: 2px solid #744318; border-radius: 999px; color: #4b2d0c; background: #ffdc6b; box-shadow: 0 5px 0 #75431a,0 10px 22px rgba(55,32,15,.28); 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); }

@keyframes coin-drop { 0% { opacity: 0; transform: translateY(-24px) rotate(-12deg) scale(.7); } 70% { opacity: 1; transform: translateY(3px) rotate(3deg) scale(1.07); } }
@keyframes mascot-cheer { 0%,100% { transform: translateY(0) rotate(0); } 35% { transform: translateY(-19px) rotate(-4deg) scale(1.04); } 65% { transform: translateY(-5px) rotate(3deg); } }
@keyframes mascot-think { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(1deg); } }
@keyframes mascot-oops { 0%,100% { transform: rotate(0); } 30% { transform: rotate(-4deg) translateX(-4px); } 68% { transform: rotate(4deg) translateX(4px); } }
@keyframes confetti-pop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.58) rotate(-4deg); } 28% { opacity: 1; transform: translate(-50%,-50%) scale(1.05) rotate(1deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-52%) scale(1.15); } }
@keyframes gentle-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

@media (max-width: 1120px) {
  .market-hud { grid-template-columns: 175px 1fr auto; }.difficulty-card { position: absolute; left: 46%; top: 74px; width: 270px; transform: translateX(-50%); }.scoreboard > div { min-width: 59px; }.game-shell { grid-template-columns: 225px minmax(620px,1fr); }.mascot { left: 16px; width: 198px; }.speech-bubble strong { font-size: 13px; }
}
@media (max-height: 760px) {
  .market-hud { top: 12px; height: 62px; }.mission-card,.scoreboard { height: 62px; }.game-shell { top: 88px; bottom: 15px; }.till-card { padding-top: 14px; }.challenge-copy h1 { font-size: 30px; }.order-stage { min-height: 108px; padding-top: 6px; }.coin-tray-wrap { min-height: 102px; }.speech-bubble { min-height: 81px; }.mascot { width: 190px; }.action-area { min-height: 61px; }.answer,.primary { min-height: 53px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
