/* Eazy Math — Kampung Kira-Kira. DuniaMisi standard (PRINSIP-DESIGN-UI):
   Titan One headings + Fredoka body, ONE warm-orange accent, sticker-book
   cards (radius 20–32px), pill buttons, touch targets ≥56px, label in its
   own text zone below the illustration. Animation vocabulary adopted from
   the Claude builds: pop/shake/jump/wob/fbp/fly. Positive feedback only. */
:root {
  --ink: #3a2e25;
  --paper: #fff8ec;
  --accent: #f07f13;
  --accent-dark: #d96a06;
  --accent-soft: #ffe7c7;
  --good: #57b83e;
  --sun: #ffd93d;
  --berry: #ff7b9c;
  --sky: #6ec6f5;
  --card: #ffffff;
  --radius: 24px;
  --shadow: 0 4px 0 rgba(58, 46, 37, .18), 0 10px 24px rgba(58, 46, 37, .12);
  --font-head: "Titan One", "Fredoka", "Baloo 2", system-ui, sans-serif;
  --font-body: "Fredoka", "Baloo 2", "Chalkboard SE", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* ---------- No-scroll shell: every screen fits ONE viewport ---------- */
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 500;
  background: linear-gradient(180deg, #bfe8ff 0%, #e8f9d8 55%, #fff3cf 100%);
  color: var(--ink);
  height: 100vh; height: 100dvh;
  overflow: hidden;
  display: flex; flex-direction: column;
}
#app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; width: 100%; }
button { font-family: inherit; cursor: pointer; }
h1, h2, .game-title, .top-title, .game-place-title, .daily-title, .pc-name, .age-big {
  font-family: var(--font-head);
  font-weight: 400;
  letter-spacing: .4px;
}
.hidden { display: none !important; }
.screen {
  flex: 1 1 auto; min-height: 0; width: 100%;
  max-width: 880px; margin: 0 auto;
  padding: clamp(8px, 1.4dvh, 14px) 14px clamp(8px, 1.6dvh, 16px);
  display: flex; flex-direction: column;
  gap: clamp(6px, 1.2dvh, 12px);
  overflow: hidden;
}

/* ---------- Keyframes (Claude vocabulary) ---------- */
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@keyframes jump { 40% { transform: translateY(-22px) scale(1.15); } }
@keyframes wob { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(4deg) scale(1.04); } }
@keyframes fbp {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  15% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(.9); opacity: 0; }
}
@keyframes fly {
  0% { transform: translate(0, 0) scale(.4) rotate(0deg); opacity: 1; }
  50% { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 35vh)) rotate(var(--r)); opacity: 0; }
}
@keyframes burst {
  0% { transform: translate(0, 0) scale(.3) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(1.2) rotate(var(--r)); opacity: 0; }
}
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }

/* ---------- Kancil poses (2x2 sheet quadrants) ---------- */
.kancil {
  background-image: url("assets/kancil-poses.jpg");
  background-size: 200% 200%;
  background-repeat: no-repeat;
  border-radius: 50%;
  flex: none;
  animation: wob 3.4s ease-in-out infinite;
}
.kancil.jump-anim { animation: jump .45s ease; }
.pose-wave  { background-position: 0% 0%; }
.pose-think { background-position: 100% 0%; }
.pose-cheer { background-position: 0% 100%; }
.pose-sign  { background-position: 100% 100%; }
.kancil-lg { width: clamp(96px, 24dvh, 168px); height: clamp(96px, 24dvh, 168px); }
.kancil-md { width: clamp(62px, 12.5dvh, 92px); height: clamp(62px, 12.5dvh, 92px); }
.kancil-sm { width: clamp(44px, 8.5dvh, 60px); height: clamp(44px, 8.5dvh, 60px); }

/* ---------- Kuih sprites (3x3 sheet) ---------- */
.sprite {
  background-image: url("assets/kuih-items.jpg");
  background-size: 300% 300%;
  background-repeat: no-repeat;
  border-radius: 14px;
  display: inline-block;
  flex: none;
}
.sprite-lg { width: clamp(64px, 13.5dvh, 104px); height: clamp(64px, 13.5dvh, 104px); }
.sprite-md { width: clamp(40px, 7.5dvh, 58px); height: clamp(40px, 7.5dvh, 58px); }
.sprite-sm { width: clamp(24px, 4.6dvh, 36px); height: clamp(24px, 4.6dvh, 36px); }
.sprite-xs { width: 26px; height: 26px; }

/* ---------- Age / entry ---------- */
.age-wrap {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center;
  justify-content: space-evenly; text-align: center;
  gap: clamp(4px, 1dvh, 12px);
}
.age-wrap .kancil { margin: 0 auto; flex: none; }
/* The Kampung Kira-Kira world art lives here as a clean banner: the game
   title sits BELOW it in its own zone (the .game-title that follows in
   flow), never overlaid on the picture. (Boss decision: home is cards
   only — the labelled map + hotspots were removed as duplication.) */
.age-banner {
  display: block; width: 100%; max-width: 580px; flex: none;
  height: clamp(96px, 17dvh, 150px); object-fit: cover; object-position: 50% 40%;
  border-radius: 26px; border: 4px solid #fff; box-shadow: var(--shadow);
}
.game-title {
  font-size: clamp(38px, 10vw, 64px);
  margin: 0;
  color: var(--accent-dark);
  text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(58,46,37,.15);
}
.tagline { font-size: clamp(15px, 4.4vw, 19px); margin: 0; line-height: 1.35; }
.age-q { font-size: clamp(19px, 5.4vw, 24px); font-weight: 700; margin: 0; }
.age-btns { display: flex; gap: clamp(8px, 2vw, 14px); justify-content: center; width: 100%; max-width: 580px; }
.age-btn {
  border: 4px solid #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(10px, 1.8dvh, 18px) 12px;
  flex: 1 1 0; min-width: 0; min-height: clamp(74px, 12.5dvh, 96px);
  display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center;
  color: #fff;
  transition: transform .25s ease, background-color .25s ease;
}
.age-btn[data-tier="45"] { background: linear-gradient(180deg, #ffa53d, #f58a1d); }
.age-btn[data-tier="67"] { background: linear-gradient(180deg, #f07f13, #d96a06); }
.age-btn:active { transform: scale(.95); }
.age-big { font-size: clamp(21px, 6vw, 30px); }
.age-sub { font-size: clamp(12px, 3.4vw, 15px); font-weight: 600; opacity: .95; line-height: 1.3; }
.age-note { margin: 0; font-size: clamp(12px, 3.4vw, 14px); opacity: .75; }

/* ---------- Top bar ---------- */
.topbar {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card); border: 3px solid #fff; border-radius: 999px;
  box-shadow: var(--shadow); padding: 5px 8px;
}
.top-left, .top-right { display: flex; align-items: center; gap: 6px; }
.top-title { font-size: clamp(17px, 4.5vw, 22px); color: var(--accent-dark); white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--paper); border-radius: 999px; padding: 4px 10px 4px 6px;
  font-weight: 700; font-size: 16px; border: 2px solid var(--accent-soft);
  min-height: 36px;
}
.chip-ic { width: 20px; height: 20px; }
.icon-btn {
  border: 2px solid var(--accent-soft); background: var(--paper); border-radius: 999px;
  width: 44px; height: 44px; font-size: 20px; line-height: 1;
  transition: transform .2s ease;
}
.icon-btn:active { transform: scale(.95); }
.icon-btn.off { opacity: .38; filter: grayscale(1); }
.home-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 700;
  border-radius: 999px; padding: 9px 15px; font-size: 16px; border: 2px solid #fff;
  box-shadow: 0 3px 0 rgba(58,46,37,.2); min-height: 44px;
  transition: transform .2s ease;
}
.home-btn:active { transform: scale(.95); }
.home-btn span { font-size: 14px; }

/* ---------- Place cards: illustration + own text zone below ---------- */
.places-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.4dvh, 12px);
}
.place-card {
  background: var(--card); border: 3px solid #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0; text-align: left; color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
  transition: transform .25s ease;
  animation: pop .45s backwards; animation-delay: calc(var(--i, 0) * 60ms);
}
.place-card:active { transform: scale(.95); }
.pc-art {
  flex: 1 1 auto; min-height: 0;
  background-image: url("assets/math-world.jpg");
  background-size: 300% 300%;
  background-repeat: no-repeat;
}
.pc-art.art-kuih    { background-position: 8% 42%; }
.pc-art.art-timbang { background-position: 44% 40%; }
.pc-art.art-katak   { background-image: url("assets/frog-pond.jpg"); background-size: cover; background-position: center; }
.pc-art.art-memori  { background-position: 92% 62%; }
.pc-art.art-bas     { background-position: 90% 12%; }
.pc-body { padding: clamp(7px, 1.2dvh, 10px) 12px clamp(8px, 1.3dvh, 12px); display: flex; flex-direction: column; gap: 2px; flex: none; }
.pc-name { font-size: clamp(17px, 4.8vw, 20px); color: var(--accent-dark); line-height: 1.15; }
.place-card.locked .pc-name { color: var(--ink); opacity: .8; }
.pc-desc { font-size: 13px; font-weight: 500; opacity: .8; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding-top: 4px; }
.pc-stars { color: #f5a623; letter-spacing: 2px; font-size: 15px; }
.pc-tag { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 11px; color: #fff; background: var(--accent); }
.pc-tag.lock { background: #a08b74; }

/* ---------- Misi Harian ---------- */
.daily-panel {
  flex: none;
  background: var(--card); border: 3px solid #fff;
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(9px, 1.5dvh, 14px) 16px;
}
.daily-head { display: flex; justify-content: space-between; align-items: baseline; }
.daily-title { font-size: clamp(17px, 4.6vw, 20px); color: var(--accent-dark); }
.daily-date { font-size: 13px; opacity: .7; }
.daily-task { display: flex; align-items: center; gap: 10px; margin-top: clamp(5px, 1dvh, 10px); }
.dt-check {
  width: clamp(23px, 4dvh, 28px); height: clamp(23px, 4dvh, 28px); border-radius: 50%; flex: none;
  border: 3px solid var(--accent); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  background: #fff;
}
.daily-task.done .dt-check { background: var(--good); border-color: var(--good); }
.dt-body { flex: 1; min-width: 0; }
.dt-text { font-size: clamp(13.5px, 3.8vw, 15.5px); font-weight: 600; line-height: 1.25; display: block; }
.daily-task.done .dt-text { opacity: .6; text-decoration: line-through; }
.dt-bar { height: clamp(6px, 1.1dvh, 9px); background: var(--accent-soft); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.dt-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.dt-num { font-size: 13px; font-weight: 700; opacity: .7; }
.daily-all-done { margin-top: 8px; font-weight: 700; color: var(--accent-dark); font-size: clamp(13px, 3.6vw, 15px); }

.tier-row { flex: none; display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 600; font-size: clamp(14px, 3.8vw, 16px); }

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--accent); color: #fff; border: 3px solid #fff; border-radius: 999px;
  box-shadow: 0 4px 0 rgba(58,46,37,.25); font-weight: 700; font-size: 19px;
  padding: 12px 26px; min-height: 58px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn-primary:active { transform: scale(.95); box-shadow: 0 2px 0 rgba(58,46,37,.25); }
.btn-ghost {
  background: #fff; color: var(--ink); border: 3px solid #e8dcc4; border-radius: 999px;
  font-weight: 700; font-size: 16px; padding: 10px 20px; min-height: 52px;
  transition: transform .2s ease;
}
.btn-ghost:active { transform: scale(.95); }
.btn-ghost.small { min-height: 44px; padding: 6px 14px; font-size: 14px; }

/* ---------- Game screen ---------- */
.game-top { flex: none; display: flex; align-items: center; gap: 10px; }
.back-btn {
  background: #fff; border: 3px solid #e8dcc4; border-radius: 999px;
  font-weight: 700; font-size: 15px; padding: 8px 14px; min-height: 48px;
  transition: transform .2s ease;
}
.back-btn:active { transform: scale(.95); }
.game-place-title { font-size: clamp(20px, 5.6vw, 30px); color: var(--accent-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-pill {
  margin-left: auto; background: var(--accent-soft); color: var(--accent-dark);
  font-family: var(--font-head); font-size: 17px;
  border-radius: 999px; padding: 6px 14px; border: 2px solid #fff;
  box-shadow: 0 2px 0 rgba(58,46,37,.15); white-space: nowrap;
}
.progress-dots { display: flex; gap: 5px; }
.progress-dots .dot { width: 13px; height: 13px; border-radius: 50%; background: #e8dcc4; border: 2px solid #fff; transition: background-color .3s ease, transform .3s ease; }
.progress-dots .dot.on { background: var(--accent); }
.progress-dots .dot.now { background: var(--sun); transform: scale(1.25); }

.speech-row { flex: none; display: flex; gap: 10px; align-items: flex-start; }
.bubble {
  background: #fff; border: 3px solid #fff; border-radius: 20px; box-shadow: var(--shadow);
  padding: clamp(8px, 1.4dvh, 10px) 14px; flex: 1; position: relative; min-width: 0;
}
.bubble::before {
  content: ""; position: absolute; left: -11px; top: 30px;
  border: 6px solid transparent; border-right: 9px solid #fff;
}
.bubble p { margin: 0; font-size: clamp(15.5px, 4.3vw, 21px); font-weight: 600; line-height: 1.32; }
.replay-btn {
  margin-top: 6px; background: var(--paper); border: 2px solid var(--accent-soft); border-radius: 999px;
  font-weight: 700; font-size: 14px; padding: 6px 12px; min-height: 44px;
  transition: transform .2s ease;
}
.replay-btn:active { transform: scale(.95); }
#game-area {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,248,236,.88));
  border: 3px solid #fff; border-radius: 26px;
  box-shadow: var(--shadow); padding: clamp(10px, 1.8dvh, 16px);
  overflow: hidden;
}
.options-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: clamp(8px, 1.5dvh, 14px); flex: none; }
.opt-btn {
  background: #fff; border: 4px solid var(--accent); border-radius: 20px;
  font-family: var(--font-head); font-size: clamp(26px, 6.5vw, 32px); color: var(--ink);
  min-width: 84px; min-height: clamp(56px, 9dvh, 72px); padding: 8px 18px;
  box-shadow: 0 4px 0 rgba(58,46,37,.18);
  transition: transform .25s ease, background-color .25s ease, border-color .25s ease;
  animation: pop .4s backwards; animation-delay: calc(var(--i, 0) * 60ms);
}
.opt-btn:active { transform: scale(.95); }
.opt-btn.good { background: var(--good); border-color: #fff; color: #fff; animation: pop .5s; }
.opt-btn.bad { animation: shake .45s; }
.opt-btn.tried { opacity: .6; }
.big-question {
  text-align: center; font-family: var(--font-head); flex: none;
  font-size: clamp(30px, 8vw, 52px); margin: clamp(2px, .8dvh, 6px) 0; color: var(--accent-dark);
}
.encourage { text-align: center; font-size: clamp(16px, 4.4vw, 19px); font-weight: 700; color: var(--berry); min-height: clamp(20px, 3.4dvh, 26px); margin-top: clamp(4px, 1dvh, 8px); flex: none; }

/* ---------- Kedai Kuih ---------- */
.order-banner {
  background: var(--paper); border: 3px dashed var(--accent); border-radius: 18px;
  padding: clamp(6px, 1.2dvh, 8px) 12px; font-weight: 700; font-size: clamp(15px, 4.2vw, 18px);
  text-align: center; margin-bottom: clamp(8px, 1.4dvh, 12px); flex: none; line-height: 1.3;
}
.kuih-stage { display: flex; flex-direction: column; gap: clamp(8px, 1.6dvh, 14px); align-items: center; flex: 1 1 auto; min-height: 0; }
.shelf-item {
  border: 4px solid #fff; border-radius: 24px; background: #fff; box-shadow: var(--shadow);
  padding: clamp(6px, 1.2dvh, 10px) 16px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform .2s ease; flex: none;
  animation: pop .4s backwards;
}
.shelf-item:active { transform: scale(.95); }
.shelf-item .tap-hint { font-size: clamp(12.5px, 3.6vw, 14px); font-weight: 700; color: var(--accent-dark); }
.basket-zone { width: 100%; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.basket-label { font-weight: 700; font-size: clamp(15px, 4.2vw, 17px); display: flex; justify-content: space-between; align-items: center; flex: none; }
.count-badge {
  background: var(--accent); color: #fff; border-radius: 999px; padding: 3px 14px;
  font-family: var(--font-head); font-size: clamp(18px, 5vw, 22px);
}
.basket {
  flex: 1 1 auto; min-height: 0; overflow: hidden;
  background: #fff; border: 3px solid var(--accent-soft); border-radius: 18px;
  padding: clamp(6px, 1.2dvh, 10px); display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start;
  margin-top: 6px;
}
.basket .sprite {
  cursor: pointer;
  /* Sized so a full basket (max 20 kuih, tier 6–7) always fits the flexed
     basket area in 3 rows — never clipped, never scrolls. */
  width: clamp(26px, 4.6dvh, 58px); height: clamp(26px, 4.6dvh, 58px);
  animation: pop .35s backwards; animation-delay: calc(var(--i, 0) * 45ms);
}
.basket-item { position: relative; display: inline-block; flex: none; }
.basket-num {
  position: absolute; top: -5px; right: -5px; z-index: 1;
  min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 999px; border: 2px solid #fff;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.basket-empty { opacity: .55; font-weight: 600; padding: 8px; }
.give-mode .basket { border-color: var(--berry); background: #fff2f5; }

/* ---------- Timbang Ajaib ---------- */
.scale-wrap { display: flex; flex-direction: column; align-items: center; flex: 1 1 auto; min-height: 0; justify-content: center; }
.scale-beam-zone { width: 100%; max-width: 520px; flex: none; }
.scale-beam {
  display: flex; justify-content: space-between; align-items: flex-end;
  transition: transform .8s cubic-bezier(.34,1.4,.64,1);
  transform-origin: 50% 100%;
}
.pan-col { display: flex; flex-direction: column; align-items: center; width: 44%; }
.pan-items {
  min-height: clamp(46px, 9.5dvh, 74px); display: flex; flex-wrap: wrap; gap: 3px; justify-content: center;
  align-content: flex-end; padding: 4px;
}
.pan-items .sprite {
  animation: pop .35s backwards; animation-delay: calc(var(--i, 0) * 45ms);
}
.pan-items .weight-chip {
  background: var(--accent); color: #fff; font-weight: 700; font-size: clamp(20px, 5.5vw, 26px);
  font-family: var(--font-head);
  border: 3px solid #fff; border-radius: 14px; padding: 4px 12px; box-shadow: var(--shadow);
  animation: pop .35s backwards;
}
.pan-items .weight-chip.mystery { background: var(--berry); }
.pan {
  width: 100%; height: 20px; background: linear-gradient(180deg, #c98d4b, #a06a2c);
  border-radius: 0 0 60px 60px; border: 3px solid #fff; border-top: none;
}
.scale-post { width: 16px; height: clamp(32px, 7dvh, 64px); background: #a06a2c; border-radius: 8px; margin: -6px auto 0; border: 2px solid #fff; }
.scale-base { width: 150px; height: 16px; background: #a06a2c; border-radius: 10px; margin: 0 auto; border: 2px solid #fff; }
.scale-status { font-size: clamp(17px, 4.6vw, 21px); font-weight: 700; margin-top: clamp(6px, 1.2dvh, 10px); min-height: clamp(22px, 4dvh, 28px); text-align: center; flex: none; }
#timbang-controls { flex: none; }
#timbang-controls p { margin: 6px 0 0; }
.side-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: clamp(8px, 1.4dvh, 12px); }
.side-btn {
  background: #fff; border: 4px solid var(--accent); border-radius: 18px;
  font-weight: 700; font-size: clamp(16px, 4.4vw, 18px); padding: 10px 16px; min-height: clamp(50px, 8dvh, 60px);
  box-shadow: 0 4px 0 rgba(58,46,37,.18);
  transition: transform .25s ease, background-color .25s ease, border-color .25s ease;
  animation: pop .4s backwards; animation-delay: calc(var(--i, 0) * 60ms);
}
.side-btn:active { transform: scale(.95); }
.side-btn.good { background: var(--good); color: #fff; border-color: #fff; animation: pop .5s; }
.side-btn.bad { animation: shake .45s; }
.pan-tap { cursor: pointer; }

/* ---------- Lumba Katak ---------- */
.race-wrap {
  position: relative; border-radius: 20px; overflow: hidden;
  background: url("assets/frog-pond.jpg") center/cover no-repeat;
  border: 3px solid #fff; flex: 1 1 auto; min-height: 110px;
}
.lane { position: absolute; left: 0; right: 0; height: 34%; }
.lane-rival { top: 16%; }
.lane-player { top: 60%; }
.lane-tag {
  position: absolute; left: 8px; top: -20px; background: rgba(255,255,255,.95);
  border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700;
}
.frog { position: absolute; width: clamp(46px, 8dvh, 62px); height: clamp(38px, 6.6dvh, 52px); transition: left .55s cubic-bezier(.34,1.5,.64,1); top: 10%; }
.frog.jump-anim { animation: jump .45s ease; }
.frog svg { width: 100%; height: 100%; filter: drop-shadow(0 3px 2px rgba(0,0,0,.25)); }
.finish-flag { position: absolute; right: 6px; top: 8px; font-size: 30px; }

/* ---------- Kad Memori ---------- */
.memo-grid {
  display: grid; gap: 8px;
  /* Sizing uses ONLY flex/grid basics supported since ~2017 — no min(),
     no dvh, no aspect-ratio anywhere in this sizing path. Two earlier
     attempts still collapsed to tiny dots on some phones: calc()
     division (invalid in older browsers) and width:min(100%, 44dvh)
     (a browser that rejects dvh inside min() drops the whole width
     declaration, so the grid shrank to fit its content). Now the board
     is a flex child of #game-area: its width comes from the container
     (width: 100%) and its height from the flexed play area
     (flex: 1 1 auto), columns share the width equally (1fr) and rows
     share the height equally (grid-auto-rows: 1fr). The play area
     bounds the board, so it always fits one screen; on tall screens
     the board is simply large. */
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  flex: 1 1 auto; min-height: 0; width: 100%;
}
.memo-card {
  perspective: 600px; border: none; background: transparent; padding: 0;
  width: 100%; height: 100%; min-height: 0;
  animation: pop .4s backwards; animation-delay: calc(var(--i, 0) * 45ms);
}
.memo-inner { display: block; position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .45s; }
.memo-card.flipped .memo-inner { transform: rotateY(180deg); }
.memo-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 16px; border: 3px solid #fff; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px; overflow: hidden;
}
.memo-back { background: linear-gradient(160deg, #ffa53d, #f07f13); color: #fff; font-size: 30px; font-weight: 700; }
.memo-front { background: #fff; transform: rotateY(180deg); }
.memo-front .memo-num { font-family: var(--font-head); font-size: clamp(24px, 6vw, 40px); color: var(--accent-dark); }
.memo-front .memo-sum { font-size: clamp(17px, 4.6vw, 26px); font-weight: 700; color: var(--berry); }
.memo-qty { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; max-width: 100%; }
.memo-qty .sprite { width: clamp(12px, 2dvh, 17px); height: clamp(12px, 2dvh, 17px); border-radius: 5px; }
.memo-card.matched .memo-front { background: #f2ffe9; border-color: var(--good); }
.memo-card.matched { animation: wiggle .5s ease; }

/* ---------- Bas Nombor ---------- */
.road { display: flex; flex-direction: column; gap: 14px; }
.stop-card { background: #fff; border: 3px solid #f1e3c8; border-radius: 18px; padding: clamp(8px, 1.5dvh, 12px); flex: none; }
.stop-card.active { border-color: var(--sun); box-shadow: var(--shadow); }
.stop-card.done { border-color: var(--good); background: #f4ffe9; }
.stop-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: clamp(5px, 1dvh, 8px); font-size: clamp(14px, 4vw, 16px); }
.stop-bus { font-size: clamp(17px, 5vw, 22px); }
.seq-row { display: flex; gap: clamp(5px, 1.4vw, 7px); flex-wrap: wrap; align-items: center; }
.seq-chip {
  min-width: clamp(44px, 7.6dvh, 56px); min-height: clamp(44px, 7.6dvh, 56px); padding: 6px 8px; border-radius: 14px;
  background: var(--accent); color: #fff; font-family: var(--font-head); font-size: clamp(20px, 5.5vw, 26px);
  display: flex; align-items: center; justify-content: center; border: 3px solid #fff;
  box-shadow: 0 3px 0 rgba(58,46,37,.15);
  animation: pop .35s backwards;
}
.seq-chip.blank { background: #fff; color: var(--berry); border: 3px dashed var(--berry); box-shadow: none; }
.seq-chip.filled { background: var(--good); animation: pop .5s; }
.seq-arrow { font-weight: 700; opacity: .5; }
.word-card { font-size: clamp(16px, 4.4vw, 19px); font-weight: 600; line-height: 1.45; margin: 0; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(58,46,37,.5);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px;
}
.sheet {
  background: var(--paper); border: 4px solid #fff; border-radius: 28px; box-shadow: var(--shadow);
  padding: clamp(14px, 2.6dvh, 24px) 20px; text-align: center; max-width: 430px; width: 100%;
  max-height: 94dvh; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: pop .45s backwards;
}
.sheet h2 { margin: clamp(4px, 1dvh, 8px) 0 4px; font-size: clamp(26px, 7vw, 32px); color: var(--accent-dark); }
.sheet p { font-size: clamp(15px, 4.2vw, 17px); margin: clamp(3px, .8dvh, 6px) 0; line-height: 1.4; }
.sheet .kancil { margin: 0 auto; animation: wob 2.4s ease-in-out infinite 1s; flex: none; }
.stars-row { display: flex; justify-content: center; gap: 8px; margin: clamp(6px, 1.4dvh, 10px) 0; }
.star-big { font-size: clamp(38px, 8dvh, 52px); color: #e8dcc4; transition: transform .3s ease, color .3s ease; line-height: 1; }
.star-big.lit { color: #f5a623; text-shadow: 0 2px 0 rgba(58,46,37,.2); animation: pop .5s; }
.sheet-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: clamp(8px, 1.8dvh, 14px); }
.new-sticker {
  background: #fff; border: 2px dashed var(--berry); color: var(--berry);
  border-radius: 14px; padding: 8px 12px; font-weight: 700; margin-top: clamp(6px, 1.4dvh, 10px); font-size: 15px;
  animation: pop .5s backwards;
}

/* ---------- Feedback banner, bursts, confetti, toast ---------- */
#fb {
  position: fixed; left: 50%; top: 42%; z-index: 95;
  transform: translate(-50%, -50%) scale(0);
  background: #fff; border: 6px solid var(--sun); border-radius: 30px;
  padding: 12px 28px; font-family: var(--font-head);
  font-size: clamp(26px, 6vw, 34px); color: var(--ink);
  text-align: center; max-width: 92vw; pointer-events: none;
  box-shadow: var(--shadow);
}
#fb.soft { border-color: var(--sky); font-size: clamp(20px, 5vw, 26px); }
#fb.show { animation: fbp 1.6s forwards; }
.burst-star {
  position: fixed; z-index: 96; pointer-events: none;
  font-size: 24px; color: #f5a623; text-shadow: 0 2px 0 rgba(58,46,37,.25);
  animation: burst .7s ease-out forwards;
}
.confetti-piece { position: fixed; left: 50%; top: 55%; z-index: 80; border-radius: 3px; pointer-events: none; animation: fly 1.6s ease-out forwards; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-weight: 700; font-size: 16px;
  border-radius: 999px; padding: 11px 22px; z-index: 90; box-shadow: var(--shadow);
  max-width: 92vw; text-align: center;
}

@media (max-width: 520px) {
  .top-title { display: none; }
}

/* Shorter screens: drop the card description line — the place name,
   stars and Main tag (the essentials) always stay. */
@media (max-height: 860px) {
  .pc-desc { display: none; }
}

/* Short screens (e.g. 360x640): compact the chrome further. Everything
   essential — all five place cards, all three daily tasks, tier row —
   remains visible and tappable; only decoration gives up space. */
@media (max-height: 720px) {
  .screen { gap: clamp(5px, 1dvh, 12px); }
  .daily-panel { padding-top: 8px; padding-bottom: 8px; }
  .daily-all-done { margin-top: 5px; }
  /* Smaller shelf kuih so a full basket still fits below it. */
  .sprite-lg { width: clamp(48px, 9.5dvh, 104px); height: clamp(48px, 9.5dvh, 104px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01s !important;
  }
}
