/* =========================================================
   Level interfaces, missions, colouring, challenges
   ========================================================= */
.mso-logo { width: 44px; height: 44px; object-fit: contain; background: #27385f; border-radius: 50%; padding: 5px; box-shadow: 0 0 0 3px var(--gold); }
.footer-logo { width: 120px; display: block; margin: 0 auto 10px; }
.brand { gap: 12px; }

/* ---------- portals on the landing page ---------- */
.portals { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.portal { text-decoration: none; color: inherit; border-radius: 30px; padding: 22px; text-align: center; position: relative; overflow: hidden; box-shadow: var(--shadow); transition: transform .3s; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.portal:hover { transform: translateY(-8px) rotate(-.5deg); }
.portal.p1 { background: linear-gradient(160deg, #e9fbf1, #ffe9f0); border: 3px solid #8fd2b8; }
.portal.p2 { background: linear-gradient(160deg, #22325a, #3e5488); border: 3px solid var(--gold); color: #fff8ec; }
.portal.p2 h3 { color: #ffe9a8; }
.portal .portal-art { width: min(300px, 80%); }
.portal .ribbon { display: inline-block; background: var(--emerald); color: #fff; font-weight: 800; padding: 6px 16px; border-radius: 999px; }
.portal.p2 .ribbon { background: var(--gold); color: #27385f; }
.portal h3 { font-size: 1.8rem; margin: 6px 0 0; }
.portal p { margin: 0 0 10px; }
.portal.p2 .btn { background: var(--gold); color: #27385f; box-shadow: 0 6px 0 #a9803a; }
.balloon { animation: bob 4s ease-in-out infinite; }
.gear { animation: spin 8s linear infinite; }
.gear.rev { animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.tw { animation: twinkle 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* ---------- level themes ---------- */
body.level { padding-top: 64px; }
body.lv1 {
  --lv-a: #2e9d7d; --lv-b: #e0708f; --lv-bg: #f3fbf5; --radius: 30px;
  background: #f3fbf5;
  background-image: radial-gradient(circle at 10% 10%, rgba(255, 143, 179, .18), transparent 35%), radial-gradient(circle at 90% 40%, rgba(143, 210, 184, .25), transparent 40%);
  font-size: 18px;
}
html:not([lang="ar"]) body.lv1 { --f-body: 'Baloo 2', 'Nunito', sans-serif; --f-title: 'Baloo 2', 'Nunito', sans-serif; }
body.lv2 {
  --lv-a: #27385f; --lv-b: #d8b064; --lv-bg: #f6f1e6;
  background: #f6f1e6;
  background-image: linear-gradient(rgba(39, 56, 95, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(39, 56, 95, .05) 1px, transparent 1px);
  background-size: 24px 24px;
}
.level-pill { text-decoration: none; font-weight: 800; padding: 6px 14px; border-radius: 999px; background: var(--lv-a); color: #fff; margin-inline-start: 6px; }
body.lv2 .level-pill { background: var(--gold); color: #27385f; }
body.level .nav-links { margin-inline-start: auto; }

.lv-hero { position: relative; height: clamp(300px, 46vw, 460px); overflow: hidden; }
.lv-hero > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lv-hero-card { position: absolute; top: 18px; inset-inline-start: 50%; transform: translateX(-50%); text-align: center; background: rgba(255, 255, 255, .88); border-radius: 26px; padding: 14px 26px; box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 32px); }
html[dir="rtl"] .lv-hero-card { transform: translateX(50%); }
body.lv2 .lv-hero-card { background: rgba(26, 38, 68, .85); color: #fff8ec; border: 2px solid var(--gold); }
body.lv2 .lv-hero-card h1 { color: #ffe9a8; }
.lv-hero-card h1 { font-size: clamp(1.5rem, 4vw, 2.6rem); margin: 6px 0 2px; }
.lv-hero-card p { margin: 0; font-weight: 700; }
.lv-hero-card .ribbon { background: var(--lv-a); color: #fff; padding: 4px 14px; border-radius: 999px; font-weight: 800; }
body.lv2 .lv-hero-card .ribbon { background: var(--gold); color: #27385f; }

.lv-sec { padding: 34px 0 10px; }
.lv-h { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin-bottom: 4px; }
.lv-sub { color: var(--ink-soft); margin-top: 0; }
.map-wrap { display: grid; gap: 16px; }
.lvmap { border-radius: 26px; box-shadow: var(--shadow); }
.lvmap .stop { cursor: pointer; }
.map-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.m-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; background: #fff; border-radius: 22px; padding: 14px 16px; box-shadow: var(--shadow); border-inline-start: 8px solid var(--c); transition: transform .2s; }
.m-card:hover { transform: translateY(-4px); }
.m-ic { font-size: 2.2rem; }
.m-card b { display: block; font-size: 1.05rem; line-height: 1.25; }
.m-card small { color: var(--ink-soft); font-weight: 700; }
.m-prog { display: block; height: 8px; background: #eee6d8; border-radius: 9px; margin-top: 6px; overflow: hidden; }
.m-prog i { display: block; height: 100%; background: var(--c); border-radius: 9px; }
.m-go { margin-inline-start: auto; width: 42px; height: 42px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tile { background: #fff; border-radius: 22px; padding: 12px; text-decoration: none; color: inherit; box-shadow: var(--shadow); text-align: center; transition: transform .2s; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; }
.tile:hover { transform: translateY(-5px) rotate(-1deg); }
.tile svg { width: 100%; aspect-ratio: 1; border-radius: 14px; background: #fffdf8; }
.tile small { color: var(--ink-soft); }
.ch-tile { padding: 22px 12px; }
.ch-ic { font-size: 3rem; }
.ch-tile.won { background: linear-gradient(160deg, #fff, #fff4cc); }
.ch-ok { position: absolute; top: 8px; inset-inline-end: 12px; color: var(--gold); font-size: 1.5rem; }
.center { text-align: center; }

/* ---------- mission shell ---------- */
.mission { padding: 18px 0 40px; }
.m-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.m-back { font-weight: 800; text-decoration: none; background: #fff; padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow); }
.m-title { flex: 1; text-align: center; }
.m-title small { display: block; color: var(--c); font-weight: 800; }
.m-title b { font-family: var(--f-title); font-size: clamp(1.3rem, 3vw, 1.9rem); color: var(--navy); }
.m-replay { border: 0; background: #fff; border-radius: 999px; padding: 8px 14px; font: 800 .9rem var(--f-body); cursor: pointer; box-shadow: var(--shadow); color: var(--ink-soft); }
.stepper { list-style: none; display: flex; gap: 6px; padding: 12px 0; margin: 0 auto; overflow-x: auto; }
.stepper li { flex: 1; min-width: 64px; }
.stepper a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; padding: 8px 4px; border-radius: 16px; background: rgba(255, 255, 255, .7); color: var(--ink-soft); border: 2px solid transparent; }
.stepper span { font-size: 1.5rem; }
.stepper em { font-style: normal; font-size: .72rem; font-weight: 800; text-align: center; line-height: 1.15; }
.stepper li.ok a { background: #e8f7ef; color: var(--emerald); }
.stepper li.ok a::after { content: "✓"; font-weight: 900; }
.stepper li.cur a { border-color: var(--c); background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.m-stage { background: #fff; border-radius: 30px; padding: clamp(16px, 3vw, 30px); box-shadow: var(--shadow); position: relative; min-height: 380px; }
.st-title { font-size: clamp(1.4rem, 3vw, 2rem); text-align: center; }
.m-foot { display: flex; justify-content: space-between; margin-top: 16px; gap: 10px; }
.btn.next { opacity: .7; }
.btn.next.ready { opacity: 1; background: var(--c, var(--navy)); }
.btn.next.pulse { animation: pulseB 1.2s ease-in-out 3; }
@keyframes pulseB { 50% { transform: scale(1.08); } }
.btn.big { font-size: 1.15rem; padding: 16px 26px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.m-guide { margin-top: 26px; }
.m-guide summary { cursor: pointer; font-weight: 800; background: #fff; padding: 12px 18px; border-radius: 16px; box-shadow: var(--shadow); }
.m-guide .session { margin-top: 12px; padding: 18px; }
.hidden { display: none !important; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* talk bubble */
.talk { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 16px; }
.talk-av { width: 86px; flex: none; }
.talk-av svg { width: 100%; height: auto; display: block; }
.talk-bubble { position: relative; background: #fff8ec; border: 2.5px solid var(--navy); border-radius: 22px; padding: 12px 16px; font-weight: 700; font-size: 1.05rem; flex: 1; display: flex; gap: 10px; align-items: center; }
body.lv1 .talk-bubble { font-size: 1.2rem; }
.talk-bubble::before { content: ""; position: absolute; bottom: 16px; inset-inline-start: -12px; border: 10px solid transparent; border-inline-end-color: var(--navy); }
.say { border: 0; background: var(--lv-a, var(--navy)); color: #fff; border-radius: 50%; width: 40px; height: 40px; flex: none; cursor: pointer; font-size: 1.1rem; margin-inline-start: auto; }
.note { font-size: .95rem; color: var(--emerald); font-weight: 700; }
.win-banner { position: sticky; bottom: 10px; margin: 18px auto 0; width: max-content; max-width: 100%; display: flex; gap: 10px; align-items: center; background: linear-gradient(90deg, #fff4cc, #ffe0ea); border: 3px solid var(--gold); border-radius: 999px; padding: 10px 22px; font-size: 1.2rem; animation: popIn .5s cubic-bezier(.2, 1.6, .4, 1); box-shadow: var(--shadow); z-index: 5; }
.win-star { font-size: 1.6rem; color: var(--gold); animation: spin 3s linear infinite; display: inline-block; }
@keyframes popIn { from { transform: scale(.3); opacity: 0; } }
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; border-radius: 2px; z-index: 100; animation: conf 2s ease-in forwards; pointer-events: none; }
@keyframes conf { to { transform: translate(var(--dx), 105vh) rotate(var(--rot)); } }
.idea { background: #eef8ff; border-inline-start: 6px solid var(--s); padding: 12px 16px; border-radius: 14px; margin-top: 14px; font-weight: 600; }
.idea b { margin-inline-end: 6px; }
.drag-ghost { position: fixed; z-index: 90; pointer-events: none; opacity: .9; transform: scale(1.08) rotate(-3deg); }
.dragging { opacity: .35; }
.over { outline: 4px dashed var(--gold); outline-offset: 3px; }
.picked { outline: 4px solid var(--gold); }
input.n { width: 84px; font: 800 1.1rem var(--f-body); padding: 6px 8px; border-radius: 10px; border: 2px solid #c9c3d8; text-align: center; }
input.n.good { border-color: var(--emerald); background: #e8f7ef; }
input.n.bad { border-color: #e0566f; background: #ffe9ee; animation: shake .4s; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 2px solid #d8cfe8; background: #fff; border-radius: 999px; padding: 8px 14px; font: 700 .95rem var(--f-body); cursor: pointer; }
.chip-btn.on, .chip-btn.good { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.chip-btn.bad { background: #ffe9ee; border-color: #e0566f; animation: shake .4s; }
.round-dots { display: flex; gap: 8px; justify-content: center; }
.round-dots i { width: 18px; height: 18px; border-radius: 50%; background: #e5ddf0; }
.round-dots i.on { background: var(--gold); box-shadow: 0 0 0 4px #fff4cc; }

/* cover */
.cover { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; }
.cover-art svg { width: 100%; height: auto; background: linear-gradient(180deg, #e9f1ff, #fff3e0); border-radius: 24px; }
.cover-tag { color: var(--c); font-weight: 800; }
.cover h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
.cover-steps { list-style: none; padding: 0; display: grid; gap: 6px; }
.cover-steps li { display: flex; gap: 10px; align-items: center; font-weight: 700; background: var(--cream); border-radius: 12px; padding: 6px 12px; }
.cover-steps span { font-size: 1.3rem; }

/* envelope */
.envelope { position: relative; width: min(420px, 92%); aspect-ratio: 3 / 2; margin: 50px auto 20px; cursor: pointer; perspective: 900px; }
.env-back, .env-front { position: absolute; inset: 0; border-radius: 10px; }
.env-back { background: #ead6b2; }
.env-front { background: linear-gradient(160deg, transparent 49.5%, #f4e3c4 50%), linear-gradient(200deg, transparent 49.5%, #f0dcb8 50%); z-index: 3; clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%); background-color: #f4e3c4; }
.env-flap { position: absolute; inset: 0 0 auto 0; height: 60%; background: #e8cfa3; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .7s; z-index: 4; }
.env-seal { position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%); width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e26a7e, #9c2a40); color: #ffe0e6; display: grid; place-items: center; font-size: 1.7rem; z-index: 5; box-shadow: 0 4px 10px rgba(0, 0, 0, .25); transition: .4s; animation: pulseB 1.6s infinite; }
.env-paper { position: absolute; inset: 8% 6% 6%; background: #fffdf6; border-radius: 6px; z-index: 2; padding: 16px; text-align: center; transition: transform .9s .4s cubic-bezier(.3, 1.3, .5, 1); font-weight: 700; overflow: hidden; }
.env-logo { width: 56px; background: #27385f; border-radius: 50%; padding: 4px; }
.env-title { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; color: var(--navy); margin: 2px 0; }
.env-sign { font-family: var(--f-hand); color: var(--emerald); font-size: 1.3rem; }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .env-seal { opacity: 0; transform: translate(-50%, -50%) scale(2); }
.envelope.open .env-paper { transform: translateY(-58%); z-index: 6; box-shadow: var(--shadow); overflow: visible; }
.who { text-align: center; margin-top: 110px; animation: popIn .5s; }
.avatars { display: flex; justify-content: center; gap: 14px; margin: 10px 0; }
.avatar { width: 120px; border: 4px solid transparent; border-radius: 24px; background: linear-gradient(180deg, #e9f1ff, #fff3e0); cursor: pointer; padding: 6px; }
.avatar.on { border-color: var(--gold); transform: scale(1.06); }
.avatar svg { width: 100%; display: block; }
.name-in { display: block; font-weight: 800; margin: 10px 0 16px; }
.name-in input { display: block; margin: 6px auto 0; font: 800 1.3rem var(--f-body); padding: 10px 16px; border-radius: 14px; border: 3px solid #d8cfe8; text-align: center; width: min(320px, 90%); }

/* worlds */
.steam-sign { display: flex; justify-content: center; gap: 8px; margin: 6px 0 16px; }
.steam-sign span { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font: 800 2rem 'Cormorant Garamond', serif; background: #eee8f5; color: #c9c3d8; transition: .4s; }
.steam-sign span.lit { background: var(--c); color: #fff; box-shadow: 0 0 22px var(--c); transform: scale(1.1); }
.bubbles { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.w-bubble { width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer; background: radial-gradient(circle at 30% 30%, #fff, color-mix(in srgb, var(--c) 45%, #fff) 60%, var(--c)); box-shadow: inset -6px -8px 14px rgba(0, 0, 0, .12), 0 8px 18px rgba(0, 0, 0, .12); font: 800 2rem 'Cormorant Garamond', serif; color: #fff; animation: bob 3s ease-in-out infinite; text-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.w-bubble.pop { animation: bubblePop .4s forwards; }
@keyframes bubblePop { 60% { transform: scale(1.3); opacity: .7; } 100% { transform: scale(0); opacity: 0; } }
.worlds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.world { background: color-mix(in srgb, var(--c) 10%, #fff); border: 3px solid var(--c); border-radius: 20px; padding: 10px; text-align: center; transition: .4s; }
.world svg { width: 100%; height: auto; }
.world.hidden-w { filter: grayscale(1) blur(2px); opacity: .35; }
.world.reveal-w { animation: popIn .5s; }
.world.nope { animation: shake .4s; }
.world.got { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent); }
.w-name { font-weight: 800; color: var(--c); font-size: 1.1rem; }
.w-hint { font-size: .85rem; color: var(--ink-soft); }
.letters-tray { display: flex; justify-content: center; gap: 12px; margin-bottom: 14px; }
.drag-letter { width: 60px; height: 60px; border-radius: 16px; background: var(--c); color: #fff; display: grid; place-items: center; font: 800 2rem 'Cormorant Garamond', serif; cursor: grab; box-shadow: 0 6px 0 rgba(0, 0, 0, .15); user-select: none; }
.drag-letter.gone { visibility: hidden; }
.bub { animation: bubUp 2s ease-in infinite; }
@keyframes bubUp { to { transform: translateY(-44px); opacity: 0; } }
.coin-drop { animation: coinDrop 1.8s ease-in infinite; }
@keyframes coinDrop { 0% { transform: translateY(-10px); opacity: 0; } 30% { opacity: 1; } 70%, 100% { transform: translateY(44px); opacity: 0; } }
.paint { stroke-dasharray: 160; stroke-dashoffset: 160; animation: paint 2.5s ease-in-out infinite; }
@keyframes paint { 60%, 100% { stroke-dashoffset: 0; } }
.num-pop { animation: twinkle 1.6s infinite; }

/* café */
.counter { text-align: center; font: 800 1.4rem var(--f-body); color: var(--navy); }
.cafe-scene svg { width: 100%; height: auto; border-radius: 22px; border: 3px solid #e8dcc6; }
.hid-obj { cursor: pointer; transition: .3s; outline: none; }
.hid-obj:hover { filter: drop-shadow(0 0 6px #fff3a0); }
.hid-obj.hint { animation: wig .4s 4; }
@keyframes wig { 25% { transform: translate(var(--x, 0), 0) rotate(-6deg); } 75% { rotate: 6deg; } }
.hid-obj.found { filter: drop-shadow(0 0 10px #f6c64e); }
.mod-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.mod-card { background: #fff; border-radius: 16px; padding: 10px 14px; border-inline-start: 6px solid var(--mc); box-shadow: 0 3px 10px rgba(0, 0, 0, .06); animation: popIn .4s; }
.mod-card b { display: block; color: var(--mc); }
.mod-card small { color: var(--ink-soft); }
.mod-card .n { background: var(--mc); color: #fff; border-radius: 999px; padding: 0 8px; font-weight: 800; font-size: .8rem; }

/* badge */
.badge-maker { display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; align-items: start; }
.badge-preview svg { width: 100%; max-width: 320px; display: block; margin: 0 auto; }
.badge-preview.jump { animation: popIn .6s; }
.badge-opts h4 { margin: 12px 0 6px; }
.swatches, .emblems { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 2px #ddd; cursor: pointer; }
.sw.on { box-shadow: 0 0 0 4px var(--gold); }
.em { width: 60px; height: 60px; border-radius: 16px; border: 3px solid #eee; background: #fff; cursor: pointer; padding: 4px; }
.em.on { border-color: var(--gold); }
.team-name { margin-top: 8px; font: 700 1rem var(--f-body); padding: 8px 12px; border-radius: 12px; border: 2px solid #d8cfe8; width: 100%; }
.badge-opts .btn { margin-top: 16px; }

/* roles */
.people { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; min-height: 120px; }
.person { width: 100px; text-align: center; cursor: grab; user-select: none; background: #fff; border-radius: 18px; padding: 4px; box-shadow: 0 3px 10px rgba(0, 0, 0, .08); font-weight: 800; }
.person svg { width: 100%; display: block; }
.person.hop { animation: hop .6s 2; }
@keyframes hop { 50% { transform: translateY(-18px); } }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.role { background: var(--cream); border: 3px dashed #d8b064; border-radius: 22px; padding: 10px; min-height: 180px; cursor: pointer; }
.role-head { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.role-head span { font-size: 1.8rem; }
.role-slot { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.role-slot .person { width: 80px; }

/* lab: jug, thermometer, tokens */
.lab { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; }
.jug { width: 100%; max-width: 280px; display: block; margin: 0 auto; }
.jug .stream { animation: stream .3s linear infinite; }
@keyframes stream { 50% { stroke-width: 12; } }
.lab-ctrl { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.pour.holding { transform: translateY(3px); box-shadow: 0 2px 0 var(--navy-deep); background: var(--s); }
.feedback { min-height: 32px; font-weight: 800; font-size: 1.15rem; text-align: center; color: var(--navy); }
.thermo-lab { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; }
.thermo-big { cursor: grab; text-align: center; background: #fff; border-radius: 20px; padding: 6px; box-shadow: var(--shadow); }
.thermo-big svg, .th svg { width: 70px; height: auto; }
.t-read { font: 800 1.6rem var(--f-body); }
.cups3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cup3 { background: var(--cream); border-radius: 20px; padding: 10px; text-align: center; cursor: pointer; border: 3px solid transparent; }
.cup3.active { border-color: var(--gold); }
.cup3 svg { width: 100%; max-width: 120px; }
.t-val { display: block; font: 800 1.5rem var(--f-body); min-height: 1.6em; }
.order-zone { margin-top: 16px; text-align: center; }
.order-slots { display: flex; gap: 10px; justify-content: center; }
.slot { min-width: 110px; padding: 10px; border-radius: 14px; background: #fff; border: 2px dashed #c9c3d8; font-weight: 800; }
.coin-game { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.coin-bank { display: flex; flex-direction: column; gap: 10px; }
.coin-src { border: 0; background: none; cursor: pointer; width: 74px; transition: transform .1s; }
.coin-src:active { transform: scale(.9); }
.coin-src svg { width: 100%; }
.jar { position: relative; width: min(260px, 100%); margin: 0 auto; }
.jar > svg { width: 100%; }
.jar-coins { position: absolute; inset: 30% 18% 8%; display: flex; flex-wrap: wrap-reverse; align-content: flex-start; gap: 2px; justify-content: center; }
.jar-coin { border: 0; background: none; width: 38px; padding: 0; animation: dropIn .4s; cursor: pointer; }
.jar-coin svg { width: 100%; }
@keyframes dropIn { from { transform: translateY(-120px); } }
.jar-total { grid-column: 1 / -1; text-align: center; font: 800 1.5rem var(--f-body); }
.coin-game .round-dots, .coin-game .btn { grid-column: 1 / -1; justify-self: center; }

/* math lv1 */
.recipe-card { background: var(--paper); border: 3px solid var(--gold); border-radius: 20px; padding: 10px 16px; margin-bottom: 12px; text-align: center; }
.recipe-row { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 1.3rem; flex-wrap: wrap; }
.recipe-row svg { width: 44px; height: 58px; }
.glass-line svg { width: 40px; height: 52px; }
.customers { display: flex; justify-content: center; gap: 14px; }
.cust { width: 92px; transition: .4s; }
.cust.served { filter: drop-shadow(0 0 8px #f6c64e); transform: translateY(-6px); }
.cust.served::after { content: "☕"; display: block; text-align: center; font-size: 1.6rem; }
.stock { display: flex; gap: 16px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.st { display: flex; align-items: center; gap: 8px; background: #fff; padding: 6px 12px; border-radius: 999px; box-shadow: 0 3px 10px rgba(0, 0, 0, .06); font-weight: 800; }
.bar { width: 120px; height: 12px; background: #eee6d8; border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--e); transition: width .4s; }
.tray-row { display: flex; align-items: center; gap: 16px; justify-content: center; margin: 10px 0; }
.glass-src { border: 3px dashed var(--gold); background: #fff; border-radius: 18px; width: 90px; cursor: pointer; }
.tray { min-width: 260px; min-height: 90px; background: linear-gradient(#d6a374, #b98457); border-radius: 50px; display: flex; gap: 4px; justify-content: center; align-items: flex-end; padding: 6px 16px; }
.tg svg, .glass-src svg { width: 52px; height: 70px; }
.fill-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.ctrls { display: flex; flex-direction: column; gap: 8px; }
.glass-wrap { text-align: center; }
.big-glass { width: 140px; height: 190px; }
.big-glass.stir { animation: shake .5s; }
.spoon-btn { border: 0; background: #7a4526; color: #fff; font: 800 1.1rem var(--f-body); padding: 10px 16px; border-radius: 999px; cursor: pointer; }
.dots { font-size: 1.6rem; color: #7a4526; letter-spacing: 6px; }
.yn { display: flex; gap: 14px; justify-content: center; margin-top: 10px; }
.yn.sm button { border: 2px solid #d8cfe8; background: #fff; border-radius: 999px; padding: 6px 12px; font: 700 .9rem var(--f-body); cursor: pointer; }
.yn button.good { background: var(--emerald); color: #fff; }
.yn button.bad { background: #ffe9ee; animation: shake .4s; }

/* math lv2 */
.machine { display: flex; align-items: center; justify-content: center; gap: 14px; background: #27385f; color: #fff; border-radius: 24px; padding: 20px; font: 800 1.6rem var(--f-body); flex-wrap: wrap; }
.machine.run { animation: shake .5s; }
.m-knob { display: flex; gap: 8px; }
.knob { border: 0; width: 64px; height: 64px; border-radius: 50%; background: var(--gold); color: #27385f; font: 800 1.2rem var(--f-body); cursor: pointer; box-shadow: 0 5px 0 #a9803a; }
.m-in, .m-out { background: #fff8ec; color: #27385f; padding: 8px 16px; border-radius: 14px; }
.calc-grid { display: grid; gap: 12px; justify-items: start; font-weight: 700; font-size: 1.1rem; background: var(--cream); padding: 16px; border-radius: 18px; }
.shelf { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sh-item { background: var(--cream); border-radius: 18px; padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sh-item svg { width: 70px; height: 100px; }
.price-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.price-cards span { background: #fff4cc; border: 2px solid var(--gold); border-radius: 12px; padding: 6px 12px; font-weight: 800; }

/* physics */
.phys-lab { display: grid; gap: 14px; }
.clock { display: flex; align-items: center; gap: 10px; justify-content: center; }
.clock svg { width: 90px; }
.clock .min { font: 800 1.6rem var(--f-body); }
.cups4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cup4 { background: var(--cream); border-radius: 20px; padding: 8px; text-align: center; display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 4px; transition: .3s; }
.cup4 .th { grid-row: span 3; }
.cup4 .th svg { width: 44px; }
.cup-btn { border: 0; background: none; cursor: pointer; padding: 0; }
.cupsvg { width: 90px; height: 120px; }
.cup4 .steam { transition: opacity .3s; opacity: 0; }
.cup4:not(.full) .cupsvg ellipse { opacity: 0; }
.cup4 .read { font: 800 1.2rem var(--f-body); min-height: 1.4em; }
.cup4.crown { box-shadow: 0 0 0 5px var(--gold); }
.cup4.crown::before { content: "👑"; grid-column: 1 / -1; font-size: 2rem; }
.phys-ctrl { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.chart { width: 100%; max-width: 560px; margin: 0 auto; display: block; box-shadow: var(--shadow); border-radius: 12px; }
table.res { border-collapse: collapse; width: 100%; margin: 10px 0; background: #fff; }
table.res th, table.res td { border: 1.5px solid #e2d8c4; padding: 8px; text-align: center; }
table.res th { background: var(--cream); }
.best { margin-top: 12px; }

/* bonus lab */
.lab2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.exp { background: var(--cream); border-radius: 22px; padding: 14px; text-align: center; }
.sed { width: 100%; max-width: 200px; background: #fff; border-radius: 12px; }
.ph-strip { width: 34px; height: 120px; background: #f7f1c8; border: 2px solid #c9b46a; border-radius: 4px; margin: 6px auto; cursor: grab; position: relative; overflow: hidden; }
.ph-strip i { position: absolute; inset: auto 0 0 0; height: 45%; background: transparent; transition: background .6s; }
.bowls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bowl { background: #fff; border-radius: 16px; padding: 8px; cursor: pointer; border: 2px solid #eee; display: flex; flex-direction: column; gap: 2px; }
.b-ic { font-size: 2rem; }
.bowl em { font-style: normal; color: #fff; border-radius: 999px; font-weight: 800; font-size: .85rem; min-height: 1.3em; }
.ph-scale { display: flex; margin-top: 10px; border-radius: 999px; overflow: hidden; }
.ph-scale span { flex: 1; color: #fff; font-weight: 800; padding: 4px; font-size: .85rem; }

/* economy */
.items { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 14px; }
.item { background: #fff; border: 3px solid #eadfcf; border-radius: 18px; padding: 8px 12px; text-align: center; cursor: grab; user-select: none; display: flex; flex-direction: column; align-items: center; min-width: 100px; }
.item.small { min-width: 86px; }
.i-ic { font-size: 2.2rem; }
.i-p { display: flex; align-items: center; gap: 4px; font-weight: 800; }
.w-coin { width: 26px; height: 26px; }
.item.bought { border-color: var(--emerald); background: #e8f7ef; transform: scale(.95); }
.item.locked { cursor: default; }
.baskets { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.basket { background: color-mix(in srgb, var(--bc, var(--gold)) 10%, #fff8ec); border: 3px dashed var(--bc, var(--gold)); border-radius: 24px; padding: 10px; min-height: 150px; text-align: center; }
.b-in { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.balance { position: relative; max-width: 360px; margin: 0 auto; }
.balance svg { width: 100%; }
.beam { transition: transform .8s cubic-bezier(.3, 1.5, .5, 1); }
.pan { position: absolute; top: 34%; width: 74px; height: 74px; border-radius: 50%; border: 3px solid var(--gold); background: #fff; font-size: 2rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; transform: translateY(var(--ty)); transition: transform .8s; }
.pan small { font: 800 .9rem var(--f-body); }
.pan.left { left: 2%; } .pan.right { right: 2%; }
.pan.good { background: #e8f7ef; border-color: var(--emerald); }
.wallet { display: flex; align-items: center; gap: 8px; justify-content: center; background: #fff4cc; border-radius: 999px; padding: 8px 16px; width: max-content; margin: 0 auto 12px; max-width: 100%; flex-wrap: wrap; font-size: 1.3rem; }
.till { display: flex; justify-content: space-around; align-items: center; gap: 14px; flex-wrap: wrap; }
.cust-big { width: 150px; position: relative; }
.hand { min-height: 60px; background: #fff8ec; border: 2px dashed #c9a77a; border-radius: 16px; display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; cursor: pointer; }
.till-box { background: #27385f; color: #fff; border-radius: 20px; padding: 14px; text-align: center; }
.split { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; font: 800 1.4rem var(--f-body); margin-bottom: 12px; }
.big-milk { width: 70px; height: 110px; }
.sg { display: inline-flex; flex-direction: column; align-items: center; animation: popIn .5s backwards; }
.sg svg { width: 40px; height: 54px; }
.sg em { font-style: normal; color: var(--e); }
.cost-stack { display: flex; gap: 8px; align-items: center; justify-content: center; font: 800 1.4rem var(--f-body); flex-wrap: wrap; margin-bottom: 12px; }
.cost-stack span { background: #fff4cc; border-radius: 14px; padding: 8px 12px; }
.budget { display: grid; gap: 10px; background: var(--cream); padding: 16px; border-radius: 18px; font-weight: 700; }
.b-opt { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.b-opt input { width: 22px; height: 22px; }
.b-bar { position: relative; height: 22px; background: #eee6d8; border-radius: 12px; }
.b-bar i { position: absolute; inset: 0 auto 0 0; background: var(--emerald); border-radius: 12px; transition: width .4s; }
html[dir="rtl"] .b-bar i { inset: 0 0 0 auto; }
.b-bar i.over { background: #e0566f; }
.b-cap { position: absolute; top: -6px; width: 3px; height: 34px; background: #27385f; font-size: 0; }
.b-tot { font-size: 1.3rem; }
.bad-t { color: #e0566f; }

/* logbook + passport */
.logbook { display: grid; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 10px; background: var(--cream); border-radius: 16px; padding: 8px 12px; flex-wrap: wrap; }
.lb-ic { font-size: 1.6rem; }
.lb-name { font-weight: 800; flex: 1; min-width: 140px; }
.lb-faces { display: flex; gap: 6px; }
.face { border: 3px solid transparent; background: #fff; border-radius: 50%; width: 52px; height: 52px; font-size: 1.7rem; cursor: pointer; }
.face.on { border-color: var(--gold); transform: scale(1.15); }
.fav { border: 0; background: none; font-size: 1.8rem; color: #d9d2e4; cursor: pointer; }
.fav.on { color: var(--gold); text-shadow: 0 0 10px #f6c64e; }
.lb-learn textarea { width: 100%; border-radius: 14px; border: 2px solid #d8cfe8; padding: 10px; font: 600 1rem var(--f-body); margin-top: 6px; }
.passport { max-width: 520px; margin: 18px auto 0; background: linear-gradient(160deg, #27385f, #3e5488); color: #fff8ec; border-radius: 22px; padding: 16px; border: 3px solid var(--gold); animation: popIn .6s; }
.pp-head { display: flex; align-items: center; gap: 10px; font: 700 1.3rem 'Cormorant Garamond', serif; color: #ffe9a8; }
.pp-head img { width: 40px; }
.pp-body { display: grid; grid-template-columns: 100px 1fr auto; gap: 12px; align-items: center; margin-top: 10px; }
.pp-av { background: #fff8ec; border-radius: 16px; }
.pp-av svg { width: 100%; display: block; }
.pp-name { font-size: 1.4rem; font-weight: 800; }
.pp-sess { color: #ffe9a8; font-weight: 700; }
.pp-date { opacity: .8; font-size: .9rem; }
.stamp { width: 96px; height: 96px; border-radius: 50%; border: 5px double var(--c); color: var(--c); background: #fff8ec; display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(-14deg); animation: stampIn .5s cubic-bezier(.2, 1.8, .4, 1); font-weight: 900; }
.stamp span { font-size: 2.2rem; }
@keyframes stampIn { from { transform: scale(3) rotate(10deg); opacity: 0; } }

/* colouring */
.color-wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.color-pic { width: 100%; height: auto; border-radius: 22px; box-shadow: var(--shadow); touch-action: manipulation; }
.rg { cursor: pointer; transition: fill .3s; }
.rg.splash { animation: splash .5s; transform-box: fill-box; transform-origin: center; }
@keyframes splash { 40% { transform: scale(1.04); } }
.rg.wrong { animation: shake .4s; }
.rg.wait { opacity: .6; }
.clue { font: 800 17px var(--f-body); fill: #2b2438; pointer-events: none; }
.clue.solved { opacity: .25; }
.alive-fx { opacity: 0; }
.color-pic.alive .alive-fx { opacity: 1; }
.color-pic.alive { animation: alive 3s ease-in-out infinite; }
@keyframes alive { 50% { transform: translateY(-4px); } }
.pots { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
.pot { border: 3px solid transparent; background: #fff; border-radius: 18px; padding: 6px 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; min-width: 80px; box-shadow: 0 3px 10px rgba(0, 0, 0, .07); font-family: var(--f-body); }
.pot-jar { width: 44px; height: 40px; border-radius: 6px 6px 14px 14px; background: var(--pc); position: relative; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12); }
.pot-jar::before { content: ""; position: absolute; top: -8px; left: -4px; right: -4px; height: 10px; border-radius: 6px; background: #c9c3d8; }
.pot b { font-size: 1.15rem; }
.pot small { font-size: .78rem; color: var(--ink-soft); }
.pot.on { border-color: var(--pc); transform: translateY(-4px) scale(1.05); }
.free-pal { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.pot.free { min-width: 0; padding: 4px; }
.pot.free .pot-jar { width: 30px; height: 28px; }

/* challenges */
.memo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 560px; margin: 0 auto; }
.mcard { aspect-ratio: 1; border: 0; border-radius: 16px; cursor: pointer; position: relative; background: none; perspective: 600px; padding: 0; font-family: var(--f-body); }
.mcard span { position: absolute; inset: 0; border-radius: 16px; display: grid; place-items: center; backface-visibility: hidden; transition: transform .4s; padding: 4px; }
.mcard .back { background: linear-gradient(135deg, var(--navy), var(--m)); color: var(--gold); font-size: 2rem; }
.mcard .front { background: #fff8ec; border: 3px solid var(--gold); transform: rotateY(180deg); font-size: clamp(.8rem, 2vw, 1.8rem); font-weight: 800; text-align: center; line-height: 1.15; }
.mcard.up .back { transform: rotateY(180deg); }
.mcard.up .front { transform: rotateY(0); }
.mcard.got .front { background: #e8f7ef; border-color: var(--emerald); }
.moves { text-align: center; font-weight: 800; }
.seq-slots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.seq-slot { width: 110px; min-height: 110px; border: 3px dashed #c9c3d8; border-radius: 18px; display: grid; place-items: center; position: relative; }
.seq-slot > span { position: absolute; top: 4px; inset-inline-start: 8px; font-weight: 800; color: #c9c3d8; }
.seq-cards { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.seq-card { width: 104px; border: 3px solid #eadfcf; background: #fff; border-radius: 16px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; font-family: var(--f-body); }
.seq-card span { font-size: 2.4rem; }
.catch { text-align: center; }
.catch canvas { width: 100%; max-width: 420px; border-radius: 20px; box-shadow: var(--shadow); touch-action: none; }
.c-score { font: 800 1.4rem var(--f-body); }
.robo { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.grid { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); width: min(320px, 80vw); aspect-ratio: 1; background: #e7f2ef; border-radius: 16px; overflow: hidden; }
.cell { border: 1px solid #cfe3dc; display: grid; place-items: center; font-size: 1.6rem; }
.cell.goal { background: #fff4cc; color: var(--gold); }
.bot { position: absolute; width: 20%; height: 20%; display: grid; place-items: center; font-size: 2rem; transition: left .3s, top .3s; }
html[dir="rtl"] .grid { direction: ltr; }
.prog { min-height: 52px; background: #27385f; color: #fff; border-radius: 14px; padding: 10px; font-size: 1.4rem; word-break: break-all; }
.arrows { display: flex; gap: 8px; margin: 10px 0; }
.arrows button { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 14px; border: 0; background: var(--cream); cursor: pointer; box-shadow: 0 4px 0 #d8b064; }
.code-btns { display: flex; gap: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .portals, .cover, .badge-maker, .lab, .color-wrap, .lab2, .robo { grid-template-columns: 1fr; }
  .map-cards { grid-template-columns: 1fr; }
  .worlds { grid-template-columns: repeat(3, 1fr); }
  .cups4 { grid-template-columns: repeat(2, 1fr); }
  .fill-row { grid-template-columns: 1fr; }
  .thermo-lab { grid-template-columns: 100px 1fr; }
  .roles { grid-template-columns: 1fr; }
  .memo { grid-template-columns: repeat(3, 1fr); }
  .stepper em { display: none; }
  .talk-av { width: 64px; }
  .pp-body { grid-template-columns: 80px 1fr; }
  .stamp { grid-column: 1 / -1; justify-self: center; }
  .coin-game { grid-template-columns: 1fr; }
  .coin-bank { flex-direction: row; justify-content: center; }
  .level-pill { display: none; }
}
@media (max-width: 520px) {
  .cups3 { grid-template-columns: 1fr; }
  .shelf, .baskets { grid-template-columns: 1fr; }
  .worlds { grid-template-columns: repeat(2, 1fr); }
  .steam-sign span { width: 44px; height: 44px; font-size: 1.6rem; }
}
.clue.sm { font-size: 13px; }
.map-wrap { min-width: 0; } .map-wrap > * { min-width: 0; } .lvmap.road-svg { min-width: 0; }
