/* EazyLife (full standard) — DuniaMisi design standard (PRINSIP-DESIGN-UI):
   Titan One headings + Fredoka body, ONE accent (fresh teal-green), sticker
   cards radius 20–32px, pill buttons, touch targets >= 56px, screen titles
   28–34px, money numbers >= 40px, label always in its own text zone below
   the illustration. Animation vocabulary from the Claude builds: pop-in
   with overshoot, gentle shake, hop, slow wobble, feedback pop, confetti
   bursting out from centre. */
:root {
  --accent: #0E9594;
  --accent-dark: #0A6B69;
  --accent-soft: #E0F4F2;
  --ink: #26413E;
  --muted: #6E857F;
  --line: #BFE3DE;
  --reward: #FFB703;
  --good: #43C465;
  --card-shadow: 0 5px 0 rgba(10, 107, 105, 0.14);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
/* ONE-SCREEN SHELL (Boss's hard rule: no scrolling, ever). The app is a
   fixed-height flex column: topbar (fixed height) + #screen (flex:1).
   Every screen section is itself a flex column whose play areas flex to
   the available height, so content scales down instead of overflowing. */
body {
  font-family: 'Fredoka', 'Segoe UI', Arial, sans-serif;
  font-weight: 500;
  background:
    radial-gradient(1100px 480px at 50% -10%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #CDEEE7 0%, #EFF9EC 52%, #FFF6DC 100%);
  color: var(--ink);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
button {
  font-family: inherit; cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.25s ease, border-color 0.25s ease;
}
h1, h2, h3 { margin: 0; line-height: 1.15; font-family: 'Titan One', 'Fredoka', sans-serif; font-weight: 400; letter-spacing: 0.2px; }
p { margin: 0; }

/* ---------- top bar ---------- */
#topbar {
  position: relative; flex: none; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: rgba(240, 251, 248, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--accent);
}
.top-left { display: flex; gap: 8px; }
.top-title { font-family: 'Titan One', 'Fredoka', sans-serif; font-size: 24px; color: var(--accent-dark); letter-spacing: 0.5px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid #fff; background: #FFC93C; color: #7A5B00;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 rgba(0,0,0,0.12); text-decoration: none;
}
.icon-btn:active { transform: scale(0.95); }
.icon-btn.active { background: var(--accent); color: #fff; }
.icon-btn.off { background: #D8D8D8; color: #777; }
.home-btn { background: #E63946; color: #fff; }

#screen {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
  width: 100%; max-width: 560px; margin: 0 auto; padding: 10px 12px 12px;
}
/* Every screen (entry / home / locked / complete / play) fills the
   viewport exactly and stacks its parts with a uniform gap; vertical
   margins inside screens are zeroed so this gap is the only spacing. */
#screen > section {
  flex: 1; min-height: 0; width: 100%;
  display: flex; flex-direction: column; gap: 8px;
}
/* Home runs a tighter stack gap — its fixed blocks are budgeted to the
   pixel at 580px usable height (see the home section below). */
#screen > section.home { gap: 5px; }

.card {
  background: #fff; border-radius: 26px; padding: 16px;
  border: 3px solid var(--line); box-shadow: var(--card-shadow);
}
.badge {
  display: inline-block; background: var(--accent); color: #fff; font-weight: 700;
  font-size: 12px; padding: 3px 10px; border-radius: 999px; letter-spacing: 0.8px;
  text-transform: uppercase;
}
.big-btn {
  display: block; width: 100%; min-height: clamp(50px, 8dvh, 64px); margin-top: 0; flex: none;
  background: var(--accent); color: #fff; font-size: 22px; font-weight: 700;
  font-family: 'Fredoka', sans-serif;
  border: none; border-radius: 999px; box-shadow: 0 5px 0 var(--accent-dark);
}
.big-btn:active { transform: scale(0.96); box-shadow: 0 2px 0 var(--accent-dark); }
.big-btn.alt { background: #fff; color: var(--accent-dark); border: 3px solid var(--accent); box-shadow: 0 5px 0 rgba(10, 107, 105, 0.25); }
.mini-toggle {
  display: block; margin: 0 auto; background: #fff; border: 2px solid var(--line);
  border-radius: 999px; padding: 8px 18px; font-size: 15px; font-weight: 600; color: var(--accent-dark);
  min-height: 44px; flex: none;
}
.mini-toggle:active { transform: scale(0.95); }

/* ---------- art sprites ---------- */
.kancil-pose {
  background-image: url('assets/kancil-poses.jpg');
  background-size: 200% 200%; background-repeat: no-repeat;
  border-radius: 22px; flex: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}
.money-sprite {
  background-image: url('assets/money-sheet.jpg');
  background-size: 300% 200%; background-repeat: no-repeat;
  aspect-ratio: 1 / 1; flex: none;
}
.routine-sprite {
  background-image: url('assets/routine-items.jpg');
  background-size: 300% 200%; background-repeat: no-repeat;
  aspect-ratio: 1 / 1; flex: none;
}
.card-money { width: 84px; }
.slot-money { width: 54px; }
.piece-money { width: 80px; }
.wallet-money { width: 62px; }
.tray-money { width: 46px; }
.pay-note { width: 150px; margin: 0 auto; }
.step-art { width: 62px; }
.item-sprite { width: 82px; }

/* ---------- entry ---------- */
.entry-hero {
  border-radius: 26px; overflow: hidden; box-shadow: var(--card-shadow); border: 3px solid var(--line);
  /* The hero is CAPPED by dvh (19dvh), not just by a tall-screen max:
     whatever it gives up flows to .entry-body, whose tier grid is the
     element that must never clip. At 580px usable the cap is ~110px,
     which is what guarantees the tier buttons their full content
     height in the budget below. */
  flex: 1 1 auto; min-height: 48px; max-height: clamp(72px, 19dvh, 330px);
}
.entry-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.entry-title { padding: 2px 4px 0; flex: none; }
.entry-title h1 { font-size: clamp(28px, 5dvh, 40px); color: var(--accent-dark); margin-top: 4px; }
.entry-title p { font-size: clamp(16px, 2.7dvh, 18px); font-weight: 600; color: var(--muted); line-height: 1.3; }
.entry-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.entry-host { display: flex; gap: 12px; align-items: center; flex: none; }
/* Entry host compaction is dvh-driven like the play screens: mascot
   capped by dvh (JS inline 104px is only a ceiling), bubble tightened,
   so the host strip is ~90px worst case instead of ~104px. */
.entry-host .kancil-pose { max-width: clamp(64px, 15dvh, 104px); max-height: clamp(64px, 15dvh, 104px); }
.entry .bubble { padding: 10px 50px 10px 12px; }
.entry .bubble p { font-size: clamp(15px, 2.6dvh, 18px); }
.tier-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; min-height: 0; }
.tier-btn {
  background: #fff; border: 4px solid var(--accent); border-radius: 26px; padding: clamp(10px, 1.8dvh, 14px) 10px;
  display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; text-align: center;
  box-shadow: var(--card-shadow); min-height: clamp(96px, 18dvh, 156px);
}
.tier-btn:active { transform: scale(0.96); background: var(--accent); }
.tier-btn:active .tier-age { color: #fff; }
.tier-btn:active .tier-desc { color: #EAF9F8; }
.tier-age { font-family: 'Titan One', 'Fredoka', sans-serif; font-size: clamp(23px, 4.5dvh, 27px); color: var(--accent-dark); }
.tier-desc { font-size: clamp(13.5px, 2.4dvh, 15px); font-weight: 600; color: var(--muted); line-height: 1.35; }
.entry-note { text-align: center; margin: 0; font-weight: 600; color: var(--muted); font-size: 13.5px; line-height: 1.35; flex: none; }

/* ---------- speech bubble / host ---------- */
.bubble {
  position: relative; flex: 1; background: #fff; border: 3px solid var(--line);
  border-radius: 20px; padding: 12px 52px 12px 14px; min-height: 64px;
  box-shadow: var(--card-shadow);
}
.bubble::before {
  content: ''; position: absolute; left: -12px; bottom: 24px; width: 18px; height: 18px;
  background: #fff; border-left: 3px solid var(--line); border-bottom: 3px solid var(--line);
  transform: rotate(45deg); border-bottom-left-radius: 5px;
}
.bubble p { font-size: clamp(16px, 2.7dvh, 18px); font-weight: 600; line-height: 1.35; }
.speaker-btn {
  position: absolute; right: 7px; bottom: 7px; width: 46px; height: 46px;
  border-radius: 50%; border: none; background: #FFC93C; color: #7A5B00;
  display: inline-flex; align-items: center; justify-content: center;
}
.speaker-btn:active { transform: scale(0.92); }
.host-strip { display: flex; gap: 12px; align-items: center; margin: 0; flex: none; }
.host-jump { animation: jump 0.5s ease; }

/* ---------- home ---------- */
/* Home hero removed: the same illustration already opens the entry
   screen, and on a one-screen home the vertical space belongs to the
   activity grid (Boss's biggest-risk element). */
.hero { display: none; }
.home-title-row { display: flex; gap: 12px; align-items: center; margin: 0 2px; flex: none; }
/* Mascot box is dvh-capped (the JS inline 84px is only a ceiling): the
   row is governed by the title text stack, never by the artwork. */
.home-title-row .kancil-pose { max-width: clamp(50px, 9dvh, 84px); max-height: clamp(50px, 9dvh, 84px); }
.home-title-text { flex: 1; min-width: 0; }
/* The brand badge lives on the entry screen and the topbar; on home it
   is pure vertical cost, so it never renders here. */
.home-title-text .badge { display: none; }
.home-title-text h1 { font-size: clamp(23px, 4dvh, 32px); color: var(--accent-dark); margin: 4px 0 2px; }
/* Home subtitle is never clamped either — it is worded to fit 2 lines
   at 360px / 1.15x, and the grid below absorbs any extra line. */
.home-title-text p {
  font-size: clamp(13.5px, 2.4dvh, 15px); font-weight: 600; color: var(--muted); line-height: 1.3;
}
/* Chips NEVER wrap and NEVER ellipsize (Boss's rule: text is never cut
   off). The three chips share the row equally; their labels are short
   by design ("1 hari", "0 pelekat", "Umur 4–5 ▾") and the font/padding
   are sized so the full label fits a third of a 360px row even at
   1.15x font scaling. */
.chips-row { display: flex; gap: 8px; flex-wrap: nowrap; margin: 0; flex: none; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: #fff;
  border: 3px solid var(--line); border-radius: 999px; padding: 5px 8px;
  font-size: 13.5px; font-weight: 600; color: var(--accent-dark); min-height: 44px;
  flex: 1 1 0; min-width: 0;
}
.chip svg, .chip b { flex: none; }
.chip-txt { white-space: nowrap; }
.chip b { font-size: 16px; }
.tier-chip { font-family: inherit; cursor: pointer; background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.tier-chip:active { transform: scale(0.95); }
.missions-card { padding: clamp(8px, 1.5dvh, 14px) 14px; flex: none; }
.missions-card h2 { font-size: clamp(18px, 3.2dvh, 22px); margin-bottom: 2px; color: var(--accent-dark); }
/* All missions done: the rows give way to the claim button / claimed
   line at EVERY height (state-driven, not viewport-driven), so the
   claim state is never taller than the in-progress state. */
.missions-card.all-done .mission { display: none; }
/* Compact one-line missions: text + count on the left, slim progress
   segment on the right — full detail without the vertical cost. */
.mission { display: grid; grid-template-columns: 1fr 54px; align-items: center; column-gap: 8px; margin-bottom: 3px; }
.mission:last-of-type { margin-bottom: 0; }
.mission-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.mission-text { font-weight: 600; font-size: 14px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mission-count { font-weight: 700; color: var(--accent-dark); flex: none; }
.mission-check { color: var(--good); display: inline-flex; flex: none; }
.mission-bar { height: 8px; background: #E4F0EC; border-radius: 999px; overflow: hidden; margin-top: 0; }
.mission-bar span { display: block; height: 100%; background: linear-gradient(90deg, #37B8B2, var(--accent)); border-radius: 999px; transition: width 0.4s; }
.mission.done .mission-bar span { background: var(--good); }
.claim-btn {
  width: 100%; min-height: 46px; border: none; border-radius: 999px; margin-top: 6px;
  background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; box-shadow: 0 4px 0 var(--accent-dark);
}
.claim-btn:active { transform: scale(0.96); }
.claim-done { text-align: center; font-weight: 600; color: var(--good); margin-top: 6px; }
/* The pick prompt is spoken by TTS on arrival and the grid is
   self-evident; as a fixed block it was unbudgeted height on home, so
   it never renders (kept in the DOM for structure/AT text flow). */
.pick-label { display: none; }
/* Activity choices: 2-column grid filling the remaining height; each row
   is 1fr so cards shrink gracefully on short screens. Illustration on
   top (flexible height), label in its own text zone below. */
.act-list { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 8px; flex: 1; min-height: 0; }
.act-card {
  display: flex; flex-direction: column; align-items: stretch; text-align: left; width: 100%;
  background: #fff; border: 3px solid var(--line); min-height: 0;
  border-radius: 24px; padding: 0; overflow: hidden; box-shadow: var(--card-shadow);
}
.act-card:active { transform: scale(0.97); }
.act-card:last-child { grid-column: span 2; }
.act-art {
  /* Art absorbs ALL vertical shortfall (min-height 0): it crops/shrinks
     with the row, so the text zone below it can never be pushed out. */
  width: 100%; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
  background: #FFF7E0; background: color-mix(in srgb, var(--mc) 15%, #ffffff); overflow: hidden;
}
.act-art svg { height: 100%; width: auto; max-height: 92px; }
.act-art .card-money { width: auto; height: 100%; max-height: 84px; }
.card-art-img { width: 100%; height: 100%; object-fit: cover; }
/* Text zone: name+sub stacked on the left, stars + Main/lock on the
   right — keeps the zone short so the art keeps real height. */
.act-info {
  flex: none; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name meta" "sub meta";
  align-items: center; column-gap: 8px; row-gap: 1px; padding: 4px 10px 5px;
}
.act-name { grid-area: name; }
.act-sub { grid-area: sub; }
.act-meta { grid-area: meta; }
/* Card names are NEVER clamped or ellipsised (Boss's rule): the name
   wraps in full — up to 3 lines for the longest ("Susun Pagi Kancil")
   in the narrow name column — at a dvh-clamped size, and the art zone
   above (flex, min-height 0) absorbs the extra line. */
.act-name {
  font-family: 'Titan One', 'Fredoka', sans-serif; font-size: clamp(13px, 2.3dvh, 17.5px); color: var(--ink); line-height: 1.15;
}
.act-sub {
  font-size: 13.5px; font-weight: 600; color: var(--muted); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* The home card text zone is NAME + stars + Main/lock ONLY — sized to
   fit its grid row at 580px usable height with 1.15x font scaling, so
   the name (up to 3 lines, wrapping in full) and the Main/lock control
   are always fully readable; the art zone above absorbs the height.
   The subtitle never competes for that fixed zone: it lives
   on each activity's own screen and in the spoken greeting. */
.act-sub { display: none; }
.act-meta { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; margin-top: 0; padding-top: 0; }
.act-go { background: var(--accent); color: #fff; font-weight: 700; padding: 4px 12px; border-radius: 999px; font-size: 13px; line-height: 1.3; }
.act-lock { color: #B9B9B9; display: inline-flex; }
.star-row { display: inline-flex; gap: 2px; align-items: center; }
.star { color: #DDD3B8; display: inline-flex; }
.star.on { color: var(--reward); }
.demo-note { text-align: center; margin: 0; font-weight: 600; color: var(--muted); font-size: 13px; line-height: 1.28; flex: none; }

/* ---------- locked / complete ---------- */
.locked-card, .complete-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.locked-card { margin: auto 0; }
.complete-card { margin: auto 0; max-height: 100%; }
.locked-icon { color: #E63946; display: inline-flex; }
.locked-card h2 { font-size: clamp(24px, 4.6dvh, 28px); }
.complete-card h1 { font-size: clamp(26px, 4.8dvh, 30px); color: var(--accent-dark); }
.locked-card p, .complete-card p { font-weight: 600; color: var(--muted); font-size: clamp(15.5px, 2.7dvh, 17px); line-height: 1.4; }
.complete-img { width: 100%; border-radius: 16px; max-height: clamp(104px, 25dvh, 300px); object-fit: cover; flex: none; }
.complete-btns { width: 100%; }
.complete-btns .big-btn + .big-btn { margin-top: 8px; }

/* ---------- play scaffold ---------- */
.play-head { display: flex; align-items: center; gap: 10px; flex: none; }
/* The title gets ALL the width the Balik button and progress pill do
   not use, at a dvh-clamped size: the longest title ("Susun Pagi
   Kancil") then takes at most 2 lines instead of squeezing into 3. */
.play-head h2 { font-size: clamp(20px, 3.6dvh, 26px); font-weight: 400; color: var(--accent-dark); flex: 1 1 auto; min-width: 0; }
.back-btn {
  display: inline-flex; align-items: center; gap: 3px; background: #fff;
  border: 3px solid var(--line); color: var(--accent-dark); border-radius: 999px;
  padding: 6px 12px 6px 8px; font-size: 15px; font-weight: 700; min-height: 44px; flex: none;
}
.back-btn:active { transform: scale(0.95); }
.prog-pill {
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14.5px;
  border-radius: 999px; padding: 4px 11px; white-space: nowrap; flex: none;
}
.prog-row { display: flex; justify-content: flex-end; margin: 0; flex: none; }
/* Play-screen host compaction — driven by dvh, NOT by a viewport-height
   media query: on real phones the layout viewport can be >700px tall
   while the usable height (dvh, URL bar visible) is ~580px, so any
   fit strategy keyed to a media query may never fire. The mascot box
   shrinks with dvh. The bubble text is NEVER line-clamped or
   ellipsised (Boss's rule: instructions are never cut off) — prompts
   are written to fit 3 lines at this size, and the flex play areas
   below absorb the strip's growth (~90px worst case). */
.play .host-strip .kancil-pose { max-width: clamp(52px, 11dvh, 92px); max-height: clamp(52px, 11dvh, 92px); }
.play .bubble { padding: 10px 50px 10px 12px; min-height: 56px; }
.play .bubble p {
  font-size: clamp(14px, 2.35dvh, 16.5px); line-height: 1.32;
}
.play .card { padding: 12px; }
.q-progress { margin-left: auto; display: flex; gap: 5px; }
.q-dot { width: 13px; height: 13px; border-radius: 50%; background: #D8E8E2; }
.q-dot.now { background: var(--accent); transform: scale(1.25); }
.q-dot.done { background: var(--good); }
.scene-card { display: flex; gap: 14px; align-items: center; margin-bottom: 0; flex: none; }
.scene-art { flex: none; width: clamp(46px, 8.5dvh, 86px); height: clamp(46px, 8.5dvh, 86px); display: flex; align-items: center; justify-content: center; background: var(--accent-soft); border-radius: 18px; overflow: hidden; }
.scene-art svg, .scene-art .item-sprite { max-width: 100%; max-height: 100%; }
.scene-card h3 { font-size: clamp(18px, 3.4dvh, 21px); }
.scene-time { font-size: clamp(20px, 4dvh, 26px); font-weight: 700; color: #E63946; }

/* ---------- susun pagi ---------- */
/* Susun layout is STRUCTURALLY flexible: the stage, slots and tray share
   whatever height the fixed blocks (head, host, label) leave behind, in
   the ratio 0.3 / 1.3 / 1.2. Nothing in this column has a hard height, so
   nothing can be pushed below the fold — areas shrink proportionally
   instead. Card/slot inner art is dvh-clamped to fit the shrunken rows. */
.susun-stage {
  position: relative; border-radius: 22px; overflow: hidden; margin-bottom: 0; box-shadow: var(--card-shadow); border: 3px solid var(--line);
  flex: 0.3 1 0; min-height: 0; max-height: 190px;
}
/* Added by JS (ResizeObserver in playSusun) when the flex column would
   leave the stage under ~56px: a sliver of cropped scene art looks
   broken, so the stage hides entirely and slots/tray take the room. */
.susun-stage.stage-gone { display: none; }
.susun-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage-clock {
  position: absolute; right: 10px; bottom: 10px; background: rgba(255,255,255,0.94);
  border-radius: 16px; padding: 6px 10px; display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--accent-dark); font-size: 13px;
}
.stage-clock svg { width: auto; height: clamp(22px, 4.6dvh, 76px); }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; gap: 8px; margin-bottom: 0; flex: 1.3 1 0; min-height: 0; }
.slot {
  background: #FFFDF6; border: 3px dashed #BFD8CF; border-radius: 18px; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 6px 4px; position: relative; overflow: hidden;
}
.slot-clock svg { width: auto; height: clamp(22px, 4.2dvh, 52px); }
.slot.filled { border-style: solid; border-color: var(--good); background: #EAF9EE; }
.slot-num {
  position: absolute; top: 5px; left: 8px; font-weight: 700; color: #9DB8AF; font-size: 14px;
}
.slot-label { font-weight: 700; font-size: 13.5px; text-align: center; color: var(--muted); }
.slot.filled .slot-label { color: #2E7D46; }
/* Tray labels are worded short enough for one line, and if one ever
   wraps it wraps IN FULL — labels are never ellipsised (Boss's rule).
   A wrapped line is absorbed by the flex tray/slots below the label. */
.tray-label { font-weight: 600; color: var(--muted); font-size: 14px; margin: 0 2px; flex: none; }
.card-tray { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; gap: 10px; flex: 1.2 1 0; min-height: 0; }
.step-card {
  width: auto; height: 100%; min-height: 0; background: #fff; border: 3px solid var(--line); border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 0 4px; overflow: hidden;
  font-size: clamp(12.5px, 2.3dvh, 15px); font-weight: 700; color: var(--ink); box-shadow: var(--card-shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.card-tray .step-art { width: clamp(24px, 4.4dvh, 62px); }
/* Selected = full colour fill (design standard). */
.step-card.selected { background: var(--accent); border-color: var(--accent-dark); color: #fff; transform: translateY(-5px); box-shadow: 0 8px 0 rgba(10, 107, 105, 0.3); }
.step-card.dragging, .coin-piece.dragging { box-shadow: 0 14px 24px rgba(0,0,0,0.3); }

/* ---------- jam ajaib / pukul berapa ---------- */
.bigclock-wrap { display: flex; justify-content: center; margin: 0; flex: 1 1 0; min-height: 0; align-items: center; }
#bigclock { cursor: grab; border-radius: 50%; height: 100%; max-height: min(232px, 64vw); aspect-ratio: 1 / 1; }
/* The draggable clock is HEIGHT-driven: it takes whatever vertical space
   the fixed blocks leave, capped at its natural 232px / 64vw. A fixed
   dvh size cannot absorb a shortfall — a flexed one can. */
#bigclock svg { width: 100%; height: 100%; display: block; }
#bigclock.clock-good svg { filter: drop-shadow(0 0 16px rgba(67, 196, 101, 0.9)); }
.clock-svg { display: block; }
.clock-svg.interactive { pointer-events: none; }
/* Hands rotate as groups around the view-box centre with a spring feel. */
.hand-g { transform-box: view-box; transform-origin: center; transition: transform 0.38s cubic-bezier(0.34, 1.45, 0.64, 1); }
.setcontrols { display: flex; gap: 12px; justify-content: center; align-items: flex-start; flex-wrap: wrap; margin-top: 0; flex: none; }
.setcontrols .mini-toggle { align-self: center; margin: 0; }
.ctl-group { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ctl-group > span { font-weight: 700; color: var(--muted); font-size: 13px; }
.ctl-group > div { display: flex; gap: 8px; }
.ctl-btn {
  width: clamp(46px, 8dvh, 58px); height: clamp(46px, 8dvh, 58px); border-radius: 50%; border: none; background: var(--accent); color: #fff;
  font-size: clamp(24px, 4.5dvh, 30px); font-weight: 700; box-shadow: 0 4px 0 var(--accent-dark);
}
.ctl-btn:active { transform: scale(0.92); box-shadow: 0 1px 0 var(--accent-dark); }
.ctl-btn.wide { width: auto; border-radius: 999px; padding: 0 22px; font-size: 18px; }
.ctl-note { font-weight: 600; color: var(--muted); align-self: center; font-size: 15px; }
.clock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; flex: 1; min-height: 0; align-content: center; }
.clock-opt {
  background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 10px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 15px; font-weight: 700; color: var(--ink); box-shadow: var(--card-shadow);
}
.clock-opt svg { width: auto; height: min(25vw, 17dvh, 118px); }
.clock-opt:active { transform: scale(0.95); }
/* Correct = full green fill + pop. */
.clock-opt.good { background: var(--good); border-color: #2E9E4F; color: #fff; animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---------- tabung ---------- */
.goal-card { display: flex; gap: 13px; align-items: center; margin-bottom: 0; flex: none; }
.goal-art { flex: none; width: clamp(52px, 10dvh, 70px); height: clamp(52px, 10dvh, 70px); display: flex; align-items: center; justify-content: center; background: var(--accent-soft); border-radius: 16px; overflow: hidden; }
.goal-art svg, .goal-art .item-sprite { max-width: 100%; max-height: 100%; }
.goal-info { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.goal-name { font-weight: 700; font-size: 17px; }
.goal-bar { height: 14px; background: #E4F0EC; border-radius: 999px; overflow: hidden; }
.goal-bar span { display: block; height: 100%; background: linear-gradient(90deg, #F2C94C, var(--reward)); transition: width 0.4s; }
.goal-saved { font-weight: 600; color: var(--accent-dark); font-size: 16px; }
.goal-saved b { font-size: 24px; }
.coin-field {
  position: relative; flex: 1 1 auto; min-height: 84px; background: #FFFDF6; border: 3px solid var(--line);
  border-radius: 22px; margin-bottom: 0; overflow: hidden;
}
.coin-piece {
  position: absolute; width: clamp(48px, 8.5dvh, 84px); height: clamp(48px, 8.5dvh, 84px); padding: 0; background: none; border: none;
  touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 50%;
}
.coin-piece .piece-money { width: 100%; height: auto; }
.coin-piece.selected { filter: drop-shadow(0 0 0.45rem var(--accent)); transform: scale(1.1); }
.piggy-slots { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; flex: none; }
.piggy-slot {
  flex: 1; min-width: 76px; max-width: 118px; min-height: 0; background: #FFE9F1; border: 3px dashed #F2A7C3;
  border-radius: 20px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  position: relative;
}
.piggy-ic { color: #E86A92; display: inline-flex; }
.piggy-ic svg { width: clamp(22px, 4dvh, 34px); height: auto; }
.slot-money { width: clamp(34px, 6dvh, 54px); }
.slot-denom { font-weight: 700; font-size: 15px; color: #B04A72; }
.slot-count {
  position: absolute; top: -9px; right: -6px; background: #E63946; color: #fff; font-weight: 700;
  font-size: 14px; min-width: 26px; height: 26px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
  border: 2px solid #fff;
}
.piggy-slot.pulse { animation: pulse 0.45s ease; }

/* ---------- kedai kecil ---------- */
.kedai-banner { border-radius: 22px; overflow: hidden; margin-bottom: 0; box-shadow: var(--card-shadow); border: 3px solid var(--line); flex: none; }
.kedai-banner img { width: 100%; height: clamp(48px, 10dvh, 150px); object-fit: cover; object-position: 50% 30%; display: block; }
#kedai-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.list-card { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 0; flex: none; }
.list-title { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; color: var(--accent-dark); }
.list-chip { background: #FFF3D6; border: 2px solid var(--reward); border-radius: 999px; padding: 5px 13px; font-weight: 700; font-size: 15px; }
.list-chip.got { background: var(--good); border-color: var(--good); color: #fff; text-decoration: line-through; }
.basket-count { margin-left: auto; font-weight: 700; color: var(--accent-dark); }
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 10px; flex: 1; min-height: 0; }
.shelf-item {
  background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 7px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  box-shadow: var(--card-shadow); min-height: 0;
}
.shelf-item:active { transform: scale(0.95); }
.shelf-item.in-basket { border-color: var(--good); background: #EAF9EE; opacity: 0.75; }
.shelf-art { flex: 1 1 auto; min-height: 14px; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden; }
.shelf-art svg { height: 100%; width: auto; max-height: 66px; }
.shelf-art .item-sprite { height: 100%; width: auto; max-height: 66px; }
.shelf-name { font-weight: 700; font-size: clamp(14px, 2.6dvh, 16px); flex: none; }
.price-tag { background: var(--reward); color: #7A5B00; font-weight: 700; font-size: 14px; border-radius: 999px; padding: 2px 10px; }
/* Pay/change phases: the counter card fills the body and lays out as a
   flex column whose TRAY absorbs any shortfall. Its fixed rows (title,
   total, labels, wallet, button) are budgeted; the tray flexes between
   them, so the Bayar button can never be pushed below the fold. */
#kedai-body .counter-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.counter-card h3 { font-size: clamp(20px, 3.6dvh, 22px); margin-bottom: 4px; }
.total-line { font-size: 19px; font-weight: 600; margin-bottom: 4px; }
.total-line b { color: #E63946; font-size: clamp(29px, 4.8dvh, 40px); font-weight: 700; }
.pay-note-btn {
  width: 100%; background: var(--accent-soft); border: 3px dashed var(--accent); border-radius: 20px;
  padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-weight: 700; font-size: 16px; color: var(--accent-dark); min-height: 56px;
}
.pay-note-btn:active { transform: scale(0.97); }
.pay-note { width: clamp(84px, 15dvh, 150px); }
.tray {
  flex: 1 1 auto; min-height: 50px; background: #FFFDF6; border: 3px dashed #BFD8CF; border-radius: 18px;
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center; align-content: center; padding: 7px;
}
.tray-money { width: clamp(30px, 5.5dvh, 46px); }
.tray-item { background: none; border: none; padding: 0; }
.tray-item:active { transform: scale(0.92); }
.tray-empty { font-weight: 600; color: #9DB8AF; }
.tray-total { font-size: 18px; font-weight: 600; margin: 4px 0; }
.tray-total b { color: var(--accent-dark); font-size: clamp(25px, 4.2dvh, 34px); }
/* The wallet NEVER wraps: the generator can hand out up to 10 pieces,
   and a wrapped second row (~+57px) is exactly what pushed the Bayar
   button off short screens. Buttons share one row and shrink instead;
   the coin face itself carries the denomination. */
.wallet { display: flex; flex-wrap: nowrap; gap: 8px; }
.wallet-btn {
  background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 5px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-weight: 700; font-size: 11.5px; color: var(--muted); box-shadow: var(--card-shadow);
  min-height: 52px; flex: 1 1 0; min-width: 0;
}
.wallet-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wallet-money { width: clamp(26px, 5dvh, 46px); }
.wallet-btn:active { transform: scale(0.93); }

/* ---------- fx ---------- */
#confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
/* Confetti bursts OUT from centre with random x/y/rotation, then falls. */
.confetti {
  position: absolute; left: 50%; top: 56%; width: 10px; height: 16px; margin: -8px 0 0 -5px;
  animation: confetti-fly 1.7s cubic-bezier(0.17, 0.67, 0.35, 1) forwards;
}
@keyframes confetti-fly {
  0% { transform: translate(0, 0) scale(0.4) rotate(0deg); opacity: 1; }
  55% { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 38vh)) rotate(var(--r)) scale(0.9); opacity: 0; }
}
.burst-star { position: fixed; z-index: 95; pointer-events: none; display: inline-flex; transform: translate(-50%, -50%); }
.fly-ghost { position: fixed; z-index: 96; pointer-events: none; transform: translate(-50%, -50%); filter: drop-shadow(0 8px 12px rgba(0,0,0,0.25)); }
#praise-pop {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 0) scale(0); z-index: 80;
  display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--good);
  border-radius: 999px; padding: 6px 22px 6px 8px; font-size: 21px; font-weight: 700; color: #2E7D46;
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
  pointer-events: none; max-width: 92vw; opacity: 0;
}
#praise-pop.show { animation: fbp 1.25s forwards; }
@keyframes fbp {
  0% { transform: translate(-50%, 0) scale(0); opacity: 1; }
  15% { transform: translate(-50%, 0) scale(1.1); opacity: 1; }
  30% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  80% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, 0) scale(0.9); opacity: 0; }
}
/* Pop entrance with overshoot (Claude vocabulary). */
.pop-in { animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards; }
@keyframes pop-in {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.shake { animation: shake 0.45s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
@keyframes jump { 40% { transform: translateY(-22px) scale(1.06); } }
@keyframes wob {
  0%, 100% { transform: rotate(-2.5deg); }
  50% { transform: rotate(2.5deg) scale(1.03); }
}
@keyframes pulse {
  0% { transform: scale(1); } 40% { transform: scale(1.09); } 100% { transform: scale(1); }
}
/* Slow wobble idle on mascot/sticker moments. */
.entry-host .kancil-pose, .complete-card .kancil-pose, #praise-pop .kancil-pose, .locked-card .kancil-pose {
  animation: wob 3.2s ease-in-out infinite;
}
@media (max-width: 380px) {
  .clock-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }
}
/* SHORT SCREENS (<= 700px tall, e.g. 360x640): graceful scale-down so
   every screen still fits one viewport. Decorative/redundant elements
   give way first; all controls stay visible and >= 44px where tappable.
   (Kancil poses carry inline px sizes from JS — max-width/max-height
   caps shrink the box, and the 200% sprite sheet scales with it.) */
@media (max-height: 700px) {
  .card { padding: 12px; }
  .missions-card { padding: 10px 12px; }
  /* All missions done: the rows give way to the claim button. */
  .missions-card.all-done .mission { display: none; }
  /* Home: prompt label + card subtitles are spoken by TTS anyway. */
  .pick-label { display: none; }
  .act-sub { display: none; }
  .act-name { font-size: 14px; }
  .act-go { padding: 6px 14px; font-size: 13.5px; }
  .star svg { width: 14px; height: auto; }
  /* Kedai: the banner is decoration — the shelf/counter is the shop.
     (In pay/change phases game.js hides it at every height.) */
  .kedai-banner { display: none; }
  /* Pay/change phases: the counter card is tall (tray + wallet + button),
     so the host pose yields and the bubble gets the full width. The
     bubble text itself is never clamped (see the play bubble rule). */
  .counter-card { padding: 10px; }
  .play:has(.counter-card) #host-pose { display: none; }
  .home-title-text .badge { display: none; }
  /* (Home subtitle clamp removed — text is never cut off.) */
  /* Mascot caps per context. */
  .host-strip .kancil-pose, .entry-host .kancil-pose { max-width: 62px; max-height: 62px; }
  .home-title-row .kancil-pose { max-width: 56px; max-height: 56px; }
  .complete-card .kancil-pose, .locked-card .kancil-pose { max-width: 100px; max-height: 100px; }
  /* Bubble text is never clamped or ellipsised — only its padding
     tightens on short screens; the flex areas absorb the lines. */
  .bubble { padding: 10px 48px 10px 12px; min-height: 56px; }
  /* Susun: the stage scene is atmosphere (slots carry their own clocks);
     the activity scene card duplicates the spoken prompt. Both yield. */
  .susun-stage { display: none; }
  .scene-card { display: none; }
  .tray-label.susun-hint { display: none; }
  .step-art { width: 46px; }
  /* Width cap only — the slot clock's height is dvh-driven (.slot-clock svg). */
  .slot svg { max-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01s !important;
  }
}

.extra-life-art{flex:1;min-height:0;max-height:155px;object-fit:contain}.extra-life-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;flex:none}.extra-life-grid button{min-height:56px;background:#fff;border:2px solid #FF9F1C;border-radius:14px;font-weight:700;font-size:15px}.extra-life-grid button.good,.checked{background:#c5efb6!important}.bag-grid{grid-template-columns:repeat(4,1fr)}.bag-grid button{display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:12px;padding:2px}.bag-grid img,.bag-list img{width:30px;height:30px;object-fit:contain}.bag-list{display:flex;flex-wrap:wrap;justify-content:center;gap:4px;flex:none;min-height:0}.bag-list span{display:flex;align-items:center;font-size:11px;padding:2px;border-radius:8px;background:white}@media(max-height:700px){.home .hero{display:none}.act-name{font-size:12px}.act-info{padding:2px 5px;column-gap:2px}.act-go{padding:2px 6px}.act-list{gap:4px}.act-card{border-radius:12px}}

/* === DuniaMisi Polish: Motion, Visual Harmony & 580px/1.15x Viewport Fit === */
@keyframes dmPopIn {
  0% { opacity: 0; transform: scale(.86) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.act-card, .extra-life-grid button, .bag-grid button {
  animation: dmPopIn .36s cubic-bezier(.34, 1.56, .64, 1) both;
  transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), box-shadow .14s ease, border-color .15s ease;
}
.act-card:nth-child(2), .extra-life-grid button:nth-child(2) { animation-delay: .04s; }
.act-card:nth-child(3), .extra-life-grid button:nth-child(3) { animation-delay: .08s; }
.act-card:nth-child(4), .extra-life-grid button:nth-child(4) { animation-delay: .12s; }
.act-card:nth-child(5), .extra-life-grid button:nth-child(5) { animation-delay: .16s; }
.act-card:nth-child(6), .extra-life-grid button:nth-child(6) { animation-delay: .20s; }
button:active, .act-card:active {
  transform: scale(.95) translateY(2px);
}
.bag-grid button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.bag-grid button img {
  max-height: 44px;
  width: auto;
  object-fit: contain;
  display: block;
}
.bag-grid button span {
  display: block;
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1.15;
  text-align: center;
}
@media (max-height: 600px) {
  .screen, .play { gap: 5px; }
  .card { padding: 8px 10px; }
  .missions-card { padding: 6px 10px; font-size: 12px; }
  .extra-life-art { max-height: 92px; object-fit: contain; margin: 0 auto; }
  .bag-list { gap: 4px; font-size: 12px; }
  .bag-list img { height: 24px; width: 24px; }
  .bag-grid button { min-height: 54px; padding: 4px; }
  .bag-grid button img { max-height: 30px; }
  .extra-life-grid button { min-height: 44px; padding: 5px 8px; }
}


/* Stage-3 finishing (Oyen): Susun Pagi/Petang toggle, pinned question line, bag list fix */
.susun-toggle{display:flex;gap:6px;justify-content:center;flex:none}
.susun-toggle button{min-height:40px;padding:4px 16px;border-radius:999px;border:2px solid #FF9F1C;background:#fff;font-weight:700;font-size:14px}
.susun-toggle button.on{background:#FF9F1C;color:#fff}
.qline{flex:none;text-align:center;font-weight:700;font-size:15px;color:#5b4a2f;background:#FFF3D6;border-radius:10px;padding:3px 8px}
.bag-list{align-content:flex-start;align-items:flex-start;flex:none}
.bag-list span{white-space:nowrap}
