* { box-sizing: border-box; margin: 0; padding: 0; }

/* iJeeto brand palette — sampled from the star logo. Copied per game rather
   than shared, so each game folder stays self-contained (guidelines 9.1). */
:root {
  --purple: #4A1A63;
  --purple-soft: #6B3A85;
  --amber: #FFC42E;
  --orange: #FF7A2F;
  --orange-dark: #DD5E15;
  --teal: #2FAFAF;
  --teal-dark: #218A8A;
  --cream: #FFF7EA;
  --cream-2: #FCEBD2;
  --font-brand: ui-rounded, "SF Pro Rounded", Nunito, Quicksand,
                "Hiragino Maru Gothic ProN", "Trebuchet MS", system-ui, sans-serif;

  --bg: var(--cream);
  --ink: var(--purple);
  --accent: var(--teal);
  --accent-dark: var(--teal-dark);
  --card: #fff;
  --bad: #d4564f;
  --shadow-soft: #e6d8c2;
}

html, body {
  height: 100%;
  font-family: var(--font-brand);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

.brand-mark { width: clamp(84px, 22vw, 116px); height: auto; display: block; margin: 0 auto; }

#app { height: 100%; display: flex; flex-direction: column; }
.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ---------- menus ---------- */

.menu-screen { align-items: center; padding: 20px 16px; overflow-y: auto; }
.logo { font-size: clamp(26px, 6.5vw, 42px); margin-top: 4vh; text-align: center; }
.tagline { font-size: clamp(14px, 3vw, 18px); margin: 12px 0 26px; text-align: center; line-height: 1.6; }
.menu-buttons { display: flex; flex-direction: column; gap: 14px; width: min(340px, 92vw); }

.big-btn {
  min-height: 54px; border: 0; border-radius: 14px;
  background: var(--accent); color: #fff;
  font-family: inherit; font-size: 18px; font-weight: 700;
  cursor: pointer; padding: 10px 18px; box-shadow: 0 4px 0 var(--accent-dark);
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
.big-btn:disabled { opacity: .55; box-shadow: none; }
.big-btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--shadow-soft); }
.big-btn.danger { background: var(--bad); box-shadow: 0 4px 0 #a53b36; }

.portal-link {
  margin-top: 22px; padding: 12px 20px; min-height: 44px;
  display: inline-flex; align-items: center;
  font-size: 14px; color: var(--ink); text-decoration: none;
  background: #fff; border-radius: 999px; box-shadow: 0 2px 0 var(--shadow-soft);
}
.build { margin-top: 14px; font-size: 12px; color: var(--purple-soft); }

.menu-header {
  display: flex; align-items: center; gap: 12px;
  width: min(720px, 100%); margin-bottom: 10px;
}
.menu-header h2 { font-size: clamp(18px, 4vw, 24px); }
.back-btn, .hud-btn {
  min-width: 44px; min-height: 44px; border: 0; border-radius: 12px;
  background: #fff; color: var(--ink); font-size: 18px; cursor: pointer;
  box-shadow: 0 2px 0 var(--shadow-soft);
}
.map-progress { width: min(720px, 100%); font-size: 14px; margin-bottom: 12px; color: var(--purple-soft); }

/* ---------- stage list ---------- */

.stage-grid { width: min(720px, 100%); display: flex; flex-direction: column; gap: 12px; }
.stage {
  display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 76px; padding: 14px 16px; border: 0; border-radius: 16px;
  background: var(--card); color: inherit; font-family: inherit;
  cursor: pointer; box-shadow: 0 3px 0 var(--shadow-soft);
}
.stage:disabled { cursor: default; opacity: .55; }
.stage.cleared { box-shadow: 0 3px 0 var(--amber); }
.stage-num {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream-2); font-size: 19px; font-weight: 800;
}
.stage-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stage-name { font-size: 17px; font-weight: 700; }
.stage-blurb { font-size: 13px; color: var(--purple-soft); line-height: 1.4; }
.stage-progress { margin-left: auto; flex: none; font-size: 13px; font-weight: 700; color: var(--purple-soft); }

/* ---------- game screen ----------
   Everything above this line is the shared iJeeto shell and should not need
   changing. Everything below is yours: replace it with what THIS game needs.  */

#game-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; width: 100%;
}
#stage-label { flex: 1; text-align: center; font-size: 14px; font-weight: 700; color: var(--purple-soft); }

/* ---------- call a grown-up ---------- */

.help-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 4px 8px; min-width: 52px;
  background: var(--cream-2); line-height: 1;
}
.help-icon { font-size: 17px; }
.help-label { font-size: 9px; font-weight: 800; letter-spacing: .2px; color: var(--purple-soft); }
/* Visible state, so a child knows the call worked and does not press again. */
.help-btn.is-calling { background: var(--amber); opacity: 1; }
.help-btn.is-calling .help-label { color: var(--purple); }
.help-btn:disabled { cursor: default; }

.grownup {
  margin: 0 12px 8px; padding: 12px 14px;
  background: #fff; border: 2px dashed var(--amber);
  border-radius: 14px;
}
.grownup-title {
  font-size: 11px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; color: var(--purple-soft);
}
.grownup-text { margin-top: 5px; font-size: 14px; line-height: 1.5; }
.grownup-close {
  margin-top: 9px; min-height: 44px; padding: 8px 18px;   /* §8: 44px floor */
  border: 0; border-radius: 999px; background: var(--cream-2);
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--ink);
  cursor: pointer;
}

.setting-select { flex-direction: column; align-items: flex-start; gap: 6px; }
.setting-select select {
  width: 100%; min-height: 44px; padding: 8px 10px;
  border: 2px solid var(--cream-2); border-radius: 12px;
  font-family: inherit; font-size: 16px; color: var(--ink); background: #fff;
}

.prompt {
  padding: 0 16px 8px; text-align: center;
  font-size: clamp(15px, 3.6vw, 19px); line-height: 1.5;
}
.prompt b { color: var(--orange-dark); }

/* The play area is whatever this game is. It gets the space between the
   prompt and the footer, and scrolls if it needs to. */
.play-area {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 16px;
}

.game-footer { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
/* Feedback is never red. A wrong answer is a nudge, not a failure (§8). */
.feedback {
  min-height: 20px; font-size: 14px; line-height: 1.45; text-align: center;
  color: var(--purple-soft);
}
.feedback.nudge { color: var(--orange-dark); font-weight: 700; }
.feedback.good { color: var(--teal-dark); font-weight: 700; }
.check-btn { width: min(340px, 92vw); background: var(--orange); box-shadow: 0 4px 0 var(--orange-dark); }
.check-btn:active { box-shadow: 0 1px 0 var(--orange-dark); }

/* ---------- overlays ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(74, 26, 99, 0.45);
}
.card {
  width: min(380px, 100%); background: var(--card);
  border-radius: 20px; padding: 22px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 12px;
}
.card h2 { font-size: 22px; }
.complete-line { font-size: 16px; line-height: 1.5; }
.complete-lesson {
  font-size: 14px; line-height: 1.5; color: var(--purple-soft);
  background: var(--cream); border-radius: 12px; padding: 10px 12px;
}
.card-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.setting-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; min-height: 44px; text-align: left;
}
.setting-row input { width: 22px; height: 22px; }

/* Room to breathe on a laptop without stretching the play area. */
@media (min-width: 620px) {
  .play-area { width: min(640px, 100%); margin: 0 auto; }
}

/* ---------- origami diagrams ---------- */

.play-area {
  justify-content: flex-start;
  gap: 8px;
  padding-top: 0;
  overflow-y: auto;
}

.paper-note {
  width: min(360px, 100%);
  font-size: 13px;
  line-height: 1.45;
  color: var(--purple-soft);
  text-align: center;
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 2px 0 var(--shadow-soft);
}

.fold-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  justify-content: center;
  width: min(360px, 100%);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.leg-line {
  display: inline-block;
  width: 36px;
  height: 0;
  border-top-width: 3px;
  border-top-style: solid;
  border-top-color: var(--teal);
}
.leg-line.valley {
  border-top-style: dashed;
  border-top-color: var(--teal);
}
.leg-line.mountain {
  /* dash-dot approximated with double border look via background */
  width: 36px;
  height: 3px;
  border: 0;
  background: repeating-linear-gradient(
    90deg,
    var(--orange-dark) 0 10px,
    transparent 10px 14px,
    var(--orange-dark) 14px 17px,
    transparent 17px 21px
  );
}
.leg-line.reverse {
  /* hollow push-arrow: circle + open chevron */
  width: 28px;
  height: 12px;
  border: 0;
  position: relative;
  background:
    radial-gradient(circle at 3px 50%, transparent 2px, var(--purple-soft) 2.5px, var(--purple-soft) 3.5px, transparent 4px),
    linear-gradient(90deg, var(--purple-soft) 0, var(--purple-soft) 14px, transparent 14px);
  background-size: 100% 100%, 14px 2px;
  background-position: left center, 6px center;
  background-repeat: no-repeat;
}
.leg-line.reverse::after {
  content: "";
  position: absolute;
  right: 0;
  top: 1px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid transparent;
  box-shadow: inset 0 0 0 0;
  /* open chevron via borders */
  border-left-color: transparent;
  background: transparent;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--purple-soft);
  opacity: 0.9;
  /* make it look hollow: smaller inner cut is hard in pure CSS; solid is OK at 12px */
}

.diagram {
  width: min(280px, 78vw);
  aspect-ratio: 1;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--shadow-soft);
  padding: 8px;
  flex: none;
}
.diagram svg {
  display: block;
  width: 100%;
  height: 100%;
}

.face-hint {
  width: min(360px, 100%);
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-dark);
  text-align: center;
}

.step-instruction {
  width: min(360px, 100%);
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.5;
  text-align: center;
  color: var(--ink);
  padding: 0 4px;
}

.step-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--purple-soft);
}

.step-nav {
  display: flex;
  gap: 10px;
  width: min(340px, 92vw);
}
.step-btn {
  flex: 1;
  min-height: 48px;
  font-size: 15px;
}

.done-card {
  width: min(340px, 92vw);
  background: var(--cream-2);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: center;
  box-shadow: 0 3px 0 var(--shadow-soft);
}
.done-card.hidden { display: none; }
.done-emoji { font-size: 36px; }
.done-title { font-size: 17px; font-weight: 800; margin-top: 4px; }
.done-blurb { font-size: 13px; color: var(--purple-soft); margin-top: 4px; line-height: 1.4; }

.prompt {
  padding: 0 16px 4px;
  font-size: clamp(14px, 3.4vw, 17px);
}

/* At 360px the diagram must stay readable — keep stroke bold via SVG, size floor. */
@media (max-width: 380px) {
  .diagram { width: min(260px, 86vw); }
  .step-instruction { font-size: 14px; }
}

