:root {
  --ink: #2e2a4f;
  --ink-soft: #6b6790;
  --lav: #cbb8ff;   --lav-d: #7c5ce0;
  --mint: #a8e6cf;  --mint-d: #2f9e74;
  --sky: #b5deff;   --sky-d: #3a86d4;
  --butter: #ffe7a3; --butter-d: #c98a0a;
  --peach: #ffc8b0; --peach-d: #e2724a;
  --pink: #ffc2dc;  --pink-d: #d9558e;
  --good: #3fbf8a;
  --radius: 26px;
  --shadow: 0 10px 30px rgba(84, 70, 160, .14);
  --accent: var(--lav);
  --accent-d: var(--lav-d);
  --ease: cubic-bezier(.22, 1, .36, 1);        /* smooth deceleration for all movement */
  --spring: cubic-bezier(.34, 1.42, .64, 1);   /* gentle overshoot for rewards only */
  --sheet: #fff4e4;                            /* page colour at the bottom of the viewport */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #e9e1ff 0%, #fde8f1 55%, #fff4e4 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; color: inherit; -webkit-user-select: none; user-select: none; }
button:focus-visible { outline: 3px solid var(--accent-d); outline-offset: 3px; }
html { overscroll-behavior-y: none; scroll-behavior: auto; }
::selection { background: var(--lav); }

/* Colour wipe used when entering a level */
.wipe { position: fixed; inset: 0; z-index: 60; pointer-events: none; display: grid; place-items: center;
  clip-path: circle(0 at var(--x) var(--y)); animation: wipeIn .62s var(--ease) forwards; }
.wipe svg { width: 84px; height: 84px; opacity: 0; transform: scale(.7); animation: wipeIcon .5s .22s var(--ease) forwards; }
.wipe.out { animation: wipeOut .45s var(--ease) forwards; clip-path: circle(150% at var(--x) var(--y)); }
@keyframes wipeIn { to { clip-path: circle(150% at var(--x) var(--y)); } }
@keyframes wipeIcon { to { opacity: 1; transform: none; } }
@keyframes wipeOut { to { opacity: 0; } }
b { font-weight: 600; }

/* ---------- Sky background ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud { position: absolute; fill: #fff; opacity: .85; filter: drop-shadow(0 6px 10px rgba(124,92,224,.08)); }
.c1 { width: 180px; top: 8%; left: -200px; animation: drift 48s linear infinite; }
.c2 { width: 120px; top: 26%; left: -140px; animation: drift 64s linear infinite 12s; opacity: .7; }
.c3 { width: 220px; top: 52%; left: -240px; animation: drift 80s linear infinite 30s; opacity: .55; }
@keyframes drift { to { transform: translateX(calc(100vw + 300px)); } }
.blob { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; animation: breathe 9s ease-in-out infinite; }
.b1 { width: 320px; height: 320px; background: #d9ccff; top: -80px; right: -60px; }
.b2 { width: 260px; height: 260px; background: #ffd6e7; bottom: 10%; left: -80px; animation-delay: 3s; }
.b3 { width: 200px; height: 200px; background: #cdf3e3; top: 40%; right: 10%; animation-delay: 6s; }
@keyframes breathe { 50% { transform: scale(1.15); } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; width: 100%;
  background: rgba(250,247,255,.72);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid rgba(124,92,224,.12);
  box-shadow: 0 6px 24px rgba(84,70,160,.06);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; height: 68px; padding: 0 16px; max-width: 1240px; margin: 0 auto; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 12px; flex: none; }
/* Partner logos */
.partners { display: flex; align-items: center; gap: 16px; padding-left: 16px; border-left: 1px solid rgba(124,92,224,.16); }
.partners img { display: block; width: auto; height: 32px; }
.partners img + img { padding-left: 16px; border-left: 1px solid rgba(124,92,224,.16); }
.partners .logo-vl { height: 30px; }

/* Tablets: one compact row */
@media (max-width: 899px) {
  .topbar .icon-btn { width: 40px; height: 40px; border-radius: 13px; }
  .topbar .star-count { height: 40px; padding: 0 12px; border-radius: 13px; }
  .topbar .tb-left { gap: 10px; }
  .topbar .partners { gap: 12px; padding-left: 12px; }
  .topbar .partners img { height: 26px; }
  .topbar .partners img + img { padding-left: 12px; }
  .topbar .partners .logo-vl { height: 24px; }
}
/* Phones: two rows (home, logos, stars, sound / title and progress) */
@media (max-width: 640px) {
  .topbar .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 8px; }
  .topbar .tb-left { flex: 1; min-width: 0; }
  .topbar .tb-right { gap: 8px; }
  .topbar .top-mid { order: 3; flex: 1 0 100%; display: flex; align-items: center; gap: 12px; }
  .topbar .top-title { margin: 0; font-size: 13px; flex: 0 1 auto; max-width: 58%; }
  .topbar .top-mid .progress { flex: 1; height: 8px; }
  .toast { top: 104px; }
}
@media (min-width: 900px) {
  .topbar-inner { display: grid; grid-template-columns: 1fr minmax(320px, 460px) 1fr; gap: 24px; padding: 0 32px; height: 72px; }
  .tb-right { justify-self: end; }
  .top-title { text-align: center; }
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer; flex: none;
  background: #fff; box-shadow: 0 4px 0 #e2dbff, var(--shadow);
  display: grid; place-items: center; transition: transform .15s;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #e2dbff; }
.icon-btn svg { width: 24px; height: 24px; }
.top-mid { flex: 1; min-width: 0; }
.top-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.progress { height: 10px; background: #fff; border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(46,42,79,.08); }
.progress span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-d)); transition: width .6s var(--ease); }
.star-count { display: flex; align-items: center; gap: 6px; height: 44px; font-weight: 700; background: #fff; padding: 0 14px; border-radius: 14px; box-shadow: 0 4px 0 #e2dbff, var(--shadow); flex: none; }
.star-count svg { width: 20px; height: 20px; fill: #ffc94d; stroke: #e8a90c; }

/* ---------- Screen container ---------- */
main { position: relative; z-index: 1; }
.screen {
  position: relative; z-index: 1; width: 100%;
  max-width: 680px; margin: 0 auto; padding: 8px 16px 32px;
  min-height: calc(100dvh - 70px);
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  animation: screenIn .6s .06s var(--ease) both;
}
.screen.full { min-height: 100dvh; justify-content: center; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } }
/* The outgoing screen fades up and away while the new one settles in (see screen() in game.js). */
.screen.leaving { position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none; animation: screenOut .34s var(--ease) forwards; }
@keyframes screenOut { to { opacity: 0; transform: translateY(-12px) scale(.985); } }
.stage { width: 100%; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.stage > *, .stagger > * { animation: popIn .6s var(--ease) both; animation-delay: calc(.1s + var(--i, 0) * .07s); }
@keyframes popIn { from { opacity: 0; transform: translateY(14px); } }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.big-btn {
  border: 0; cursor: pointer; font-size: 21px; font-weight: 600;
  padding: 16px 36px; border-radius: 22px; min-width: 220px;
  color: #fff; background: var(--accent-d);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--accent-d) 70%, #000), 0 14px 26px rgba(124,92,224,.3);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .12s, box-shadow .12s;
}
.big-btn svg { width: 24px; height: 24px; }
.big-btn:hover { transform: translateY(-2px); }
.big-btn:active { transform: translateY(6px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent-d) 70%, #000); }
.big-btn.pulse { animation: btnPulse 2.6s ease-in-out 1.2s infinite; }
.big-btn.pulse:hover, .big-btn.pulse:active { animation: none; }
@keyframes btnPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
/* Primary action stays pinned to the bottom of the viewport, like a native app. */
.next-slot, .cta-bar {
  position: sticky; bottom: 0; z-index: 4; width: calc(100% + 32px); margin: auto -16px -32px;
  display: flex; justify-content: center; padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--sheet) 55%, rgba(255,244,228,0));
}
.next-slot:empty { padding: 0; background: none; min-height: 0; }
.full .next-slot { position: static; width: auto; margin: 0; padding: 6px 0 0; background: none; }
.next-slot .big-btn { animation: btnIn .5s var(--ease) both; }
.next-slot .big-btn.pulse { animation: btnIn .5s var(--ease) both, btnPulse 2.6s ease-in-out 1.4s infinite; }
@keyframes btnIn { from { opacity: 0; transform: translateY(10px); } }
.text-link { background: none; border: 0; color: var(--ink-soft); font-size: 15px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Owl guide ---------- */
.guide { display: flex; align-items: flex-end; gap: 12px; width: 100%; }
.owl { width: 84px; flex: none; animation: bob 3s ease-in-out infinite; }
.owl.big { width: 170px; }
.owl svg { width: 100%; display: block; overflow: visible; }
.owl .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
.owl .wing-r { transform-box: fill-box; transform-origin: top left; }
.owl.wave .wing-r { animation: wave .6s ease-in-out 3; }
.owl.cheer { animation: cheer .6s ease-in-out 2; }
.owl.think { animation: tilt 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes wave { 50% { transform: rotate(-40deg); } }
@keyframes cheer { 30% { transform: translateY(-18px) rotate(-6deg); } 60% { transform: translateY(0) rotate(6deg); } }
@keyframes tilt { 50% { transform: rotate(-6deg); } }
.bubble {
  position: relative; flex: 1; background: #fff; border-radius: 24px; padding: 14px 18px;
  font-size: 19px; line-height: 1.4; box-shadow: var(--shadow); margin-bottom: 22px;
}
.bubble::before { content: ""; position: absolute; left: -10px; bottom: 18px; width: 22px; height: 22px; background: inherit; transform: rotate(45deg); border-radius: 4px; }
.bubble.center { margin: 0; max-width: 520px; text-align: center; font-size: 22px; flex: none; }
.bubble.center::before { left: 50%; top: -9px; bottom: auto; margin-left: -11px; }
.bubble.pop { animation: bubblePop .4s var(--spring); }
@keyframes bubblePop { from { transform: scale(.9); opacity: .4; } }
.bubble.good { background: #e5f9ef; }
.bubble.bad { background: #fff0f2; }

/* ---------- Shared bits ---------- */
.kicker { display: inline-block; background: #fff; padding: 6px 16px; border-radius: 99px; font-weight: 500; color: var(--lav-d); box-shadow: var(--shadow); font-size: 15px; }
@keyframes floaty { 50% { transform: translateY(-12px) rotate(6deg); } }
.foot-note { font-size: 13px; color: var(--ink-soft); text-align: center; max-width: 440px; margin: 0; }

/* ---------- Journey map ---------- */
.st svg { width: 14px; height: 14px; fill: #e9e5f3; stroke: #d3cde6; }
.st.on svg { fill: #ffc94d; stroke: #e8a90c; }

.map-head { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.mh-text h2 { margin: 0; font-size: 28px; line-height: 1.1; }
.mh-text p { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.4; }
.mh-text p b { color: var(--ink); }
.mh-ref { display: inline-block; margin-left: 4px; font-size: 13px; background: rgba(255,255,255,.7); border-radius: 99px; padding: 1px 9px; white-space: nowrap; }
.mh-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mh-stats span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; background: rgba(255,255,255,.75); font-size: 14px; color: var(--ink-soft); box-shadow: 0 2px 10px rgba(84,70,160,.08); }
.mh-stats b { color: var(--ink); }
.mh-stats svg { width: 16px; height: 16px; stroke: var(--lav-d); }
.mh-stats span:nth-child(2) svg { fill: #ffc94d; stroke: #e8a90c; }
.mh-cta { display: none; }
@media (max-width: 420px) {
  .mh-stats { gap: 6px; flex-wrap: nowrap; }
  .mh-stats span { padding: 0 10px; font-size: 13px; gap: 5px; height: 32px; }
  .mh-text h2 { font-size: 26px; }
}

.zones { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.zone {
  position: relative; display: grid; grid-template-columns: 1fr;
  background: rgba(255,255,255,.62); border: 1px solid rgba(255,255,255,.9); border-radius: 26px;
  box-shadow: 0 10px 30px rgba(84,70,160,.10);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.zone-head {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 14px 18px; border-radius: 25px 25px 0 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--zc) 60%, #fff), color-mix(in srgb, var(--zc) 22%, #fff));
}
.zone-num { grid-column: 1; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--zd); }
.zone-head h3 { grid-column: 1; margin: 0; font-size: 20px; line-height: 1.15; }
.zone-prog { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.zp-bar { width: 64px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.85); overflow: hidden; }
.zp-bar i { display: block; height: 100%; border-radius: 99px; background: var(--zd); transition: width .8s var(--ease); }

/* Mobile: vertical timeline */
.track { position: relative; padding: 6px 18px 10px; }
.track::before { content: ""; position: absolute; left: 46px; top: 34px; bottom: 34px; border-left: 3px dotted color-mix(in srgb, var(--zd) 40%, #fff); }
.trail-svg { display: none; }
.stop { position: relative; display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.node {
  position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--c, #fff3c4);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--d, #c98a0a) 30%, transparent), 0 8px 18px rgba(84,70,160,.14);
}
.node svg { width: 26px; height: 26px; }
.node:not([disabled]):hover { transform: scale(1.06); }
.node:not([disabled]):active { transform: scale(.97); }
/* Locked chapters: their own icon, greyed out, with a small lock badge */
.stop.locked .node, .stop.finish.locked .node { background: color-mix(in srgb, var(--c, #ece8f5) 22%, #f3f1f8); box-shadow: inset 0 0 0 2px #e6e1f2; cursor: default; color: #aaa4c4; }
.stop.locked .node > svg { stroke: #aaa4c4; opacity: .85; }
.stop.finish.locked .node > svg { opacity: .85; }
.lock-badge { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; box-shadow: 0 2px 6px rgba(46,42,79,.18); }
.node .lock-badge svg { width: 12px; height: 12px; stroke: #7d7899; stroke-width: 2.4; opacity: 1; }
.stop.locked .node .num { color: #8f89ab; }
.stop.finish.open .node { background: #fff3c4; }
.node .num { position: absolute; top: -3px; right: -3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(46,42,79,.15); }
.stop.done .node .num { background: var(--good); }
.node .num svg { width: 12px; height: 12px; }
.stop.current .node::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 3px solid var(--d); animation: ring 1.8s var(--ease) infinite; }
.stop.current .node { box-shadow: 0 0 0 4px #fff, 0 4px 0 4px color-mix(in srgb, var(--d) 30%, transparent), 0 10px 24px color-mix(in srgb, var(--d) 35%, transparent); }
@keyframes ring { from { transform: scale(.9); opacity: .8; } to { transform: scale(1.35); opacity: 0; } }
.stop-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stop-text b { font-size: 16px; line-height: 1.2; }
.stop.locked .stop-text b { color: #7d7899; }
.stop-text .meta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.stop-text .meta svg { width: 13px; height: 13px; }
.stop-text .status { font-size: 12px; font-weight: 600; color: #9a95b5; display: flex; gap: 1px; }
.stop-text .status.cur { align-self: flex-start; color: #fff; background: var(--d); padding: 2px 9px; border-radius: 99px; margin-top: 2px; }

.cta-bar .big-btn, .mh-cta .big-btn { max-width: 100%; }

/* Desktop: the whole journey on one screen, each Part a band with a winding trail */
@media (min-width: 900px) {
  .screen.map-screen { max-width: 1240px; padding: 18px 32px 20px; gap: 16px; min-height: calc(100dvh - 72px); }
  .map-head { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 20px; text-align: left; }
  .mh-cta { display: block; }
  .mh-cta .big-btn { min-width: 0; padding: 14px 26px; font-size: 18px; }
  .mobile-only { display: none !important; }
  .zones { gap: 12px; }
  .zone { grid-template-columns: 220px 1fr; }
  .zone-head { grid-template-columns: 1fr; align-content: center; gap: 6px; padding: 18px 22px; border-radius: 25px 0 0 25px; }
  .zone-head h3 { font-size: 21px; }
  .zone-prog { grid-column: 1; grid-row: auto; }
  .zp-bar { flex: 1; width: auto; }
  .track { height: 184px; padding: 0; margin: 0 14px; }
  .track::before { display: none; }
  .trail-svg { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .trail { fill: none; stroke: color-mix(in srgb, var(--zd) 38%, #fff); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 0.1 11; }
  .trail.lit { stroke: var(--zd); stroke-dasharray: none; opacity: .5; }
  .stop { position: absolute; left: var(--x); top: var(--y); width: 0; height: 0; padding: 0; display: block; }
  .node { position: absolute; left: 0; top: 0; translate: -50% -50%; width: 60px; height: 60px; }
  .node svg { width: 28px; height: 28px; }
  .stop-text { position: absolute; top: 38px; left: 0; translate: -50% 0; width: 150px; align-items: center; text-align: center; white-space: nowrap; }
  .stop-text b { font-size: 14px; }
  .stop-text .meta { font-size: 12px; justify-content: center; }
  .stop-text .status { justify-content: center; }
  .stop-text .status:not(.done) { display: none; }
  .stop-text .status .st svg { width: 12px; height: 12px; }
}
@media (min-width: 900px) and (max-height: 820px) {
  .screen.map-screen { padding-top: 12px; gap: 12px; }
  .zones { gap: 10px; }
  .track { height: 166px; }
  .node { width: 54px; height: 54px; }
  .stop-text { top: 34px; }
  .zone-head { padding: 14px 20px; }
}

/* ---------- Level intro ---------- */
.level-hero { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; position: relative; box-shadow: var(--shadow); animation: heroIn .7s var(--spring) both; margin-top: 2vh; }
.level-hero svg { width: 70px; height: 70px; }
.level-hero.small { width: 110px; height: 110px; }
.level-hero.small svg { width: 52px; height: 52px; fill: #ffc94d; }
.level-hero::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 3px dashed currentColor; opacity: .35; animation: spin 18s linear infinite; }
@keyframes heroIn { from { transform: scale(0) rotate(-30deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
.level-tag { font-weight: 600; color: var(--ink-soft); letter-spacing: .5px; text-transform: uppercase; font-size: 13px; text-align: center; }
.level-name { font-size: clamp(32px, 8vw, 46px); margin: -8px 0 0; font-weight: 700; text-align: center; line-height: 1.05; }
.bm { font-style: italic; color: var(--ink-soft); font-size: 15px; }
.mission { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); width: 100%; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.mission small { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); font-weight: 600; }
.learn-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.learn-chips span { background: color-mix(in srgb, var(--accent) 45%, #fff); padding: 6px 12px; border-radius: 99px; font-size: 15px; font-weight: 500; }

/* ---------- Learning cards ---------- */
.lcard { width: 100%; background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-top: 6px solid var(--accent); }
.lc-head { display: flex; align-items: center; gap: 14px; }
.lc-ic { width: 54px; height: 54px; border-radius: 18px; background: var(--accent); display: grid; place-items: center; flex: none; }
.lc-ic svg { width: 30px; height: 30px; }
.lc-head h3 { margin: 0; font-size: 23px; line-height: 1.15; }
.big-line { margin-top: 14px; padding: 14px 16px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 35%, #fff); font-size: 21px; font-weight: 600; text-align: center; line-height: 1.3; }
.official { width: 100%; background: #fbfaff; border: 2px dashed color-mix(in srgb, var(--accent-d) 35%, #fff); border-radius: 22px; padding: 14px 16px; }
.off-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--accent-d); }
.off-label svg { width: 18px; height: 18px; }
.official p { margin: 8px 0 10px; font-size: 16px; line-height: 1.5; color: #4a4670; }
.ref-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-soft); background: #fff; border-radius: 99px; padding: 4px 10px; box-shadow: 0 2px 6px rgba(46,42,79,.08); align-self: center; }
.ref-chip svg { width: 15px; height: 15px; }

.lcard.practice { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 40%, #fff), #fff 60%); }
.p-num { font-weight: 700; color: var(--accent-d); letter-spacing: 2px; text-transform: uppercase; font-size: 14px; }
.lcard.practice h3 { margin: 0; font-size: clamp(26px, 6vw, 34px); line-height: 1.1; }
blockquote { margin: 10px 0 4px; font-size: 21px; font-weight: 600; line-height: 1.3; color: var(--accent-d); }
blockquote small { display: block; font-size: 15px; font-weight: 500; font-style: italic; color: var(--ink-soft); margin-top: 6px; }
.skills { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.skills b { background: var(--accent); color: var(--ink); padding: 4px 10px; border-radius: 99px; font-size: 14px; }

.items { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.item { background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; animation: popIn .45s var(--ease) both; }
.it-ic { width: 44px; height: 44px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 55%, #fff); display: grid; place-items: center; flex: none; }
.it-ic svg { width: 24px; height: 24px; }
.item b { font-size: 17px; display: block; line-height: 1.2; }
.item p { margin: 4px 0 0; font-size: 15px; line-height: 1.4; color: #4a4670; }

.thoughts { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.thought { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: 22px; padding: 16px 18px; box-shadow: var(--shadow); font-size: 20px; font-weight: 500; line-height: 1.35; animation: popIn .5s var(--ease) both; }
.thought svg { width: 40px; height: 40px; flex: none; }

.panels { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.panel { display: flex; gap: 12px; align-items: flex-start; background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.panel.fresh { animation: popIn .45s var(--ease) both; }
.panel p { margin: 0; font-size: 17px; line-height: 1.45; }
.pn { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); font-weight: 700; display: grid; place-items: center; flex: none; }
.lesson { display: flex; gap: 12px; background: #e5f9ef; border-radius: 20px; padding: 14px 16px; border: 2px solid #bdecd4; animation: popIn .5s var(--ease) both; }
.lesson > svg { width: 30px; height: 30px; flex: none; }
.lesson p { margin: 4px 0 10px; font-size: 17px; line-height: 1.4; }
.lesson .ref-chip { align-self: flex-start; }

.ladder { width: 100%; display: flex; flex-direction: column-reverse; gap: 10px; }
.rung { display: flex; gap: 12px; align-items: flex-start; background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); opacity: .5; transition: opacity .4s, transform .4s; }
.rung.r1 { margin-left: 8%; } .rung.r2 { margin-left: 16%; }
.rung.on { opacity: 1; animation: popIn .45s var(--ease) both; }
.rung .rn { width: 36px; height: 36px; border-radius: 12px; background: #ece8f5; display: grid; place-items: center; font-weight: 700; flex: none; }
.rung.on .rn { background: var(--accent); }
.rung b { font-size: 18px; }
.rung small { display: block; font-style: italic; color: var(--ink-soft); font-size: 13px; }
.rung p { margin: 4px 0 0; font-size: 16px; line-height: 1.4; }

/* ---------- Machine ---------- */
.machine { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 6px; width: 100%; }
.station { background: #fff; border-radius: 22px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); min-height: 160px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 8px; }
.station h4 { margin: 0; font-size: 16px; }
.station p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
.data-pile { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.data-pile span { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; }
.data-pile svg { width: 20px; height: 20px; }
.gear svg { width: 62px; height: 62px; stroke: var(--sky-d); }
.out-box { width: 64px; height: 64px; border-radius: 18px; background: #f3f0fb; display: grid; place-items: center; }
.out-box svg { width: 34px; height: 34px; opacity: 0; transform: scale(0); }
.flow-arrow svg { width: 26px; height: 26px; stroke: var(--ink-soft); }
.machine.run .data-pile span { animation: feed 1.2s ease-in both; }
.machine.run .data-pile span:nth-child(2) { animation-delay: .15s; }
.machine.run .data-pile span:nth-child(3) { animation-delay: .3s; }
.machine.run .data-pile span:nth-child(4) { animation-delay: .45s; }
@keyframes feed { 60% { transform: translateX(80px) scale(.6); opacity: .8; } 100% { transform: translateX(110px) scale(.2); opacity: 0; } }
.machine.run .gear svg { animation: spin 1s linear 3; }
.machine.run .out-box { animation: glow 1s ease 1.8s both; }
.machine.run .out-box svg { animation: outPop .6s var(--spring) 2.2s forwards; }
@keyframes outPop { to { opacity: 1; transform: scale(1); } }
@keyframes glow { 50% { box-shadow: 0 0 0 10px rgba(63,191,138,.25); } }

/* ---------- Prompt builder ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; width: 100%; }
.prompt-box { font-size: 17px; line-height: 1.6; }
.prompt-box .label { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); font-weight: 600; display: flex; justify-content: space-between; margin-bottom: 6px; }
.chunk { display: inline; padding: 2px 8px; border-radius: 8px; animation: chunkIn .5s var(--spring) both; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
@keyframes chunkIn { from { opacity: 0; } }
.weak { color: var(--ink-soft); font-size: 19px; }
.weak-tag { background: #fff0f2; color: #c2415a; border-radius: 99px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.power { display: flex; gap: 6px; }
.power i { width: 22px; height: 12px; border-radius: 99px; background: #ece8f5; transition: background .3s, transform .3s; }
.power i.on { background: var(--butter-d); transform: scaleY(1.3); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.tile { border: 0; cursor: pointer; border-radius: 22px; padding: 14px; font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 0 rgba(46,42,79,.12); animation: floaty 3.4s ease-in-out infinite; }
.tile:nth-child(2) { animation-delay: .5s; } .tile:nth-child(3) { animation-delay: 1s; } .tile:nth-child(4) { animation-delay: 1.5s; }
.tile svg { width: 26px; height: 26px; }
.tile.used { animation: tileGone .4s forwards; pointer-events: none; }
@keyframes tileGone { to { transform: scale(.4) translateY(-60px); opacity: 0; } }

/* ---------- Quiz ---------- */
.q-count { font-weight: 600; color: var(--ink-soft); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.q-card { font-size: 22px; font-weight: 600; text-align: center; line-height: 1.35; border-top: 6px solid var(--accent); }
.options { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.option {
  border: 0; cursor: pointer; background: #fff; border-radius: 20px; padding: 14px 16px; font-size: 18px; font-weight: 500;
  display: flex; align-items: center; gap: 14px; text-align: left; line-height: 1.3;
  box-shadow: 0 6px 0 #e5def9, var(--shadow); transition: transform .12s, box-shadow .12s, background .2s, opacity .2s;
}
.option:hover { transform: translateY(-2px); }
.option:active { transform: translateY(4px); box-shadow: 0 2px 0 #e5def9; }
.letter { width: 38px; height: 38px; border-radius: 12px; background: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.letter svg { width: 22px; height: 22px; }
.option.wrong { animation: shake .45s; background: #fff0f2; opacity: .55; pointer-events: none; }
.option.right { background: #e5f9ef; box-shadow: 0 6px 0 #bdecd4, 0 0 0 4px var(--good); animation: choiceWin .5s var(--spring); }
.option.right .letter { background: var(--good); }
.options.locked .option { pointer-events: none; }
.options.locked .option:not(.right) { opacity: .4; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes choiceWin { 50% { transform: scale(1.04); } }

/* ---------- Badge / complete ---------- */
.badge { position: relative; width: 170px; height: 188px; animation: badgeIn 1s var(--ease) both; }
.badge svg { width: 100%; height: 100%; overflow: visible; }
@keyframes badgeIn { 0% { transform: scale(0) rotate(-200deg); } 70% { transform: scale(1.1) rotate(10deg); } }
.rays { position: absolute; inset: -60px; background: repeating-conic-gradient(rgba(255,255,255,.7) 0 10deg, transparent 10deg 24deg); border-radius: 50%; mask: radial-gradient(circle, #000 30%, transparent 70%); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); animation: spin 14s linear infinite; z-index: -1; }
.big-stars { display: flex; gap: 8px; }
.big-stars .st svg { width: 46px; height: 46px; }
.big-stars .st { animation: spinIn .6s both; }
.big-stars .st:nth-child(2) { animation-delay: .25s; } .big-stars .st:nth-child(3) { animation-delay: .5s; }
@keyframes spinIn { from { transform: scale(0) rotate(-180deg); } }
.star-msg { margin: -6px 0 0; color: var(--ink-soft); font-size: 16px; text-align: center; }
.rule-card { background: #fff; border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); text-align: center; width: 100%; font-size: 20px; font-weight: 500; border: 3px solid var(--accent); display: flex; flex-direction: column; gap: 10px; }
.rule-card small { display: block; font-size: 13px; color: var(--ink-soft); letter-spacing: 1px; text-transform: uppercase; }

/* ---------- Certificate ---------- */
.cert { background: #fff; border-radius: 32px; padding: 26px 20px; box-shadow: var(--shadow); width: 100%; text-align: center; border: 4px solid var(--lav); }
.cert h2 { margin: 6px 0 2px; font-size: clamp(28px, 7vw, 40px); }
.cert .sub { color: var(--ink-soft); margin: 0 0 18px; }
.cert-h { font-size: 18px; margin: 6px 0 10px; }
.badge-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.mini-badge { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; line-height: 1.15; animation: spinIn .6s both; }
.mini-badge .mb { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 4px 0 rgba(46,42,79,.1); }
.mini-badge .mb svg { width: 26px; height: 26px; }
.rules-list { text-align: left; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rules-list li { display: flex; gap: 10px; align-items: flex-start; background: #faf8ff; padding: 10px 12px; border-radius: 16px; font-size: 16px; }
.rules-list li svg { width: 22px; height: 22px; flex: none; stroke: var(--good); margin-top: 1px; }

/* ---------- Confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

@media (max-width: 560px) {
  .bubble { font-size: 17px; padding: 12px 15px; }
  .owl { width: 66px; }
  .items { grid-template-columns: 1fr; }
  .machine { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); justify-self: center; }
  .station { min-height: 0; flex-direction: row; padding: 12px 16px; text-align: left; gap: 12px; }
  .station .txt { flex: 1; }
  @keyframes feed { 60% { transform: translateY(60px) scale(.6); opacity: .8; } 100% { transform: translateY(90px) scale(.2); opacity: 0; } }
  .big-btn { font-size: 19px; padding: 15px 28px; }
  .q-card { font-size: 19px; }
  .option { font-size: 16px; }
  .thought { font-size: 18px; }
  .badge-row { grid-template-columns: repeat(3, 1fr); }
}

/* Reduced motion: keep short fades and reward feedback; remove large, looping or parallax movement. */
@media (prefers-reduced-motion: reduce) {
  .owl, .owl .eyes, .owl .wing-r, .cv-stars i, .cv-rays, .blob, .cloud, .bob, .tree, .flag-cloth, .logo .ch,
  .big-btn.pulse, .next-slot .big-btn.pulse, .play-btn, .pb-shine, .stop.current .node::after, .tile, .rays,
  .level-hero::before, .puzzle.armed .pz-slot:not(.filled) { animation: none !important; }
  .screen, .stage > *, .stagger > *, .cv-world, .cv-rainbow, .badge, .level-hero { animation-name: fadeOnly !important; }
  .cv-world [data-depth] { translate: none !important; }
  .confetti { display: none; }
}
@keyframes fadeOnly { from { opacity: 0; } }

/* ---------- Labs ---------- */
.lab-tag { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; padding: 7px 14px; border-radius: 99px; }
.lab-tag svg { width: 18px; height: 18px; }
.lab-hero svg { fill: none !important; }
.lab-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--ink) !important; color: #fff; }
.lab-chip svg { width: 16px; height: 16px; }
.basis { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fbfaff; border: 2px dashed color-mix(in srgb, var(--accent-d) 35%, #fff); border-radius: 18px; padding: 10px 14px; font-size: 14px; color: #4a4670; }
.basis > svg { width: 18px; height: 18px; stroke: var(--accent-d); }
.basis span { flex: 1; min-width: 160px; }
.lab-stamp { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; font-weight: 600; padding: 8px 16px; border-radius: 99px; transform: rotate(-3deg); animation: spinIn .6s .6s both; }
.lab-stamp svg { width: 20px; height: 20px; }
.inline-ic { width: 18px; height: 18px; vertical-align: -3px; }
.shake { animation: shake .45s; }
.counter { font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.scene { display: flex; gap: 12px; align-items: center; font-size: 17px; font-weight: 500; line-height: 1.4; padding: 14px 16px; }
.scene > svg { width: 34px; height: 34px; flex: none; }

/* Chat lab */
.phone { width: 100%; max-width: 420px; background: var(--ink); border-radius: 32px; padding: 10px; box-shadow: var(--shadow); }
.phone-screen { background: linear-gradient(180deg, #f2fbff, #f8f2ff); border-radius: 24px; padding: 12px; height: 290px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.phone-head { position: sticky; top: -12px; margin: -12px -12px 2px; padding: 12px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; background: #f2fbff; border-bottom: 2px dashed #dfd9f3; z-index: 1; }
.phone-head .av { width: 34px; height: 34px; border-radius: 12px; background: var(--peach); display: grid; place-items: center; }
.phone-head .av svg { width: 20px; height: 20px; }
.ai-pill { margin-left: auto; background: var(--lav); font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.msg { align-self: flex-start; background: #fff; padding: 9px 13px; border-radius: 18px 18px 18px 6px; font-size: 16px; max-width: 85%; line-height: 1.35; box-shadow: 0 3px 8px rgba(46,42,79,.06); animation: popIn .35s both; }
.msg.me { align-self: flex-end; background: var(--mint); border-radius: 18px 18px 6px 18px; display: inline-flex; gap: 6px; align-items: center; }
.msg.me svg { width: 16px; height: 16px; }
.msg.closed { align-self: center; background: #ffe3e7; font-size: 13px; font-weight: 600; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: #b9b3d6; animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-5px); } }
.meter { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 420px; font-size: 14px; }
.meter > svg { width: 26px; height: 26px; flex: none; }
.meter .bar { flex: 1; height: 14px; background: #fff; border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(46,42,79,.08); }
.meter .bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--mint-d)); border-radius: 99px; transition: width .7s var(--ease); }
.lab-choices { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lab-choices:empty { display: none; }
.lab-btn { border: 0; cursor: pointer; background: #fff; border-radius: 22px; padding: 14px 10px; font-size: 18px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 6px 0 #e5def9, var(--shadow); animation: popIn .4s both; transition: transform .12s; }
.lab-btn svg { width: 46px; height: 46px; padding: 9px; border-radius: 16px; background: var(--bg); }
.lab-btn:active { transform: translateY(4px); }
.lab-btn.wrong { animation: shake .45s; background: #fff0f2; opacity: .55; pointer-events: none; }

/* Prompt lab */
.pl-prompt .label { display: flex; justify-content: space-between; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); font-weight: 600; }
.pl-prompt .label b { font-size: 18px; color: var(--ink); }
.strength { height: 14px; border-radius: 99px; background: #ece8f5; overflow: hidden; margin: 8px 0 12px; }
.strength span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ffe7a3, #3fbf8a); transition: width .6s var(--ease); }
.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { position: relative; border: 2px dashed #ddd6f0; background: #fbfaff; border-radius: 16px; padding: 10px 40px 10px 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: border-color .2s, background .2s; }
.slot.active { border: 2px solid var(--ink); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 60%, #fff); }
.slot.strong { border-style: solid; border-color: #bdecd4; background: color-mix(in srgb, var(--c) 30%, #fff); }
.slot.weak { border-style: solid; border-color: #ffc8b0; background: #fff6f1; }
.slot .sk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.slot .sk svg { width: 16px; height: 16px; }
.slot .sv { font-size: 16px; line-height: 1.35; }
.slot:not(.strong):not(.weak) .sv { color: var(--ink-soft); }
.slot .mark { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; }
.picker { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.picker:empty { display: none; }
.pick-label { font-size: 15px; color: var(--ink-soft); text-align: center; }
.pick { border: 0; cursor: pointer; display: flex; align-items: center; gap: 12px; text-align: left; background: #fff; border-radius: 18px; padding: 12px 14px; font-size: 16px; line-height: 1.35; box-shadow: 0 5px 0 #e5def9, var(--shadow); animation: popIn .4s both; transition: transform .12s; }
.pick:nth-child(3) { animation-delay: .06s; } .pick:nth-child(4) { animation-delay: .12s; }
.pick svg { width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: var(--c); flex: none; }
.pick:active { transform: translateY(4px); }

/* Task splitter */
.task-wrap { width: 100%; min-height: 110px; display: flex; justify-content: center; }
.task-card { text-align: center; font-size: 21px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: popIn .4s var(--ease) both; }
.task-card.fly { transition: transform .55s cubic-bezier(.5,0,.7,.4), opacity .55s; opacity: 0; }
.bins { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bins.n4, .summary.n4 { grid-template-columns: 1fr 1fr; }
.bin { position: relative; border: 3px dashed color-mix(in srgb, var(--c) 80%, #000 5%); background: color-mix(in srgb, var(--c) 45%, #fff); border-radius: 22px; padding: 16px 6px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 16px; transition: transform .12s; }
.bin svg { width: 36px; height: 36px; }
.bin:active { transform: translateY(4px); }
.bin .cnt { position: absolute; top: -10px; right: -6px; min-width: 28px; height: 28px; border-radius: 99px; background: #fff; font-weight: 700; display: grid; place-items: center; box-shadow: var(--shadow); font-size: 14px; }
.bin.bump { animation: choiceWin .5s var(--spring); }
.bins.locked .bin { pointer-events: none; }
.summary { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; animation: popIn .5s both; }
.sum-col { background: color-mix(in srgb, var(--c) 35%, #fff); border-radius: 16px; padding: 10px; }
.sum-h { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.sum-h svg { width: 18px; height: 18px; }
.sum-col p { margin: 0 0 6px; background: #fff; border-radius: 10px; padding: 6px 8px; font-size: 13px; line-height: 1.3; }

@media (max-width: 560px) {
  .phone-screen { height: 250px; }
  .lab-btn { font-size: 16px; }
  .task-card { font-size: 18px; }
  .bin { font-size: 14px; }
  .summary, .summary.n4 { grid-template-columns: 1fr; }
}

/* ---------- Cover (title screen) ---------- */
.screen.cover-screen { max-width: none; padding: 0; gap: 0; overflow: hidden; }
.cover {
  position: relative; width: 100%; min-height: 100dvh; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-items: center;
  padding: max(18px, 3vh) 16px max(14px, 2vh);
  background:
    radial-gradient(60% 45% at 50% 58%, rgba(255,246,201,.85), rgba(255,246,201,0) 70%),
    radial-gradient(40% 30% at 15% 20%, rgba(181,222,255,.6), transparent 70%),
    radial-gradient(40% 30% at 85% 25%, rgba(255,194,220,.55), transparent 70%),
    linear-gradient(180deg, #cdb9ff 0%, #ead2fb 38%, #ffd9e8 68%, #ffe6d2 100%);
}
.cover > * { position: relative; z-index: 2; }
.cover .cv-stars, .cover .cv-rays, .cover .cv-rainbow { position: absolute; z-index: 0; pointer-events: none; }

.cv-stars { inset: 0; }
.cv-stars i { position: absolute; width: calc(7px * var(--s)); height: calc(7px * var(--s)); background: #fff; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 4px #fff); animation: twinkle 3.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.6) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(45deg); } }
.cv-rays { left: 50%; top: 58%; width: 1100px; aspect-ratio: 1; margin: -550px 0 0 -550px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,255,255,.55) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 8%, transparent 52%); mask: radial-gradient(circle, #000 8%, transparent 52%);
  animation: spin 60s linear infinite; opacity: .7; }
.cv-rainbow { --rw: min(760px, 130vw); left: 50%; top: 30%; width: var(--rw); aspect-ratio: 2; transform: translateX(-50%); opacity: .5;
  background: radial-gradient(circle calc(var(--rw) / 2) at 50% 100%, transparent 65.5%, #cbb8ff 66% 71.5%, #b5deff 72% 77.5%, #a8e6cf 78% 83.5%, #ffe7a3 84% 89.5%, #ffc2dc 90% 95.5%, transparent 96%);
  -webkit-mask: linear-gradient(180deg, #000 40%, transparent 98%); mask: linear-gradient(180deg, #000 40%, transparent 98%);
  animation: rainbowIn 1.4s .3s cubic-bezier(.2,1,.4,1) both; }
@keyframes rainbowIn { from { opacity: 0; transform: translateX(-50%) scale(.7) translateY(40px); } }

/* Logo */
.cv-logo { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cv-kicker { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 7px 16px; border-radius: 99px; font-weight: 600; font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--lav-d);
  box-shadow: 0 6px 20px rgba(124,92,224,.18); animation: fadeDown .8s both; }
.cv-kicker svg { width: 18px; height: 18px; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-20px); } }
.logo { margin: 10px 0 0; display: flex; flex-direction: column; align-items: center; line-height: .86; font-weight: 700; font-size: clamp(54px, min(14vw, 12.5vh), 112px); letter-spacing: 1px; }
.logo .ch { display: inline-block; animation: dropIn .8s cubic-bezier(.2,1.7,.45,1) both, letterWave 3.6s ease-in-out infinite; animation-delay: var(--d), calc(var(--d) + 1.4s); }
.logo .w1 .ch { font-size: 1.12em; color: #ffd66b; -webkit-text-stroke: 2px #c97a18;
  text-shadow: 0 2px 0 #ffc24d, 0 4px 0 #f5ad2e, 0 6px 0 #e8962a, 0 8px 0 #d9822a, 0 10px 0 #c97a18, 0 20px 26px rgba(160,90,20,.35); }
.logo .w2 .ch { color: #fff; -webkit-text-stroke: 2px #7c5ce0;
  text-shadow: 0 2px 0 #e2d8ff, 0 4px 0 #c8b6fb, 0 6px 0 #ad96f3, 0 8px 0 #9478ea, 0 10px 0 #7c5ce0, 0 20px 28px rgba(70,40,160,.38); }
.logo .w2 { font-size: .62em; margin-top: 4px; letter-spacing: 3px; }
@keyframes dropIn { 0% { opacity: 0; transform: translateY(-120px) scale(.6) rotate(-12deg); } 100% { opacity: 1; transform: none; } }
@keyframes letterWave { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-10px); } 90% { transform: translateY(2px); } }
.ribbon { position: relative; width: min(250px, 66vw); margin-top: 8px; animation: ribbonIn .7s 1.15s var(--spring) both; filter: drop-shadow(0 8px 14px rgba(217,85,142,.3)); }
.ribbon svg { width: 100%; display: block; }
.ribbon span { position: absolute; inset: 0 0 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: clamp(16px, 4.6vw, 21px); letter-spacing: 5px; text-shadow: 0 2px 0 #d9558e; }
@keyframes ribbonIn { from { opacity: 0; transform: scale(.3) rotate(8deg); } }

/* World */
.cv-world { position: relative; width: min(600px, 100%); height: clamp(240px, 37vh, 380px); animation: worldIn 1.2s .2s cubic-bezier(.2,1,.4,1) both; }
@keyframes worldIn { from { opacity: 0; transform: translateY(80px); } }
.cv-world [data-depth] { transition: translate .25s ease-out; }
.bob { position: relative; animation: isleBob 6s ease-in-out infinite; }
@keyframes isleBob { 50% { transform: translateY(-14px); } }
.island-svg { display: block; overflow: visible; filter: drop-shadow(0 26px 22px rgba(90,60,180,.22)); }
.main-isle { position: absolute; left: 50%; bottom: 2%; width: 330px; margin-left: -165px; }
.cv-owl { position: absolute; width: 124px; left: 50%; margin-left: -66px; top: -70px; z-index: 2; filter: drop-shadow(0 8px 10px rgba(90,60,180,.2)); }
.cv-owl.owl { animation: none; }
.cv-owl.owl.wave .wing-r { animation: wave .6s ease-in-out 2s 4; }
.tree { transform-box: fill-box; transform-origin: bottom center; animation: sway 4s ease-in-out infinite; }
.flag-cloth { transform-box: fill-box; transform-origin: left center; animation: flagWave 1.6s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(4deg); } }
@keyframes flagWave { 50% { transform: scaleX(.86) skewY(6deg); } }
.mini { position: absolute; width: 92px; }
.mini .bob { animation-duration: 5s; }
.mini.m1 { left: 1%; top: 2%; } .mini.m2 { right: 3%; top: -4%; }
.mini.m3 { left: -3%; top: 50%; } .mini.m4 { right: -2%; top: 44%; }
.mini-badge-ic { position: absolute; left: 50%; top: -18px; transform: translateX(-50%); width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; z-index: 1;
  box-shadow: inset 0 -4px 0 rgba(46,42,79,.12), 0 8px 16px rgba(90,60,180,.25); }
.mini-badge-ic svg { width: 26px; height: 26px; }
.cv-cloud { position: absolute; fill: #fff; filter: drop-shadow(0 10px 14px rgba(124,92,224,.12)); z-index: 3; }
.cl1 { width: 190px; left: -60px; bottom: -2%; }
.cl2 { width: 230px; right: -80px; bottom: 10%; opacity: .92; }

/* Call to action */
.cv-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.play-btn {
  position: relative; overflow: hidden; border: 0; cursor: pointer; display: flex; align-items: center; gap: 14px;
  padding: 12px 40px 12px 12px; border-radius: 999px; color: #fff; font-size: 32px; font-weight: 700; letter-spacing: 1px; text-align: left;
  background: linear-gradient(180deg, #a48cff 0%, #7c5ce0 55%, #6844d4 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -6px 0 rgba(60,30,150,.3), 0 9px 0 #5232b5, 0 24px 40px rgba(90,60,200,.45);
  animation: btnIn .8s 1.3s var(--spring) both, playPulse 2.4s ease-in-out 2.4s infinite;
  transition: transform .12s, box-shadow .12s;
}
.play-btn:hover { filter: brightness(1.05); }
.play-btn:active { transform: translateY(7px); box-shadow: inset 0 3px 0 rgba(255,255,255,.45), inset 0 -6px 0 rgba(60,30,150,.3), 0 2px 0 #5232b5, 0 10px 20px rgba(90,60,200,.4); }
.pb-ic { width: 60px; height: 60px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: inset 0 -4px 0 #e3dbff; flex: none; }
.pb-ic svg { width: 28px; height: 28px; margin-left: 4px; }
.pb-txt { text-shadow: 0 2px 0 rgba(60,30,150,.35); line-height: 1.05; }
.pb-txt small { display: block; font-size: 14px; font-weight: 500; letter-spacing: 0; opacity: .92; margin-top: 3px; }
.pb-shine { position: absolute; top: 0; left: -60%; width: 40%; height: 100%; transform: skewX(-20deg);
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.6), transparent); animation: shine 3.4s ease-in-out 2.4s infinite; }
@keyframes btnIn { from { opacity: 0; transform: scale(.4) translateY(30px); } }
@keyframes playPulse { 50% { transform: scale(1.05); } }
@keyframes shine { 0% { left: -60%; } 45%, 100% { left: 130%; } }
.cv-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; animation: fadeDown .8s 1.6s both; }
.cv-stats span { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 14px; box-shadow: 0 4px 12px rgba(124,92,224,.12); }
.cv-stats svg { width: 16px; height: 16px; stroke: var(--lav-d); }
.cv-stats span:last-child svg { fill: #ffc94d; stroke: #e8a90c; }
.cv-cta .foot-note { opacity: .8; }

@media (max-width: 560px) {
  .main-isle { width: 290px; margin-left: -145px; }
  .main-isle .island-svg { width: 290px; }
  .cv-owl { width: 108px; margin-left: -58px; top: -62px; }
  .mini { width: 70px; }
  .mini .island-svg { width: 70px; }
  .mini-badge-ic { width: 38px; height: 38px; top: -16px; border-radius: 12px; }
  .mini-badge-ic svg { width: 21px; height: 21px; }
  .mini.m3, .mini.m4 { top: 30%; }
  .play-btn { font-size: 27px; padding-right: 32px; }
  .pb-ic { width: 52px; height: 52px; }
}
@media (max-height: 700px) {
  .cv-world { height: 250px; }
  .logo { font-size: clamp(48px, 12vw, 90px); }
}

/* ---------- Polish ---------- */
.star-count.bump { animation: starBump .6s var(--spring); }
@keyframes starBump { 40% { transform: scale(1.18); } }
.icon-btn, .star-count { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.icon-btn:hover { transform: translateY(-1px); }
.top-title { transition: opacity .3s var(--ease); }
.bubble { transition: background-color .35s var(--ease); }
.option, .lab-btn, .pick, .tile, .bin, .node, .slot { transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .25s var(--ease), opacity .25s var(--ease); }
body:not(.ready) .topbar { visibility: hidden; }

/* Larger screens: keep the primary action with its content instead of at the far bottom. */
@media (min-width: 761px) {
  .stage { flex: 0 0 auto; }
  .screen.stagger { justify-content: center; padding-top: 0; }
  .next-slot, .cta-bar { margin-top: 6px; background: none; padding: 10px 16px 28px; }
}

/* Framework Puzzle (jigsaw lab) */
.puzzle { position: relative; width: min(380px, 100%); aspect-ratio: 1; margin: 4px 0; }
.pz-board { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 14px 24px rgba(84,70,160,.14)); }
.pz-slot { fill: rgba(255,255,255,.7); stroke: #cbbff0; stroke-width: 2.5; stroke-dasharray: 7 6; stroke-linejoin: round;
  transition: fill .45s var(--ease), stroke .45s var(--ease); transform-box: fill-box; transform-origin: center; }
.pz-slot.filled { stroke-dasharray: none; stroke-width: 3; }
.pz-slot.snap { animation: pzSnap .55s var(--spring); }
@keyframes pzSnap { 0% { transform: scale(1.08); opacity: .4; } 100% { transform: none; opacity: 1; } }
.puzzle.armed .pz-slot:not(.filled) { stroke: var(--accent-d); animation: pzArm 1.2s ease-in-out infinite; }
@keyframes pzArm { 50% { stroke-dashoffset: 13; } }
.pz-hub { transform-box: fill-box; transform-origin: center; transform: scale(0); opacity: 0; transition: transform .6s var(--spring), opacity .3s; }
.pz-hub circle { fill: #fff; stroke: #7c5ce0; stroke-width: 4; }
.pz-hub text { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 15px; fill: var(--ink); text-anchor: middle; }
.pz-hub text.sm { font-size: 12px; font-weight: 600; fill: var(--ink-soft); }
.puzzle.complete .pz-hub { transform: scale(1); opacity: 1; transition-delay: .25s; }
.puzzle.complete .pz-slot { stroke: #fff; stroke-width: 5; }
.puzzle.complete .pz-board { filter: drop-shadow(0 0 22px rgba(255,214,107,.7)) drop-shadow(0 14px 24px rgba(84,70,160,.16)); transition: filter .6s; }

.pz-cells { position: absolute; inset: 1.3%; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.pz-cell { position: relative; border: 0; background: none; cursor: pointer; padding: 17% 15%; display: grid; place-items: center; border-radius: 18px; transition: background-color .2s var(--ease); }
.pz-cell.hover { background: rgba(124,92,224,.10); }
.pz-cell.nope { animation: pzNope .5s var(--ease); }
@keyframes pzNope { 30% { background: rgba(255,122,138,.22); } }
.pz-clue, .pz-done { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: opacity .35s var(--ease), transform .45s var(--spring); }
.pz-clue { font-size: 12.5px; line-height: 1.3; color: #57527a; font-weight: 500; }
.pz-clue svg { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: #fff; stroke: #8f88b5; box-shadow: 0 2px 6px rgba(84,70,160,.12); }
.pz-done { opacity: 0; transform: scale(.6); pointer-events: none; }
.pz-done svg { width: 34px; height: 34px; }
.pz-done b { font-size: 15px; line-height: 1.15; color: var(--ink); }
.pz-cell.placed { cursor: default; }
.pz-cell.placed .pz-clue { opacity: 0; transform: scale(.8); }
.pz-cell.placed .pz-done { opacity: 1; transform: none; }
.pz-cell:focus-visible { outline-offset: -6px; }

.pz-tray { width: 100%; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; min-height: 10px; }
.pz-piece { position: relative; width: 116px; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: grab; touch-action: none;
  filter: drop-shadow(0 6px 10px rgba(84,70,160,.16)); animation: popIn .5s var(--ease) backwards; }
.pz-piece:nth-child(2) { animation-delay: .08s; } .pz-piece:nth-child(3) { animation-delay: .16s; }
.pz-piece svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pz-piece svg path { fill: color-mix(in srgb, var(--c) 45%, #fff); stroke: var(--d); stroke-width: 2.5; transition: fill .2s var(--ease); }
.pp-in { position: absolute; left: 2.3%; top: 20%; width: 77.5%; height: 77.5%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.15; pointer-events: none; }
.pp-in svg { position: static; width: 26px; height: 26px; }
.pz-piece:hover svg path, .pz-piece.selected svg path { fill: var(--c); }
.pz-piece.selected { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 10px 18px color-mix(in srgb, var(--d) 45%, transparent)); transform: translateY(-4px); }
.pz-piece.dragging { cursor: grabbing; z-index: 50; filter: drop-shadow(0 18px 24px rgba(84,70,160,.3)); }
.pz-piece.shake { animation: shake .45s; }
@media (max-width: 420px) {
  .pz-piece { width: 100px; }
  .pp-in { font-size: 12px; }
  .pz-clue { font-size: 11.5px; }
  .pz-clue svg { width: 26px; height: 26px; }
}

/* ---------- Star rewards ---------- */
.fly-star { position: fixed; z-index: 80; pointer-events: none; width: 26px; height: 26px; will-change: transform; }
.fly-star svg { width: 100%; height: 100%; fill: #ffc94d; stroke: #e8a90c; filter: drop-shadow(0 0 6px rgba(255,201,77,.8)); }
.star-count span { min-width: 1.4ch; text-align: right; font-variant-numeric: tabular-nums; }
.star-count.bump svg { animation: starSpin .5s var(--spring); }
@keyframes starSpin { 50% { transform: scale(1.35) rotate(25deg); } }
.toast {
  position: fixed; left: 50%; top: 86px; z-index: 70; translate: -50% 0;
  display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 12px; border-radius: 99px; white-space: nowrap;
  background: linear-gradient(180deg, #fff7d6, #ffe7a3); color: #7a4b00; font-size: 17px;
  box-shadow: 0 0 0 2px #ffd66b, 0 14px 30px rgba(201,138,10,.3);
  animation: toastIn .55s var(--spring) both;
}
.toast svg { width: 30px; height: 30px; fill: #ffc94d; stroke: #e8a90c; animation: starSpin .8s .2s var(--spring); }
.toast b { font-weight: 700; }
.toast span { font-weight: 700; background: #fff; border-radius: 99px; padding: 2px 10px; color: #c98a0a; }
.toast.out { animation: toastOut .45s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-24px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px) scale(.96); } }
.haul { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 99px; padding: 8px 18px 8px 10px; box-shadow: 0 0 0 2px #ffe7a3, var(--shadow); font-size: 16px; color: var(--ink-soft); }
.haul svg { width: 30px; height: 30px; fill: #ffc94d; stroke: #e8a90c; }
.haul b { font-size: 24px; color: var(--ink); }
.rating { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rating small { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--ink-soft); }
.rating .big-stars .st svg { width: 34px; height: 34px; }
@media (max-width: 560px) { .toast { top: 104px; font-size: 15px; } }

/* Cover corner badges: partner logos (left) mirrored by the guide badge and sound toggle (right) */
.cover > .cv-partners, .cover > .cv-aside {
  position: absolute; top: 22px; left: 28px; z-index: 5; height: 64px;
  display: flex; align-items: center; gap: 18px; padding: 0 20px; border-radius: 20px;
  background: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(84,70,160,.14);
  animation: fadeDown .8s .1s var(--ease) both;
}
.cover > .cv-aside { left: auto; right: 28px; gap: 14px; padding: 0 12px 0 18px; animation-delay: .18s; }
.cv-edition { display: flex; align-items: center; gap: 10px; }
.cv-edition > svg { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: #efe9ff; }
.cv-edition > span { font-weight: 700; font-size: 15px; line-height: 1.1; color: var(--ink); }
.cv-edition small { display: block; margin-top: 3px; font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--lav-d); }
.cv-sound { width: 40px; height: 40px; border-radius: 13px; box-shadow: 0 3px 0 #e2dbff, 0 4px 12px rgba(84,70,160,.12); }
.cv-sound svg { width: 22px; height: 22px; }
.cv-aside .cv-edition + .cv-sound { margin-left: 2px; }
@media (min-width: 900px) { .cv-logo .cv-kicker { display: none; } .cv-logo .logo { margin-top: 18px; } }
.cv-partners img { display: block; width: auto; height: 36px; }
.cv-partners .logo-vl { height: 33px; }
.cv-partners img + img { padding-left: 18px; border-left: 1px solid rgba(124,92,224,.18); }
@media (max-width: 899px) {
  .cover { grid-template-rows: auto auto 1fr auto; }
  .cover > .cv-partners { position: relative; top: auto; left: auto; height: auto; justify-self: center; margin-bottom: 12px; padding: 9px 16px; gap: 14px; border-radius: 16px; }
  .cover > .cv-aside { top: 28px; right: 12px; left: auto; height: auto; padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .cover > .cv-aside .cv-edition { display: none; }
  .cv-partners img { height: 28px; }
  .cv-partners .logo-vl { height: 26px; }
  .cv-partners img + img { padding-left: 14px; }
}

/* Music indicator on the sound toggle */
#soundBtn.playing, .cv-sound.playing { position: relative; }
#soundBtn.playing::after, .cv-sound.playing::after {
  content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); box-shadow: 0 0 0 0 rgba(63,191,138,.6); animation: musicDot 1.6s ease-out infinite;
}
@keyframes musicDot { 70% { box-shadow: 0 0 0 7px rgba(63,191,138,0); } 100% { box-shadow: 0 0 0 0 rgba(63,191,138,0); } }

/* ---------- Read-aloud ---------- */
.bubble { display: flex; align-items: flex-start; gap: 10px; }
.bubble .bt { flex: 1; min-width: 0; }
.speak { flex: none; width: 34px; height: 34px; margin: -4px -6px -4px 0; border: 0; border-radius: 11px; cursor: pointer;
  display: grid; place-items: center; background: #f3effd; color: var(--accent-d); transition: background-color .2s var(--ease), transform .15s var(--ease); }
.speak svg { width: 19px; height: 19px; }
.speak:hover { background: #e9e2fd; }
.speak:active { transform: scale(.94); }
.speak.speaking { background: var(--accent-d); color: #fff; animation: speakPulse 1.2s ease-in-out infinite; }
@keyframes speakPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-d) 22%, transparent); } }
.bubble.good .speak { background: #d3f3e3; color: var(--mint-d); }
.bubble.bad .speak { background: #ffe1e6; color: #c2415a; }
.bubble.center { display: flex; text-align: center; }

/* ---------- Guide's exact words (tap to reveal) ---------- */
details.official { padding: 0; overflow: hidden; }
details.official summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  font-size: 14px; font-weight: 600; color: var(--accent-d); user-select: none; -webkit-user-select: none; }
details.official summary::-webkit-details-marker { display: none; }
details.official summary > svg { width: 18px; height: 18px; flex: none; }
details.official summary span { flex: 1; }
details.official .chev { transition: transform .3s var(--ease); }
details.official[open] .chev { transform: rotate(180deg); }
details.official .off-body { padding: 0 16px 14px; animation: popIn .4s var(--ease) both; }
details.official .off-body p { margin: 0 0 10px; }

/* ---------- Flip cards ---------- */
.flips { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.flip { border: 0; padding: 0; background: none; cursor: pointer; perspective: 900px; text-align: left; animation: popIn .5s var(--ease) both; animation-delay: calc(.25s + var(--k) * .07s); }
.flip-inner { display: grid; transform-style: preserve-3d; transition: transform .6s var(--ease); min-height: 118px; }
.flip.on .flip-inner { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.face.front { background: #fff; align-items: flex-start; justify-content: space-between; border: 2px solid color-mix(in srgb, var(--accent) 60%, #fff); }
.face.front b { font-size: 17px; line-height: 1.2; }
.face.front small { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--accent-d); }
.face.front small svg { width: 14px; height: 14px; }
.flip:hover .face.front { border-color: var(--accent-d); }
.face.back { background: color-mix(in srgb, var(--accent) 38%, #fff); transform: rotateY(180deg); justify-content: center; }
.face.back b { font-size: 14px; color: var(--accent-d); }
.face.back .txt { font-size: 15px; line-height: 1.4; color: var(--ink); }
.flip[data-seen] .face.front::after { content: ""; }
.flip-count { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); width: min(320px, 100%); }
.flip-count b { color: var(--ink); }
.fc-bar { flex: 1; height: 8px; border-radius: 99px; background: #fff; overflow: hidden; box-shadow: inset 0 1px 3px rgba(46,42,79,.1); }
.fc-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent-d); transition: width .5s var(--ease); }
.flip-count.all .fc-bar i { background: var(--good); }
@media (max-width: 420px) { .flips { grid-template-columns: 1fr 1fr; gap: 10px; } .face.front b { font-size: 15px; } .face.back .txt { font-size: 14px; } }

/* ---------- Resume & leave dialog ---------- */
.resume-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 99px; padding: 8px 16px; font-size: 15px; color: var(--ink-soft); box-shadow: 0 0 0 2px var(--accent), var(--shadow); text-align: center; }
.resume-chip svg { width: 18px; height: 18px; stroke: var(--accent-d); flex: none; }
.resume-chip b { color: var(--ink); }
.next-slot.stacked { flex-direction: column; align-items: center; gap: 10px; }
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(46,42,79,.35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn .25s var(--ease) both; }
.modal.out { animation: fadeOut .25s var(--ease) forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal-card { width: min(400px, 100%); background: #fff; border-radius: 28px; padding: 24px 22px 20px; text-align: center; box-shadow: 0 30px 60px rgba(46,42,79,.25); animation: popIn .4s var(--spring) both; }
.modal-card .owl { width: 76px; margin: 0 auto 6px; }
.modal-card h3 { margin: 0 0 6px; font-size: 24px; }
.modal-card p { margin: 0 0 18px; color: var(--ink-soft); font-size: 16px; line-height: 1.45; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.modal-actions .big-btn { min-width: 0; width: 100%; }
.ghost-btn { border: 0; cursor: pointer; background: #f3effd; color: var(--lav-d); font-size: 17px; font-weight: 600; border-radius: 18px; padding: 13px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ghost-btn svg { width: 20px; height: 20px; }
.ghost-btn:hover { background: #e9e2fd; }

/* ---------- Lab: AI Timeline ---------- */
.tl { position: relative; width: 100%; display: flex; flex-direction: column; gap: 10px; padding-left: 4px; }
.tl::before { content: ""; position: absolute; left: 27px; top: 22px; bottom: 22px; width: 4px; border-radius: 4px; background: #e4def3; transition: background .6s var(--ease); }
.tl.complete::before { background: linear-gradient(180deg, #cbb8ff, #b5deff, #ffe7a3, #a8e6cf); }
.tl-row { position: relative; display: grid; grid-template-columns: 48px 112px 1fr; align-items: center; gap: 10px; }
.tl-dot { width: 48px; height: 48px; border-radius: 50%; background: var(--c); display: grid; place-items: center; box-shadow: 0 0 0 4px #fff, var(--shadow); z-index: 1; }
.tl-dot svg { width: 24px; height: 24px; }
.tl-when { font-size: 13px; color: var(--ink-soft); line-height: 1.2; }
.tl-when b { display: block; font-size: 16px; color: var(--ink); }
.tl-slot { min-height: 64px; border: 2px dashed #cfc6ee; border-radius: 18px; background: rgba(255,255,255,.7); cursor: pointer; padding: 10px 14px; text-align: left; display: grid; align-items: center; transition: background-color .25s var(--ease), border-color .25s var(--ease); }
.tl-empty, .tl-event { grid-area: 1 / 1; transition: opacity .3s var(--ease); }
.tl-empty { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #9a95b5; }
.tl-empty svg { width: 14px; height: 14px; }
.tl-event { opacity: 0; font-size: 15px; font-weight: 500; line-height: 1.3; }
.tl-slot.filled { border-style: solid; border-color: var(--d); background: color-mix(in srgb, var(--c) 40%, #fff); cursor: default; }
.tl-slot.filled .tl-empty { opacity: 0; } .tl-slot.filled .tl-event { opacity: 1; }
.tl-slot.snap { animation: pzSnap .55s var(--spring); }
.tl-slot.hover, .tl.armed .tl-slot:not(.filled) { border-color: var(--accent-d); background: #fff; }
.tl-slot.nope { animation: pzNope .5s var(--ease); }
.tl-tray { width: 100%; display: grid; gap: 10px; }
.tl-card { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; border: 2px solid var(--d); background: #fff; border-radius: 18px; padding: 12px 14px; font-size: 15px; font-weight: 500; text-align: left; line-height: 1.3; cursor: grab; box-shadow: 0 5px 0 color-mix(in srgb, var(--d) 25%, transparent), var(--shadow); }
.tl-card svg { width: 26px; height: 26px; flex: none; padding: 5px; border-radius: 10px; background: var(--c); box-sizing: content-box; }
.tl-card.selected { background: color-mix(in srgb, var(--c) 35%, #fff); transform: translateY(-3px); }
.tl-card.dragging { cursor: grabbing; z-index: 50; box-shadow: 0 18px 30px rgba(84,70,160,.28); }
@media (max-width: 420px) { .tl-row { grid-template-columns: 44px 84px 1fr; gap: 8px; } .tl::before { left: 25px; } .tl-dot { width: 44px; height: 44px; } .tl-event { font-size: 14px; } }

/* ---------- Lab: Benefit or Risk? (swipe) ---------- */
.sw { width: 100%; display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 10px; }
.sw-side { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; opacity: .8; }
.sw-side svg { width: 28px; height: 28px; padding: 8px; border-radius: 50%; box-sizing: content-box; }
.sw-side.risk svg { background: #ffe1e6; stroke: #c2415a; } .sw-side.benefit svg { background: #d3f3e3; stroke: var(--mint-d); }
.sw-deck { position: relative; height: 250px; }
.sw-card { position: absolute; inset: 0; background: #fff; border-radius: 26px; padding: 22px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center;
  box-shadow: 0 14px 30px rgba(84,70,160,.16); border: 2px solid #efeaf9; touch-action: none; user-select: none; -webkit-user-select: none;
  transform: translateY(calc(var(--k) * 8px)) scale(calc(1 - var(--k) * .04)); opacity: .9; transition: transform .4s var(--ease); }
.sw-card.active { cursor: grab; opacity: 1; transform: none; z-index: 5; }
.sw-card.active:active { cursor: grabbing; }
.sw-card p { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.35; }
.sw-card small { color: var(--ink-soft); font-size: 13px; }
.sw-ic { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); display: grid; place-items: center; }
.sw-ic svg { width: 30px; height: 30px; }
.sw-stamp { position: absolute; top: 16px; padding: 4px 12px; border-radius: 10px; font-weight: 700; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; border: 3px solid; opacity: 0; transition: opacity .15s; }
.sw-stamp.benefit { left: 16px; color: var(--mint-d); transform: rotate(-12deg); } .sw-stamp.risk { right: 16px; color: #c2415a; transform: rotate(12deg); }
.sw-card.to-benefit .sw-stamp.benefit, .sw-card.to-risk .sw-stamp.risk { opacity: 1; }
.sw-card.shake { animation: shake .45s; }
.sw-btns { display: flex; gap: 12px; width: 100%; justify-content: center; }
.sw-btn { flex: 1; max-width: 200px; border: 0; cursor: pointer; border-radius: 18px; padding: 14px; font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s var(--ease); }
.sw-btn svg { width: 20px; height: 20px; }
.sw-btn.risk { background: #ffe1e6; color: #b03650; box-shadow: 0 5px 0 #f7c3cd; } .sw-btn.benefit { background: #d3f3e3; color: #22805d; box-shadow: 0 5px 0 #b3e6cd; }
.sw-btn:active { transform: translateY(4px); box-shadow: none; }
.sw-btn:disabled { opacity: .45; pointer-events: none; }
.tag-pill { display: inline-block; margin-left: 4px; padding: 1px 9px; border-radius: 99px; background: #fff; font-size: 13px; font-weight: 600; color: var(--accent-d); white-space: nowrap; }
@media (max-width: 420px) { .sw { grid-template-columns: 1fr; } .sw-side { display: none; } .sw-deck { height: 230px; } .sw-card p { font-size: 17px; } }

/* ---------- Lab: Moral Compass ---------- */
.cp-situation { text-align: center; }
.cp-situation small { color: var(--ink-soft); font-size: 13px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.cp-situation p { margin: 6px 0 0; font-size: 18px; font-weight: 600; line-height: 1.35; }
.cp-situation.swap { animation: popIn .45s var(--ease); }
.cp { position: relative; width: min(330px, 92%); aspect-ratio: 1; margin: 8px 0 14px; }
.cp-dial { position: absolute; inset: 14%; width: 72%; height: 72%; filter: drop-shadow(0 12px 22px rgba(84,70,160,.18)); }
.cp-ring { fill: #fff; stroke: #e4def3; stroke-width: 3; } .cp-inner { fill: #faf8ff; stroke: #efeaf9; stroke-width: 2; }
.cp-tick { stroke: #cfc6ee; stroke-width: 2; stroke-linecap: round; }
.cp-needle { position: absolute; left: 50%; top: 50%; width: 14px; height: 30%; margin: -30% 0 0 -7px; transform-origin: 50% 100%; transform: rotate(var(--a)); transition: transform .7s var(--spring); z-index: 2; }
.cp-needle i { display: block; width: 100%; height: 100%; background: linear-gradient(180deg, var(--accent-d), color-mix(in srgb, var(--accent-d) 60%, #fff)); clip-path: polygon(50% 0, 100% 88%, 50% 100%, 0 88%); }
.cp-needle.wobble { animation: wobble .6s var(--ease); }
@keyframes wobble { 25% { transform: rotate(calc(var(--a) - 14deg)); } 60% { transform: rotate(calc(var(--a) + 8deg)); } }
.cp-hub { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 50%; background: #fff; border: 5px solid var(--accent-d); z-index: 3; }
.cp-point { position: absolute; transform: translate(-50%, -50%); z-index: 4; border: 0; cursor: pointer; background: #fff; border-radius: 16px; padding: 7px 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 0 #e5def9, 0 8px 18px rgba(84,70,160,.14); transition: transform .2s var(--ease), background-color .25s var(--ease); }
.cp-point svg { width: 24px; height: 24px; stroke: var(--accent-d); }
.cp-point:hover { transform: translate(-50%, -50%) scale(1.06); }
.cp-point.right { background: #d3f3e3; box-shadow: 0 0 0 3px var(--good), 0 8px 18px rgba(63,191,138,.3); }
.cp-point.right svg { stroke: var(--mint-d); }
.cp-point.wrong { animation: pointNope .5s var(--ease); }
@keyframes pointNope { 30% { background: #ffe1e6; } }
.cp.locked .cp-point:not(.right) { opacity: .55; pointer-events: none; }

/* Cover greeting: Ollie's speech bubble with the learner's name */
.cv-greet {
  position: absolute; left: calc(50% + 66px); top: -92px; z-index: 3; width: max-content; max-width: 190px;
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 18px 18px 18px 6px;
  background: #fff; box-shadow: 0 10px 24px rgba(84,70,160,.18); text-align: left;
  animation: greetIn .6s 1.5s var(--spring) both;
}
.cv-greet::before { content: ""; position: absolute; left: -7px; bottom: 6px; width: 16px; height: 16px; background: #fff; transform: rotate(45deg); border-radius: 3px; }
.cv-greet b { position: relative; font-size: 17px; line-height: 1.15; color: var(--ink); }
.cv-greet span { position: relative; font-size: 13px; line-height: 1.3; color: var(--ink-soft); }
@keyframes greetIn { from { opacity: 0; transform: translateY(10px) scale(.85); transform-origin: left bottom; } }
.cert-name { margin: 0 0 6px; font-size: 17px; color: var(--ink-soft); }
.cert-name b { color: var(--ink); font-size: 20px; }
@media (max-width: 560px) {
  .cv-greet { left: 50%; translate: -50% 0; top: -128px; max-width: 210px; padding: 8px 14px; border-radius: 16px; align-items: center; text-align: center; }
  .cv-greet::before { left: 50%; bottom: -6px; margin-left: -7px; width: 14px; height: 14px; }
  .cv-greet b { font-size: 15px; }
  .cv-greet span { font-size: 12px; }
}
@media (min-width: 561px) {
  .mini.m2 { right: -6%; top: -9%; }
  .cv-greet { top: -84px; }
}

/* Full-height screens that also show the header (e.g. welcome) */
.screen.full.with-bar { min-height: calc(100dvh - 73px); }
@media (max-width: 640px) { .screen.full.with-bar { min-height: calc(100dvh - 86px); } }

/* Cover bottom: one clear action, a quiet stats line, and a footer note at the very bottom */
.cv-cta { gap: 14px; padding-bottom: 34px; }
.cv-stats { margin: 10px 0 0; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  font-size: 14px; font-weight: 500; color: var(--ink-soft); animation: fadeDown .8s 1.6s both; }
.cv-stats span { display: inline-flex; align-items: center; gap: 5px; height: auto; padding: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 0; }
.cv-stats i { font-style: normal; opacity: .5; }
.cv-stats svg { width: 15px; height: 15px; }
.cover > .cv-foot { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 2; margin: 0; text-align: center;
  font-size: 12px; color: var(--ink-soft); opacity: .75; }
.cv-cta .text-link { margin-top: -4px; font-size: 14px; }

/* ---------- Mascot: Rakyat Digital robot (default) ----------
   The image is 227×187 with the robot's body in the left ~57% and the flag top-right,
   so placements centre the body (≈30% across the image), not the whole image. */
.mascot-img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; pointer-events: none; -webkit-user-drag: none; }
.mascot-robot .guide .owl { width: 104px; }
.mascot-robot .owl.big { width: 230px; }
.mascot-robot .modal-card .owl { width: 110px; }
.mascot-robot .cert .owl { width: 130px !important; }
.mascot-robot .isle-flag { display: none; }
.mascot-robot .cv-owl { width: 176px; margin-left: -53px; top: -88px; }
.mascot-robot .cv-greet { left: auto; right: calc(50% + 58px); top: -78px; border-radius: 18px 18px 6px 18px; text-align: right; align-items: flex-end; }
.mascot-robot .cv-greet::before { left: auto; right: -7px; }
@media (max-width: 560px) {
  .mascot-robot .guide .owl { width: 84px; }
  .mascot-robot .owl.big { width: 200px; }
  .mascot-robot .cv-owl { width: 156px; margin-left: -47px; top: -80px; }
  .mascot-robot .cv-greet { right: auto; left: 50%; translate: -50% 0; top: -150px; border-radius: 16px; text-align: center; align-items: center; }
  .mascot-robot .cv-greet::before { right: auto; left: 50%; }
}
@media (min-width: 561px) { .mascot-robot .mini.m1 { left: -6%; top: -9%; } }
@media (max-width: 560px) {
  .mascot-robot .cv-owl { width: 146px; margin-left: -44px; top: -74px; }
  .mascot-robot .cv-greet { top: -134px; }
  .mascot-robot .mini.m2 { right: -3%; top: 2%; }
}
/* Centre the robot's body (not the whole image, which includes the flag) where it is shown centred */
.mascot-robot .owl.big, .mascot-robot .modal-card .owl, .mascot-robot .cert .owl { translate: 20% 0; }
