/*
  HeadStartMicrogames — shared overlay styles.
  Reuses The Head Start book palette so games feel native to the story, not bolted on.
  Load AFTER the book's own page styles.
*/

:root {
  --hsg-parchment: #faf3e0;
  --hsg-ink: #2c2416;
  --hsg-gold: #d4a017;
  --hsg-gold-dark: #b8862e;
  --hsg-green: #234f3a;
  --hsg-green-2: #5a8f43;
  --hsg-red: #9c3a22;
  --hsg-brown: #8b6914;
  --hsg-paper: #f0e8d4;
  --hsg-muted: #7a6e52;
  --hsg-starlight: #fff8dc;
  --hsg-shadow: rgba(25, 18, 10, 0.18);
}

/* Host gets a positioning context so the absolute layer can sit over it.
   The INNER hosts (kidpg / kp-scene / bk-info-inner) are not positioned by PageFlip, so we
   force relative on them. The OUTER .bk-pg, however, IS positioned by PageFlip (it sets inline
   position:absolute; left:… to lay the spread out side by side) — so we must NOT override that
   with !important, or adjacent game pages collapse out of the spread. A non-important relative
   is only a fallback; PageFlip's inline absolute wins and still serves as the layer's context. */
.kidpg.hsg-host,
.kp-scene.hsg-host,
.bk-info-inner.hsg-host { position: relative !important; }
.bk-pg.hsg-host { position: relative; }

/* The overlay shell never blocks page turns — only controls inside it are interactive. */
.hsg-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  font-family: "DM Mono", ui-monospace, monospace;
  color: var(--hsg-ink);
}
.hsg-layer * { box-sizing: border-box; }
.hsg-layer button,
.hsg-layer input,
.hsg-layer .hsg-draggable,
.hsg-layer .hsg-panel { pointer-events: auto; }

/* While a page is mid-flip (or a corner is being folded), hide the game overlay. It's a flat
   absolutely-positioned card that can't follow the page's 3D fold, so it would float/offset
   during the ~900ms turn and only snap into place when the page lands. The book toggles
   `.hsg-flipping` on its root on PageFlip's changeState; overlays fade back once it settles. */
.hsg-layer { transition: opacity 150ms ease; }
/* Hide INSTANTLY the moment a flip/fold starts (transition:none) so there's no trailing frame
   where the flat card is still visible over the curling page; fade gently back in on settle. */
.hsg-flipping .hsg-layer { opacity: 0 !important; pointer-events: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .hsg-layer { transition: none; } }

/* ---- prompt pill ---- */
.hsg-prompt {
  position: absolute;
  left: 50%;
  bottom: clamp(4px, 1vw, 10px);
  transform: translateX(-50%);
  max-width: min(94%, 560px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(35, 79, 58, 0.42);
  background: rgba(240, 232, 212, 0.95);
  box-shadow: 0 4px 14px var(--hsg-shadow);
  color: var(--hsg-green);
  font-size: clamp(9px, 1.5vw, 12px);
  line-height: 1.15;
  text-align: center;
  letter-spacing: 0.02em;
  pointer-events: auto;
}
.hsg-prompt strong { color: var(--hsg-red); }
.hsg-prompt-hidden { display: none; }
.hsg-layer[data-complete="true"] .hsg-prompt {
  border-color: rgba(90, 143, 67, 0.8);
  background: rgba(238, 244, 230, 0.98);
  color: var(--hsg-green-2);
}
.hsg-replay {
  flex: none;
  width: 24px; height: 24px;
  min-width: 24px;
  border-radius: 999px;
  border: 1px solid rgba(35, 79, 58, 0.35);
  background: rgba(35, 79, 58, 0.08);
  color: var(--hsg-green);
  cursor: pointer;
  font: inherit;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---- hotspots ---- */
.hsg-hotspot {
  position: absolute;
  min-width: 44px; min-height: 44px;
  border: 2px dashed rgba(184, 150, 90, 0);
  border-radius: 999px;
  background: rgba(233, 196, 90, 0);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.hsg-hotspot:hover,
.hsg-hotspot:focus-visible {
  border-color: rgba(184, 150, 90, 0.85);
  background: rgba(233, 196, 90, 0.14);
  outline: none;
  transform: scale(1.03);
}
.hsg-hotspot[data-hit="true"] {
  border-color: rgba(35, 79, 58, 0.8);
  background: rgba(35, 79, 58, 0.14);
}

/* ---- chips / choices / draggables ---- */
.hsg-coin,
.hsg-draggable,
.hsg-choice {
  border: 1.5px solid rgba(155, 117, 54, 0.72);
  border-radius: 999px;
  background: rgba(240, 232, 212, 0.97);
  box-shadow: 0 5px 14px var(--hsg-shadow);
  color: var(--hsg-green);
  font-family: "DM Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: clamp(11px, 1.6vw, 14px);
  line-height: 1;
  min-height: 44px;
  padding: 10px 14px;
  user-select: none;
  cursor: pointer;
}
.hsg-choice:hover,
.hsg-choice:focus-visible,
.hsg-draggable:focus-visible {
  outline: 2px solid rgba(233, 196, 90, 0.9);
  outline-offset: 2px;
}
.hsg-draggable { position: absolute; cursor: grab; touch-action: none; }
.hsg-draggable[aria-grabbed="true"] { cursor: grabbing; transform: scale(1.05); z-index: 6; }
.hsg-placed { border-color: rgba(90, 143, 67, 0.85); color: var(--hsg-green-2); }

/* ---- drop zones ---- */
.hsg-dropzone {
  position: absolute;
  border: 2px dashed rgba(35, 79, 58, 0.36);
  border-radius: 14px;
  background: rgba(35, 79, 58, 0.06);
  color: var(--hsg-green);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: clamp(9px, 1.35vw, 12px);
  line-height: 1.15;
  padding: 6px;
  pointer-events: none;
}
.hsg-dropzone[data-kind="variable"],
.hsg-dropzone[data-kind="cost"] {
  border-color: rgba(156, 58, 34, 0.42);
  background: rgba(156, 58, 34, 0.07);
  color: var(--hsg-red);
}
.hsg-dropzone[data-active="true"] { border-style: solid; background: rgba(233, 196, 90, 0.2); }

/* ---- coin tray (tapCoins) ---- */
.hsg-tray {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  bottom: clamp(40px, 7vw, 70px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.hsg-counter-pill {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 78px; padding: 8px 14px;
  border-radius: 16px;
  background: var(--hsg-green); color: var(--hsg-paper);
  box-shadow: 0 8px 18px var(--hsg-shadow);
}
.hsg-counter-pill b { font-family: "Playfair Display", serif; font-size: clamp(22px, 4.5vw, 38px); line-height: 1; }
.hsg-counter-pill span { margin-top: 2px; color: #bcd8b0; font-size: clamp(8px, 1.3vw, 11px); letter-spacing: 0.1em; text-transform: uppercase; }
.hsg-coin-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 320px; }
.hsg-coin {
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  background: radial-gradient(circle at 38% 34%, #f6e2a0, var(--hsg-gold));
  border-color: var(--hsg-gold-dark);
  color: #8a5a16; font-size: 18px;
  transition: transform 140ms ease, opacity 140ms ease;
}
.hsg-coin-gone { opacity: 0; transform: scale(0.4); pointer-events: none; }

/* ---- panels (choice / stack / calc / progress / modules) ---- */
.hsg-panel {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  width: min(92%, 460px);
  max-height: calc(100% - 12px);
  overflow-y: auto;
  border: 1.5px solid rgba(155, 117, 54, 0.62);
  border-radius: 16px;
  background: rgba(247, 241, 224, 0.97);
  box-shadow: 0 8px 20px var(--hsg-shadow);
  padding: 12px 14px;
}
.hsg-panel-bottom { bottom: 6px; }
.hsg-panel-mid { top: 50%; transform: translate(-50%, -50%); }
.hsg-question { text-align: center; font-weight: 700; color: var(--hsg-green); margin-bottom: 10px; font-size: clamp(12px, 2vw, 16px); }
.hsg-choice-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* stack */
.hsg-stack { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hsg-stack-read { font-weight: 800; color: var(--hsg-gold-dark); font-size: clamp(14px, 2.4vw, 18px); }
.hsg-stack-bar { width: 100%; height: 16px; border-radius: 999px; background: rgba(122, 110, 82, 0.2); overflow: hidden; }
.hsg-stack-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--hsg-gold-dark), var(--hsg-gold)); transition: width 280ms ease; }

/* progress / shortfall */
.hsg-prog-row { display: flex; align-items: center; gap: 10px; }
.hsg-prog-track { position: relative; flex: 1; height: 16px; border-radius: 999px; background: rgba(122, 110, 82, 0.2); overflow: hidden; }
.hsg-prog-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--hsg-green), #6fa36c); transition: width 280ms ease; }
.hsg-prog-read { min-width: 76px; text-align: right; font-weight: 800; color: var(--hsg-red); }
.hsg-panel .hsg-choice { margin: 10px auto 0; display: block; }

/* calculator */
.hsg-calc-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.hsg-calc label { flex: 1; font-size: clamp(10px, 1.6vw, 13px); color: var(--hsg-green); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hsg-calc input { width: 76px; min-height: 40px; border: 1px solid rgba(35, 79, 58, 0.35); border-radius: 10px; padding: 6px 8px; background: #fffaf0; color: var(--hsg-ink); font: inherit; }
.hsg-calc-out { margin-top: 8px; color: var(--hsg-red); font-weight: 800; text-align: center; font-size: clamp(11px, 1.8vw, 14px); line-height: 1.3; }

/* ---- win celebration (always on top of the game pieces) ---- */
.hsg-win {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(20, 15, 8, 0.30);
  pointer-events: auto;
  animation: hsgFade 0.25s ease both;
}
.hsg-win-card {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  max-width: min(90%, 340px);
  padding: 16px 20px;
  border-radius: 18px;
  border: 2px solid var(--hsg-green-2);
  background: var(--hsg-starlight);
  box-shadow: 0 14px 36px rgba(20, 15, 8, 0.4);
  text-align: center;
}
.hsg-win-mark {
  font-size: 30px; line-height: 1;
  color: var(--hsg-gold);
  filter: drop-shadow(0 2px 3px rgba(184, 134, 46, 0.4));
}
.hsg-win-msg {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 800;
  color: var(--hsg-green);
  font-size: clamp(14px, 2.4vw, 18px);
  line-height: 1.25;
}
.hsg-win-again {
  margin-top: 2px;
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--hsg-green-2);
  background: var(--hsg-green-2);
  color: #fff;
  font-family: "DM Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: clamp(11px, 1.7vw, 13px);
  cursor: pointer;
}
.hsg-win-again:hover, .hsg-win-again:focus-visible { background: #4d7e38; outline: none; }
@keyframes hsgFade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hsg-win { animation: none; } }

/* ---- feedback animations ---- */
.hsg-success { animation: hsgPop 0.5s cubic-bezier(.2, 1.5, .45, 1) both; }
.hsg-wiggle { animation: hsgWiggle 0.28s ease-in-out; }
@keyframes hsgPop { 0% { transform: scale(0.82); } 65% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes hsgWiggle { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
  .hsg-success, .hsg-wiggle { animation: none !important; }
  .hsg-stack-fill, .hsg-prog-fill, .hsg-hotspot, .hsg-coin { transition: none !important; }
}

/* ---- Book 5 module: Two Doors ---- */
.hsg-two-doors { width: min(92%, 460px); padding: 10px 12px; }
.hsg-doors { display: flex; gap: 12px; justify-content: center; }
.hsg-door {
  flex: 1; max-width: 180px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 52px; padding: 9px 8px;
  border-radius: 12px; cursor: pointer;
  border: 2px solid var(--hsg-brown);
  background: linear-gradient(160deg, var(--hsg-starlight), rgba(212, 160, 23, 0.12));
  color: var(--hsg-ink);
  font-family: "DM Mono", ui-monospace, monospace; font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.hsg-door:hover:not(:disabled),
.hsg-door:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 8px 18px var(--hsg-shadow); }
.hsg-door-spend { border-color: rgba(156, 58, 34, 0.6); }
.hsg-door-reinvest { border-color: rgba(90, 143, 67, 0.7); }
.hsg-door-icon { font-size: 26px; line-height: 1; }
.hsg-door-label { font-size: clamp(11px, 1.7vw, 13px); }
.hsg-door-dim { opacity: 0.4; }
.hsg-door-chosen { transform: scale(1.03); box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.5), 0 8px 18px var(--hsg-shadow); }
.hsg-door:disabled { cursor: default; }
.hsg-outcome:empty { display: none; }
.hsg-outcome {
  margin-top: 12px; text-align: center; line-height: 1.4;
  font-size: clamp(11px, 1.8vw, 14px); color: var(--hsg-ink);
}
.hsg-outcome b { color: var(--hsg-brown); }
.hsg-outcome-good b { color: var(--hsg-green-2); }
.hsg-outcome-warn b { color: var(--hsg-red); }
.hsg-outcome-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.hsg-outcome-actions:empty { display: none; }
.hsg-parent-prompt {
  font-size: clamp(10px, 1.5vw, 12px); line-height: 1.45; color: var(--hsg-muted);
  background: rgba(139, 105, 20, 0.08); border-left: 3px solid var(--hsg-brown);
  border-radius: 0 10px 10px 0; padding: 9px 12px; text-align: left; max-width: 440px;
}
.hsg-parent-prompt b { color: var(--hsg-brown); }

/* ===========================================================================
   Book 5 Phase-2 modules — Compounding Loop, Dividend Share, Upgrade Workshop,
   Quality Check, Train & Trust. All render inside .hsg-panel (pointer-events on).
   =========================================================================== */

/* ---- shared: stage (shop + graph), crowd of faces ---- */
.hsg-cl-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.hsg-cl-shop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  min-height: 96px; padding: 6px; border: 1.5px solid rgba(155, 117, 54, 0.4);
  border-radius: 12px; background: rgba(250, 243, 224, 0.6); overflow: hidden;
}
.hsg-cl-cloud { position: absolute; top: 4px; left: 0; right: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; padding: 2px; }
.hsg-cl-face { font-size: 13px; line-height: 1; animation: hsgPopIn 0.4s ease-out both; }
@keyframes hsgPopIn { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
.hsg-cl-building { font-size: 42px; line-height: 1; z-index: 1; transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); transform: scale(0.65); }
.hsg-cl-shopnote { margin-top: 4px; font-size: clamp(8px, 1.3vw, 10px); color: var(--hsg-muted); text-align: center; line-height: 1.2; }
.hsg-cl-graph { display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  min-height: 96px; padding: 6px; border: 1.5px solid rgba(155, 117, 54, 0.4); border-radius: 12px; background: rgba(255, 255, 255, 0.45); }
.hsg-cl-svg { width: 100%; height: auto; }
.hsg-cl-axis { stroke: #e0d2b4; stroke-width: 1; }
.hsg-cl-flat { fill: none; stroke: #c3b89a; stroke-width: 2; stroke-dasharray: 4 4; }
.hsg-cl-curve { fill: none; stroke: var(--hsg-gold); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.hsg-cl-dot { fill: var(--hsg-gold); opacity: 0; transition: opacity 0.35s ease; }
.hsg-cl-dot.show { opacity: 1; }
.hsg-cl-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin-top: 4px; font-size: clamp(7px, 1.2vw, 9px); color: var(--hsg-muted); }
.hsg-cl-legend span { display: inline-flex; align-items: center; gap: 4px; }
.hsg-cl-key { width: 14px; height: 3px; border-radius: 2px; }
.hsg-cl-key.gold { background: var(--hsg-gold); }
.hsg-cl-key.gray { background: #c3b89a; }
.hsg-cl-key.red { background: var(--hsg-red); }

.hsg-cl-year { text-align: center; font-family: "Playfair Display", Georgia, serif; font-weight: 800; color: var(--hsg-gold-dark); font-size: clamp(15px, 2.6vw, 20px); }
.hsg-cl-formula { text-align: center; font-size: clamp(11px, 1.8vw, 14px); color: var(--hsg-ink); background: rgba(212, 160, 23, 0.1); border-radius: 9px; padding: 6px 8px; margin: 4px 0; }
.hsg-cl-formula b { color: var(--hsg-gold-dark); }
.hsg-cl-bigmath { font-family: "Playfair Display", Georgia, serif; font-size: clamp(18px, 3.2vw, 26px); font-weight: 800; color: var(--hsg-gold-dark); text-align: center; }
.hsg-cl-bigmath b { color: var(--hsg-green-2); }

/* big call-to-action button shared by Compounding Loop / Quality Check */
.hsg-cl-btn, .hsg-qc-btn, .hsg-uw-open, .hsg-tt-check {
  display: block; width: 100%; margin: 4px auto 0; min-height: 46px; padding: 11px 14px;
  border: none; border-radius: 13px; cursor: pointer;
  font-family: "DM Mono", ui-monospace, monospace; font-weight: 700; font-size: clamp(13px, 2vw, 16px);
  color: #fff; box-shadow: 0 6px 16px var(--hsg-shadow);
}
.hsg-cl-btn { background: linear-gradient(135deg, var(--hsg-gold), var(--hsg-gold-dark)); }
.hsg-cl-btn:not(:disabled):hover, .hsg-cl-btn:focus-visible { transform: translateY(-2px); outline: none; }
.hsg-cl-btn.hsg-cl-done, .hsg-qc-btn.hsg-cl-done { background: var(--hsg-green-2); cursor: default; transform: none; }
@media (prefers-reduced-motion: no-preference) {
  .hsg-cl-btn:not(.hsg-cl-done):not(:disabled) { animation: hsgBtnBob 2.2s ease-in-out infinite; }
}
@keyframes hsgBtnBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ---- Dividend Share ---- */
.hsg-ds-tip, .hsg-uw-tip, .hsg-tt-tip, .hsg-qc-head { text-align: center; font-size: clamp(10px, 1.7vw, 13px); color: var(--hsg-green); margin-bottom: 6px; line-height: 1.3; }
.hsg-ds-tip b, .hsg-qc-head b { color: var(--hsg-red); }
.hsg-ds-pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; min-height: 30px; margin-bottom: 6px; }
.hsg-ds-coin {
  width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--hsg-gold-dark); background: radial-gradient(circle at 38% 34%, #f6e2a0, var(--hsg-gold));
  color: #8a5a16; font-weight: 800; font-size: 14px; cursor: pointer; transition: transform 0.14s ease, opacity 0.2s ease;
}
.hsg-ds-coin.hsg-ds-picked { transform: scale(1.28); box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.5); }
.hsg-ds-coin.hsg-ds-gone { opacity: 0; transform: scale(0.3); pointer-events: none; }
.hsg-ds-bar { height: 8px; border-radius: 999px; background: rgba(122, 110, 82, 0.2); overflow: hidden; margin-bottom: 8px; }
.hsg-ds-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--hsg-gold-dark), var(--hsg-gold)); transition: width 0.3s ease; }
.hsg-ds-owners { display: flex; gap: 6px; justify-content: center; }
.hsg-ds-owner {
  flex: 1; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 44px; padding: 6px 4px; border-radius: 11px; cursor: pointer;
  border: 1.5px solid rgba(155, 117, 54, 0.55); background: rgba(247, 241, 224, 0.95);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.hsg-ds-owner.hsg-ds-magne { border-color: rgba(90, 143, 67, 0.7); background: linear-gradient(160deg, var(--hsg-starlight), rgba(90, 143, 67, 0.1)); }
.hsg-ds-owner:hover, .hsg-ds-owner:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 6px 14px var(--hsg-shadow); }
.hsg-ds-owner.hsg-ds-full { border-color: var(--hsg-green-2); box-shadow: 0 0 0 2px rgba(90, 143, 67, 0.3); }
.hsg-ds-face { font-size: 22px; line-height: 1; }
.hsg-ds-name { font-size: clamp(8px, 1.3vw, 10px); font-weight: 700; color: var(--hsg-green); }
.hsg-ds-slots { display: flex; gap: 2px; min-height: 14px; }
.hsg-ds-slot { font-size: 11px; color: var(--hsg-gold-dark); animation: hsgPop 0.5s cubic-bezier(.2, 1.5, .45, 1) both; }
.hsg-ds-say { font-size: clamp(7px, 1.1vw, 9px); color: var(--hsg-muted); text-align: center; line-height: 1.15; max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.25s ease, opacity 0.25s ease; }
.hsg-ds-owner.hsg-ds-full .hsg-ds-say { max-height: 30px; opacity: 1; }
.hsg-ds-nudge { animation: hsgWiggle 0.28s ease-in-out; }

/* ---- Upgrade Workshop ---- */
.hsg-uw-purse { text-align: center; font-weight: 700; color: var(--hsg-green); font-size: clamp(12px, 2vw, 15px); }
.hsg-uw-count { font-family: "Playfair Display", serif; font-size: 1.25em; color: var(--hsg-gold-dark); display: inline-block; min-width: 1.2em; }
.hsg-uw-zones { display: flex; gap: 6px; justify-content: center; margin: 6px 0; }
.hsg-uw-zone {
  flex: 1; max-width: 130px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-height: 70px; padding: 7px 4px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid rgba(155, 117, 54, 0.55); background: rgba(247, 241, 224, 0.95);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.2s ease;
}
.hsg-uw-zone:hover:not(.hsg-uw-bought), .hsg-uw-zone:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 6px 14px var(--hsg-shadow); }
.hsg-uw-zone.hsg-uw-bought { border-color: var(--hsg-green-2); background: linear-gradient(160deg, var(--hsg-starlight), rgba(90, 143, 67, 0.12)); cursor: default; }
.hsg-uw-icon { font-size: 24px; line-height: 1; }
.hsg-uw-name { font-size: clamp(9px, 1.4vw, 11px); font-weight: 700; color: var(--hsg-green); text-align: center; }
.hsg-uw-cost { font-size: clamp(8px, 1.2vw, 10px); color: var(--hsg-gold-dark); font-weight: 700; }
.hsg-uw-zone.hsg-uw-bought .hsg-uw-cost { text-decoration: line-through; opacity: 0.5; }
.hsg-uw-effect { font-size: clamp(7px, 1.15vw, 9px); color: var(--hsg-muted); text-align: center; line-height: 1.15; }
.hsg-uw-zone.hsg-uw-bought .hsg-uw-effect { color: var(--hsg-green-2); font-weight: 700; }
.hsg-uw-open { background: #b9b0a0; box-shadow: none; }
.hsg-uw-open.hsg-uw-ready { background: linear-gradient(135deg, var(--hsg-green-2), #4a7a36); box-shadow: 0 6px 16px var(--hsg-shadow); }
.hsg-uw-crowd { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 0; margin-top: 4px; }
.hsg-uw-crowd .hsg-cl-face { font-size: 17px; }

/* ---- Quality Check (downward mirror) ---- */
.hsg-qc-graph { justify-content: flex-start; }
.hsg-qc-meter { display: flex; align-items: center; gap: 6px; width: 100%; font-size: clamp(8px, 1.3vw, 10px); color: var(--hsg-muted); margin-bottom: 4px; }
.hsg-qc-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(122, 110, 82, 0.2); overflow: hidden; }
.hsg-qc-fill { height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--hsg-green-2), #8fb36c); transition: width 0.45s ease, background 0.45s ease; }
.hsg-qc-meter:has(.hsg-qc-pct.hsg-qc-low) .hsg-qc-fill, .hsg-qc-fill.hsg-qc-low { background: linear-gradient(90deg, var(--hsg-red), #c75b39); }
.hsg-qc-pct { color: var(--hsg-green-2); min-width: 30px; text-align: right; }
.hsg-qc-pct.hsg-qc-low { color: var(--hsg-red); }
.hsg-qc-curve { fill: none; stroke: var(--hsg-red); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.hsg-qc-dot { fill: var(--hsg-red); opacity: 0; transition: opacity 0.35s ease; }
.hsg-qc-dot.show { opacity: 1; }
.hsg-qc-btn { background: linear-gradient(135deg, #c75b39, var(--hsg-red)); }
.hsg-qc-btn:not(:disabled):hover, .hsg-qc-btn:focus-visible { transform: translateY(-2px); outline: none; }

/* ---- Train & Trust ---- */
.hsg-tt-bench { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.hsg-tt-chef {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-height: 44px; padding: 5px 9px; border-radius: 11px; cursor: pointer;
  border: 1.5px solid rgba(155, 117, 54, 0.55); background: rgba(247, 241, 224, 0.95);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}
.hsg-tt-chef:hover:not(.hsg-tt-done), .hsg-tt-chef:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 6px 14px var(--hsg-shadow); }
.hsg-tt-chef.hsg-tt-picked { border-color: var(--hsg-gold); box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.45); transform: translateY(-2px); }
.hsg-tt-chef.hsg-tt-done { opacity: 0.4; cursor: default; }
.hsg-tt-face { font-size: 22px; line-height: 1; }
.hsg-tt-cname { font-size: clamp(8px, 1.3vw, 10px); font-weight: 700; color: var(--hsg-green); }
.hsg-tt-stations { display: flex; gap: 6px; justify-content: center; }
.hsg-tt-station {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-height: 62px; padding: 6px 4px; border-radius: 12px; cursor: pointer;
  border: 2px dashed rgba(35, 79, 58, 0.4); background: rgba(35, 79, 58, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.2s ease;
}
.hsg-tt-station:hover:not(.hsg-tt-staffed), .hsg-tt-station:focus-visible { outline: none; transform: translateY(-2px); }
.hsg-tt-station.hsg-tt-staffed { border-style: solid; border-color: rgba(155, 117, 54, 0.6); background: rgba(247, 241, 224, 0.95); cursor: default; }
.hsg-tt-station.hsg-tt-checked { border-color: var(--hsg-green-2); background: linear-gradient(160deg, var(--hsg-starlight), rgba(90, 143, 67, 0.12)); }
.hsg-tt-sicon { font-size: 22px; line-height: 1; }
.hsg-tt-sname { font-size: clamp(9px, 1.4vw, 11px); font-weight: 700; color: var(--hsg-green); }
.hsg-tt-slot { font-size: clamp(8px, 1.2vw, 10px); color: var(--hsg-muted); text-align: center; line-height: 1.15; }
.hsg-tt-station.hsg-tt-staffed .hsg-tt-slot { color: var(--hsg-ink); }
.hsg-tt-ok { color: var(--hsg-green-2); font-weight: 800; }
.hsg-tt-check { background: #b9b0a0; box-shadow: none; }
.hsg-tt-check.hsg-tt-ready { background: linear-gradient(135deg, var(--hsg-gold), var(--hsg-gold-dark)); box-shadow: 0 6px 16px var(--hsg-shadow); }

@media (prefers-reduced-motion: reduce) {
  .hsg-cl-building { transition: none; }
  .hsg-cl-face, .hsg-ds-slot { animation: none !important; }
  .hsg-cl-btn, .hsg-qc-btn { animation: none !important; }
  .hsg-cl-dot, .hsg-qc-dot, .hsg-ds-fill, .hsg-qc-fill { transition: none !important; }
}

@media (max-width: 680px) {
  .hsg-prompt { bottom: 4px; padding: 5px 9px; }
  .hsg-panel { width: 94%; padding: 10px; }
  .hsg-tray { bottom: 34px; }
  .hsg-doors { gap: 10px; }
  .hsg-door { padding: 10px 8px; }
  .hsg-cl-building { font-size: 34px; }
  .hsg-ds-owners, .hsg-uw-zones, .hsg-tt-stations, .hsg-tt-bench { gap: 4px; }
}

/* Very small / narrow screens: stack the shop + graph so neither gets crushed. */
@media (max-width: 420px) {
  .hsg-cl-stage { grid-template-columns: 1fr; }
  .hsg-cl-shop { min-height: 78px; }
}

/* ===========================================================================
   Books 1–3 little-kid layer: Book 1 toy games, WinCircusReward, PageSpark.
   Bigger touch targets, brighter, more "toy box" than the 4–5 modules.
   =========================================================================== */

/* ---- Book 1 shared ---- */
.hsb1 { width: min(94%, 480px); text-align: center; }
.hsb1-tip { font-size: clamp(13px, 2.3vw, 17px); color: var(--hsg-green); line-height: 1.3; margin-bottom: 10px; padding: 0 30px; }
.hsb1-tip b { color: var(--hsg-red); }
.hsb1-skip {
  position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; min-height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid rgba(122, 110, 82, 0.4); background: rgba(240, 232, 212, 0.92);
  color: var(--hsg-muted); font: 600 14px "DM Mono", ui-monospace, monospace; cursor: pointer;
}
.hsb1-skip:hover, .hsb1-skip:focus-visible { outline: none; color: var(--hsg-ink); border-color: var(--hsg-muted); }

/* counting games (apples / coins) */
.hsb1-counter { display: inline-flex; align-items: baseline; gap: 4px; margin-bottom: 8px;
  background: var(--hsg-green); color: var(--hsg-paper); border-radius: 14px; padding: 4px 14px; }
.hsb1-counter b { font-family: "Playfair Display", serif; font-size: clamp(22px, 5vw, 34px); line-height: 1; }
.hsb1-counter span { font-size: clamp(10px, 1.6vw, 13px); color: #bcd8b0; }
.hsb1-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hsb1-big {
  width: 58px; height: 58px; min-height: 58px; padding: 0; border-radius: 16px; cursor: pointer;
  border: 2px solid rgba(155, 117, 54, 0.5); background: rgba(255, 250, 240, 0.96);
  font-size: 32px; line-height: 1; transition: transform 0.16s ease, opacity 0.22s ease;
}
.hsb1-big:hover, .hsb1-big:focus-visible { outline: none; transform: translateY(-3px) scale(1.06); }
.hsb1-collected { opacity: 0.28; transform: scale(0.7); pointer-events: none; }

/* pick-the-cheaper */
.hsb1-stands { display: flex; gap: 14px; justify-content: center; }
.hsb1-stand {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 92px; padding: 12px 18px; border-radius: 18px; cursor: pointer;
  border: 2px solid rgba(155, 117, 54, 0.5); background: rgba(255, 250, 240, 0.96);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.hsb1-stand:hover, .hsb1-stand:focus-visible { outline: none; transform: translateY(-3px); box-shadow: 0 8px 18px var(--hsg-shadow); }
.hsb1-apple { font-size: 40px; line-height: 1; }
.hsb1-price { font-family: "Playfair Display", serif; font-weight: 800; font-size: clamp(16px, 3vw, 22px); color: var(--hsg-gold-dark); }
.hsb1-stand.hsb1-right { border-color: var(--hsg-green-2); box-shadow: 0 0 0 3px rgba(90, 143, 67, 0.35); }
.hsb1-stand.hsb1-oops { border-color: var(--hsg-red); }

/* price seesaw (supply & demand toy) */
.hsb1-seesaw-stage { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(255, 250, 240, 0.7); border: 1.5px solid rgba(155, 117, 54, 0.4); border-radius: 16px;
  padding: 12px; margin-bottom: 10px; min-height: 92px; }
.hsb1-hands { flex: 1; display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; align-items: center; }
.hsb1-hand { font-size: 26px; line-height: 1; animation: hsgPopIn 0.3s ease-out both; }
.hsb1-pricebox { flex: none; width: 96px; display: flex; flex-direction: column; align-items: center;
  border-radius: 14px; padding: 6px 4px; background: rgba(212, 160, 23, 0.12); transition: background 0.25s ease; }
.hsb1-arrow { font-size: 22px; line-height: 1; color: var(--hsg-muted); }
.hsb1-bigprice { font-family: "Playfair Display", serif; font-weight: 800; font-size: clamp(30px, 7vw, 46px); line-height: 1; color: var(--hsg-gold-dark); }
.hsb1-pricelbl { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--hsg-muted); }
.hsb1-pricebox.hsb1-up { background: rgba(90, 143, 67, 0.18); }
.hsb1-pricebox.hsb1-up .hsb1-arrow { color: var(--hsg-green-2); }
.hsb1-pricebox.hsb1-down { background: rgba(156, 58, 34, 0.14); }
.hsb1-pricebox.hsb1-down .hsb1-arrow { color: var(--hsg-red); }
.hsb1-ctrls { display: flex; gap: 10px; justify-content: center; }
.hsb1-ctrl { flex: 1; max-width: 200px; min-height: 50px; border-radius: 14px; cursor: pointer;
  border: none; color: #fff; font: 700 clamp(13px, 2.1vw, 16px) "DM Mono", ui-monospace, monospace;
  box-shadow: 0 5px 14px var(--hsg-shadow); transition: transform 0.14s ease; }
.hsb1-ctrl:hover, .hsb1-ctrl:focus-visible { outline: none; transform: translateY(-2px); }
.hsb1-more { background: linear-gradient(135deg, var(--hsg-green-2), #4a7a36); }
.hsb1-less { background: linear-gradient(135deg, #c75b39, var(--hsg-red)); }

/* ---- Book 2: The Shop You Can Own ---- */
/* Fund the shop — the ownership pie + helpers */
.hsb2-fund { display: flex; flex-direction: column; align-items: center; }
.hsb2-pie { position: relative; width: 110px; height: 110px; margin: 4px 0 8px; }
.hsb2-pie svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hsb2-pie-base { fill: rgba(122, 110, 82, 0.14); }
.hsb2-pie-ring { fill: none; stroke: var(--hsg-brown); stroke-width: 2.5; }
.hsb2-slice { fill: var(--hsg-gold); stroke: var(--hsg-starlight); stroke-width: 1.5; transform-origin: 50px 50px; animation: hsgPop 0.45s cubic-bezier(.2,1.5,.45,1) both; }
.hsb2-pie-lbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(9px,1.4vw,11px); font-weight: 700; color: var(--hsg-green); pointer-events: none; }
.hsb2-helpers { display: flex; gap: 8px; justify-content: center; }
.hsb2-helper { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; padding: 6px 8px;
  border-radius: 12px; cursor: pointer; border: 1.5px solid rgba(155,117,54,0.55); background: rgba(247,241,224,0.95);
  transition: transform 0.15s ease, box-shadow 0.15s ease; }
.hsb2-helper:hover:not(.hsb2-gave), .hsb2-helper:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 6px 14px var(--hsg-shadow); }
.hsb2-helper.hsb2-gave { border-color: var(--hsg-green-2); background: linear-gradient(160deg, var(--hsg-starlight), rgba(90,143,67,0.12)); cursor: default; }
.hsb2-hface { font-size: 24px; line-height: 1; }
.hsb2-coin { font-size: clamp(10px,1.5vw,12px); color: var(--hsg-gold-dark); font-weight: 700; }
.hsb2-helper.hsb2-gave .hsb2-coin { color: var(--hsg-green-2); }

/* Worth more / less */
.hsb2-worth-stage, .hsb2-belief-stage { display: flex; align-items: center; justify-content: center; gap: 16px;
  background: rgba(255,250,240,0.7); border: 1.5px solid rgba(155,117,54,0.4); border-radius: 16px; padding: 12px; margin: 6px 0 10px; min-height: 90px; }
.hsb2-worth-stage { flex-direction: column; gap: 6px; }
.hsb2-piece { font-size: 46px; line-height: 1; transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1); }
.hsb2-piece.hsb2-up { transform: scale(1.45); filter: drop-shadow(0 0 10px rgba(90,143,67,0.6)); }
.hsb2-piece.hsb2-down { transform: scale(0.6); opacity: 0.6; }
.hsb2-worth-read { font-weight: 800; font-size: clamp(13px,2.2vw,17px); color: var(--hsg-green); }
.hsb2-piece.hsb2-up ~ .hsb2-worth-read { color: var(--hsg-green-2); }

/* Watch the line grow */
.hsb2-lane { display: flex; align-items: center; gap: 4px; background: rgba(255,250,240,0.7);
  border: 1.5px solid rgba(155,117,54,0.4); border-radius: 16px; padding: 10px; margin: 6px 0 10px; min-height: 64px; overflow: hidden; }
.hsb2-shop { font-size: 36px; line-height: 1; flex: none; }
.hsb2-queue { display: flex; flex-wrap: wrap; gap: 1px; align-items: center; }
.hsb2-cust { font-size: 22px; line-height: 1; animation: hsgPopIn 0.35s ease-out both; }

/* Belief & worry move the price */
.hsb2-shopsame { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hsb2-shopsame span { font-size: 40px; line-height: 1; }
.hsb2-shopsame small { font-size: clamp(8px,1.3vw,10px); color: var(--hsg-muted); letter-spacing: 0.04em; }

/* ---- Book 3: The Pattern of the Trains ---- */
/* Collect the data */
.hsb3-note { display: inline-flex; align-items: baseline; gap: 5px; margin-bottom: 8px;
  background: var(--hsg-green); color: var(--hsg-paper); border-radius: 12px; padding: 4px 12px; }
.hsb3-note b { font-family: "Playfair Display", serif; font-size: clamp(18px,3.5vw,26px); line-height: 1; }
.hsb3-note span { font-size: clamp(9px,1.4vw,11px); color: #bcd8b0; }
.hsb3-trains { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.hsb3-train { display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 52px; padding: 5px 8px;
  border-radius: 11px; cursor: pointer; border: 1.5px solid rgba(155,117,54,0.5); background: rgba(255,250,240,0.96);
  transition: transform 0.15s ease, box-shadow 0.15s ease; }
.hsb3-train:hover:not(.hsb3-logged), .hsb3-train:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 6px 14px var(--hsg-shadow); }
.hsb3-train.hsb3-logged { border-color: var(--hsg-green-2); background: linear-gradient(160deg, var(--hsg-starlight), rgba(90,143,67,0.12)); cursor: default; }
.hsb3-train.hsb3-logged::after { content: '✓ written'; font-size: 8px; color: var(--hsg-green-2); font-weight: 700; }
.hsb3-loco { font-size: 20px; line-height: 1; }
.hsb3-time { font-weight: 800; font-size: clamp(11px,1.7vw,13px); color: var(--hsg-green); }
.hsb3-late { font-size: clamp(8px,1.2vw,10px); color: var(--hsg-muted); }

/* Spot the pattern — dot chart */
.hsb3-chart { display: flex; gap: 6px; justify-content: center; align-items: flex-end; min-height: 84px;
  background: rgba(255,250,240,0.7); border: 1.5px solid rgba(155,117,54,0.4); border-radius: 14px; padding: 8px; margin: 6px 0 4px; }
.hsb3-seg { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 76px; padding: 4px;
  border-radius: 10px; cursor: pointer; border: 1.5px dashed rgba(35,79,58,0.3); background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease; }
.hsb3-seg:hover, .hsb3-seg:focus-visible { outline: none; background: rgba(233,196,90,0.12); }
.hsb3-seg.hsb3-found { border-style: solid; border-color: var(--hsg-green-2); background: rgba(90,143,67,0.14); }
.hsb3-dots { display: flex; align-items: flex-end; gap: 2px; height: 52px; }
.hsb3-dot { width: 6px; border-radius: 3px 3px 0 0; background: var(--hsg-gold); align-self: flex-end; }
.hsb3-seg[data-hot="true"] .hsb3-dot { background: var(--hsg-red); }
.hsb3-seg-lbl { font-size: clamp(9px,1.4vw,11px); font-weight: 700; color: var(--hsg-green); }
.hsb3-axis { display: flex; justify-content: space-between; font-size: clamp(8px,1.3vw,10px); color: var(--hsg-muted); padding: 0 4px 4px; }

/* Find the tiny clue */
.hsb3-tracks { position: relative; height: 120px; border-radius: 14px; margin: 6px 0 4px; overflow: hidden;
  background: linear-gradient(180deg, #2b2415 0%, #3a3220 100%); border: 1.5px solid rgba(155,117,54,0.5); }
.hsb3-rail { position: absolute; left: 4%; right: 4%; height: 5px; background: repeating-linear-gradient(90deg, #6b5a36 0 10px, #4a3f25 10px 16px); border-radius: 3px; }
.hsb3-rail-a { top: 42%; } .hsb3-rail-b { top: 58%; }
.hsb3-spot { position: absolute; transform: translate(-50%,-50%); min-width: 30px; min-height: 30px; padding: 0;
  border: none; background: transparent; font-size: 19px; line-height: 1; cursor: pointer; transition: transform 0.14s ease; }
.hsb3-spot:hover, .hsb3-spot:focus-visible { outline: none; transform: translate(-50%,-50%) scale(1.25); }
.hsb3-spot-clue { font-size: 13px; } /* tiny — easy to miss */
.hsb3-spot-found { filter: drop-shadow(0 0 8px rgba(90,143,67,0.9)); }

/* Patterns notice, don't guarantee */
.hsb3-recap { text-align: center; font-size: clamp(11px,1.8vw,14px); color: var(--hsg-green); background: rgba(212,160,23,0.1);
  border-radius: 10px; padding: 7px 10px; margin-bottom: 8px; }
.hsb3-recap b { color: var(--hsg-gold-dark); }
.hsb3-choices { display: flex; flex-direction: column; gap: 8px; }
.hsb3-bigchoice { min-height: 50px; padding: 10px 14px; border-radius: 13px; cursor: pointer;
  border: 1.5px solid rgba(155,117,54,0.55); background: rgba(247,241,224,0.97); color: var(--hsg-green);
  font-family: "DM Mono", ui-monospace, monospace; font-size: clamp(13px,2vw,16px); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.hsb3-bigchoice b { color: var(--hsg-red); }
.hsb3-bigchoice:hover, .hsb3-bigchoice:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 6px 14px var(--hsg-shadow); }
.hsb3-bigchoice.hsb3-right { border-color: var(--hsg-green-2); background: linear-gradient(160deg, var(--hsg-starlight), rgba(90,143,67,0.12)); }
.hsb3-bigchoice.hsb3-right b { color: var(--hsg-green-2); }
.hsb3-bigchoice.hsb3-gentle { border-color: var(--hsg-gold-dark); }

/* ---- Book 4: The Cost of Growing (income statement, ages 8–10) ---- */
.hsb4 { width: min(92%, 460px); text-align: center; }
.hsb4-tip { font-size: clamp(11px, 1.9vw, 14px); color: var(--hsg-green); line-height: 1.35; margin-bottom: 9px; }
.hsb4-tip b { color: var(--hsg-red); }

/* revenue / costs flow — the till read-out + coins/cost rows */
.hsb4-till { display: inline-flex; flex-direction: column; align-items: center; margin-bottom: 8px;
  background: var(--hsg-green); color: var(--hsg-paper); border-radius: 14px; padding: 5px 16px; }
.hsb4-till.hsb4-till-out { background: var(--hsg-red); }
.hsb4-till b { font-family: "Playfair Display", serif; font-size: clamp(22px, 4.5vw, 34px); line-height: 1; }
.hsb4-tilllbl { font-size: clamp(8px, 1.2vw, 10px); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.78); }
.hsb4-coins { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.hsb4-coin { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--hsg-gold-dark); background: radial-gradient(circle at 38% 34%, #f6e2a0, var(--hsg-gold));
  font-size: 22px; line-height: 1; transition: transform 0.14s ease, opacity 0.2s ease; }
.hsb4-coin:hover, .hsb4-coin:focus-visible { outline: none; transform: translateY(-3px) scale(1.06); }
.hsb4-coin-in { opacity: 0.25; transform: scale(0.6); pointer-events: none; }
.hsb4-costlist { display: flex; flex-direction: column; gap: 5px; }
.hsb4-costrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 42px; padding: 6px 14px;
  border-radius: 11px; cursor: pointer; border: 1.5px solid rgba(156,58,34,0.4); background: rgba(255,250,240,0.96);
  color: var(--hsg-ink); font-size: clamp(12px, 1.9vw, 15px); transition: transform 0.14s ease, opacity 0.2s ease, background 0.2s ease; }
.hsb4-costrow:hover:not(.hsb4-paid), .hsb4-costrow:focus-visible { outline: none; transform: translateY(-1px); }
.hsb4-ca { font-weight: 800; color: var(--hsg-red); white-space: nowrap; }
.hsb4-costrow.hsb4-paid { opacity: 0.5; background: rgba(156,58,34,0.08); cursor: default; }
.hsb4-costrow.hsb4-paid .hsb4-ca::after { content: ' ✓'; color: var(--hsg-green-2); }

/* profit equation */
.hsb4-eq { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 10px; }
.hsb4-term { display: flex; flex-direction: column; align-items: center; min-width: 56px; padding: 8px 10px; border-radius: 12px;
  font-family: "Playfair Display", serif; font-weight: 800; font-size: clamp(20px, 4vw, 30px); line-height: 1; }
.hsb4-term small { font-family: "DM Mono", monospace; font-weight: 500; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 3px; }
.hsb4-term.hsb4-in { background: rgba(35,79,58,0.12); color: var(--hsg-green); }
.hsb4-term.hsb4-out { background: rgba(156,58,34,0.12); color: var(--hsg-red); }
.hsb4-term.hsb4-left { background: rgba(212,160,23,0.16); color: var(--hsg-gold-dark); }
.hsb4-op { font-family: "Playfair Display", serif; font-size: clamp(18px, 3vw, 24px); color: var(--hsg-muted); }
.hsb4-hidden { opacity: 0.35; }
.hsb4-glow { box-shadow: 0 0 0 2px rgba(212,160,23,0.4), 0 4px 12px var(--hsg-shadow); }
.hsb4-fly { opacity: 0.3; transform: translateY(-8px); transition: opacity 0.4s ease, transform 0.4s ease; }
.hsb4-reveal, .hsb4-stackbtn { margin: 0 auto; display: block; }

/* fixed vs variable sort */
.hsb4-cardtray { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-bottom: 8px; }
.hsb4-card { min-height: 38px; padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: clamp(11px,1.7vw,13px);
  border: 1.5px solid rgba(155,117,54,0.55); background: rgba(247,241,224,0.97); color: var(--hsg-green); font-weight: 700;
  transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.2s ease; }
.hsb4-card:hover:not(.hsb4-sorted), .hsb4-card:focus-visible { outline: none; transform: translateY(-2px); box-shadow: 0 5px 12px var(--hsg-shadow); }
.hsb4-card.hsb4-picked { border-color: var(--hsg-gold); box-shadow: 0 0 0 3px rgba(212,160,23,0.45); transform: translateY(-2px); }
.hsb4-card.hsb4-sorted { opacity: 0.4; cursor: default; }
.hsb4-buckets { display: flex; gap: 8px; }
.hsb4-bucket { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; padding: 8px;
  border-radius: 13px; cursor: pointer; border: 2px dashed rgba(35,79,58,0.4); background: rgba(35,79,58,0.05);
  color: var(--hsg-green); transition: transform 0.14s ease, background 0.2s ease, border-color 0.15s ease; }
.hsb4-bucket b { font-size: clamp(11px,1.7vw,13px); }
.hsb4-bucket small { font-size: clamp(8px,1.2vw,10px); color: var(--hsg-muted); }
.hsb4-bucket-fixed { border-color: rgba(35,79,58,0.4); }
.hsb4-bucket-var { border-color: rgba(156,58,34,0.4); background: rgba(156,58,34,0.05); }
.hsb4-bucket:hover, .hsb4-bucket:focus-visible { outline: none; transform: translateY(-2px); }

/* start-up cost bar */
.hsb4-startup-read { font-weight: 800; color: var(--hsg-gold-dark); font-size: clamp(14px,2.4vw,18px); margin-bottom: 6px; }
.hsb4-bar { width: 100%; height: 16px; border-radius: 999px; background: rgba(122,110,82,0.2); overflow: hidden; margin-bottom: 10px; }
.hsb4-bar-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--hsg-gold-dark), var(--hsg-gold)); transition: width 0.3s ease; }

/* income statement capstone */
.hsb4-stmt { display: flex; align-items: stretch; justify-content: center; gap: 8px; margin: 6px 0 10px; }
.hsb4-slot { flex: 1; max-width: 120px; min-height: 64px; border-radius: 13px; cursor: pointer; padding: 8px;
  border: 1.5px solid rgba(155,117,54,0.5); background: rgba(247,241,224,0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: "Playfair Display", serif; font-weight: 800; font-size: clamp(17px,3vw,24px); line-height: 1; transition: transform 0.15s ease, background 0.2s ease, border-color 0.15s ease; }
.hsb4-slot small { font-family: "DM Mono", monospace; font-weight: 500; font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--hsg-muted); margin-top: 4px; }
.hsb4-slot-q { font-family: "DM Mono", monospace; font-size: 14px; color: var(--hsg-muted); }
.hsb4-slot.hsb4-slot-hidden { border-style: dashed; }
.hsb4-slot.hsb4-slot-on { background: rgba(247,241,224,0.97); }
.hsb4-slot.hsb4-in.hsb4-slot-on { color: var(--hsg-green); }
.hsb4-slot.hsb4-out.hsb4-slot-on { color: var(--hsg-red); }
.hsb4-slot.hsb4-left.hsb4-slot-on { color: var(--hsg-gold-dark); border-color: var(--hsg-gold); background: rgba(212,160,23,0.12); }

/* ---- WinCircusReward ---- */
.hsc-reward {
  position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  padding: 10px; background: rgba(20, 15, 8, 0.34); pointer-events: auto; animation: hsgFade 0.25s ease both;
}
.hsc-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: min(92%, 360px); max-height: 96%; overflow-y: auto;
  padding: 14px 18px; border-radius: 20px;
  border: 2px solid var(--hsg-gold); background: var(--hsg-starlight);
  box-shadow: 0 16px 40px rgba(20, 15, 8, 0.45); text-align: center;
}
.hsc-ring { position: relative; width: 104px; height: 104px; flex: none; }
.hsc-orbits { position: absolute; inset: 0; animation: hscSpin 1.1s linear infinite; }
.hsc-orbit { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  transform: rotate(var(--a)) translateY(-44px); }
.hsc-clown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 46px; line-height: 1; animation: hscBob 0.9s ease-in-out infinite; }
.hsc-ring.hsc-ring-bow { animation: hscBow 0.6s cubic-bezier(.3, 1.4, .5, 1) forwards; }
.hsc-ring.hsc-ring-bow .hsc-orbits { animation-duration: 0.5s; }
.hsc-ring.hsc-static .hsc-orbits { animation: none; }
.hsc-ring.hsc-static .hsc-clown { animation: none; }
.hsc-msg { font-family: "Playfair Display", Georgia, serif; font-weight: 800; color: var(--hsg-green);
  font-size: clamp(16px, 3vw, 21px); line-height: 1.25; }
.hsc-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.hsc-parent { font-size: clamp(10px, 1.6vw, 12px); line-height: 1.45; color: var(--hsg-muted);
  background: rgba(139, 105, 20, 0.08); border-left: 3px solid var(--hsg-brown);
  border-radius: 0 10px 10px 0; padding: 9px 12px; text-align: left; }
.hsc-parent b { color: var(--hsg-brown); }
.hsc-btn-row { display: flex; gap: 10px; justify-content: center; }
.hsc-btn { min-height: 44px; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--hsg-green-2); background: rgba(255, 250, 240, 0.9); color: var(--hsg-green);
  font: 700 clamp(12px, 1.8vw, 14px) "DM Mono", ui-monospace, monospace; }
.hsc-btn-go { background: var(--hsg-green-2); color: #fff; }
.hsc-btn:hover, .hsc-btn:focus-visible { outline: none; transform: translateY(-1px); }
@keyframes hscSpin { to { transform: rotate(360deg); } }
@keyframes hscBob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-6px) scale(1.05); } }
@keyframes hscBow { to { transform: scale(0.5); opacity: 0; } }

/* ---- PageSpark ambient ---- */
.hsps-layer { position: absolute; inset: 0; z-index: 12; pointer-events: none; overflow: hidden; }
.hsps-bit { position: absolute; bottom: -6%; font-size: clamp(15px, 2.6vw, 22px); opacity: 0;
  will-change: transform, opacity; animation-name: hspsDrift; animation-timing-function: ease-out;
  animation-iteration-count: 1; animation-fill-mode: forwards; }
@keyframes hspsDrift {
  0% { transform: translateY(0) rotate(0deg) scale(0.7); opacity: 0; }
  18% { opacity: 0.85; }
  80% { opacity: 0.5; }
  100% { transform: translateY(-78vh) rotate(22deg) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hsb1-hand { animation: none !important; }
  .hsc-reward { animation: none; }
  .hsc-orbits, .hsc-clown { animation: none !important; }
  .hsps-layer { display: none !important; }
}

@media (max-width: 680px) {
  .hsb1-big { width: 52px; height: 52px; font-size: 28px; }
  .hsb1-stands { gap: 10px; }
  .hsb1-ctrls { gap: 8px; }
  .hsc-ring { width: 100px; height: 100px; }
  .hsc-orbit { transform: rotate(var(--a)) translateY(-42px); }
}
