:root {
  --ink: #2a1c16;
  --muted-d: #b9a89b;          /* muted on dark */
  --muted: #95897f;            /* muted on light panels */
  --brand: #ff7a3d;
  --brand2: #ff4d8d;
  --grape: #8b5cf6;
  --gold: #ffc93c;
  --green: #43d17a;
  --green-dark: #25a85c;
  --cyan: #34e0c4;
  --blue: #4aa3ff;
  --line: #ece1d6;
  --radius: 26px;
  --glass: rgba(255,255,255,.13);
  --glass-brd: rgba(255,255,255,.38);
  --glass-sh: 0 22px 50px rgba(8,22,16,.45), inset 0 1px 0 rgba(255,255,255,.45);
  --panel: rgba(255,255,255,.94);
  --txt-sh: 0 2px 10px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;                 /* game shell: no page scroll */
  position: fixed; inset: 0;        /* kill mobile rubber-band bounce */
  background: #14241c;
  touch-action: manipulation;       /* disable double-tap zoom */
}

/* ---------- game shell (landscape) ---------- */
/* Fills phone & tablet edge-to-edge; on desktop it's capped (letterboxed). */
.app-shell {
  position: fixed; inset: 0; margin: auto;
  width: min(100vw, 1366px); height: 100dvh; max-height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}

/* portrait touch devices: ask to rotate (game is landscape-only) */
.rotate-note { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  .app-shell, .sheet-backdrop { display: none !important; }
  .rotate-note {
    position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 30px;
  }
}
.rotate-note img { width: 140px; filter: drop-shadow(0 12px 18px rgba(0,0,0,.5));
  animation: rot-wobble 1.8s ease-in-out infinite; }
.rotate-note h2 { font-family: "Fredoka", sans-serif; font-size: 26px; color: #fff; text-shadow: var(--txt-sh); margin: 0; }
.rotate-note p { color: #ffe9dc; font-weight: 700; max-width: 300px; margin: 0; }
@keyframes rot-wobble { 0%,100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
.game-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; z-index: 30;
}
.gt-btn {
  width: 48px; height: 48px; flex: 0 0 auto; border-radius: 15px;
  border: 3px solid rgba(255,255,255,.85);
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d);
  display: grid; place-items: center; font-size: 20px; color: #fff; cursor: pointer;
  text-shadow: 0 2px 3px rgba(120,50,0,.5);
  box-shadow: 0 5px 0 rgba(150,62,10,.85), 0 11px 18px rgba(8,20,14,.45),
              inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
.gt-btn:hover { filter: brightness(1.08); }
.gt-btn img { width: 30px; height: 30px; object-fit: contain; display: block;
  filter: drop-shadow(0 2px 2px rgba(120,50,0,.4)); }
.sheet-ic { width: 26px; height: 26px; object-fit: contain; }
.btn-ic { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; }
.title-ic { height: 36px; width: auto; object-fit: contain; vertical-align: -8px; }
.gt-btn:active {
  transform: translateY(4px) scale(.97);
  box-shadow: 0 1px 0 rgba(150,62,10,.85), 0 4px 8px rgba(8,20,14,.4),
              inset 0 2px 0 rgba(255,255,255,.55);
}
.gt-stats { flex: 1; display: flex; gap: 8px; justify-content: center; align-items: center; }
.gt-chip {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; color: #fff;
  font-family: "Fredoka", sans-serif;
  background: linear-gradient(180deg, #3a6b48, #1f4630);
  border: 3px solid rgba(255,217,107,.9);
  padding: 6px 14px; border-radius: 999px; text-shadow: var(--txt-sh);
  box-shadow: 0 4px 0 rgba(8,20,14,.6), 0 9px 14px rgba(8,20,14,.4),
              inset 0 2px 0 rgba(255,255,255,.25);
}
.gt-chip .badge-ic { width: 22px; height: 22px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.gt-brand {
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 22px; padding-left: 4px;
  background: linear-gradient(92deg, #ffd86b, var(--brand) 55%, var(--brand2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 6px rgba(8,20,14,.65));
}
.gt-brand span { -webkit-text-fill-color: #fff; color: #fff; }
.gt-brand-img { height: 30px; display: block; margin-left: 4px;
  filter: drop-shadow(0 2px 6px rgba(8,20,14,.65)); }
.stage-row { flex: 1 1 auto; display: flex; min-height: 0; }
.cikgu-rail { flex: 0 0 0; position: relative; transition: flex-basis .3s ease; }
.app-shell.has-cikgu .cikgu-rail { flex-basis: clamp(104px, 16vw, 200px); }
.stage {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; position: relative; min-width: 0;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.stage::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- parent settings sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: sheet-fade .18s ease;
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  width: min(480px, 100%); background: var(--panel); color: var(--ink);
  border-radius: 26px 26px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px rgba(0,0,0,.4); animation: sheet-up .22s cubic-bezier(.2,.8,.2,1);
}
.sheet-title { font-weight: 800; font-size: 13px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); padding: 4px 12px 10px; }
.sheet a { display: flex; align-items: center; gap: 12px; padding: 15px 14px; border-radius: 14px;
  font-weight: 800; font-size: 17px; color: var(--ink); }
.sheet a:hover { background: #f6efe8; }
.sheet-close { width: 100%; margin-top: 8px; padding: 14px; border: 0; border-radius: 14px;
  background: #efe6dd; color: var(--ink); font-family: inherit; font-weight: 800; font-size: 16px; cursor: pointer; }
@keyframes sheet-fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ---------- immersive world background ---------- */
.world-bg {
  position: fixed; inset: 0; z-index: -3;
  background: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/bg.jpg") center/cover no-repeat;
  transform: scale(1.08);
  animation: drift 26s ease-in-out infinite alternate;
}
.world-veil {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,201,90,.25), transparent 55%),
    radial-gradient(100% 70% at 100% 110%, rgba(139,92,246,.30), transparent 60%),
    linear-gradient(180deg, rgba(10,24,18,.35) 0%, rgba(10,24,18,.62) 55%, rgba(8,18,14,.82) 100%);
}
.twinkles { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.9), transparent),
    radial-gradient(2px 2px at 70% 20%, rgba(255,255,255,.7), transparent),
    radial-gradient(1.5px 1.5px at 40% 70%, rgba(255,255,255,.8), transparent),
    radial-gradient(1.5px 1.5px at 85% 60%, rgba(255,255,255,.6), transparent),
    radial-gradient(2px 2px at 55% 45%, rgba(255,255,255,.7), transparent);
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes drift { to { transform: scale(1.16) translate(-1.5%, -1%); } }
@keyframes twinkle { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

.jawi { font-family: "Amiri", serif; }
a { color: #fff; text-decoration: none; }

/* ---------- HUD top bar (floating) ---------- */
.hud {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; margin: 12px;
}
.brand {
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 27px; letter-spacing: .5px;
  background: linear-gradient(92deg, #ffd86b, var(--brand) 55%, var(--brand2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 6px rgba(255,120,60,.45));
}
.brand span { -webkit-text-fill-color: #fff; color: #fff; }
.hud nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hud-pill {
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 14px; color: #fff;
  padding: 9px 15px; border-radius: 999px;
  border: 3px solid rgba(255,255,255,.85);
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d);
  text-shadow: 0 2px 3px rgba(120,50,0,.5);
  box-shadow: 0 4px 0 rgba(150,62,10,.85), 0 9px 14px rgba(8,20,14,.45),
              inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
.hud-pill:hover { filter: brightness(1.08); }
.hud-pill:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(150,62,10,.85), 0 4px 8px rgba(8,20,14,.4),
              inset 0 2px 0 rgba(255,255,255,.55);
}
.hud-pill.ghost {
  background: linear-gradient(180deg, #3a6b48, #1f4630);
  border-color: rgba(255,217,107,.9); color: #fff;
  box-shadow: 0 4px 0 rgba(8,20,14,.6), 0 9px 14px rgba(8,20,14,.4),
              inset 0 2px 0 rgba(255,255,255,.25);
}

/* ---------- layout ---------- */
.wrap { width: 100%; margin: 0;
  padding: clamp(16px, 2.6vw, 32px) clamp(16px, 3vw, 40px) calc(30px + env(safe-area-inset-bottom)); }
.center { width: 100%; min-height: 100%; padding: 18px;
  display: flex; flex-direction: column; justify-content: center; }

/* ---------- glass + panels ---------- */
.glass {
  background: var(--glass); backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh); border-radius: var(--radius);
}
.card, .panel {
  color: var(--ink); background: transparent;
  border-style: solid; border-color: transparent; border-width: 40px;
  border-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ui_panel.png") 150 fill / 40px / 0 stretch;
  border-radius: 0; padding: 14px 18px;
  filter: drop-shadow(0 26px 40px rgba(8,20,14,.45));
}
.card.flat { border-image: none; background: var(--panel); border: 1px solid rgba(255,255,255,.7);
  border-radius: var(--radius); padding: 26px; filter: none; box-shadow: 0 24px 50px rgba(8,20,14,.4); }

/* reward badge images */
.badge-ic { width: 30px; height: 30px; object-fit: contain; vertical-align: middle;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
.badge-ic.lg { width: 40px; height: 40px; }

/* wooden title ribbon */
.ribbon {
  display: inline-block; color: #fff; font-family: "Fredoka", sans-serif; font-weight: 700;
  font-size: 26px; text-shadow: 0 2px 5px rgba(0,0,0,.5); line-height: 1;
  padding: 30px 78px; background: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ui_ribbon.png") center/100% 100% no-repeat;
  filter: drop-shadow(0 12px 16px rgba(0,0,0,.32));
}

/* ---------- buttons (image 9-slice plates) ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  cursor: pointer; font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 18px; color: #fff;
  text-shadow: 0 2px 3px rgba(0,0,0,.4); overflow: visible; min-width: 130px; padding: 2px 6px;
  background: transparent; border-style: solid; border-color: transparent; border-width: 30px 56px;
  border-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ui_btn_orange.png") 78 210 fill / 30px 56px / 0 stretch;
  transition: transform .07s, filter .15s; filter: drop-shadow(0 10px 14px rgba(0,0,0,.28));
}
.btn::after { content:""; position:absolute; top:-30px; left:-56px; right:-56px; bottom:-30px;
  background: linear-gradient(100deg, transparent 40%, rgba(255,255,255,.45) 50%, transparent 60%);
  background-size: 220% 100%; background-position: 140% 0; pointer-events:none; border-radius: 40px; }
.btn:hover::after { animation: shine .8s ease; }
.btn:hover { filter: brightness(1.05) drop-shadow(0 12px 16px rgba(0,0,0,.3)); }
.btn:active { transform: translateY(4px) scale(.99); filter: brightness(.97) drop-shadow(0 5px 8px rgba(0,0,0,.3)); }
.btn.green { border-image-source: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ui_btn_green.png"); }
.btn.secondary { border-image-source: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ui_btn_orange.png"); }
/* red = orange plate hue-shifted (no red plate asset) */
.btn.red { filter: hue-rotate(-32deg) saturate(1.45) drop-shadow(0 10px 14px rgba(0,0,0,.28)); }
.btn.red:hover { filter: hue-rotate(-32deg) saturate(1.45) brightness(1.05) drop-shadow(0 12px 16px rgba(0,0,0,.3)); }
.btn.red:active { filter: hue-rotate(-32deg) saturate(1.45) brightness(.97) drop-shadow(0 5px 8px rgba(0,0,0,.3)); }
.btn.block { width: 100%; }
.btn.lg { font-size: 22px; border-width: 36px 64px; border-image-slice: 78 210 fill; }
.btn.ghost {
  border-image: none; border: 1px solid rgba(255,255,255,.45); border-radius: 16px;
  background: rgba(255,255,255,.18); backdrop-filter: blur(10px); padding: 13px 20px; min-width: 0;
  filter: none; box-shadow: 0 8px 18px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn.ghost:active { transform: translateY(3px); }
@keyframes shine { from { background-position: 140% 0; } to { background-position: -40% 0; } }

/* round image icon buttons */
.iconbtn {
  width: 58px; height: 58px; flex: 0 0 auto; padding: 0; border: 0; cursor: pointer; background: transparent;
  background-size: contain; background-repeat: no-repeat; background-position: center;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.3)); transition: transform .08s, filter .15s;
}
.iconbtn:hover { filter: brightness(1.06) drop-shadow(0 10px 12px rgba(0,0,0,.32)); }
.iconbtn:active { transform: translateY(3px) scale(.94); }
.iconbtn.lg { width: 72px; height: 72px; }
.iconbtn.sound { background-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ic_sound.png"); }
.iconbtn.back  { background-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ic_back.png"); }
.iconbtn.play  { background-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ic_play.png"); }
.iconbtn.check { background-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ic_check.png"); }
.iconbtn.close { background-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ic_close.png"); }
.iconbtn.left  { background-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ic_left.png"); }
.iconbtn.right { background-image: url("https://desaverse.sgp1.cdn.digitaloceanspaces.com/assets/base/ui/ic_right.png"); }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; color: var(--ink); }
.field input {
  width: 100%; padding: 15px 16px; border-radius: 15px; border: 2px solid var(--line);
  font-family: inherit; font-size: 16px; background: #fffdfb; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(255,122,61,.18); }

.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; font-weight: 700;
  background: var(--glass); border:1px solid var(--glass-brd); color:#fff; backdrop-filter: blur(12px); }
.flash-error { background: rgba(255,90,90,.3); }
.flash-success { background: rgba(67,209,122,.3); }

h1 { font-family:"Fredoka",sans-serif; font-size: 34px; margin: 0 0 6px; }
h2 { font-family:"Fredoka",sans-serif; font-size: 24px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.card .muted, .panel .muted { color: var(--muted); }
.sub { color: var(--muted); margin: 0 0 22px; }
.on-dark { color:#fff; text-shadow: var(--txt-sh); }
.on-dark .muted, .dim { color: rgba(255,255,255,.82); }

/* ---------- entrance anim ---------- */
.pop { animation: pop .5s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes pop { from { opacity:0; transform: translateY(16px) scale(.96); } to { opacity:1; transform:none; } }
.float { animation: floaty 3.4s ease-in-out infinite; }
@keyframes floaty { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-12px);} }

/* ---------- kid home (game menu) ---------- */
.hero {
  position: relative; border-radius: 30px; overflow: hidden; margin-bottom: 16px;
  min-height: clamp(150px, 34vh, 260px); display: flex; align-items: center; padding: 24px 28px;
  background: linear-gradient(115deg, rgba(255,77,141,.30), rgba(139,92,246,.18) 60%, rgba(52,224,196,.16));
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
  backdrop-filter: blur(8px);
}
.hero .hi { flex: 1; z-index: 2; }
.hero .eyebrow { font-weight:700; letter-spacing:2px; text-transform:uppercase; font-size:13px; color: var(--gold); text-shadow: var(--txt-sh); }
.hero h1 { font-size: 42px; color:#fff; text-shadow: var(--txt-sh); line-height: 1.05; margin: 4px 0 10px; }
.hero .tag { font-size: 19px; font-weight: 700; color:#fff; text-shadow: var(--txt-sh); opacity:.95; }
.hero .mascot { width: 230px; align-self: center; filter: drop-shadow(0 18px 22px rgba(0,0,0,.4)); z-index:2; }
.hero .glow { position:absolute; width: 340px; height: 340px; right: 2%; top: 50%; transform: translateY(-50%);
  background: radial-gradient(circle, rgba(255,201,60,.5), transparent 60%); filter: blur(10px); z-index:1; }

/* HUD stat chips */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 2px 26px; }
.stat {
  flex: 1; min-width: 96px; display:flex; align-items:center; gap:10px;
  background: var(--glass); backdrop-filter: blur(16px); border:1px solid var(--glass-brd);
  border-radius: 18px; padding: 12px 14px; box-shadow: var(--glass-sh);
}
.stat .ic { font-size: 24px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.stat .n { font-family:"Fredoka",sans-serif; font-size: 24px; font-weight: 700; color:#fff; line-height:1; display:block; text-shadow: var(--txt-sh); }
.stat .l { font-size: 12px; color: rgba(255,255,255,.8); font-weight: 700; }

.section-title { font-family:"Fredoka",sans-serif; font-size: 22px; font-weight: 700; color:#fff; margin: 6px 2px 16px; text-shadow: var(--txt-sh); }

/* game module cards */
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.module {
  position: relative; border-radius: var(--radius); padding: 22px; min-height: 200px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; color: #fff;
  border: 1px solid rgba(255,255,255,.3); box-shadow: 0 22px 44px rgba(8,20,14,.45), inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform .14s ease, box-shadow .14s ease; transform-style: preserve-3d;
}
.module::before { content:""; position:absolute; inset:0; opacity:.55;
  background: radial-gradient(120% 90% at 80% 0%, rgba(255,255,255,.45), transparent 55%); }
.module:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 32px 60px rgba(0,0,0,.5), 0 0 0 2px rgba(255,255,255,.25); }
.module:active { transform: translateY(-2px) scale(.99); }
.module .icon-img { align-self: flex-end; margin: -8px -6px auto 0; width: 96px; height: 96px; object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.35)); transition: transform .25s; }
.module:hover .icon-img { transform: translateY(-4px) rotate(-4deg) scale(1.06); }
.module h3 { font-family:"Fredoka",sans-serif; margin: 8px 0 3px; font-size: 26px; text-shadow: 0 2px 6px rgba(0,0,0,.3); }
.module p { margin: 0 0 10px; opacity: .95; font-weight: 600; }
.module .play { align-self:flex-start; font-weight:800; font-size:13px; letter-spacing:1px;
  background: rgba(255,255,255,.25); padding: 6px 12px; border-radius: 11px; border:1px solid rgba(255,255,255,.4); }
.module.huruf  { background: linear-gradient(150deg, #ff8a3d, #ff3d6e); }
.module.cerita { background: linear-gradient(150deg, #4aa3ff, #8b5cf6); }
.module.menulis{ background: linear-gradient(150deg, #2fe0a0, #16b9c8); }
.module.eja     { background: linear-gradient(150deg, #ff6b6b, #ee5a6f); }
.module.sukukata { background: linear-gradient(150deg, #f757b5, #b01ed6); }
.module.padan   { background: linear-gradient(150deg, #ffb340, #ff7a1a); }
.module.cari    { background: linear-gradient(150deg, #7ec850, #2e8b57); }
.module.dengar  { background: linear-gradient(150deg, #36d1dc, #5b86e5); }
.module.kembar  { background: linear-gradient(150deg, #ffd86b, #f5a623); }
.module.bina    { background: linear-gradient(150deg, #8b5cf6, #5b2ea6); }
.module.kira    { background: linear-gradient(150deg, #ff9966, #ff5e62); }
.module.bentuk  { background: linear-gradient(150deg, #00c6a7, #1e7fb8); }
.module.pola    { background: linear-gradient(150deg, #c471f5, #fa71cd); }
.module.congak  { background: linear-gradient(150deg, #f6d365, #fda085); }
.module.titik   { background: linear-gradient(150deg, #5b86e5, #2bc0e4); }
.module.sambung { background: linear-gradient(150deg, #e96443, #904e95); }
.module.susun   { background: linear-gradient(150deg, #11998e, #38ef7d); }
.module.tangkap { background: linear-gradient(150deg, #f7971e, #ffd200); }
.module.pasar   { background: linear-gradient(150deg, #fc4a1a, #f7b733); }
.module.salin   { background: linear-gradient(150deg, #1fa2ff, #12d8fa); }
.module.lagu    { background: linear-gradient(150deg, #ee0979, #ff6a00); }
.module.puzzle  { background: linear-gradient(150deg, #614385, #516395); }
.module.banding { background: linear-gradient(150deg, #30cfd0, #330867); }
.module.jejak   { background: linear-gradient(150deg, #56ab2f, #a8e063); }
.module.roda    { background: linear-gradient(150deg, #fa709a, #fee140); }

/* ---------- auth (cinematic) ---------- */
.auth-mascot { display:block; width: 170px; margin: 0 auto -36px; position: relative; z-index: 3;
  filter: drop-shadow(0 16px 18px rgba(0,0,0,.45)); }
.brand-img { display:block; height: 58px; margin: 0 auto 10px;
  filter: drop-shadow(0 3px 10px rgba(255,120,60,.35)); }

/* ---------- profile picker ---------- */
.profiles-grid { display: flex; gap: 26px; flex-wrap: wrap; justify-content: center; }
.profile-pick { text-align: center; cursor: pointer; border: 0; background: none; font-family: inherit; }
.avatar {
  width: 124px; height: 124px; border-radius: 34px; display: grid; place-items: center;
  font-size: 60px; transition: transform .12s; border: 2px solid rgba(255,255,255,.5);
  background: var(--glass); backdrop-filter: blur(14px); box-shadow: var(--glass-sh);
}
.profile-pick:hover .avatar { transform: translateY(-8px) scale(1.05) rotate(-2deg); }
.profile-pick .name { display: block; margin-top: 12px; font-weight: 800; font-size: 18px; color:#fff; text-shadow: var(--txt-sh); }
.profile-pick .meta { display:block; font-size:13px; color: rgba(255,255,255,.85); font-weight:700; }
.avatar.add { color: #fff; }
.avatar-img { width: 104px; height: 104px; object-fit: contain;
  filter: drop-shadow(0 7px 9px rgba(0,0,0,.35)); }
.avatar-opt img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Cikgu Intan guide (lives in the side rail) ---------- */
.cikgu-guide { position: absolute; inset: 0; z-index: 60; pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding: 6px; opacity: 0; transform: translateY(20px);
  transition: opacity .3s ease, transform .3s ease; }
.cikgu-guide.show { opacity: 1; transform: translateY(0); }
.cikgu-guide img { width: 100%; max-width: 190px; display: block;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.4)); }
.cikgu-guide.bounce img { animation: cikgu-pop .42s ease; }
@keyframes cikgu-pop { 0%{transform:scale(.94)} 50%{transform:scale(1.05)} 100%{transform:scale(1)} }
/* speech bubble sits ABOVE her, tail pointing down */
.cikgu-bubble { position: relative; width: 100%; margin-bottom: 10px;
  background: #fff; color: #3a2a20; font-family: "Baloo 2", sans-serif; font-weight: 700;
  font-size: clamp(12px, 1.5vw, 15px); line-height: 1.22; text-align: center;
  padding: 10px 12px; border-radius: 16px; box-shadow: 0 8px 22px rgba(0,0,0,.28);
  opacity: 0; transform: translateY(6px) scale(.96); transform-origin: 50% 100%;
  transition: opacity .2s ease, transform .2s ease; }
.cikgu-bubble.show { opacity: 1; transform: translateY(0) scale(1); }
.cikgu-bubble:after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%);
  border: 9px solid transparent; border-top-color: #fff; border-bottom: 0; }

/* ---------- huruf ---------- */
.letter-grid { display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 2.6vw, 28px); max-width: 720px; margin: 0 auto; }
/* RTL scripts read right-to-left — alif lands top-right */
.letter-grid.rtl { direction: rtl; }
.letter-cell {
  background: var(--panel); border-radius: 22px; padding: clamp(16px, 2.6vw, 30px) 10px; text-align: center; cursor: pointer;
  box-shadow: 0 10px 22px rgba(8,20,14,.32); border: 3px solid transparent; transition: transform .1s, box-shadow .1s;
}
.letter-cell:hover { transform: translateY(-5px); box-shadow: 0 16px 30px rgba(8,20,14,.4); }
.letter-cell.picked { border-color: var(--brand); }
.letter-cell.mastered { border-color: var(--green); }
.letter-cell .glyph { font-size: clamp(44px, 7vw, 72px); line-height: 1; color: #d4541f; }
/* Amiri ascenders/descenders overflow a 1em line box — give RTL glyphs room
   so they don't paint over the rumi name below */
.letter-cell .glyph.jawi { line-height: 1.8; }
.letter-cell .nm { font-size: clamp(12px, 1.6vw, 16px); color: var(--muted); font-weight: 800; margin-top: 8px; }

.quiz { max-width: 560px; margin: 0 auto; text-align: center; }
.quiz .progress-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.quiz .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.quiz .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.quiz .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.quiz .big-glyph {
  font-size: 150px; line-height: 1.1; color: #d4541f;
  background: linear-gradient(160deg,#fff,#ffe9d8); border-radius: 30px;
  box-shadow: 0 24px 50px rgba(8,20,14,.45), inset 0 2px 0 rgba(255,255,255,.8);
  padding: 14px 30px; margin: 0 auto 22px; display: inline-block; min-width: 240px; border: 4px solid rgba(255,255,255,.7);
}
.quiz .ask { font-size: 22px; font-weight: 800; color:#fff; margin-bottom: 18px; text-shadow: var(--txt-sh); }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opt {
  padding: 22px; border-radius: 18px; background: var(--panel); box-shadow: 0 10px 22px rgba(8,20,14,.32);
  border: 3px solid transparent; font-family:"Fredoka",sans-serif; font-size: 23px; font-weight: 700; cursor: pointer; color: var(--ink);
  transition: transform .08s;
}
.opt:hover:not(:disabled) { transform: translateY(-3px); }
/* shared option sizing — one place to keep touch targets ≥64px for small fingers */
.opt.glyph-opt { font-size: 38px; padding: 16px 22px; min-width: 64px; min-height: 64px; }
.opt.glyph-opt.lg { font-size: 44px; }
.opt.emoji-opt { font-size: 52px; padding: 14px 20px; line-height: 1; min-width: 64px; min-height: 64px; }
.opt.correct { border-color: var(--green); background: #e7faf0; }
.opt.wrong { border-color: #ff5252; background: #ffe9e9; }
.opt:disabled { cursor: default; }
/* hint after repeated wrongs: quiz.js pulses the .is-answer option */
.opt.hint { animation: hint-pulse 1s ease-in-out infinite; border-color: var(--gold); }
@keyframes hint-pulse {
  0%, 100% { box-shadow: 0 10px 22px rgba(8,20,14,.32); transform: scale(1); }
  50% { box-shadow: 0 0 26px var(--gold); transform: scale(1.07); }
}

.score-pill { font-size: 24px; font-weight: 800; color:#fff; text-shadow: var(--txt-sh); }
/* small replay-the-question speaker button (tangkap, jejak, roda...) */
.mini-play { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; font-size: 18px; padding: 4px 10px; cursor: pointer; vertical-align: middle; }
.star-fly { position: fixed; width: 64px; height: auto; pointer-events: none; animation: fly 1s ease-out forwards; z-index: 99; filter: drop-shadow(0 0 8px var(--gold)); }
@keyframes fly { to { transform: translateY(-140px) scale(1.8); opacity: 0; } }

/* ---------- sukukata ---------- */
/* fills the stage, no scroll: dots row + two columns (build | letter banks) */
.sk-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sk-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.sk-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.sk-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.sk-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.sk-stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: minmax(260px, 44%) 1fr;
  gap: clamp(20px, 4vw, 56px); align-items: center; padding: 0 clamp(8px, 2vw, 32px);
}

/* drag-direction cue: banks (right) → slots (left), so it points + drifts left.
   shown until the first letter is placed, then hidden for the rest of the game */
.sk-dragcue {
  position: absolute; top: 50%; left: 46%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 5;
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(15px, 1.8vw, 19px);
  color: #fff; text-shadow: var(--txt-sh); white-space: nowrap;
  animation: sk-cue 1.4s ease-in-out infinite;
}
.sk-cue-arrow { width: clamp(15px, 1.9vw, 22px); height: clamp(15px, 1.9vw, 22px); flex: 0 0 auto;
  border-left: 5px solid #fff; border-bottom: 5px solid #fff; border-radius: 3px;
  transform: rotate(45deg); filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
@keyframes sk-cue { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(calc(-50% - 18px), -50%); } }

/* left: listen + build slots, grouped in a frosted card so the scene behind
   doesn't bleed through the empty drop slots */
.sk-build {
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
  justify-self: center; max-width: 420px; width: 100%;
  padding: clamp(20px, 3.4vh, 36px) clamp(20px, 3vw, 38px) clamp(30px, 4vh, 44px);
  border-radius: var(--radius); background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
.sk-build .ask { font-size: clamp(18px, 2.4vw, 24px); font-weight: 800; color: #fff; margin: 0; text-shadow: var(--txt-sh); }
.sk-listen {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: clamp(20px, 2.6vw, 26px); color: #fff;
  padding: 14px 34px; border-radius: 999px; border: 3px solid rgba(255,255,255,.85);
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d); text-shadow: 0 2px 3px rgba(120,50,0,.5);
  box-shadow: 0 6px 0 rgba(150,62,10,.85), 0 12px 20px rgba(8,20,14,.45), inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
.sk-listen:hover { filter: brightness(1.07); }
.sk-listen:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(150,62,10,.85), 0 5px 10px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.55); }
.sk-spk { width: 1.25em; height: 1.25em; flex: 0 0 auto; color: #fff;
  filter: drop-shadow(0 2px 2px rgba(120,50,0,.4)); }
.sk-rumi { font-size: clamp(26px, 3.6vw, 40px); font-weight: 800; color: rgba(255,255,255,.95); text-shadow: var(--txt-sh); min-height: 1.1em; }

/* RTL: huruf (consonant) sits right, bunyi (vowel) left — real jawi order */
.sk-slots { direction: rtl; display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2vw, 22px); margin-top: 8px; }
.sk-slot {
  position: relative; width: clamp(88px, 11vw, 128px); height: clamp(88px, 11vw, 128px);
  border-radius: 24px; background: rgba(20,40,30,.28); border: 3px dashed rgba(255,255,255,.6);
  display: grid; place-items: center; transition: transform .12s, background .15s, border-color .15s;
}
.sk-slot:not(.filled) { animation: sk-breathe 1.8s ease-in-out infinite; }
@keyframes sk-breathe { 0%, 100% { border-color: rgba(255,255,255,.55); } 50% { border-color: var(--gold); } }
.sk-slot .sk-glyph { font-size: clamp(42px, 6vw, 66px); line-height: 1; color: #fff; }
.sk-slot.filled { background: var(--panel); border-style: solid; border-color: var(--gold); box-shadow: 0 10px 22px rgba(8,20,14,.32); animation: sk-pop .28s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes sk-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.sk-slot.filled .sk-glyph { color: #d4541f; }
.sk-slot.drop-hi { transform: scale(1.07); border-color: var(--gold); background: rgba(255,201,60,.28); }
.sk-slot-lbl { position: absolute; bottom: -24px; left: 0; right: 0; font-size: 13px; font-weight: 800; color: rgba(255,255,255,.85); }
.sk-plus { font-size: clamp(26px, 3vw, 36px); font-weight: 800; color: rgba(255,255,255,.8); }
.sk-built {
  font-size: clamp(64px, 9vw, 104px); line-height: 1.2; direction: rtl; color: #d4541f;
  background: linear-gradient(160deg,#fff,#ffe9d8); border-radius: 26px; padding: 6px 30px;
  border: 4px solid rgba(255,255,255,.7); box-shadow: 0 20px 44px rgba(8,20,14,.42);
}

/* LTR (rumi courses, e.g. bm): normal reading order + Latin font for the
   slots/built which carry a hardcoded .jawi class in the markup */
.sk-ltr .sk-slots, .sk-ltr .sk-built { direction: ltr; }
.sk-ltr .sk-glyph, .sk-ltr .sk-built { font-family: "Fredoka", sans-serif; }

/* right: letter banks */
.sk-banks { display: flex; flex-direction: column; gap: clamp(14px, 3vh, 30px); justify-content: center; }
.sk-bank-lbl { font-size: clamp(14px, 1.8vw, 17px); font-weight: 800; color: #fff; text-shadow: var(--txt-sh); text-align: center; margin-bottom: 10px; }
.sk-tiles { display: grid; gap: clamp(10px, 1.6vw, 16px); }
#sk-cons { grid-template-columns: repeat(2, 1fr); }
#sk-vowels { grid-template-columns: repeat(3, 1fr); max-width: 420px; margin: 0 auto; }
.sk-tile { touch-action: none; user-select: none; -webkit-user-select: none; }
.sk-tile.picked { outline: 3px solid var(--gold); outline-offset: 2px; }
.sk-tile.drag-src { opacity: .35; }
.sk-ghost {
  position: fixed; z-index: 120; transform: translate(-50%, -50%); pointer-events: none;
  display: grid; place-items: center; font-size: 38px; color: var(--ink); border-radius: 18px;
  background: var(--panel); border: 3px solid var(--gold); box-shadow: 0 16px 30px rgba(8,20,14,.45);
}

#sk-done { margin: auto; text-align: center; }

@media (max-width: 760px) {
  .sk-stage { grid-template-columns: 1fr; align-content: center; gap: 22px; }
  .sk-built { font-size: clamp(56px, 16vw, 90px); }
  .sk-dragcue { display: none; } /* columns stack — left arrow no longer maps */
}

/* ---------- padan ---------- */
/* fills the stage, no scroll: dots row + picture board on top + word-card
   dock below. The child lifts the word card onto its picture (or taps the
   picture) — the classroom "padankan kad" gesture. */
.pd-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pd-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.pd-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.pd-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.pd-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.pd-stage {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  gap: clamp(10px, 2vh, 22px); padding: 0 clamp(8px, 2vw, 32px);
}

/* picture board: frosted card so tiles read as one answer zone over the scene */
.pd-board-card {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center;
  gap: clamp(8px, 1.6vh, 16px); width: min(100%, 960px); margin: 0 auto;
  padding: clamp(12px, 2.4vh, 24px) clamp(14px, 2.4vw, 30px);
  border-radius: var(--radius); background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
.pd-ask { font-size: clamp(16px, 2.2vw, 22px); font-weight: 800; color: #fff; margin: 0; text-shadow: var(--txt-sh); }
.pd-board {
  display: grid; gap: clamp(10px, 1.6vw, 18px);
  grid-template-columns: repeat(auto-fit, minmax(clamp(96px, 14vw, 170px), 1fr));
  align-content: center;
}
.pd-pic {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: clamp(8px, 1.6vh, 16px); min-height: clamp(86px, 16vh, 150px);
  font-size: clamp(38px, 8vh, 62px); line-height: 1.15;
  transition: transform .12s, border-color .15s, background .15s;
}
.pd-pic .pd-emoji { display: block; word-break: break-all; }
/* multi-emoji picture banks (counting): smaller, wrapping rows */
.pd-board.pd-sm .pd-pic { font-size: clamp(22px, 4.6vh, 34px); }
/* on match the word lands inside its picture — word next to meaning */
.pd-pic .pd-match { display: none; font-size: clamp(20px, 4vh, 32px); line-height: 1.4; color: #d4541f; font-weight: 700; }
.pd-pic.matched .pd-match { display: block; animation: pd-pop .28s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes pd-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.pd-pic.drop-hi { transform: scale(1.07); border-color: var(--gold); background: rgba(255,231,186,.95); }

/* word-card dock */
.pd-dock { position: relative; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  padding: clamp(6px, 1.4vh, 14px) 0 clamp(10px, 2vh, 18px); }
.pd-card {
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  text-align: center; padding: clamp(6px, 1.2vh, 12px) clamp(26px, 4vw, 48px);
  color: #d4541f; background: linear-gradient(160deg, #fff, #ffe9d8);
  border: 4px solid rgba(255,255,255,.7); border-radius: 26px;
  box-shadow: 0 16px 36px rgba(8,20,14,.42), inset 0 2px 0 rgba(255,255,255,.8);
  animation: pd-breathe 1.8s ease-in-out infinite;
}
@keyframes pd-breathe { 0%, 100% { border-color: rgba(255,255,255,.7); } 50% { border-color: var(--gold); } }
.pd-word { font-size: clamp(44px, 9vh, 80px); line-height: 1.3; }
.pd-word.jawi { direction: rtl; }
.pd-rumi { font-size: clamp(14px, 2.4vh, 19px); font-weight: 800; color: #a8623f; }
.pd-rumi:empty { display: none; }
.pd-card.drag-src { opacity: .35; animation: none; }
/* correct: the card has flown into the picture */
.pd-card.away { opacity: 0; transform: translateY(-18px) scale(.6); transition: transform .3s, opacity .3s; animation: none; }
/* wrong: the card shakes "no" and stays home */
.pd-card.shake { animation: pd-shake .4s ease; }
@keyframes pd-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.pd-ghost {
  position: fixed; z-index: 120; transform: translate(-50%, -50%); pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #d4541f; background: linear-gradient(160deg, #fff, #ffe9d8);
  border: 4px solid var(--gold); border-radius: 26px; box-shadow: 0 16px 30px rgba(8,20,14,.45);
}

/* drag cue: card travels up to the pictures — points + drifts up. Shown
   until the first answer, then hidden for the rest of the game */
.pd-cue {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -100%);
  display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 5;
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(14px, 1.8vw, 18px);
  color: #fff; text-shadow: var(--txt-sh); white-space: nowrap;
  animation: pd-cue 1.4s ease-in-out infinite;
}
.pd-cue-arrow { width: clamp(13px, 1.7vw, 20px); height: clamp(13px, 1.7vw, 20px); flex: 0 0 auto;
  border-left: 5px solid #fff; border-top: 5px solid #fff; border-radius: 3px;
  transform: rotate(45deg); filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
@keyframes pd-cue { 0%, 100% { transform: translate(-50%, -100%); } 50% { transform: translate(-50%, calc(-100% - 14px)); } }

#pd-done { margin: auto; text-align: center; }
#pd-done .ribbon { margin-bottom: 16px; }
#pd-done #pd-again { margin-top: 18px; }
#pd-done .btn.green { margin-top: 10px; }

@media (max-width: 760px) {
  .pd-board { grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)); }
  .pd-pic { min-height: clamp(64px, 15vh, 96px); font-size: clamp(30px, 7vh, 44px); }
  .pd-word { font-size: clamp(34px, 8vh, 54px); }
  .pd-cue { font-size: 13px; } /* layout stays vertical — up arrow still maps */
}

/* ---------- sambung (Titi Ayam) ---------- */
/* fills the stage, no scroll: stream scene with a 3-plank footbridge = the
   word (RTL: first plank rightmost). The asked position is the missing plank;
   an animal walks in and waits at the hole — no positional text labels.
   Right bank: signpost (letter + name + listen). Bottom: plank tiles. */
.sb-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sb-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 8px; }
.sb-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.sb-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.sb-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.sb-stage {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  gap: clamp(8px, 1.6vh, 16px); padding: 0 clamp(8px, 2vw, 32px);
}

/* the stream scene */
.sb-scene { position: relative; flex: 1 1 auto; min-height: 0; border-radius: var(--radius); overflow: hidden; }
.sb-water {
  position: absolute; left: 0; right: 0; bottom: 0; height: 46%;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 26px, rgba(255,255,255,0) 26px 78px),
    linear-gradient(180deg, rgba(52,224,196,.38), rgba(74,163,255,.5));
  animation: sb-ripple 9s linear infinite;
}
@keyframes sb-ripple { from { background-position: 0 0, 0 0; } to { background-position: 156px 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .sb-water { animation: none; } }
.sb-bank { position: absolute; bottom: 0; height: 58%; width: clamp(80px, 14%, 170px); background: radial-gradient(120% 100% at 50% 100%, #2f7a45 55%, #1f4630); }
.sb-bank-r { right: 0; border-top-left-radius: 70% 55%; }
.sb-bank-l { left: 0; border-top-right-radius: 70% 55%; }
.sb-home { position: absolute; left: clamp(8px, 2.6%, 28px); bottom: 52%; font-size: clamp(30px, 6vh, 52px); line-height: 1; filter: drop-shadow(0 8px 10px rgba(0,0,0,.35)); z-index: 3; }

/* signpost on the right bank: whose plank do we need? */
.sb-signpost {
  position: absolute; right: clamp(6px, 1.6%, 20px); top: clamp(6px, 2vh, 16px); z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: clamp(8px, 1.4vh, 14px) clamp(14px, 1.8vw, 22px);
  border-radius: 20px; background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
.sb-glyph { font-size: clamp(44px, 9vh, 80px); line-height: 1.6; color: #fff; text-shadow: var(--txt-sh); direction: rtl; }
.sb-name { font-family: "Fredoka", sans-serif; font-size: clamp(15px, 1.8vw, 20px); font-weight: 700; color: #fff; text-shadow: var(--txt-sh); margin: clamp(4px, 1vh, 10px) 0 4px; }
.sb-listen {
  width: clamp(40px, 5.6vh, 52px); height: clamp(40px, 5.6vh, 52px); border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: #fff;
  border: 3px solid rgba(255,255,255,.85);
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d);
  box-shadow: 0 5px 0 rgba(150,62,10,.85), 0 10px 16px rgba(8,20,14,.45), inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
.sb-listen:hover { filter: brightness(1.07); }
.sb-listen:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(150,62,10,.85), 0 5px 8px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.55); }
.sb-listen svg { width: 55%; height: 55%; filter: drop-shadow(0 2px 2px rgba(120,50,0,.4)); }

/* the footbridge (RTL: first plank rightmost — jawi reading order) */
.sb-bridge {
  position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); z-index: 2;
  direction: rtl; display: flex; align-items: center;
}
.sb-plank {
  position: relative; width: clamp(88px, 13vw, 132px); height: clamp(60px, 10vh, 88px);
  border-radius: 14px; display: grid; place-items: center;
  background:
    repeating-linear-gradient(90deg, rgba(120,70,20,.16) 0 3px, rgba(120,70,20,0) 3px 26px),
    linear-gradient(180deg, #e2b277, #c08544 70%, #a2682e);
  border: 3px solid rgba(90,50,12,.55);
  box-shadow: 0 8px 14px rgba(8,20,14,.35), inset 0 2px 0 rgba(255,255,255,.35);
  transition: transform .12s, background .15s, border-color .15s;
}
.sb-plank-glyph { font-size: clamp(32px, 5.8vh, 56px); line-height: 1; direction: rtl; color: rgba(80,45,12,.5); }
.sb-plank.gap {
  background: rgba(8,28,38,.3); border: 3px dashed rgba(255,255,255,.65); box-shadow: none;
  animation: sb-bob 1.8s ease-in-out infinite;
}
@keyframes sb-bob {
  0%, 100% { transform: translateY(0); border-color: rgba(255,255,255,.55); }
  50% { transform: translateY(4px); border-color: var(--gold); }
}
.sb-plank.filled {
  background: var(--panel); border: 3px solid var(--gold);
  box-shadow: 0 10px 22px rgba(8,20,14,.32); animation: sb-thunk .32s cubic-bezier(.3,1.4,.5,1) both;
}
.sb-plank.filled .sb-plank-glyph { color: #d4541f; }
@keyframes sb-thunk { 0% { transform: translateY(-28px) scale(1.05); } 70% { transform: translateY(2px) rotate(1.5deg); } 100% { transform: none; } }
.sb-plank.sink { animation: sb-sink .7s ease-in both; }
@keyframes sb-sink { 0% { transform: rotate(0); } 30% { transform: rotate(7deg); } 100% { transform: translateY(48px) rotate(16deg); opacity: 0; } }
.sb-splash {
  position: absolute; left: 50%; bottom: -14px; width: 12px; height: 12px; border-radius: 50%;
  opacity: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(116,214,255,0) 70%);
}
.sb-plank.sink .sb-splash { animation: sb-splash .6s ease-out .3s both; }
@keyframes sb-splash { 0% { opacity: 0; transform: translateX(-50%) scale(.4); } 30% { opacity: .95; } 100% { opacity: 0; transform: translateX(-50%) scale(7); } }
.sb-plank.drop-hi { transform: scale(1.08); border-color: var(--gold); background: rgba(255,201,60,.3); }
.sb-rope { width: clamp(16px, 2.6vw, 36px); height: 7px; border-radius: 4px; flex: 0 0 auto;
  background: linear-gradient(180deg, #caa36a, #8a6534); box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
/* correct plank: lash only the rope(s) on the joining side(s) — the tatweel
   direction made visible (awal lights its left rope, tengah both, akhir right) */
.sb-rope.lit { background: var(--gold); box-shadow: 0 0 12px var(--gold); animation: sb-link .4s ease both; }
@keyframes sb-link { from { transform: scaleX(.2); } to { transform: scaleX(1); } }

/* the walker: waits at the hole, hops across when the word links up */
.sb-walker {
  position: absolute; z-index: 6; left: 0; top: 0; font-size: clamp(28px, 5.6vh, 46px); line-height: 1;
  pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0,0,0,.35));
  transition: left .45s ease, top .45s ease;
  animation: sb-idle 1.6s ease-in-out infinite;
}
.sb-walker.no-anim { transition: none; }
@keyframes sb-idle {
  0%, 100% { transform: translate(-50%, -92%) translateY(0); }
  50% { transform: translate(-50%, -92%) translateY(-5px); }
}
.sb-walker.startle { animation: sb-startle .55s ease; }
@keyframes sb-startle {
  0%, 100% { transform: translate(-50%, -92%); }
  25% { transform: translate(-50%, -92%) rotate(-14deg) translateY(-4px); }
  60% { transform: translate(-50%, -92%) rotate(10deg) translateY(-7px); }
}

/* one-time cue above the first hole; dies after first placement */
.sb-cue {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  pointer-events: none; z-index: 5; white-space: nowrap; direction: ltr;
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(14px, 1.7vw, 18px);
  color: #fff; text-shadow: var(--txt-sh);
  animation: sb-cue 1.4s ease-in-out infinite;
}
.sb-cue-arrow { width: clamp(13px, 1.7vw, 18px); height: clamp(13px, 1.7vw, 18px);
  border-left: 5px solid #fff; border-bottom: 5px solid #fff; border-radius: 3px;
  transform: rotate(-45deg); filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
@keyframes sb-cue { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* plank tiles (kept .opt so quiz.js disable/hint machinery works) */
.sb-tiles { flex: 0 0 auto; direction: rtl; display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 1.6vw, 16px); padding-bottom: 4px; }
.sb-tile { direction: rtl; touch-action: none; user-select: none; -webkit-user-select: none;
  border: 3px solid rgba(154,95,40,.75); }
.sb-tile.drag-src { opacity: .35; }
.sb-ghost {
  position: fixed; z-index: 120; transform: translate(-50%, -50%); pointer-events: none;
  display: grid; place-items: center; font-size: 38px; direction: rtl; color: var(--ink); border-radius: 18px;
  background: var(--panel); border: 3px solid var(--gold); box-shadow: 0 16px 30px rgba(8,20,14,.45);
}

#sb-done { margin: auto; text-align: center; }

@media (max-width: 760px) {
  .sb-signpost { padding: 6px 12px; }
  .sb-glyph { font-size: clamp(36px, 9vw, 52px); }
  .sb-plank { width: clamp(64px, 15vw, 88px); height: clamp(46px, 8vh, 64px); }
  .sb-plank-glyph { font-size: clamp(24px, 6.5vw, 36px); }
  .sb-rope { width: 14px; height: 6px; }
  .sb-home { font-size: clamp(24px, 5vw, 34px); }
  .sb-walker { font-size: clamp(22px, 5vw, 34px); }
}

/* ---------- eja ---------- */
/* repair-the-word: meaning anchor (picture + listen) → word strip of letter
   cards with one breathing gap → letter tray below. fills the stage, no scroll */
.eja-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.eja-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 8px; }
.eja-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.eja-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.eja-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.eja-stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
  gap: clamp(6px, 1.4vh, 16px); padding: 0 clamp(8px, 2vw, 32px);
}

/* drag-direction cue: tray (bottom) → gap (above), so it points + drifts up.
   shown until the first letter is placed, then hidden for the rest of the game */
.eja-cue {
  position: absolute; left: 50%; top: 67%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 5;
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(15px, 1.8vw, 19px);
  color: #fff; text-shadow: var(--txt-sh); white-space: nowrap;
  animation: eja-cue 1.4s ease-in-out infinite;
}
.eja-cue-arrow { width: clamp(15px, 1.9vw, 22px); height: clamp(15px, 1.9vw, 22px); flex: 0 0 auto;
  border-left: 5px solid #fff; border-top: 5px solid #fff; border-radius: 3px;
  transform: rotate(45deg); filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
@keyframes eja-cue { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-50%, calc(-50% - 16px)); } }

/* meaning anchor: what the word *means* (picture) + how it sounds (listen) */
.eja-meaning { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: clamp(14px, 3vw, 32px); }
.eja-pic { font-size: clamp(48px, 9vh, 84px); line-height: 1; filter: drop-shadow(0 6px 10px rgba(8,20,14,.35)); }
.eja-meaning-txt { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.eja-listen {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: clamp(17px, 2.4vh, 23px); color: #fff;
  padding: clamp(8px, 1.6vh, 12px) clamp(20px, 3vw, 30px); border-radius: 999px; border: 3px solid rgba(255,255,255,.85);
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d); text-shadow: 0 2px 3px rgba(120,50,0,.5);
  box-shadow: 0 6px 0 rgba(150,62,10,.85), 0 12px 20px rgba(8,20,14,.45), inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
.eja-listen:hover { filter: brightness(1.07); }
.eja-listen:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(150,62,10,.85), 0 5px 10px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.55); }
.eja-spk { width: 1.25em; height: 1.25em; flex: 0 0 auto; color: #fff; filter: drop-shadow(0 2px 2px rgba(120,50,0,.4)); }
.eja-rumi { font-size: clamp(16px, 2.4vh, 24px); font-weight: 800; color: rgba(255,255,255,.95); text-shadow: var(--txt-sh); min-height: 1.1em; }

/* the word strip, grouped in a frosted card so the scene behind doesn't
   bleed through the empty gap */
.eja-wordcard {
  position: relative; flex: 0 1 auto; max-width: 100%;
  padding: clamp(16px, 3vh, 30px) clamp(22px, 4vw, 48px);
  border-radius: var(--radius); background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
/* RTL flex row — letter cards read right→left, real jawi order */
.eja-word { direction: rtl; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: clamp(6px, 1vw, 12px); }
.eja-letter {
  display: grid; place-items: center; min-width: clamp(54px, 9vh, 92px); height: clamp(64px, 11vh, 104px);
  padding: 0 clamp(6px, 1vw, 14px); font-size: clamp(38px, 7vh, 66px); line-height: 1; color: #d4541f;
  background: linear-gradient(160deg,#fff,#ffe9d8); border-radius: 18px;
  border: 3px solid rgba(255,255,255,.7); box-shadow: 0 10px 22px rgba(8,20,14,.32);
}
.eja-gap {
  display: grid; place-items: center; width: clamp(54px, 9vh, 92px); height: clamp(64px, 11vh, 104px);
  border-radius: 18px; background: rgba(20,40,30,.28); border: 3px dashed rgba(255,255,255,.6);
  transition: transform .12s, background .15s, border-color .15s;
}
.eja-gap:not(.filled) { animation: eja-breathe 1.8s ease-in-out infinite; }
@keyframes eja-breathe { 0%, 100% { border-color: rgba(255,255,255,.55); } 50% { border-color: var(--gold); } }
.eja-gap-glyph { font-size: clamp(38px, 7vh, 66px); line-height: 1; color: #fff; }
.eja-gap.filled { background: var(--panel); border-style: solid; border-color: var(--gold);
  box-shadow: 0 10px 22px rgba(8,20,14,.32); animation: eja-pop .28s cubic-bezier(.2,.9,.3,1.4) both; }
.eja-gap.filled .eja-gap-glyph { color: #d4541f; }
.eja-gap.drop-hi { transform: scale(1.07); border-color: var(--gold); background: rgba(255,201,60,.28); }
@keyframes eja-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.eja-word-lbl { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center;
  font-size: 13px; font-weight: 800; color: rgba(255,255,255,.85); }
/* success reveal: letter cards swap to the connected (sambung) word */
.eja-built {
  font-size: clamp(52px, 11vh, 96px); line-height: 1.3; direction: rtl; color: #d4541f;
  text-align: center; background: linear-gradient(160deg,#fff,#ffe9d8); border-radius: 26px;
  padding: 6px 30px; border: 4px solid rgba(255,255,255,.7); box-shadow: 0 20px 44px rgba(8,20,14,.42);
}

/* letter tray (drag sources) */
.eja-tray { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.eja-tray-lbl { font-size: clamp(14px, 1.8vw, 17px); font-weight: 800; color: #fff; text-shadow: var(--txt-sh); }
.eja-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 1.6vw, 16px); }
.eja-tile { touch-action: none; user-select: none; -webkit-user-select: none; }
.eja-tile.picked { outline: 3px solid var(--gold); outline-offset: 2px; }
.eja-tile.drag-src { opacity: .35; }
.eja-ghost {
  position: fixed; z-index: 120; transform: translate(-50%, -50%); pointer-events: none;
  display: grid; place-items: center; font-size: 38px; color: var(--ink); border-radius: 18px;
  background: var(--panel); border: 3px solid var(--gold); box-shadow: 0 16px 30px rgba(8,20,14,.45);
}

#eja-done { margin: auto; text-align: center; }
#eja-done .ribbon { margin-bottom: 16px; }
#eja-done .btn { display: block; width: fit-content; margin: 18px auto 0; }
#eja-done .btn.green { margin-top: 10px; }

@media (max-width: 760px), (max-height: 480px) {
  .eja-pic { font-size: clamp(38px, 8vh, 56px); }
  .eja-letter, .eja-gap { height: clamp(52px, 12vh, 76px); min-width: clamp(44px, 9vh, 68px); }
  .eja-gap { width: clamp(44px, 9vh, 68px); }
  .eja-letter, .eja-gap-glyph { font-size: clamp(30px, 7vh, 50px); }
  .eja-built { font-size: clamp(38px, 10vh, 60px); }
  .eja-word-lbl { display: none; } /* too tight under the card when stacked */
}

/* ---------- cari ---------- */
/* hidden-object search: the desa scene IS the play area (full-bleed, no card).
   Target card floats top-left, collection tray bottom-center; glyph plaques
   bob in the scene with depth scaling (lower = nearer = bigger). */
.cr-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.cr-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.cr-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.cr-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.cr-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.cr-stage { flex: 1 1 auto; min-height: 0; display: flex; }
.cr-scene {
  position: relative; flex: 1 1 auto; min-width: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--cr-scene-img) center/cover no-repeat, linear-gradient(160deg, #7ec850, #2e8b57);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
/* time-of-day veil: each round visits the desa at a different hour */
.cr-veil { position: absolute; inset: 0; pointer-events: none; transition: background 1s ease; }
.cr-scene.tint-1 .cr-veil { background: linear-gradient(180deg, rgba(255,201,90,.20), rgba(255,122,61,.12)); }
.cr-scene.tint-2 .cr-veil { background: linear-gradient(180deg, rgba(139,92,246,.22), rgba(255,77,141,.12)); }

/* glyph plaques: little wooden signs hidden in the scene */
.cr-field { position: absolute; inset: 0; }
.cr-glyph {
  position: absolute; left: var(--x); top: var(--y); cursor: pointer;
  font-family: inherit; font-size: clamp(26px, 4.8vh, 46px); line-height: 1;
  min-width: 64px; min-height: 64px; padding: clamp(8px, 1.4vh, 14px) clamp(12px, 1.8vh, 18px);
  color: #4a3322; background: linear-gradient(170deg, #fffdf6, #f3e3c5);
  border: 3px solid #d9b98c; border-radius: 16px;
  box-shadow: 0 5px 0 rgba(120,80,30,.5), 0 12px 16px rgba(8,20,14,.35), inset 0 2px 0 rgba(255,255,255,.8);
  transform: translate(-50%, -50%) rotate(var(--rot)) scale(var(--scale));
  animation: cr-bob var(--bob-dur) ease-in-out var(--bob-delay) infinite;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
/* this block sits after the global .jawi rule, so restate Amiri for RTL glyphs */
.cr-glyph.jawi { font-family: "Amiri", serif; }
@keyframes cr-bob {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rot)) scale(var(--scale)); }
  50% { transform: translate(-50%, calc(-50% - 7px)) rotate(var(--rot)) scale(var(--scale)); }
}
.cr-glyph.wrong { border-color: #ff5252; background: #ffe9e9; animation: cr-shake .4s ease; }
@keyframes cr-shake {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rot)) scale(var(--scale)); }
  25% { transform: translate(-50%, -50%) rotate(calc(var(--rot) - 8deg)) scale(var(--scale)); }
  75% { transform: translate(-50%, -50%) rotate(calc(var(--rot) + 8deg)) scale(var(--scale)); }
}
/* quiz.js hint pulses .opt.hint with a bare scale() — that would wipe the
   plaque's centering translate, so cari overrides with a full transform */
.cr-glyph.hint { animation: cr-hint 1s ease-in-out infinite; border-color: var(--gold); }
@keyframes cr-hint {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rot)) scale(var(--scale)); box-shadow: 0 5px 0 rgba(120,80,30,.5), 0 12px 16px rgba(8,20,14,.35); }
  50% { transform: translate(-50%, -50%) rotate(var(--rot)) scale(calc(var(--scale) * 1.12)); box-shadow: 0 0 26px var(--gold); }
}
/* idle glint: a shine sweeps one remaining target so a stuck child looks there */
.cr-glyph.glint { box-shadow: 0 5px 0 rgba(120,80,30,.5), 0 0 22px var(--gold); }
.cr-glyph.glint::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.85) 50%, transparent 65%);
  background-size: 220% 100%; animation: cr-glint 1.5s ease;
}
@keyframes cr-glint { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.cr-glyph.found { opacity: 0; transition: opacity .2s; pointer-events: none; }

/* target card: what we're hunting, always in the corner of the eye */
.cr-target-card {
  position: absolute; top: clamp(10px, 2vh, 18px); left: clamp(10px, 1.6vw, 18px); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: clamp(10px, 1.8vh, 16px) clamp(14px, 2vw, 22px);
  border-radius: 20px; background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
.cr-target-lbl { font-family: "Fredoka", sans-serif; font-weight: 700; font-size: clamp(13px, 1.7vw, 17px); color: #fff; text-shadow: var(--txt-sh); }
.cr-target-glyph {
  min-width: clamp(64px, 10vh, 92px); padding: 4px 14px; text-align: center;
  font-size: clamp(38px, 7.5vh, 64px); line-height: 1.25; color: #d4541f;
  background: linear-gradient(160deg, #fff, #ffe9d8); border-radius: 18px;
  border: 3px solid rgba(255,255,255,.7); box-shadow: 0 10px 22px rgba(8,20,14,.32);
}
.cr-listen {
  position: relative; width: clamp(48px, 7vh, 58px); height: clamp(48px, 7vh, 58px); border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: #fff;
  border: 3px solid rgba(255,255,255,.85);
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d);
  box-shadow: 0 5px 0 rgba(150,62,10,.85), 0 10px 16px rgba(8,20,14,.45), inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
/* invisible halo keeps the tap target >= 64px even when the button bottoms out */
.cr-listen::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; }
.cr-listen:hover { filter: brightness(1.07); }
.cr-listen:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(150,62,10,.85), 0 5px 8px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.55); }
.cr-spk { width: 55%; height: 55%; filter: drop-shadow(0 2px 2px rgba(120,50,0,.4)); }

/* one-time cue: drifts from the target card toward the scene, dies on first find */
.cr-cue {
  position: absolute; top: clamp(110px, 24vh, 200px); left: clamp(24px, 4vw, 60px); z-index: 5;
  display: flex; align-items: center; gap: 8px; pointer-events: none; white-space: nowrap;
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(14px, 1.8vw, 19px);
  color: #fff; text-shadow: var(--txt-sh);
  animation: cr-cue 1.4s ease-in-out infinite;
}
.cr-cue-arrow { width: clamp(14px, 1.8vw, 20px); height: clamp(14px, 1.8vw, 20px); flex: 0 0 auto;
  border-right: 5px solid #fff; border-bottom: 5px solid #fff; border-radius: 3px;
  transform: rotate(-45deg); filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
@keyframes cr-cue { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(16px, 8px); } }

/* collection tray: one slot per copy — the slots themselves say "find N" */
.cr-tray {
  position: absolute; bottom: clamp(10px, 2vh, 18px); left: 50%; transform: translateX(-50%); z-index: 5;
  display: flex; gap: clamp(8px, 1.2vw, 14px); padding: clamp(8px, 1.4vh, 12px) clamp(12px, 1.8vw, 20px);
  border-radius: 999px; background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
.cr-slot {
  width: clamp(42px, 7vh, 58px); height: clamp(42px, 7vh, 58px); border-radius: 14px;
  display: grid; place-items: center; font-size: clamp(20px, 3.6vh, 32px); line-height: 1;
  color: rgba(255,255,255,.45); background: rgba(20,40,30,.30);
  border: 3px dashed rgba(255,255,255,.55);
}
.cr-slot:not(.filled) { animation: cr-breathe 1.8s ease-in-out infinite; }
@keyframes cr-breathe { 0%, 100% { border-color: rgba(255,255,255,.55); } 50% { border-color: var(--gold); } }
.cr-slot.filled { border-style: solid; border-color: var(--gold); background: var(--panel); color: #d4541f; animation: cr-pop .28s cubic-bezier(.2,.9,.3,1.4) both; }
/* visually-hidden live counter: rendered text so role="status" actually announces */
.cr-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes cr-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* found glyph flies from the scene into its tray slot */
.cr-fly {
  position: fixed; z-index: 130; pointer-events: none; display: grid; place-items: center;
  font-size: clamp(26px, 4.8vh, 46px); line-height: 1; color: #d4541f;
  background: linear-gradient(160deg, #fff, #ffe9d8); border: 3px solid var(--gold);
  border-radius: 16px; padding: 8px 12px; box-shadow: 0 16px 30px rgba(8,20,14,.45);
  transform: translate(-50%, -50%);
  transition: transform .55s cubic-bezier(.3,.7,.3,1.1), opacity .55s ease;
}

#cr-done { margin: auto; text-align: center; }

@media (max-width: 760px), (max-height: 480px) {
  .cr-target-card { flex-direction: row; gap: 10px; padding: 8px 12px; }
  .cr-target-lbl { display: none; } /* card shrinks to glyph + speaker; label adds nothing */
  .cr-target-glyph { font-size: clamp(30px, 9vw, 44px); min-width: 56px; }
  .cr-glyph { font-size: clamp(22px, 6.4vw, 34px); min-width: 56px; min-height: 56px; }
  .cr-slot { width: clamp(34px, 9vw, 44px); height: clamp(34px, 9vw, 44px); font-size: clamp(16px, 4.6vw, 24px); }
}

/* ---------- cerita ---------- */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.story-card { background: var(--panel); border-radius: var(--radius); box-shadow: 0 16px 32px rgba(8,20,14,.4); overflow: hidden; cursor: pointer; transition: transform .1s; }
.story-card:hover { transform: translateY(-6px); }
.story-card .cover { position: relative; height: 140px; display: grid; place-items: center; font-size: 64px; background: linear-gradient(135deg, #ffe29f, #ffa99f); }
.story-card .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-card .t { padding: 14px 16px; font-weight: 800; color: var(--ink); }
.reader { max-width: 700px; margin: 0 auto; text-align: center; }
.reader .scene-wrap { margin-bottom: 18px; border-radius: var(--radius); overflow: hidden; box-shadow: 0 24px 50px rgba(8,20,14,.42); }
.reader #scene-img { display: block; width: 100%; max-height: 340px; object-fit: cover; transition: opacity .16s; }
.reader .lines { background: var(--panel); border-radius: var(--radius); box-shadow: 0 24px 50px rgba(8,20,14,.42); padding: 36px 26px; }
.reader .line { font-size: 44px; line-height: 1.9; margin: 0 0 10px; direction: rtl; color: #d4541f; }
.reader .word { padding: 2px 8px; border-radius: 10px; transition: background .15s; cursor: pointer; }
.reader .word:hover { background: rgba(255,201,60,.35); }
.reader .word.active { background: var(--gold); color: var(--ink); box-shadow: 0 0 16px rgba(255,201,60,.7); }
.reader .rumi { font-size: 15px; color: var(--muted); direction: ltr; margin-top: 4px; font-weight: 600; }

/* ---------- menulis ---------- */
/* menulis fills the stage height — no scroll. square canvas sized by available height */
.wrap.fill { height: 100%; display: flex; flex-direction: column; }
.trace-wrap { max-width: 760px; width: 100%; margin: 0 auto; text-align: center;
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.trace-head { flex: 0 0 auto; }
.trace-hint { flex: 0 0 auto; margin: 0; }
.trace-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.trace-square { position: relative; height: 100%; aspect-ratio: 1; max-width: 100%; margin: 0 auto; }
#guide, #pad { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--radius); }
#guide { background: linear-gradient(160deg,#fff,#ffe9d8); box-shadow: 0 24px 50px rgba(8,20,14,.42); border: 4px solid rgba(255,255,255,.7); }
#pad { z-index: 2; touch-action: none; cursor: crosshair; }
.trace-controls { flex: 0 0 auto; display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.praise { flex: 0 0 auto; min-height: 28px; font-size: clamp(16px, 2.2vw, 22px); font-weight: 800;
  color: var(--gold); margin: 0; text-shadow: var(--txt-sh); }

/* ---------- kembar ---------- */
/* fills the stage, no scroll: head row + "ampaian" clothesline rail + woven
   felt holding a two-row card board. Matched pairs fly up to wooden pegs on
   the rope, slotted in letter order (row reversed for rtl courses) — the rail
   is progress bar, recap strip and ordering lesson at once. Cards are 3:4,
   board sized by container queries so 8/12/16 cards fit both axes. */
.km-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: clamp(4px, 1vh, 10px); }
.km-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 10px; }
.km-ask { font-size: clamp(14px, 2vh, 18px); font-weight: 800; color: #fff; text-shadow: var(--txt-sh); }
.km-count { font-family: "Fredoka", sans-serif; font-weight: 700; font-size: clamp(13px, 1.8vh, 16px);
  color: #fff; text-shadow: var(--txt-sh); background: rgba(0,0,0,.28);
  border: 2px solid rgba(255,255,255,.5); border-radius: 999px; padding: 2px 14px; }
.km-count.tick { animation: km-tick .3s ease; }
@keyframes km-tick { 50% { transform: scale(1.18); } }

/* ampaian: sagging rope + one wooden peg per pair, faded until its pair lands */
.km-rail { flex: 0 0 auto; position: relative; height: clamp(56px, 11vh, 88px); }
.km-rope { position: absolute; left: 3%; right: 3%; top: clamp(8px, 1.6vh, 12px); height: 4px;
  background: linear-gradient(#b98a52, #7a4f22); border-radius: 0 0 50% 50% / 0 0 8px 8px;
  box-shadow: 0 2px 0 rgba(0,0,0,.28); }
.km-pegs { position: absolute; inset: 0; display: flex; justify-content: center; gap: clamp(8px, 1.8vw, 20px); }
.km-rtl .km-pegs { flex-direction: row-reverse; } /* jawi fills right → left */
.km-peg { position: relative; width: clamp(40px, 6.4vh, 60px); display: flex; flex-direction: column;
  align-items: center; transform-origin: top center; }
.km-pin { width: 9px; height: clamp(15px, 2.8vh, 22px); margin-top: clamp(2px, .6vh, 5px); border-radius: 4px;
  background: linear-gradient(180deg, #d9a05e, #8a5a2a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 2px 3px rgba(0,0,0,.3); opacity: .55; }
.km-peg.filled .km-pin { opacity: 1; }
.km-peg.filled { animation: km-swing .55s ease-out; }
@keyframes km-swing { 0% { transform: rotate(6deg); } 40% { transform: rotate(-4deg); }
  75% { transform: rotate(2deg); } 100% { transform: rotate(0); } }
.km-pair { display: flex; margin-top: -2px; }
.km-mini { width: clamp(22px, 3.8vh, 36px); aspect-ratio: 3 / 4; display: flex; align-items: center;
  justify-content: center; overflow: hidden; font-size: clamp(12px, 2.2vh, 20px); line-height: 1;
  color: #d4541f; font-weight: 700; background: linear-gradient(160deg, #fff, #ffe9d8);
  border: 2px solid rgba(255,255,255,.85); border-radius: 6px; box-shadow: 0 3px 6px rgba(8,20,14,.35);
  transform: rotate(-6deg); animation: km-mini-pop .3s cubic-bezier(.2,.9,.3,1.4) both; }
.km-mini + .km-mini { margin-left: -8px; transform: rotate(6deg); }
@keyframes km-mini-pop { 0% { scale: .3; } 60% { scale: 1.15; } 100% { scale: 1; } }
/* finish: silent wave across the hung pairs, staggered per peg from JS */
.km-game.over .km-peg.filled { animation: km-wave .5s ease both; animation-delay: var(--wd, 0ms); }
@keyframes km-wave { 0% { transform: translateY(0); } 40% { transform: translateY(-5px) rotate(3deg); }
  100% { transform: translateY(0); } }

/* woven felt: the play surface; cards are opaque so no frosted card needed —
   a subtle kelarai weave over the scene marks the board's home */
.km-felt { position: relative; flex: 1 1 auto; min-height: 0; container-type: size;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); border: 2px solid rgba(120,82,30,.35);
  background:
    repeating-linear-gradient(45deg, rgba(214,178,94,.10) 0 12px, transparent 12px 24px),
    repeating-linear-gradient(-45deg, rgba(120,82,30,.10) 0 12px, transparent 12px 24px),
    rgba(60,40,18,.18);
  box-shadow: inset 0 2px 16px rgba(40,22,6,.25); }

/* two-row board: width fits BOTH axes by construction, so it can never
   scroll. --c set per board from JS; --ar = board width/height for 3:4 cards */
.km-board { --c: 4; --ar: calc(var(--c) * 3 / 8);
  height: 94%; max-width: 97%; aspect-ratio: var(--ar);
  display: grid; grid-template-columns: repeat(var(--c), 1fr); grid-template-rows: 1fr 1fr;
  gap: clamp(6px, 1.6vh, 16px); }
@supports (width: 1cqw) {
  .km-board { height: auto; max-width: none; width: min(97cqw, calc(94cqh * var(--ar))); }
}

.km-card { position: relative; border: 0; padding: 0; background: transparent; cursor: pointer;
  container-type: size; perspective: 700px; border-radius: clamp(10px, 2vh, 16px);
  -webkit-user-select: none; user-select: none;
  box-shadow: 0 5px 0 rgba(90,55,20,.85), 0 10px 14px rgba(8,20,14,.35);
  transition: transform .1s, box-shadow .1s; }
.km-card:not(.matched):not(.open):active { transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(90,55,20,.85), 0 4px 8px rgba(8,20,14,.3); }
.km-card.gone { visibility: hidden; pointer-events: none; } /* keeps its cell — board never reflows */

/* 3D flip: the inner owns ONLY the rotation; rim shadow stays on the button */
.km-inner { position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.4,1.4,.6,1); }
.km-card.open .km-inner { transform: rotateY(180deg); }
.km-rtl .km-card.open .km-inner { transform: rotateY(-180deg); } /* jawi cards open the jawi way */
.km-card.peek .km-inner { transform: rotateY(32deg); }
.km-rtl .km-card.peek .km-inner { transform: rotateY(-32deg); }
.km-f { position: absolute; inset: 0; border-radius: inherit; display: flex; align-items: center;
  justify-content: center; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.km-back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.08) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,.10) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #c98a4b, #8a5a2a);
  border: 3px solid rgba(255,231,178,.5); }
.km-back::after { content: "❖"; color: rgba(255,231,178,.55); font-size: clamp(18px, 4vh, 34px); }
.km-card:not(.open):not(.gone) .km-back::after { animation: km-breathe 3.2s ease-in-out infinite; }
@keyframes km-breathe { 0%, 100% { opacity: .45; scale: 1; } 50% { opacity: .8; scale: 1.1; } }
.km-front { transform: rotateY(180deg); background: linear-gradient(160deg, #fff, #ffe9d8);
  border: 3px solid rgba(255,255,255,.85); color: #d4541f; font-weight: 700;
  font-size: clamp(20px, 7vh, 60px); line-height: 1.1; padding: 4%;
  overflow-wrap: anywhere; text-align: center; }
.km-front.multi { font-size: clamp(12px, 3vh, 24px); } /* matematik 🐟🐟🐟 count faces */
@supports (width: 1cqw) { /* size glyphs to the card itself, not the viewport */
  .km-back::after { font-size: 38cqh; }
  .km-front { font-size: 52cqh; }
  .km-front.multi { font-size: 20cqh; }
}

/* deal ripple: the delay lives inside .deal, so stripping the class can
   never leave a stale animation-delay behind */
.km-card.deal { animation: km-deal .42s cubic-bezier(.2,.8,.3,1) both; animation-delay: var(--d, 0ms); }
@keyframes km-deal { 0% { opacity: 0; transform: scale(.3) rotate(-6deg); }
  70% { opacity: 1; transform: scale(1.06) rotate(2deg); } 100% { opacity: 1; transform: none; } }

/* match: green ring while the pair is admired, then it flies to its peg */
.km-card.hit .km-front { box-shadow: inset 0 0 0 3px var(--green), 0 0 18px var(--green); }
/* mismatch: amber head-shake on the OUTER button so it composes with the
   inner flip — a memory miss is information, not failure (no red) */
.km-card.no { animation: km-no .5s ease; }
@keyframes km-no { 20%, 60% { transform: translateX(-5px) rotate(-2deg); }
  40%, 80% { transform: translateX(5px) rotate(2deg); } }
.km-card.no .km-front { box-shadow: inset 0 0 0 3px rgba(255,170,60,.85); }

/* matched pair flying to its peg (fixed-position clones) */
.km-fly { position: fixed; z-index: 130; pointer-events: none; display: flex; align-items: center;
  justify-content: center; line-height: 1.1; color: #d4541f; font-weight: 700;
  overflow: hidden; overflow-wrap: anywhere; text-align: center;
  background: linear-gradient(160deg, #fff, #ffe9d8); border: 2px solid rgba(255,255,255,.9);
  border-radius: 10px; box-shadow: 0 10px 20px rgba(8,20,14,.4);
  transform-origin: top left; transition: transform .6s cubic-bezier(.3,.8,.3,1); }

/* one-time ghost-fingertip cue (first board ever): glides pair → twin */
.km-cue { position: absolute; z-index: 20; pointer-events: none;
  font-size: clamp(28px, 6vh, 44px); filter: drop-shadow(0 4px 6px rgba(0,0,0,.4));
  transition: left .5s ease, top .5s ease; animation: km-cue-bob 1.1s ease-in-out infinite; }
.km-cue[hidden] { display: none; }
@keyframes km-cue-bob { 0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, -50%) translateY(8px) scale(.92); } }

/* done: glass overlay over the felt only — the rope of finished pairs stays
   visible above it through the score moment */
.km-done { position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column;
  align-items: center; justify-content: center; border-radius: var(--radius);
  background: rgba(10,24,16,.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: km-done-pop .35s cubic-bezier(.2,.9,.3,1.3) both; }
.km-done[hidden] { display: none; }
@keyframes km-done-pop { from { opacity: 0; scale: .9; } }

/* landscape phones are wide but SHORT — compaction must key on height too */
@media (max-width: 760px), (max-height: 480px) {
  .km-wrap { padding-top: 8px; padding-bottom: 12px; }
  .km-rail { height: clamp(36px, 11vh, 60px); }
  .km-pin { height: clamp(10px, 2.8vh, 22px); }
  .km-peg { width: clamp(30px, 6.4vh, 60px); }
  .km-mini { width: clamp(16px, 3.8vh, 36px); font-size: clamp(9px, 2.2vh, 20px); }
  .km-pegs { gap: 8px; }
  .km-game { gap: 4px; }
  .km-ask { display: none; } /* head row shrinks to the counter alone */
}

/* ---------- dashboard ---------- */
.dash-child { background: var(--panel); border-radius: var(--radius); box-shadow: 0 20px 44px rgba(8,20,14,.4); padding: 24px; margin-bottom: 18px; color: var(--ink); }
.dash-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.dash-head .avatar { width: 64px; height: 64px; border-radius: 18px; font-size: 30px; background: #fff3e9; box-shadow:none; border:2px solid var(--line); overflow:hidden; }
.dash-head .avatar .avatar-img { width: 54px; height: 54px; }
.dash-head h2 { color: var(--ink); }
.bars { display: flex; gap: 14px; flex-wrap: wrap; }
.bar-item { flex: 1; min-width: 120px; }
.bar-item .l { font-size: 13px; color: var(--muted); font-weight: 800; }
.bar-item .v { font-family:"Fredoka",sans-serif; font-size: 26px; font-weight: 700; color: var(--ink); }
.progress-bar { height: 14px; border-radius: 8px; background: #f0e3d6; overflow: hidden; margin-top: 6px; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); }
.recent { margin-top: 16px; font-size: 14px; color: var(--muted); }
.recent ul { margin: 6px 0 0; padding-left: 18px; }

/* dashboard v2: weekly stats */
.dash-insights { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.insight-chip { background: linear-gradient(120deg,#fff6e8,#ffe9d8); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; color: var(--ink); }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.tile { background: #fff8f0; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tile .l { font-size: 12px; color: var(--muted); font-weight: 800; }
.tile .v { font-family: "Fredoka",sans-serif; font-size: 26px; font-weight: 700; color: var(--ink); }
.tile .v small { font-size: 14px; color: var(--muted); font-weight: 600; }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile .delta { font-size: 13px; font-weight: 800; margin-left: 4px; }
.tile .delta.up { color: var(--green); }
.tile .delta.down { color: #d65745; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.dash-panel { background: #fff8f0; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.dash-cols .dash-panel { margin-top: 0; }
.dash-panel h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 800; }
.week-chart { display: flex; gap: 6px; align-items: stretch; height: 120px; }
.wc-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wc-n { font-size: 11px; font-weight: 800; color: var(--muted); min-height: 14px; }
.wc-bar { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end;
  background: #f0e3d6; border-radius: 8px; overflow: hidden; }
.wc-bar > span { display: block; width: 100%; border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--cyan), var(--green)); }
.wc-col.today .wc-bar > span { background: linear-gradient(180deg, var(--gold), #ff9a3d); }
.wc-day { font-size: 11px; font-weight: 800; color: var(--muted); }
.wc-col.today .wc-day { color: var(--ink); }
.game-table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--ink); }
.game-table td { padding: 4px 2px; border-bottom: 1px dashed var(--line); }
.game-table tr:last-child td { border-bottom: none; }
.game-table .num { text-align: right; font-weight: 700; white-space: nowrap; }
.trouble-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.trouble-chip { background: #fdebe6; border: 1px solid #f3c4b8; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 700; color: var(--ink); }
.tr-glyph { font-size: 18px; }
.confusion { margin: 4px 0 0; font-size: 13px; }
.letter-map { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.lm-cell { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px;
  font-size: 18px; border: 1px solid var(--line); background: #f6efe7; color: #c9b8a6; }
.lm-cell.learning { background: #fff3cf; color: var(--ink); border-color: #ecd49a; }
.lm-cell.mastered { background: #dcf3e1; color: var(--ink); border-color: #a8d9b5; }
.lm-key { display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  background: #f6efe7; border: 1px solid var(--line); margin: 0 3px 0 10px; vertical-align: -1px; }
.lm-key.learning { background: #fff3cf; border-color: #ecd49a; }
.lm-key.mastered { background: #dcf3e1; border-color: #a8d9b5; }

@media (max-width: 700px) { .dash-cols { grid-template-columns: 1fr; } }

.back { display: inline-block; margin-bottom: 16px; font-weight: 800; color:#fff; text-shadow: var(--txt-sh);
  background: rgba(255,255,255,.16); padding:8px 14px; border-radius: 12px; border:1px solid rgba(255,255,255,.3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title { font-family:"Fredoka",sans-serif; color:#fff; text-shadow: var(--txt-sh); }

@media (max-width: 560px) {
  .options { grid-template-columns: 1fr; }
  .hero { flex-direction: column; text-align:center; min-height: 0; }
  .hero h1 { font-size: 32px; }
  .hero .mascot { width: 150px; }
  .hud .brand { font-size: 22px; }
}

/* ---------- replay levels (shared ladder, see js/app.js App.levels) ---------- */
.level-chip {
  align-self: center; font-family: "Fredoka", sans-serif; font-size: 13px; font-weight: 700;
  color: #fff; background: rgba(0,0,0,.28); border: 2px solid rgba(255,255,255,.5);
  border-radius: 999px; padding: 2px 12px; margin-right: 8px; white-space: nowrap;
}
.level-up-note {
  font-family: "Fredoka", sans-serif; font-size: 22px; font-weight: 700;
  color: var(--gold); text-shadow: var(--txt-sh); margin-bottom: 12px;
}

/* ---------- tangkap (falling-fruit catch) ---------- */
/* fills the stage, no scroll: prompt pill on top, the rest is the orchard sky
   where glyph-carrying fruit fall; drag the basket along the bottom to catch */
.tg-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.tg-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.tg-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.tg-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.tg-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.tg-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: clamp(8px, 1.6vh, 16px); padding: 0 clamp(8px, 2vw, 32px); }
.tg-prompt {
  flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; gap: 14px;
  padding: 8px clamp(18px, 2.6vw, 30px); border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
.tg-ask { font-size: clamp(18px, 2.4vw, 24px); font-weight: 800; color: #fff; text-shadow: var(--txt-sh); }
.tg-target { font-size: clamp(30px, 4.4vw, 46px); font-weight: 800; line-height: 1; color: var(--gold); vertical-align: middle; padding: 0 4px; }
.tg-listen {
  display: grid; place-items: center; width: clamp(42px, 5vw, 52px); height: clamp(42px, 5vw, 52px); cursor: pointer;
  border-radius: 999px; border: 3px solid rgba(255,255,255,.85); color: #fff;
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d);
  box-shadow: 0 5px 0 rgba(150,62,10,.85), 0 10px 16px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
.tg-listen:hover { filter: brightness(1.07); }
.tg-listen:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(150,62,10,.85), 0 4px 8px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.55); }
.tg-spk { width: 60%; height: 60%; filter: drop-shadow(0 2px 2px rgba(120,50,0,.4)); }

.tg-sky { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; touch-action: none; cursor: grab; }
.tg-sky:active { cursor: grabbing; }

/* fruit: a real .opt button so quiz.js disable/hint keep working, but the
   basket does the catching — pointers fall through to the sky */
.tg-fruit, .tg-fruit.correct, .tg-fruit.wrong {
  position: absolute; left: 0; top: 0; pointer-events: none;
  background: none; border: none; box-shadow: none; padding: 0;
  display: grid; place-items: center; user-select: none; -webkit-user-select: none;
}
.tg-fruit-ic { grid-area: 1 / 1; font-size: clamp(56px, 8vw, 86px); line-height: 1.15; filter: drop-shadow(0 8px 12px rgba(0,0,0,.35)); }
.tg-fruit-glyph { grid-area: 1 / 1; z-index: 1; font-size: clamp(22px, 3.2vw, 34px); font-weight: 800; color: #fff;
  text-shadow: 0 0 6px rgba(0,0,0,.85), 0 2px 6px rgba(0,0,0,.7); transform: translateY(8%); }
/* .opt.hint animates transform/box-shadow — fruits are JS-positioned, so they
   glow on the inner emoji instead of scaling the button */
.tg-fruit.hint { animation: none; box-shadow: none; }
.tg-fruit.hint .tg-fruit-ic { animation: tg-glow 1s ease-in-out infinite; }
@keyframes tg-glow { 0%, 100% { filter: drop-shadow(0 8px 12px rgba(0,0,0,.35)); } 50% { filter: drop-shadow(0 0 18px var(--gold)); transform: scale(1.12); } }
.tg-fruit.tg-caught .tg-fruit-ic { animation: tg-pop .35s cubic-bezier(.2,.9,.3,1.4) both; filter: drop-shadow(0 0 16px var(--green)); }
@keyframes tg-pop { 0% { transform: scale(1.25); } 60% { transform: scale(.85); } 100% { transform: scale(1); } }
.tg-fruit.tg-splat .tg-fruit-ic { animation: tg-shake .5s ease both; filter: drop-shadow(0 0 14px #ff5252) grayscale(.4); }
@keyframes tg-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 50% { transform: rotate(12deg); } 75% { transform: rotate(-8deg); } }

.tg-basket {
  position: absolute; left: 50%; bottom: clamp(4px, 1.4vh, 16px); transform: translateX(-50%);
  pointer-events: none; z-index: 4; display: grid; place-items: center;
}
.tg-basket-ic { font-size: clamp(68px, 10vw, 110px); line-height: 1; filter: drop-shadow(0 10px 14px rgba(0,0,0,.45)); }
.tg-basket.tg-idle .tg-basket-ic { animation: tg-rock 1.8s ease-in-out infinite; }
@keyframes tg-rock { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

/* one-time gesture cue: drifts left-right above the basket until first drag */
.tg-cue {
  position: absolute; left: 50%; bottom: clamp(96px, 16vh, 160px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; pointer-events: none; z-index: 5;
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(15px, 1.8vw, 19px);
  color: #fff; text-shadow: var(--txt-sh); white-space: nowrap;
  animation: tg-cue-drift 1.6s ease-in-out infinite;
}
.tg-cue-arr { width: clamp(13px, 1.7vw, 19px); height: clamp(13px, 1.7vw, 19px); flex: 0 0 auto;
  border-left: 5px solid #fff; border-bottom: 5px solid #fff; border-radius: 3px;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
.tg-arr-l { transform: rotate(45deg); }
.tg-arr-r { transform: rotate(225deg); }
@keyframes tg-cue-drift { 0%, 100% { transform: translateX(calc(-50% - 26px)); } 50% { transform: translateX(calc(-50% + 26px)); } }

#tg-done { margin: auto; text-align: center; }
#tg-done .ribbon { margin-bottom: 16px; }
#tg-done .btn { margin-top: 18px; }
#tg-done .btn.green { margin-top: 10px; }

@media (max-width: 760px) {
  .tg-prompt { gap: 10px; padding: 6px 16px; }
  .tg-fruit-ic { font-size: clamp(48px, 11vw, 64px); }
  .tg-basket-ic { font-size: clamp(58px, 13vw, 84px); }
}

/* ---------- pasar (market stall: shelf above, counter below) ---------- */
/* fills the stage, no scroll: dots row + shelf (drag sources) + counter band */
.ps-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.ps-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.ps-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.ps-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.ps-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.ps-stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: clamp(10px, 1.8vh, 18px);
  padding: 0 clamp(8px, 2vw, 28px) clamp(8px, 1.6vh, 16px);
}

/* shelf: frosted card with an awning scallop, goods laid out like a stall */
.ps-shelf {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(10px, 2vh, 20px); text-align: center;
  padding: clamp(22px, 3.6vh, 34px) clamp(14px, 2vw, 28px) clamp(14px, 2.4vh, 24px);
  border-radius: var(--radius); background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
  overflow: hidden;
}
.ps-shelf::before { /* awning valance along the stall's top edge */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 16px;
  background:
    radial-gradient(circle 11px at 11px 0, #e8533f 96%, transparent) 0 0 / 44px 16px repeat-x,
    radial-gradient(circle 11px at 11px 0, #fff4ea 96%, transparent) 22px 0 / 44px 16px repeat-x;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.25));
}
.ps-ask { font-size: clamp(17px, 2.2vw, 22px); font-weight: 800; color: #fff; text-shadow: var(--txt-sh); }
.ps-goods { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 1.8vw, 20px); }
.ps-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: clamp(96px, 12vw, 136px); padding: clamp(10px, 1.8vh, 16px) clamp(14px, 1.8vw, 24px) clamp(8px, 1.4vh, 12px);
  border-radius: 20px; touch-action: none; user-select: none; -webkit-user-select: none;
}
.ps-item .ps-pic { font-size: clamp(36px, 6.4vh, 56px); line-height: 1; }
.ps-item .ps-label { font-size: clamp(20px, 3.4vh, 30px); line-height: 1.5; direction: rtl; }
.ps-item.drag-src { opacity: .35; }
.ps-ghost {
  position: fixed; z-index: 120; transform: translate(-50%, -50%); pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 20px; background: var(--panel); border: 3px solid var(--gold);
  box-shadow: 0 16px 30px rgba(8,20,14,.45); color: var(--ink);
  font-family: "Fredoka", sans-serif; font-weight: 700;
}
.ps-ghost .ps-pic { font-size: clamp(36px, 6.4vh, 56px); line-height: 1; }
.ps-ghost .ps-label { font-size: clamp(20px, 3.4vh, 30px); line-height: 1.5; direction: rtl; }

/* counter band: generated stall-counter art; syllable sign + basket on top */
.ps-counter {
  flex: 0 0 auto; min-height: clamp(112px, 20vh, 168px);
  display: flex; align-items: center; justify-content: space-evenly; gap: clamp(10px, 2vw, 24px);
  padding: clamp(8px, 1.6vh, 14px) clamp(12px, 2vw, 28px);
  border-radius: var(--radius); border: 3px solid rgba(255,255,255,.4);
  background: var(--ps-counter-img) center bottom / cover no-repeat, linear-gradient(180deg, #9a6a3d, #6c4423);
  box-shadow: var(--glass-sh);
}

/* hanging price-tag sign: replays the syllable to buy */
.ps-tag {
  display: inline-flex; align-items: center; gap: 12px; cursor: pointer;
  padding: clamp(8px, 1.6vh, 14px) clamp(18px, 2.4vw, 30px); border-radius: 18px;
  border: 3px solid var(--gold); background: linear-gradient(160deg, #fff, #ffe9d8);
  transform: rotate(-2deg);
  box-shadow: 0 6px 0 rgba(90,50,14,.75), 0 12px 20px rgba(8,20,14,.45), inset 0 2px 0 rgba(255,255,255,.8);
  transition: transform .1s, filter .15s, box-shadow .1s;
}
.ps-tag:hover { filter: brightness(1.04); }
.ps-tag:active { transform: rotate(-2deg) translateY(4px); box-shadow: 0 2px 0 rgba(90,50,14,.75), 0 5px 10px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.8); }
.ps-tag .ps-tag-syl { font-size: clamp(34px, 6.4vh, 54px); line-height: 1.2; direction: rtl; color: #d4541f; }
.ps-spk { width: clamp(22px, 3.6vh, 30px); height: clamp(22px, 3.6vh, 30px); flex: 0 0 auto; color: #b9743c;
  filter: drop-shadow(0 1px 1px rgba(120,50,0,.25)); }

/* basket drop spot on the counter */
.ps-basket {
  position: relative; width: clamp(124px, 17vw, 190px); min-height: clamp(78px, 14vh, 118px);
  border-radius: 22px; background: rgba(20,40,30,.28); border: 3px dashed rgba(255,255,255,.65);
  display: grid; place-items: center;
  transition: transform .12s, background .15s, border-color .15s;
}
.ps-basket:not(.filled) { animation: ps-breathe 1.8s ease-in-out infinite; }
@keyframes ps-breathe { 0%, 100% { border-color: rgba(255,255,255,.55); } 50% { border-color: var(--gold); } }
.ps-basket .ps-basket-ic { font-size: clamp(42px, 8vh, 64px); line-height: 1; filter: drop-shadow(0 8px 12px rgba(0,0,0,.4)); }
.ps-basket.drop-hi { transform: scale(1.07); border-color: var(--gold); background: rgba(255,201,60,.28); }
.ps-basket.filled { border-style: solid; border-color: var(--gold); background: var(--panel); box-shadow: 0 10px 22px rgba(8,20,14,.32); animation: ps-pop .28s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes ps-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.ps-basket.filled .ps-basket-ic { display: none; }
.ps-bought { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; }
.ps-bought .ps-bought-pic { font-size: clamp(34px, 6.4vh, 52px); line-height: 1; }
.ps-bought .ps-bought-word { font-size: clamp(22px, 4vh, 34px); line-height: 1.4; direction: rtl; color: #d4541f; }

/* one-time gesture cue: drifts down toward the counter until the first buy */
.ps-cue {
  position: absolute; left: 50%; bottom: clamp(118px, 22vh, 178px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 5;
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(15px, 1.8vw, 19px);
  color: #fff; text-shadow: var(--txt-sh); white-space: nowrap;
  animation: ps-cue 1.4s ease-in-out infinite;
}
.ps-cue-arrow { width: clamp(15px, 1.9vw, 22px); height: clamp(15px, 1.9vw, 22px); flex: 0 0 auto;
  border-left: 5px solid #fff; border-bottom: 5px solid #fff; border-radius: 3px;
  transform: rotate(-45deg); filter: drop-shadow(0 3px 5px rgba(0,0,0,.4)); }
@keyframes ps-cue { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 14px); } }

#ps-done { margin: auto; text-align: center; }
#ps-done .ribbon { margin-bottom: 16px; }
#ps-done .btn { margin-top: 18px; }
#ps-done .btn.green { margin-top: 10px; }

@media (max-width: 760px) {
  .ps-item { min-width: clamp(84px, 14vw, 110px); }
  .ps-item .ps-pic, .ps-ghost .ps-pic { font-size: clamp(30px, 5.6vh, 44px); }
  .ps-item .ps-label, .ps-ghost .ps-label { font-size: clamp(17px, 3vh, 24px); }
  .ps-counter { min-height: clamp(92px, 18vh, 130px); }
  .ps-tag .ps-tag-syl { font-size: clamp(28px, 5.6vh, 42px); }
  .ps-basket { width: clamp(104px, 20vw, 150px); min-height: clamp(64px, 12vh, 96px); }
  .ps-cue { bottom: clamp(98px, 20vh, 140px); } /* still points at the counter */
}

/* short viewports (landscape phones): shared chrome eats ~200px, so the ask
   line gives way (the cue + syllable tag still carry the task) and the
   counter compresses to keep the goods labels fully visible */
@media (max-height: 520px) {
  .ps-stage { gap: 6px; padding-bottom: 6px; }
  .ps-shelf { padding: 8px 10px 4px; gap: 6px; }
  .ps-shelf::before { height: 10px;
    background:
      radial-gradient(circle 7px at 7px 0, #e8533f 96%, transparent) 0 0 / 28px 10px repeat-x,
      radial-gradient(circle 7px at 7px 0, #fff4ea 96%, transparent) 14px 0 / 28px 10px repeat-x; }
  .ps-ask { display: none; }
  .ps-item { padding: 4px 10px 3px; min-width: 84px; }
  .ps-item .ps-pic, .ps-ghost .ps-pic { font-size: 26px; }
  .ps-item .ps-label, .ps-ghost .ps-label { font-size: 16px; line-height: 1.5; }
  .ps-counter { min-height: 70px; padding: 6px 12px; }
  .ps-tag { padding: 5px 14px; }
  .ps-tag .ps-tag-syl { font-size: 26px; }
  .ps-spk { width: 18px; height: 18px; }
  .ps-basket { width: 96px; min-height: 54px; }
  .ps-basket .ps-basket-ic { font-size: 32px; }
  .ps-bought { padding: 2px 6px; }
  .ps-bought .ps-bought-pic { font-size: 24px; }
  .ps-bought .ps-bought-word { font-size: 18px; }
  .ps-cue { bottom: 84px; font-size: 14px; }
  .ps-cue-arrow { width: 12px; height: 12px; border-width: 4px; }
}

/* ---------- roda (syllable wheel) ---------- */
/* fills the stage, no scroll: dots row + two zones — fairground wheel left
   (flick or tap to spin), answer stall right (waits, then shows the words) */
.rd-game { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.rd-game .progress-dots { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.rd-game .progress-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.3); }
.rd-game .progress-dots .dot.done { background: var(--green); box-shadow: 0 0 10px var(--green); }
.rd-game .progress-dots .dot.current { background: var(--gold); box-shadow: 0 0 12px var(--gold); }

.rd-stage {
  --rd-size: clamp(220px, min(40vw, 54vh), 430px);
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: auto 1fr;
  gap: clamp(18px, 4vw, 56px); align-items: center;
  padding: 0 clamp(10px, 2.5vw, 40px);
}

/* the wheel — a real fairground attraction, spun by hand */
.rd-wheelzone { display: grid; place-items: center; }
.rd-wheelwrap {
  position: relative; width: var(--rd-size); height: var(--rd-size);
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.rd-wheelwrap.spinning { cursor: default; }
.rd-pointer {
  position: absolute; top: calc(var(--rd-size) * -0.025); left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 3;
  border-left: calc(var(--rd-size) * 0.045) solid transparent;
  border-right: calc(var(--rd-size) * 0.045) solid transparent;
  border-top: calc(var(--rd-size) * 0.085) solid var(--gold);
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 4px 6px rgba(0,0,0,.45));
}
.rd-wheel {
  width: 100%; height: 100%; border-radius: 50%; position: relative;
  border: calc(var(--rd-size) * 0.028) solid rgba(255,255,255,.9);
  box-shadow: 0 18px 40px rgba(8,20,14,.5), inset 0 0 calc(var(--rd-size) * 0.1) rgba(0,0,0,.22);
  transition: transform 3s cubic-bezier(.12,.8,.22,1);
}
.rd-wheelwrap.dragging .rd-wheel { transition: none; }
.rd-wheel .rd-label {
  position: absolute; left: 50%; top: 50%;
  font-size: calc(var(--rd-size) * 0.105); font-weight: 800; line-height: 1;
  color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.45); pointer-events: none;
}
.rd-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(var(--rd-size) * 0.2); height: calc(var(--rd-size) * 0.2);
  border-radius: 50%; z-index: 2;
  background: linear-gradient(180deg, #ffd86b, #ff9a3d 60%, #ff7a3d);
  border: calc(var(--rd-size) * 0.014) solid rgba(255,255,255,.9);
  box-shadow: 0 6px 14px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.55);
}

/* one-time spin cue: circular arrow wiggling around the hub until first spin */
.rd-spincue {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  display: grid; place-items: center;
}
.rd-cue-orbit {
  position: absolute; width: 56%; height: 56%; color: #fff;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.45));
  animation: rd-orbit 1.8s ease-in-out infinite;
}
@keyframes rd-orbit { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(34deg); } }
.rd-cue-lbl {
  position: absolute; bottom: calc(var(--rd-size) * 0.06); left: 50%; transform: translateX(-50%);
  font-family: "Fredoka", sans-serif; font-weight: 800; font-size: clamp(16px, 2vw, 21px);
  color: #fff; text-shadow: var(--txt-sh); white-space: nowrap;
}

/* the answer stall — frosted so the scene doesn't bleed through the word cards */
.rd-stall {
  justify-self: center; width: 100%; max-width: 560px; min-height: calc(var(--rd-size) * 0.8);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(12px, 2.4vh, 22px); text-align: center;
  padding: clamp(18px, 3vh, 32px) clamp(18px, 2.6vw, 34px);
  border-radius: var(--radius); background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-brd); box-shadow: var(--glass-sh);
}
.rd-ask { font-size: clamp(17px, 2.2vw, 23px); font-weight: 800; color: #fff; text-shadow: var(--txt-sh); }
.rd-wait .rd-ask { animation: rd-wait-pulse 1.8s ease-in-out infinite; }
@keyframes rd-wait-pulse { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
.rd-pick { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vh, 18px); width: 100%; }
.rd-pick[hidden] { display: none; }

/* landed syllable: big tappable chip that replays its sound */
.rd-syl-chip {
  display: inline-flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 4px 26px; border-radius: 22px;
  background: linear-gradient(160deg, #fff, #ffe9d8); border: 4px solid var(--gold);
  box-shadow: 0 14px 30px rgba(8,20,14,.4), inset 0 2px 0 rgba(255,255,255,.8);
  animation: rd-pop .32s cubic-bezier(.2,.9,.3,1.4) both;
}
@keyframes rd-pop { 0% { transform: scale(.5); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.rd-syl-chip #rd-syl { font-size: clamp(38px, 6vh, 58px); line-height: 1.6; color: #d4541f; direction: rtl; }
.rd-spk { width: clamp(22px, 3.4vh, 30px); height: clamp(22px, 3.4vh, 30px); flex: 0 0 auto; color: #ff8a3d;
  filter: drop-shadow(0 1px 1px rgba(120,50,0,.3)); }

.rd-options {
  display: grid; gap: clamp(10px, 1.6vw, 16px); width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(clamp(96px, 10vw, 132px), 1fr));
  justify-items: stretch;
}
.rd-options .rd-word {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: clamp(8px, 1.6vh, 14px) clamp(10px, 1.4vw, 16px);
  min-height: 64px;
}
.rd-options .rd-word .pic { font-size: clamp(30px, 5.6vh, 44px); line-height: 1.15; }
.rd-options .rd-word .label { font-size: clamp(18px, 3.4vh, 26px); line-height: 1.6; direction: rtl; }

#rd-done { margin: auto; text-align: center; }

@media (max-width: 760px) {
  .rd-stage { --rd-size: clamp(190px, min(38vw, 48vh), 320px); gap: 14px; padding: 0 8px; }
  .rd-stall { min-height: 0; padding: 14px 12px; }
}
/* short viewports (landscape phones): chrome eats ~180px — the syllable chip
   and word cards carry the task, so the ask lines give way first */
@media (max-height: 520px) {
  .rd-stage { --rd-size: clamp(180px, min(36vw, 52vh), 280px); }
  .rd-pick .rd-ask { display: none; }
  .rd-syl-chip { padding: 2px 18px; border-width: 3px; }
  .rd-options .rd-word .pic { font-size: 26px; }
  .rd-options .rd-word .label { font-size: 17px; }
  .rd-cue-lbl { font-size: 14px; }
}
