/* ─────────────────────────────────────────────────────────────
   The Garden Market — "Grow it, then sell it!"
   Fruit3D house style. Chrome (header/footer/overlays/cards/
   buttons/mascot/banner) is cloned from the mirror-maze reference
   so this page reads as the same product; the level nav, progress
   bar and in-scene panels are new for the two-strand structure.
   ───────────────────────────────────────────────────────────── */

:root {
  /* ── Brief §2.2 palette (exact hexes) ── */
  --plum:        #2B0326;   /* page / theme background */
  --plum-panel:  #300028;   /* panel variant */
  --cream:       #F9F4F1;
  --raspberry:   #E83459;
  --orange:      #FF8A20;
  --hotpink:     #FC74B4;
  --plum-accent: #C03E86;
  --palepink:    #FFD8D1;
  --lime:        #E0E31A;
  --jade:        #45BA90;
  --mint:        #81FFCF;
  --yellow:      #FFD401;
  --gold:        #FFBE00;
  --ice:         #CAF5FC;
  --sky:         #38C3E4;

  /* ── Strand coding ── */
  --grow:        #45BA90;   /* Science / Grow leans green */
  --grow-soft:   #81FFCF;
  --sell:        #FFBE00;   /* Maths / Sell leans warm gold */
  --sell-soft:   #FFD401;

  /* ── Dark plum theme surfaces ── */
  --card:       #3a0a33;
  --card-inset: #4a133f;
  --line-dark:  #5a1a4f;
  --nav:        #A1FCD2;    /* primary buttons (mint) */
  --nav-dark:   #6fcea3;

  --text-strong: #FFFFFF;
  --text-body:   #FFFFFF;
  --text-soft:   rgba(249, 244, 241, .70);
  --text-faint:  rgba(249, 244, 241, .5);

  /* ── Type: Raleway chrome (as the reference), rounded fallback ── */
  --font-brand: 'Raleway', 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans:  'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-chrome:'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700; --fw-ultrabold: 800;
  --tracking-tight: -0.02em;

  --text-xs: 12px; --text-sm: 14px; --text-base: 16px; --text-md: 18px;
  --text-lg: 20px; --text-xl: 24px; --text-2xl: 30px; --text-3xl: 36px;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px;
  --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px; --radius-full: 9999px;
  --shadow-card: 0 12px 28px rgba(28,10,36,0.35), 0 2px 6px rgba(28,10,36,0.20);
  --shadow-soft: 0 4px 12px rgba(28,10,36,0.22);
  --ease-pop: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms; --dur-base: 220ms; --dur-slow: 360ms;
  --ring: color-mix(in srgb, var(--hotpink) 55%, transparent);
}

/* ── Reset & base ── */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  background: var(--plum);
  font-family: var(--font-sans);
  color: var(--text-body);
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-md); }
[hidden] { display: none !important; }

.mm-app { width: 100vw; height: 100vh; display: flex; flex-direction: column; }

/* ═══════════════  Fruit3D site chrome (header & footer)  ═══════════════ */
.site-header, .site-footer {
  flex: none; background: var(--plum); z-index: 10; font-family: var(--font-chrome);
}
.site-header { border-bottom: 1px solid var(--line-dark); }
.site-footer { border-top: 1px solid var(--line-dark); }
.site-bar { display: flex; align-items: center; gap: 14px; padding: 8px 22px; }
.site-header .site-bar { height: 60px; padding: 0 20px; gap: 16px; }
.site-logo-link { display: inline-flex; align-items: center; flex: 0 0 auto; transition: opacity .15s ease; }
.site-logo-link:hover { opacity: .85; }
.site-logo { height: 30px; width: auto; display: block; }
.site-title { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.site-title h1 {
  margin: 0; font-family: var(--font-chrome);
  font-size: clamp(14px, 2vw, 20px); font-weight: 700; letter-spacing: -.01em;
  line-height: 1.1; color: #fff;
}
.fruit3d-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap; border-radius: 11px; background: var(--card-inset);
  border: 1px solid var(--line-dark); padding: 6px 13px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  color: #f8f4f1; text-decoration: none; transition: opacity .16s;
}
.fruit3d-pill:hover { opacity: .9; }
.fruit3d-pill .pill-logo { display: block; height: 16px; width: auto; }
.signup-btn {
  display: inline-flex; align-items: center; border: 1px solid transparent; border-radius: 11px;
  background: #EB7CB2; color: #fff; padding: 6px 16px;
  font-family: var(--font-chrome); font-size: 13px; font-weight: 700; letter-spacing: .02em; line-height: 16px;
  white-space: nowrap; text-decoration: none; transition: filter .16s;
}
.signup-btn:hover { filter: brightness(1.06); }

.site-footer .copyright, .site-footer .made-with {
  white-space: nowrap; font-size: 13.5px; font-weight: 600; letter-spacing: .01em; color: #f8f4f1;
}
.site-footer .copyright { margin-right: auto; }
.site-footer .site-bar { position: relative; }
.site-footer .created-by {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; letter-spacing: .01em; color: #f8f4f1;
}
.site-footer .created-by svg { display: block; flex: none; }
.site-footer .wordmark-link { display: inline-flex; align-items: center; transition: opacity .16s; }
.site-footer .wordmark-link:hover { opacity: .8; }
.site-footer .wordmark { height: 22px; width: auto; }

/* ═══════════════  Progress HUD + Back/Menu (top-right of the play area) ═══════════════
   Matches the exploding-dots reference: a mint card (level + % + bar) spanning
   the top, with outlined "← Back" and "Menu" buttons beneath it. */
.hud-group {
  position: absolute; top: 12px; right: 12px; z-index: 12;
  display: grid; grid-template-columns: 1fr 1fr;
  grid-template-areas: "card card" "back menu";
  gap: 8px; width: 200px;
}
.hud-group[hidden] { display: none !important; }
.progress-hud {
  grid-area: card;
  background: var(--card); border: 2px solid #A1FCD2; border-radius: 16px;
  padding: 11px 16px 13px;
  box-shadow: var(--shadow-soft);
  font-family: var(--font-brand);
  text-align: center;
}
.progress-level {
  font-size: 20px; font-weight: 800; letter-spacing: .01em;
  color: #A1FCD2; margin-bottom: 3px; line-height: 1.05;
}
.progress-label {
  font-size: 15px; font-weight: 800; letter-spacing: .01em;
  color: #A1FCD2; margin-bottom: 9px;
}
.progress-track {
  height: 14px; border-radius: var(--radius-full); overflow: hidden;
  background: rgba(161, 252, 210, .22);
}
.progress-fill {
  height: 100%; width: 0%; border-radius: var(--radius-full);
  background: #A1FCD2;
  transition: width .45s var(--ease-pop);
}
.hud-btn {
  font-family: var(--font-brand); font-weight: 800; font-size: 15px;
  color: #A1FCD2; background: var(--card);
  border: 2px solid #A1FCD2; border-radius: 14px;
  padding: 8px 6px; cursor: pointer; width: 100%;
  transition: background .15s, color .15s, transform .1s;
  touch-action: manipulation;
}
.hud-btn:hover { background: #A1FCD2; color: var(--plum); }
.hud-btn:active { transform: translateY(1px) scale(.98); }
#btnBack { grid-area: back; }
#btnMenu { grid-area: menu; }
@media (max-width: 640px) {
  .hud-group { top: 6px; right: 6px; width: 148px; gap: 5px; }
  .progress-hud { padding: 6px 10px 8px; border-width: 1.5px; border-radius: 13px; }
  .progress-level { font-size: 14px; margin-bottom: 2px; }
  .progress-label { font-size: 10.5px; margin-bottom: 5px; }
  .progress-track { height: 8px; }
  .hud-btn { font-size: 12px; padding: 6px 4px; border-radius: 11px; border-width: 1.5px; }
}

/* ═══════════════  Stage & canvas  ═══════════════ */
.mm-stage-wrap {
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative; padding: 8px; overflow: hidden;
}
.mm-canvas-wrap {
  position: absolute; inset: 8px;
  border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-card); touch-action: none;
  background: #e4eff8;
}
.mm-three-host { position: absolute; inset: 0; z-index: 1; }
.mm-three-host canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }

/* ── Strand chip (top-left) ── */
.gm-strand-chip {
  position: absolute; top: 12px; left: 12px; z-index: 12;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-full); padding: 7px 14px 7px 11px;
  font-family: var(--font-brand); font-weight: 700; font-size: 13.5px; color: #fff;
  box-shadow: var(--shadow-soft);
}
.gm-strand-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--grow); }
.gm-strand-chip.is-sell .gm-strand-dot { background: var(--sell); }

/* ── Banner (top-centre) ── */
.mm-banner {
  position: absolute; top: 3%; left: 50%; transform: translate(-50%, -8px); z-index: 11;
  background: var(--card); border: 1px solid var(--line-dark);
  border-radius: var(--radius-full); box-shadow: var(--shadow-soft);
  padding: 10px 22px; max-width: 82%;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-pop), transform var(--dur-slow) var(--ease-pop);
}
.mm-banner.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mm-banner p {
  font-family: var(--font-sans); font-weight: 600; font-size: var(--text-md);
  color: #fff; text-align: center;
}
@media (min-width: 641px) { .mm-banner p { white-space: nowrap; } }

/* ── Drag hint ── */
.mm-drag-hint {
  position: absolute; z-index: 9; left: 50%; top: 60%;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transform: translate(-50%, -50%); pointer-events: none;
}
.mm-drag-hint-hand {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.85); animation: mm-pulse 1.4s ease-in-out infinite;
}
.mm-drag-hint p {
  font-family: var(--font-sans); font-weight: 600; font-size: var(--text-sm); color: #fff;
  background: rgba(38, 9, 33, 0.75); padding: 3px 10px; border-radius: var(--radius-full); white-space: nowrap;
}
@keyframes mm-pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  50% { transform: scale(1.25); opacity: 0.35; }
  100% { transform: scale(0.85); opacity: 0.9; }
}

/* ── Mascot dock ── */
.mm-mascot-dock {
  position: absolute; left: 2%; bottom: 3%; z-index: 10;
  display: flex; align-items: flex-end; gap: 10px; pointer-events: none; max-width: 46%;
}
.mm-mascot { width: 108px; height: 108px; flex-shrink: 0; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35)); }
.mm-mascot.mm-bounce { animation: mm-bounce 620ms var(--ease-pop); }
.mm-mascot.mm-tilt { animation: mm-tilt 560ms var(--ease-pop); }
@keyframes mm-bounce {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-16px) scale(1.06); }
  60% { transform: translateY(2px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes mm-tilt {
  0% { transform: rotate(0deg); } 30% { transform: rotate(-12deg); }
  60% { transform: rotate(8deg); } 100% { transform: rotate(0deg); }
}
.mm-speech-bubble {
  position: relative; max-width: 300px;
  background: #D6455C; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
  padding: 10px 14px; margin-bottom: 8px;
  opacity: 0; transform: scale(0.96);
  transition: opacity var(--dur-base) var(--ease-pop), transform var(--dur-base) var(--ease-pop);
}
.mm-speech-bubble.is-visible { opacity: 1; transform: scale(1); }
.mm-speech-bubble p { font-size: var(--text-base); line-height: 1.4; color: #ffffff; font-weight: 600; }
.mm-speech-bubble::after {
  content: ''; position: absolute; left: 22px; bottom: -8px; width: 16px; height: 16px;
  background: #D6455C; clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* ═══════════════  In-scene panels  ═══════════════ */
/* Right-hand panel: coin tray / job cards / representation picker */
.gm-panel {
  position: absolute; right: 2%; bottom: 3%; z-index: 10;
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
  max-width: 40%;
}
.gm-panel-title {
  font-family: var(--font-brand); font-weight: 700; font-size: 13px;
  color: var(--text-soft); text-align: center; letter-spacing: .01em;
}

/* Coin tray grid */
.gm-coin-tray { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gm-coin-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--card); border: 2px solid var(--line-dark); border-radius: var(--radius-lg);
  padding: 6px 4px; box-shadow: var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-pop), border-color var(--dur-base);
}
.gm-coin-btn:hover { transform: translateY(-2px); }
.gm-coin-btn:active { transform: scale(0.94); }
.gm-coin-btn.is-picked { border-color: var(--sky); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 35%, transparent), var(--shadow-soft); }
.gm-coin-face {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-brand); font-weight: 800; font-size: 12px; line-height: 1;
  box-shadow: inset 0 2px 3px rgba(255,255,255,.35), inset 0 -2px 4px rgba(0,0,0,.28), 0 2px 3px rgba(0,0,0,.3);
  border: 1px solid rgba(0,0,0,.25);
}
.gm-coin-face.note { border-radius: 6px; width: 52px; height: 32px; font-size: 12px; }
.gm-coin-label { font-size: 11px; font-weight: 700; color: var(--text-soft); }

/* Copper / silver / gold coin finishes */
.coin-copper { background: radial-gradient(circle at 35% 30%, #E7A16A, #B5652E 70%); color: #4a2410; }
.coin-silver { background: radial-gradient(circle at 35% 30%, #F0F2F5, #A9B2BC 72%); color: #33383f; }
.coin-gold   { background: radial-gradient(circle at 35% 30%, #FFE08A, #E0A21C 72%); color: #5a3d05; }
.coin-bimetal{ background: radial-gradient(circle at 50% 50%, #FFE08A 0 42%, #C9CFD6 44%); color: #3a2f10; }
.note-fiver  { background: linear-gradient(135deg, #9fd6e6, #4a9fc0); color: #05323f; }
.note-tenner { background: linear-gradient(135deg, #f2b8c6, #d06a90); color: #4a0f26; }

/* Generic card list (job cards, rep picker) */
.gm-card-list { display: flex; flex-direction: column; gap: 8px; }
.gm-mini-card {
  background: var(--card-inset); border: 2px solid var(--line-dark); border-radius: var(--radius-lg);
  padding: 10px 14px; box-shadow: var(--shadow-soft);
  font-family: var(--font-sans); font-weight: 600; font-size: var(--text-sm); color: #fff;
  text-align: left; transition: transform var(--dur-fast) var(--ease-pop), border-color var(--dur-base), background var(--dur-base);
}
.gm-mini-card:hover { transform: translateY(-2px); border-color: var(--grow-soft); }
.gm-mini-card:active { transform: scale(0.97); }
.gm-mini-card.is-selected { border-color: var(--sell); background: color-mix(in srgb, var(--sell) 20%, var(--card-inset)); }
.gm-mini-card.is-placed { opacity: .4; pointer-events: none; }
.gm-mini-card .gm-mini-tag { display: block; font-size: 11px; font-weight: 700; color: var(--grow-soft); margin-top: 2px; }

/* Left-hand readout (total / labels) */
.gm-readout {
  position: absolute; left: 2%; top: 64px; z-index: 10;
  background: var(--card); border: 2px solid var(--line-dark); border-radius: var(--radius-lg);
  padding: 12px 16px; box-shadow: var(--shadow-soft); min-width: 150px; max-width: 42%;
}
.gm-readout h4 {
  font-family: var(--font-brand); font-weight: 700; font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-soft); margin-bottom: 6px;
}
.gm-readout .gm-big {
  font-family: var(--font-brand); font-weight: 800; font-size: 28px; color: #fff; line-height: 1;
}
.gm-readout .gm-big.grow { color: var(--grow-soft); }
.gm-readout .gm-big.sell { color: var(--sell-soft); }
.gm-readout .gm-sub { font-size: 13px; color: var(--text-soft); margin-top: 6px; line-height: 1.4; }

/* ── Action dock (bottom-centre pills) ── */
.gm-action-dock {
  position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); z-index: 11;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 92%;
}
.gm-act-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 24px; border-radius: var(--radius-full);
  font-family: var(--font-brand); font-weight: 700; font-size: var(--text-md); letter-spacing: var(--tracking-tight);
  background: var(--card); border: 2px solid var(--line-dark); color: #fff; box-shadow: var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-pop), box-shadow var(--dur-base), background var(--dur-base), border-color var(--dur-base);
}
.gm-act-btn:active { transform: scale(0.96); }
.gm-act-btn.grow { background: var(--grow); border-color: #2f8f6c; color: #06251b; }
.gm-act-btn.grow:hover { background: #52c99e; }
.gm-act-btn.sell { background: var(--sell); border-color: #c79400; color: #3a2a00; }
.gm-act-btn.sell:hover { background: #ffca2b; }
.gm-act-btn.primary { background: var(--nav); border-color: var(--nav-dark); color: var(--plum); box-shadow: 0 6px 0 var(--nav-dark), 0 12px 18px rgba(0,0,0,.35); }
.gm-act-btn.primary:active { transform: translateY(3px) scale(.98); box-shadow: 0 3px 0 var(--nav-dark), 0 6px 10px rgba(0,0,0,.35); }
.gm-act-btn:disabled { opacity: .45; cursor: default; transform: none; }

/* ═══════════════  Overlays & cards  ═══════════════ */
.mm-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(38, 9, 33, 0.62); padding: 16px;
  transition: opacity var(--dur-slow) var(--ease-pop);
}
.mm-card {
  background: var(--card); border: 1px solid var(--line-dark); border-radius: 24px;
  box-shadow: var(--shadow-card); padding: var(--space-8);
  max-width: 560px; width: 100%; max-height: 100%; overflow: auto;
  animation: f3d-pop var(--dur-base) var(--ease-pop);
}
@keyframes f3d-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.mm-title-card { text-align: center; }
.intro-logo { display: block; height: 34px; width: auto; margin: 0 auto 16px; }
.intro-emoji { font-size: clamp(38px, 6vh, 48px); line-height: 1; }
.mm-title-card h1 {
  margin: 12px 0 8px; font-family: var(--font-brand); font-weight: 700;
  font-size: clamp(26px, 4.6vh, 38px); line-height: 1.1; letter-spacing: var(--tracking-tight);
  text-wrap: balance; color: #fff;
}
.intro-sub { font-size: clamp(13px, 1.8vh, 15px); font-weight: 700; letter-spacing: .02em; color: #EB7CB2; margin: 0 0 6px; }
.intro-subtitle { font-size: clamp(15px, 2.2vh, 19px); font-weight: 800; letter-spacing: .01em; color: #EB7CB2; margin: 0 0 12px; }
.intro-subhead { margin: clamp(24px, 5vh, 46px) auto; max-width: 420px; font-size: clamp(16px, 2.6vh, 21px); font-weight: 700; line-height: 1.2; text-wrap: balance; color: #fff; }

/* ── Opening-card level picker — matches the exploding-dots reference:
   all three levels in a single row, Level 1 filled mint, Levels 2 & 3 outlined. */
.intro-levels { display: flex; flex-flow: row wrap; align-items: center; justify-content: center; gap: 12px; }
.btn-intro-start {
  font-family: var(--font-brand); font-size: clamp(15px, 2.4vh, 18px); font-weight: 800;
  color: var(--plum); background: var(--nav);
  border: 2px solid var(--nav); border-radius: var(--radius-full);
  padding: 11px 30px; cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .3);
  transition: transform var(--dur-base) var(--ease-pop), box-shadow var(--dur-base), background var(--dur-base);
  touch-action: manipulation;
}
.btn-intro-start:hover { background: #b6ffdd; }
.btn-intro-start:active { transform: translateY(2px) scale(.98); box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.btn-intro-level {
  font-family: var(--font-brand); font-size: clamp(15px, 2.4vh, 18px); font-weight: 800;
  color: #A1FCD2; background: transparent;
  border: 2px solid #A1FCD2; border-radius: var(--radius-full);
  padding: 11px 30px; cursor: pointer;
  transition: transform var(--dur-base) var(--ease-pop), background .15s, color .15s;
  touch-action: manipulation;
}
.btn-intro-level:hover { background: #A1FCD2; color: var(--plum); }
.btn-intro-level:active { transform: translateY(2px) scale(.98); }

.mm-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 60px; padding: 14px 32px; border-radius: var(--radius-full);
  font-family: var(--font-brand); font-weight: 700; font-size: var(--text-md); letter-spacing: var(--tracking-tight);
  transition: transform var(--dur-fast) var(--ease-pop), box-shadow var(--dur-base), background var(--dur-base);
}
.mm-btn:active { transform: scale(0.96); }
.mm-btn--primary { background: var(--nav); color: var(--plum); border: none; box-shadow: 0 8px 0 var(--nav-dark), 0 14px 22px rgba(0,0,0,.4); }
.mm-btn--primary:hover { background: #b6ffdd; }
.mm-btn--primary:active { transform: translateY(3px) scale(.98); box-shadow: 0 4px 0 var(--nav-dark), 0 8px 14px rgba(0,0,0,.4); }
.mm-btn--secondary { background: transparent; color: #fff; border: 2px solid var(--line-dark); box-shadow: var(--shadow-soft); }
.mm-btn--secondary:hover { border-color: var(--nav); background: var(--card-inset); }

.mm-level-picker { margin-top: var(--space-6); display: flex; flex-direction: column; gap: 10px; }
.mm-title-card .mm-level-picker .mm-btn { margin-top: 0; width: 100%; }
.mm-level-btn { min-height: 60px; padding: 12px 16px; }
.mm-level-row { display: flex; gap: 10px; }
.mm-level-row .mm-level-btn { flex: 1 1 0; min-width: 0; padding: 12px 10px; min-height: 52px; }

/* ═══════════════  Quiz / card body — matched to the mirror-maze reference  ═══════════════
   Dark plum card with a round Back button (top-left) and round Next button
   (bottom-right, revealed once the answer is right), a white "Show what you
   know" title, pink question, outlined option tiles and a mint correct answer. */
.gm-card-h { font-family: var(--font-brand); font-weight: 700; font-size: var(--text-2xl); color: #fff; text-align: center; }
.gm-card-emoji { font-size: 44px; text-align: center; line-height: 1; margin-bottom: 6px; }

/* Quiz card shell: relative so the round nav buttons anchor to its corners */
.mm-card.gm-quiz-card {
  position: relative; text-align: center;
  max-width: 520px; padding: clamp(24px, 5vh, 44px) clamp(24px, 5vw, 52px);
}

/* Round nav buttons — Back (top-left) and Next (bottom-right), mint outline */
.gm-quiz-back, .gm-quiz-next {
  position: absolute; z-index: 3;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border-radius: 50%; border: 2px solid var(--nav);
  background: transparent; color: var(--nav);
  font-family: var(--font-brand); font-weight: 700; font-size: 21px; line-height: 1;
  cursor: pointer; transition: background .15s, color .15s, transform .1s;
}
.gm-quiz-back { top: 12px; left: 12px; }
.gm-quiz-next { bottom: 12px; right: 12px; }
.gm-quiz-next[hidden] { display: none; }
.gm-quiz-back:hover, .gm-quiz-next:hover { background: var(--nav); color: var(--plum); }
.gm-quiz-back:active, .gm-quiz-next:active { transform: scale(0.95); }

.gm-quiz-title { font-family: var(--font-brand); font-weight: 700; font-size: clamp(20px, 3.2vh, 28px); color: #fff; text-align: center; margin-bottom: var(--space-3); }
.gm-quiz-stars { display: flex; gap: 8px; justify-content: center; margin-bottom: var(--space-5); }
.gm-quiz-star { width: 30px; height: 30px; flex-shrink: 0; opacity: .35; transition: opacity var(--dur-base) var(--ease-pop), transform var(--dur-base) var(--ease-pop); }
.gm-quiz-star.is-earned { opacity: 1; transform: scale(1.12); }
.gm-quiz-prompt { font-family: var(--font-brand); font-weight: 800; font-size: clamp(16px, 2.6vh, 21px); color: #EB7CB2; text-align: center; margin-bottom: var(--space-2); text-wrap: balance; }
.gm-quiz-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; margin-top: var(--space-4); }
.gm-quiz-option {
  flex: 0 1 auto; min-width: 88px; min-height: 64px;
  background: var(--card-inset); border: 3px solid var(--line-dark);
  border-radius: var(--radius-lg); padding: 12px 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-brand); font-weight: 800; font-size: clamp(16px, 2.6vh, 22px); color: #fff; text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform .16s var(--ease-pop), border-color .16s, background .16s, color .16s;
}
.gm-quiz-option:hover { transform: translateY(-2px); }
.gm-quiz-option:active { transform: scale(0.95); }
.gm-quiz-option.is-correct { background: #A1FCD2; color: var(--plum); border-color: #A1FCD2; transform: scale(1.06); }
.gm-quiz-option.is-wrong { border-color: var(--orange); opacity: .55; animation: mm-shake .4s; }
@keyframes mm-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.gm-quiz-emoji { font-size: 30px; line-height: 1; }
.gm-quiz-feedback {
  margin-top: var(--space-5); min-height: 2.4em;
  font-size: clamp(14px, 2vh, 17px); font-weight: 600;
  color: var(--text-soft); text-align: center;
}
.gm-quiz-feedback[hidden] { display: none; }
.gm-quiz-feedback.is-good { color: var(--mint); }
.gm-quiz-feedback.is-good strong, .gm-quiz-feedback.is-kind strong { color: inherit; }
.gm-card-btn { margin-top: var(--space-5); width: 100%; }
.gm-finale-take {
  margin-top: var(--space-4); padding: var(--space-5); background: var(--card-inset);
  border: 1px solid var(--line-dark); border-radius: var(--radius-lg);
  font-size: var(--text-md); color: #fff; text-align: center; line-height: 1.5;
}
.gm-finale-note { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--text-faint); text-align: center; }

/* ── Level-complete / finale card (matched to the mirror-maze finale) ── */
.finale-card {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--line-dark);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  padding: clamp(28px, 4vh, 42px) clamp(24px, 4vw, 40px) clamp(26px, 3.4vh, 36px);
  text-align: center;
  max-height: 100%; overflow: auto;
  animation: f3d-pop var(--dur-base) var(--ease-pop);
}
.finale-emoji { font-size: clamp(38px, 6vh, 48px); line-height: 1; }
.finale-stars { display: flex; gap: 8px; justify-content: center; margin: 6px 0 2px; min-height: 34px; }
.finale-stars:empty { min-height: 0; margin: 0; }
.finale-stars .gm-quiz-star { width: 40px; height: 40px; opacity: 1; }
.finale-stars .gm-quiz-star svg { width: 40px; height: 40px; }
.finale-card h1 {
  font-family: var(--font-brand); font-weight: 700;
  font-size: clamp(26px, 4.6vh, 40px); line-height: 1.1; margin: 8px 0 10px; text-wrap: balance; color: #fff;
}
.takeaway-line {
  font-size: clamp(15px, 2.4vh, 20px); line-height: 1.45; color: var(--text-body);
  max-width: 100%; margin: 0 auto 26px; text-wrap: balance;
}
.finale-note { color: var(--nav); font-size: clamp(15px, 2.4vh, 20px); margin: 0 0 22px; font-weight: 800; }
.finale-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: var(--space-4); }
/* Menu button shrinks to its content and centres so it never overlaps the
   round Next button in the bottom-right (mirror-maze finale rule). */
.finale-actions .finale-menu { width: auto; min-width: 200px; align-self: center; }
.finale-actions .finale-again { width: 100%; }
/* End card: play again + Sign Up sit side by side, like the mirror-maze end row */
.finale-actions.gm-end-actions { flex-direction: row; gap: 12px; margin-top: var(--space-6); }
.gm-end-actions .mm-btn { flex: 1 1 0; width: auto; margin-top: 0; text-decoration: none; }
@media (max-width: 560px) { .finale-actions.gm-end-actions { flex-direction: column; } }
.finale-card.champion .takeaway-line { color: #EB7CB2; font-weight: 800; }

/* Level-complete strand ticks */
.gm-strand-ticks { display: flex; gap: 12px; justify-content: center; margin: var(--space-4) 0; }
.gm-strand-tick { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: var(--text-sm); color: var(--text-soft); }
.gm-strand-tick .dot { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--plum); font-weight: 900; }
.gm-strand-tick.grow .dot { background: var(--grow-soft); }
.gm-strand-tick.sell .dot { background: var(--sell-soft); }

/* ═══════════════  Bar model / number line (Level 3 maths)  ═══════════════ */
.gm-rep { margin: var(--space-4) 0; }
.gm-barmodel { display: flex; flex-direction: column; gap: 8px; }
.gm-bar-whole, .gm-bar-parts { display: flex; height: 44px; border-radius: 8px; overflow: hidden; border: 2px solid var(--line-dark); }
.gm-bar-seg { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: var(--plum); border-right: 2px solid rgba(0,0,0,.2); }
.gm-bar-seg:last-child { border-right: none; }
.gm-numline { position: relative; height: 60px; margin: 10px 6px; }
.gm-numline-axis { position: absolute; top: 30px; left: 0; right: 0; height: 3px; background: var(--text-soft); border-radius: 3px; }
.gm-numline-tick { position: absolute; top: 22px; width: 3px; height: 18px; background: var(--text-soft); border-radius: 2px; }
.gm-numline-lab { position: absolute; top: 42px; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--text-soft); }
.gm-numline-hop { position: absolute; top: 6px; height: 22px; border: 2.5px solid var(--sell); border-bottom: none; border-radius: 40px 40px 0 0; }
.gm-numline-hoplab { position: absolute; top: -4px; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: var(--sell-soft); }
.gm-eqn { font-family: var(--font-brand); font-weight: 800; font-size: 26px; color: #fff; text-align: center; letter-spacing: .01em; }
.gm-eqn .blank { color: var(--sell-soft); border-bottom: 3px solid var(--sell); padding: 0 8px; }

/* ═══════════════  Responsive  ═══════════════ */
@media (max-width: 900px) {
  .gm-panel { max-width: 46%; }
  .gm-coin-tray { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .mm-stage-wrap { padding: 6px 6px calc(120px + env(safe-area-inset-bottom, 0px)); }
  .mm-banner { display: none !important; }
  .gm-strand-chip { top: 6px; left: 6px; font-size: 12px; padding: 5px 10px; }
  .mm-overlay { position: fixed; inset: 0; z-index: 50; padding: 14px; }
  .mm-card { padding: var(--space-6); max-height: calc(100dvh - 28px); max-width: 460px; }
  .mm-title-card h1 { font-size: clamp(24px, 8vw, 34px); }
  .mm-mascot-dock {
    position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    flex-direction: row-reverse; align-items: center; justify-content: flex-end; gap: 8px; z-index: 15; max-width: none;
  }
  .mm-mascot { width: 75px; height: 75px; }
  .mm-speech-bubble { flex: 1 1 auto; max-width: none; margin-bottom: 0; }
  .mm-speech-bubble p { font-size: var(--text-sm); }
  .mm-speech-bubble::after { display: none; }
  .gm-panel {
    position: fixed; left: 8px; right: 8px; bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    max-width: none; z-index: 15;
  }
  .gm-coin-tray { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .gm-coin-face { width: 34px; height: 34px; font-size: 11px; }
  .gm-readout { position: fixed; left: 8px; top: auto; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); padding: 8px 12px; min-width: 0; }
  .gm-readout .gm-big { font-size: 22px; }
  .gm-action-dock { bottom: auto; top: 8px; }
  .gm-act-btn { min-height: 46px; padding: 10px 18px; font-size: var(--text-base); }
}

/* ── growth-phase orb (Roots/Stem/Leaves/Flower) + pause/play ── */
.gm-grow-orb {
  position: absolute; top: 24%; left: 50%; transform: translate(-50%, -50%);
  z-index: 12; width: 118px; height: 118px; border-radius: 50%;
  background: #2B0326; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-brand); font-weight: 800; font-size: 21px; letter-spacing: .01em;
  box-shadow: 0 8px 22px rgba(0,0,0,.38);
  opacity: 0; pointer-events: none;
}
.gm-play-btn {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 13; width: 46px; height: 46px; border-radius: 50%;
  background: #EB7CB2; color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  transition: filter .15s, transform .1s;
}
.gm-play-btn:hover { filter: brightness(1.07); }
.gm-play-btn:active { transform: translateX(-50%) scale(.94); }
.gm-play-btn svg { display: block; }

/* ── little explanation pop-up (plant parts) ── */
.mm-card.gm-popup { max-width: 400px; text-align: center; }
.gm-pop-h { font-family: var(--font-brand); font-weight: 800; font-size: var(--text-xl); color: #fff; margin: 4px 0 10px; }
.gm-pop-body { font-size: var(--text-md); line-height: 1.5; color: #fff; }

/* ═══════════════  Floating 3D part labels  ═══════════════ */
.gm-label {
  position: absolute; z-index: 8; transform: translate(-50%, -50%);
  pointer-events: none; white-space: nowrap;
  font-family: var(--font-brand); font-weight: 700; font-size: 13px; letter-spacing: .01em;
  color: var(--plum); background: var(--mint);
  padding: 4px 11px; border-radius: var(--radius-full);
  box-shadow: 0 3px 8px rgba(0,0,0,.35);
  opacity: 0; transition: opacity .3s var(--ease-pop), transform .3s var(--ease-pop);
}
.gm-label.show { opacity: 1; }
.gm-label.sell { background: var(--sell-soft); }
.gm-label::after {
  content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px;
  background: inherit; transform: translateX(-50%) rotate(45deg);
}

/* dye colour swatches (Level 3 science) */
.gm-swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); box-shadow: var(--shadow-soft); padding: 0; }
.gm-swatch.is-picked { border-color: #fff; transform: scale(1.12); }
.gm-act-btn.swatch-row { gap: 12px; background: var(--card); border-color: var(--line-dark); padding: 10px 16px; }

/* ═══════════════  Fruit sprinkle (from reference)  ═══════════════ */
.fruit-sprinkle { position: fixed; inset: 0 0 auto 0; height: 0; pointer-events: none; z-index: 900; }
.fruit-sprinkle-item { position: fixed; display: block; height: auto; opacity: 0; will-change: transform, opacity; filter: drop-shadow(0 3px 4px rgba(0,0,0,.16)); }
.fruit-burst { position: fixed; inset: 0; height: 0; pointer-events: none; z-index: 950; }
.fruit-burst-item { position: fixed; display: block; height: auto; opacity: 0; will-change: transform, opacity; filter: drop-shadow(0 3px 4px rgba(0,0,0,.18)); }

/* ═══════════════  Reduced motion  ═══════════════ */
@media (prefers-reduced-motion: reduce) {
  .mm-mascot.mm-bounce, .mm-mascot.mm-tilt { animation: mm-fade-pulse 380ms ease-in-out; }
  .mm-drag-hint-hand { animation: none; opacity: 0.75; }
  .mm-banner, .mm-banner.is-visible { transform: translate(-50%, 0) !important; }
  .mm-overlay, .mm-card, .mm-banner, .mm-speech-bubble { animation: none !important; transition-duration: 180ms !important; }
  .gm-act-btn, .mm-btn, .gm-quiz-option, .gm-coin-btn, .gm-mini-card { transition-duration: 80ms !important; }
}
@keyframes mm-fade-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
