/* =====================================================================
   Math Adventure – playful, child-friendly theme
   ===================================================================== */
:root {
  --bg1: #e0f2ff; --bg2: #fff4e0; --ink: #2d3436; --muted: #6b7a80; --card: #ffffff;
  --pri: #6c5ce7; --pri-d: #4b3cc4; --ok: #00b894; --ok-d: #00916f; --bad: #e17055; --bad-d: #c0503a;
  --yellow: #fdcb6e; --pink: #fd79a8; --blue: #0984e3; --line: #e8ecf1;
  --r: 22px; --sh: 0 6px 0 rgba(0,0,0,.06), 0 10px 30px rgba(60,80,140,.12);
  --c1: #6c5ce7; --c2: #d6d0ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'Baloo 2', 'Nunito', system-ui, 'Segoe UI', Roboto, sans-serif; color: var(--ink);
  background: linear-gradient(180deg, var(--bg1), var(--bg2)) fixed; min-height: 100vh; font-size: 18px; line-height: 1.35;
  overscroll-behavior-y: none;
}
#bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; background:
  radial-gradient(circle at 8% 15%, rgba(255,255,255,.9) 0 40px, transparent 41px),
  radial-gradient(circle at 12% 14%, rgba(255,255,255,.9) 0 30px, transparent 31px),
  radial-gradient(circle at 88% 8%, rgba(255,255,255,.8) 0 50px, transparent 51px),
  radial-gradient(circle at 93% 9%, rgba(255,255,255,.8) 0 34px, transparent 35px),
  radial-gradient(circle at 75% 85%, rgba(253,203,110,.18) 0 160px, transparent 161px),
  radial-gradient(circle at 15% 80%, rgba(108,92,231,.10) 0 200px, transparent 201px); }
#app { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 0 16px 110px; }
button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font-family: inherit; font-size: inherit; }
h1, h2, h3 { margin: .2em 0 .3em; line-height: 1.15; }
h1 { font-size: 30px; } h2 { font-size: 24px; } h3 { font-size: 20px; }
.muted { color: var(--muted); } .center { text-align: center; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 18px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2000; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 16px; background: #fff; font-weight: 700; box-shadow: 0 4px 0 #d5dbe3; border: 2px solid #e3e8ee; transition: transform .1s; min-height: 48px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d5dbe3; }
.btn.primary { background: var(--pri); color: #fff; border-color: var(--pri); box-shadow: 0 5px 0 var(--pri-d); }
.btn.primary:active { box-shadow: 0 2px 0 var(--pri-d); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); box-shadow: 0 5px 0 var(--bad-d); }
.btn.big { font-size: 21px; padding: 12px 26px; min-height: 56px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-check { display: flex; margin: 16px auto 0; background: var(--ok); color: #fff; border-radius: 18px; font-weight: 800; font-size: 22px; padding: 10px 34px; box-shadow: 0 5px 0 var(--ok-d); min-height: 56px; align-items: center; }
.btn-check:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ok-d); }
.btn-check:disabled { opacity: .45; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
.link { color: var(--pri); font-weight: 700; font-size: 16px; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------- top bar & nav ---------- */
#topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 0 10px; background: linear-gradient(180deg, var(--bg1) 70%, transparent); }
.tb-me { display: flex; align-items: center; gap: 8px; text-align: left; }
.tb-name { display: flex; flex-direction: column; line-height: 1.05; }
.tb-name b { font-size: 18px; } .tb-name small { font-size: 13px; color: var(--muted); }
.tb-wallet { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: #fff; border-radius: 999px; padding: 3px 12px; font-size: 16px; box-shadow: 0 2px 0 rgba(0,0,0,.06); white-space: nowrap; }
.pill.star b { color: #e1a100; } .pill.coin b { color: #d68400; } .pill.dia b { color: #0984e3; }
.tb-tools { display: flex; gap: 6px; }
.tb-btn { background: #fff; border-radius: 14px; padding: 6px 10px; box-shadow: 0 2px 0 rgba(0,0,0,.08); font-weight: 700; font-size: 15px; min-height: 40px; }
.avatar { position: relative; display: inline-grid; place-items: center; width: 46px; height: 46px; font-size: 30px; background: linear-gradient(135deg, #ffeaa7, #fab1a0); border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.12); }
.avatar .acc { position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 22px; }
.avatar.xl { width: 110px; height: 110px; font-size: 70px; border-width: 5px; }
.avatar.xl .acc { font-size: 48px; top: -34px; }
#bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; display: flex; justify-content: center; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); box-shadow: 0 -4px 20px rgba(0,0,0,.08); border-radius: 22px 22px 0 0; }
.nav-b { display: flex; flex-direction: column; align-items: center; padding: 4px 12px; border-radius: 14px; min-width: 64px; }
.nav-b span { font-size: 26px; line-height: 1.1; } .nav-b small { font-size: 12px; font-weight: 700; color: var(--muted); }
.nav-b.on { background: #efecff; } .nav-b.on small { color: var(--pri); }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; margin-top: 6px; background: linear-gradient(135deg, #fff 0%, #fff 55%, color-mix(in srgb, var(--wc) 18%, #fff) 100%); position: relative; overflow: hidden; }
.hero-left { position: relative; padding: 18px 10px 0; }
.hero-left .pet { position: absolute; right: -14px; bottom: -6px; font-size: 44px; }
.hero h1 { font-size: 34px; margin: 0; }
.level-chip { background: #efecff; color: var(--pri); font-weight: 800; border-radius: 999px; padding: 4px 14px; margin: 6px 0; font-size: 16px; }
.speech { background: #f5f7fb; border-radius: 16px; padding: 8px 14px; margin: 6px 0 12px; font-size: 16px; position: relative; }
.hero-right { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ring { --p: 0; width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ok) calc(var(--p) * 360deg), #e9eef3 0); }
.ring > div { width: 84px; height: 84px; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ring b { font-size: 30px; } .ring small { font-size: 12px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.daily-card, .map-card { display: flex; gap: 14px; align-items: center; cursor: pointer; transition: transform .15s; }
.daily-card:hover, .map-card:hover { transform: translateY(-3px); }
.daily-card { background: linear-gradient(135deg, #ff9f43, #feca57); color: #4a2a00; }
.daily-card.done { background: linear-gradient(135deg, #55efc4, #81ecec); color: #00473a; }
.daily-card h3, .map-card h3 { margin: 0; } .daily-card p, .map-card p { margin: 2px 0; font-size: 16px; }
.dc-ic { font-size: 54px; } .streak { font-weight: 800; font-size: 15px; background: rgba(255,255,255,.5); padding: 2px 10px; border-radius: 99px; }
.map-card { background: linear-gradient(135deg, #74b9ff, #a29bfe); color: #fff; }
.mini-map { display: grid; grid-template-columns: repeat(4, 1fr); font-size: 26px; gap: 2px; background: rgba(255,255,255,.25); border-radius: 14px; padding: 6px; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.card.mini { padding: 10px; text-align: center; } .card.mini b { display: block; font-size: 24px; } .card.mini small { color: var(--muted); font-size: 13px; }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 24px 0 10px; font-size: 24px; }
.sec-title .link { margin-left: auto; }
.world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.wcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px 12px; border-radius: var(--r); background: linear-gradient(160deg, var(--c2), #fff 75%); box-shadow: var(--sh); border: 3px solid #fff; text-align: center; transition: transform .15s; }
.wcard:hover { transform: translateY(-4px) rotate(-1deg); }
.wcard .w-ic { font-size: 50px; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.wcard b { font-size: 17px; line-height: 1.1; color: color-mix(in srgb, var(--c1) 80%, #000); }
.wcard small { font-size: 13px; color: var(--muted); }
.wcard.locked { filter: grayscale(.8); opacity: .75; }
.w-prog { width: 80%; height: 8px; border-radius: 9px; background: #eef1f5; overflow: hidden; }
.w-prog i { display: block; height: 100%; background: var(--c1, var(--ok)); border-radius: 9px; }
.badge-strip { display: flex; gap: 14px; flex-wrap: wrap; }
.badge-mini { display: inline-flex; flex-direction: column; align-items: center; font-size: 38px; width: 86px; text-align: center; }
.badge-mini small { font-size: 12px; line-height: 1.1; color: var(--muted); }

/* ---------- welcome ---------- */
.welcome { max-width: 620px; margin: 30px auto; text-align: center; }
.welcome-hero { font-size: 70px; display: flex; justify-content: center; gap: 16px; }
.field { margin: 16px 0; text-align: left; } .field label { display: block; font-weight: 800; margin-bottom: 6px; }
.field input, .gate input { width: 100%; border: 3px solid var(--line); border-radius: 16px; padding: 10px 14px; font-size: 22px; outline: none; }
.field input:focus, .gate input:focus { border-color: var(--pri); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { padding: 8px 16px; border-radius: 14px; background: #f1f3f7; font-weight: 700; min-height: 46px; border: 3px solid transparent; }
.seg button.on { background: #efecff; border-color: var(--pri); color: var(--pri); }
.seg.ages button { width: 56px; font-size: 22px; }
.av-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.av-grid button { font-size: 34px; width: 58px; height: 58px; border-radius: 50%; background: #f1f3f7; border: 3px solid transparent; }
.av-grid button.on { border-color: var(--pri); background: #efecff; transform: scale(1.1); }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 1000; background: rgba(30,30,60,.45); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { position: relative; background: #fff; border-radius: 26px; padding: 26px 22px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; text-align: center; animation: popIn .3s; }
.modal-x { position: absolute; top: 10px; right: 12px; font-size: 22px; width: 40px; height: 40px; border-radius: 50%; background: #f1f3f7; }
.lv-list { display: grid; gap: 8px; text-align: left; margin: 10px 0; }
.lv-list.compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.lv-card { display: flex; gap: 12px; align-items: center; background: #f6f7fb; border-radius: 16px; padding: 10px 14px; border: 3px solid transparent; text-align: left; }
.lv-card span { font-size: 32px; } .lv-card small { display: block; color: var(--muted); font-size: 14px; }
.lv-card.on { border-color: var(--pri); background: #efecff; }
.toggle { display: flex; align-items: center; gap: 12px; margin: 10px 0; cursor: pointer; text-align: left; font-weight: 600; }
.toggle input { display: none; }
.toggle span { flex: none; width: 52px; height: 30px; border-radius: 99px; background: #d5dbe3; position: relative; transition: .2s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--ok); } .toggle input:checked + span::after { left: 25px; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1500; background: #2d3436; color: #fff; border-radius: 18px; padding: 10px 20px; display: flex; gap: 12px; align-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: drop .35s; font-size: 17px; max-width: calc(100% - 32px); }
.toast.out { opacity: 0; transform: translate(-50%, -20px); transition: .4s; }
.toast-ic { font-size: 36px; }

/* ---------- map ---------- */
.page-title { text-align: center; margin-top: 10px; }
.map { position: relative; margin: 10px auto 0; max-width: 760px; padding: 30px 0 40px; background: linear-gradient(180deg, #b8e994 0%, #78e08f 40%, #82ccdd 70%, #a29bfe 100%); border-radius: 36px; box-shadow: inset 0 0 0 6px rgba(255,255,255,.5), var(--sh); overflow: hidden; }
.map-path { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-row { position: relative; height: 128px; }
.map-node { position: absolute; top: 8px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; width: 150px; z-index: 2; }
.mn-ic { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; font-size: 42px; background: radial-gradient(circle at 35% 30%, #fff, var(--c2)); border: 5px solid var(--c1); box-shadow: 0 6px 0 rgba(0,0,0,.15); transition: transform .2s; }
.map-node:hover .mn-ic { transform: scale(1.1) rotate(-5deg); }
.map-node b { background: #fff; padding: 1px 10px; border-radius: 12px; font-size: 15px; margin-top: 4px; box-shadow: 0 2px 0 rgba(0,0,0,.1); text-align: center; line-height: 1.15; }
.map-node small { font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.map-node.locked .mn-ic { filter: grayscale(1); opacity: .8; }
.map-deco span { position: absolute; font-size: 34px; opacity: .85; pointer-events: none; }

/* ---------- world ---------- */
.world-head { display: flex; align-items: center; gap: 16px; padding: 18px; margin-top: 6px; border-radius: var(--r); color: #fff; background: linear-gradient(135deg, var(--c1), color-mix(in srgb, var(--c1) 60%, #fff)); box-shadow: var(--sh); }
.world-head h1 { margin: 0; font-size: 30px; } .world-head p { margin: 2px 0; font-size: 16px; }
.back { font-size: 34px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.25); color: #fff; line-height: 1; flex: none; }
.wh-ic { font-size: 64px; }
.tag { background: rgba(255,255,255,.3); border-radius: 99px; padding: 0 8px; font-size: 13px; }
.stages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stage { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 20px; background: #fff; box-shadow: var(--sh); border: 3px solid #fff; }
.stage b { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--c1); color: #fff; font-size: 24px; }
.stage.cleared { border-color: #ffd32a; } .stage.locked { opacity: .55; } .stage.locked b { background: #b2bec3; }
.stage small { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.1; }
.stg-stars i { font-style: normal; color: #dfe6e9; font-size: 18px; } .stg-stars i.on { color: #ffc312; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tables { margin-bottom: 14px; } .tables > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tbl { padding: 6px 12px; border-radius: 12px; background: #e8f8ef; font-weight: 800; color: #1e824c; min-height: 42px; }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.act { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 14px; border-radius: 20px; background: #fff; box-shadow: var(--sh); border-left: 8px solid var(--c1); transition: transform .15s; min-height: 110px; }
.act:hover { transform: translateY(-3px); }
.act-ic { font-size: 34px; } .act b { font-size: 17px; line-height: 1.15; } .act small { font-size: 13px; color: var(--muted); }
.act.mode { background: linear-gradient(135deg, #fff, var(--c2)); }

/* ---------- play ---------- */
body[data-screen="play"] #app { padding-bottom: 30px; }
.play { max-width: 900px; margin: 0 auto; padding-top: 10px; }
.play-head { display: flex; align-items: center; gap: 12px; }
.quit { width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.08); font-size: 20px; flex: none; }
.ph-mid { flex: 1; min-width: 0; }
.ph-title { font-weight: 800; font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 16px; border-radius: 99px; background: #fff; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.08); }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--c1), color-mix(in srgb, var(--c1) 50%, #fff)); border-radius: 99px; transition: width .4s; }
.hud { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hearts { font-size: 20px; letter-spacing: -2px; }
.timer { background: #fff; border-radius: 99px; padding: 2px 10px; font-weight: 800; } .timer.low { background: var(--bad); color: #fff; animation: pulse .6s infinite; }
.streak-c { font-weight: 800; background: #fff; border-radius: 99px; padding: 2px 10px; } .streak-c.hot { background: #ffeaa7; animation: pulse 1s infinite; }
.mode-banner:empty { display: none; }
.mode-banner { margin-top: 10px; }
.boss { display: flex; align-items: center; gap: 12px; background: #2d3436; color: #fff; border-radius: 18px; padding: 8px 14px; }
.boss-e { font-size: 48px; } .boss-e.hit { animation: hit .5s; }
.hp { flex: 1; height: 18px; background: #555; border-radius: 99px; overflow: hidden; } .hp i { display: block; height: 100%; background: linear-gradient(90deg, #ff7675, #d63031); transition: width .4s; }
.tower, .bonus { text-align: center; background: #fff; border-radius: 16px; padding: 6px; font-weight: 700; }
.bonus { background: linear-gradient(90deg, #ffeaa7, #fab1a0); }
.chests { display: flex; justify-content: center; align-items: center; gap: 4px; font-size: 32px; background: #fff; border-radius: 16px; padding: 4px; flex-wrap: wrap; }
.chests i { font-style: normal; color: #b2bec3; font-size: 18px; }
.q-card { position: relative; margin-top: 12px; padding: 18px 18px 22px; border-top: 8px solid var(--c1); }
.q-card.slide-in { animation: slideIn .35s; }
.q-card.flash-ok { box-shadow: 0 0 0 5px var(--ok), var(--sh); }
.q-card.flash-bad { animation: shakeX .4s; }
.q-top { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.q-skill { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-lv { background: #f1f3f7; border-radius: 99px; padding: 1px 10px; }
.speak { width: 44px; height: 44px; border-radius: 50%; background: #efecff; font-size: 22px; flex: none; }
.q-prompt { font-size: 26px; font-weight: 800; text-align: center; margin: 10px 0 8px; line-height: 1.25; }
.q-visual { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0 10px; }
.q-area { display: flex; flex-direction: column; align-items: center; }
.q-timer { height: 8px; background: #eef1f5; border-radius: 99px; overflow: hidden; margin-top: 14px; } .q-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--ok), var(--yellow), var(--bad)); transition: width .25s linear; }
.mascot-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; min-height: 70px; }
.mascot { font-size: 58px; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); } .mascot.jump { animation: jump .6s; }
.mascot-row .pet { font-size: 36px; }
.bubble { background: #fff; border-radius: 20px 20px 20px 4px; padding: 10px 16px; font-weight: 700; box-shadow: var(--sh); opacity: 0; transform: scale(.8); transform-origin: left bottom; transition: .25s; max-width: 100%; }
.bubble:empty { display: none; } .bubble.show { opacity: 1; transform: none; }
.plus { color: #d68400; white-space: nowrap; }
/* answer sheet: fixed to the bottom of the screen so "Continue" is always visible */
.feedback { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: flex; justify-content: center; padding: 0 10px; animation: sheetUp .3s ease-out; pointer-events: none; }
.feedback::before { content: ''; position: fixed; inset: 0; background: rgba(30,30,60,.18); z-index: -1; pointer-events: auto; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.fb-in { text-align: center; pointer-events: auto; background: #fff; width: 100%; max-width: 720px; max-height: 80vh; display: flex; flex-direction: column; border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); border-top: 6px solid var(--ok); overflow: hidden; }
.fb-body { overflow: auto; min-height: 0; flex: 1 1 auto; padding: 16px 18px 6px; }
.fb-foot { flex: none; padding: 10px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.fb-foot .btn { width: 100%; max-width: 360px; }
.fb-why { text-align: left; background: #f6f9ff; border-radius: 16px; padding: 10px 14px; margin: 0 auto 14px; max-width: 560px; font-size: 17px; }
.fb-why ol { margin: 6px 0 0; padding-left: 22px; } .fb-why li { margin: 4px 0; }
.fb-board { display: block; font-weight: 800; color: var(--pri-d); font-size: 18px; }
.q-card.locked .q-area { pointer-events: none; }
.q-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.q-actions .btn { min-width: 120px; }
.pause-menu { display: grid; gap: 10px; margin-top: 12px; }
.err-card { max-width: 560px; margin: 40px auto; padding: 30px 20px; }
.ws-note { background: #fff8e1; border: 2px solid var(--yellow); border-radius: 14px; padding: 8px 12px; font-size: 15px; margin: -6px 0 12px; } .fb-t { font-size: 22px; font-weight: 800; color: var(--bad); }
.fb-a { font-size: 34px; font-weight: 800; margin: 8px 0 12px; color: var(--ok-d); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.fb-a svg { max-width: 140px; height: auto; }

/* ---------- exercise kinds ---------- */
.k-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 620px; }
.k-choice.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.k-choice.wide { grid-template-columns: 1fr 1fr; }
.k-choice.row { display: flex; flex-wrap: wrap; justify-content: center; }
.k-choice.row.tight .opt { min-width: 56px; padding: 6px; }
.k-choice.tf { grid-template-columns: 1fr 1fr; max-width: 420px; }
.k-choice.symbols { grid-template-columns: repeat(3, 1fr); max-width: 420px; }
.opt { background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 10px; min-height: 70px; font-size: 26px; font-weight: 800; box-shadow: 0 5px 0 #dfe4ea; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: transform .1s, background .2s; }
.opt:hover { border-color: var(--c1); }
.opt:active { transform: translateY(3px); box-shadow: 0 2px 0 #dfe4ea; }
.opt small { font-size: 14px; color: var(--muted); }
.opt.right { background: #d4f8e8; border-color: var(--ok); box-shadow: 0 5px 0 var(--ok); animation: popIn .3s; }
.opt.wrong { background: #ffe3dc; border-color: var(--bad); opacity: .65; }
.k-choice.wide .opt { font-size: 20px; }
.k-choice .opt .objs { padding: 0; }
.sym { font-size: 46px; line-height: 1; }
.eq-line { font-size: 36px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.ans-box { display: inline-flex; align-items: center; gap: 2px; min-width: 84px; min-height: 60px; padding: 0 12px; border: 4px dashed #b2bec3; border-radius: 16px; background: #fff; justify-content: center; color: var(--pri); }
.ans-box.filled { border-style: solid; border-color: var(--pri); }
.ans-box.right { border-color: var(--ok); color: var(--ok-d); background: #e1fbef; }
.ans-box.wrong { border-color: var(--bad); color: var(--bad); }
.ans-pre, .ans-suf { font-size: .7em; color: var(--muted); }
.eq-line.solo .ans-box { min-width: 150px; font-size: 40px; }
.numpad { display: grid; grid-template-columns: repeat(3, 76px); gap: 10px; }
.numpad button { height: 62px; border-radius: 18px; background: #fff; font-size: 30px; font-weight: 800; box-shadow: 0 5px 0 #d5dbe3; border: 2px solid #e3e8ee; }
.numpad button:active { transform: translateY(3px); box-shadow: 0 2px 0 #d5dbe3; }
.numpad .np-del { background: #ffeaa7; } .numpad .np-ok { background: var(--ok); color: #fff; box-shadow: 0 5px 0 var(--ok-d); border-color: var(--ok); }
.k-tap { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 700px; }
.tap-item { min-width: 70px; min-height: 70px; border-radius: 18px; background: #fff; border: 3px solid var(--line); font-size: 40px; display: grid; place-items: center; padding: 4px; box-shadow: 0 4px 0 #dfe4ea; transition: transform .1s; }
.k-tap.nums .tap-item { font-size: 28px; font-weight: 800; min-width: 80px; }
.tap-item.sel { border-color: var(--pri); background: #efecff; transform: scale(1.06); }
.tap-item.right { border-color: var(--ok); background: #d4f8e8; }
.tap-item.wrong { border-color: var(--bad); background: #ffe3dc; }
.tap-count { margin-top: 8px; color: var(--muted); font-weight: 700; }
.k-slots { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.slot-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 34px; font-weight: 800; }
.slot-row.arrows .slot:not(:last-of-type)::after { content: '›'; position: absolute; right: -14px; color: #b2bec3; font-size: 26px; }
.slot { position: relative; min-width: 76px; min-height: 76px; border: 4px dashed #b2bec3; border-radius: 18px; display: grid; place-items: center; background: #fafbfc; }
.slot.full { border-style: solid; border-color: var(--c1); background: #fff; }
.slot.right { border-color: var(--ok); background: #e1fbef; } .slot.wrong { border-color: var(--bad); background: #ffe3dc; }
.slot .tile { box-shadow: none; border: 0; background: transparent; }
.tile-pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 84px; padding: 10px; border-radius: 20px; background: #f4f6fb; width: 100%; max-width: 640px; }
.tile { min-width: 66px; min-height: 66px; padding: 4px 10px; border-radius: 16px; background: #fff; border: 3px solid #dfe4ea; box-shadow: 0 4px 0 #d5dbe3; display: grid; place-items: center; font-size: 28px; font-weight: 800; cursor: grab; user-select: none; touch-action: none; }
.tile.dragging { opacity: .3; } .tile.picked { border-color: var(--pri); transform: scale(1.08); background: #efecff; }
.tile.right { border-color: var(--ok); } .tile.wrong { border-color: var(--bad); background: #ffe3dc; }
.ghost { position: fixed; z-index: 3000; pointer-events: none; transform: scale(1.12) rotate(-3deg); box-shadow: 0 12px 24px rgba(0,0,0,.25); }
.rt { display: flex; flex-direction: column; align-items: center; font-size: 34px; line-height: 1; } .rt small { font-size: 12px; font-weight: 700; }
.k-sort { width: 100%; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.bins { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 700px; }
.bin { border: 4px dashed var(--bc); border-radius: 22px; min-height: 140px; padding: 8px; background: color-mix(in srgb, var(--bc) 10%, #fff); cursor: pointer; }
.bin-lab { font-weight: 800; text-align: center; color: color-mix(in srgb, var(--bc) 70%, #000); margin-bottom: 6px; }
.bin-items { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.bin-items .tile { min-width: 56px; min-height: 56px; font-size: 22px; }
.k-match { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 60px; width: 100%; max-width: 620px; }
.match-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.mcol { display: flex; flex-direction: column; gap: 10px; z-index: 2; }
.mcard { min-height: 70px; border-radius: 18px; background: #fff; border: 3px solid var(--line); box-shadow: 0 4px 0 #dfe4ea; font-size: 22px; font-weight: 800; padding: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.mcard small { font-size: 13px; color: var(--muted); }
.mcard.sel { border-color: var(--pri); background: #efecff; transform: scale(1.04); }
.mcard.done { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 18%, #fff); box-shadow: 0 4px 0 var(--mc); }
.hint-line { color: var(--muted); font-size: 15px; text-align: center; margin-top: 8px; font-weight: 600; }
.k-memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; max-width: 560px; }
.k-memory.c12 { grid-template-columns: repeat(4, 1fr); }
.mem { aspect-ratio: 1 / .85; perspective: 600px; padding: 0; }
.mem-in { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.mem.flip .mem-in { transform: rotateY(180deg); }
.mem-front, .mem-back { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; backface-visibility: hidden; font-weight: 800; }
.mem-front { background: linear-gradient(135deg, var(--c1), color-mix(in srgb, var(--c1) 50%, #fff)); font-size: 30px; box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.mem-back { background: #fff; border: 3px solid var(--line); transform: rotateY(180deg); font-size: 22px; padding: 4px; }
.mem.done .mem-back { border-color: var(--ok); background: #e1fbef; }
.k-clock { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: center; }
.clock-holder svg { cursor: grab; touch-action: none; }
.clock-ctrl { display: flex; flex-direction: column; gap: 10px; }
.clock-ctrl div { display: flex; align-items: center; gap: 8px; } .clock-ctrl span { width: 110px; font-weight: 700; }
.clock-ctrl button { width: 54px; height: 50px; border-radius: 14px; background: #fff; box-shadow: 0 4px 0 #d5dbe3; border: 2px solid #e3e8ee; font-size: 20px; }
.k-frac svg { cursor: pointer; max-width: 100%; height: auto; } .k-frac .fp { transition: fill .15s; } .k-frac .fp:hover { opacity: .85; }
.k-nl { width: 100%; } .k-nl svg { width: 100%; height: auto; cursor: pointer; touch-action: none; }
.q-visual > svg.nl, .q-visual svg.nl { width: 100%; max-width: 660px; height: auto; }
.q-visual { width: 100%; }
.k-sudoku { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; }
.sud-grid { display: grid; gap: 0; border: 4px solid #2d3436; border-radius: 12px; overflow: hidden; background: #2d3436; }
.sud-c { width: 64px; height: 64px; background: #fff; border-right: 1px solid #b2bec3; border-bottom: 1px solid #b2bec3; font-size: 30px; font-weight: 800; color: var(--pri); }
.s6 .sud-c { width: 52px; height: 52px; font-size: 26px; }
.sud-c.br { border-right: 4px solid #2d3436; } .sud-c.bb { border-bottom: 4px solid #2d3436; }
.sud-c.given { background: #f1f3f7; color: var(--ink); cursor: default; }
.sud-c.sel { background: #ffeaa7; } .sud-c.bad { background: #ffd1c7; }
.sud-pal { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; }
.sud-p { height: 60px; border-radius: 16px; background: #fff; box-shadow: 0 4px 0 #d5dbe3; border: 2px solid #e3e8ee; font-size: 28px; font-weight: 800; }
.sud-p.erase { background: #ffeaa7; }
.k-coins { width: 100%; max-width: 680px; display: flex; flex-direction: column; gap: 12px; }
.coin-pal { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; background: #f4f6fb; border-radius: 20px; padding: 12px; }
.coin-pal .money { cursor: pointer; transition: transform .1s; } .coin-pal .money:active { transform: scale(.9); }
.coin-tray { min-height: 110px; border: 4px dashed #b2bec3; border-radius: 22px; padding: 10px; background: #fffdf3; }
.tray-items { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; min-height: 60px; }
.tray-items .money { cursor: pointer; transform: scale(.85); }
.tray-empty { color: var(--muted); font-size: 15px; } .tray-total { text-align: center; font-size: 20px; margin-top: 6px; }
.money { display: inline-flex; vertical-align: middle; }
.money.note { flex-direction: column; align-items: center; justify-content: center; width: 104px; height: 54px; border-radius: 8px; background: linear-gradient(135deg, var(--nc), color-mix(in srgb, var(--nc) 60%, #fff)); border: 3px solid color-mix(in srgb, var(--nc) 70%, #000); box-shadow: 0 3px 0 rgba(0,0,0,.15); line-height: 1; color: #1e272e; }
.money.note b { font-size: 18px; } .money.note i { font-size: 10px; font-style: normal; }
.money-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.money-row.sm .money { transform: scale(.8); margin: -4px; }
.purses { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; } .purses > div { background: #f6f7fb; border-radius: 18px; padding: 8px; text-align: center; }
.k-balance { width: 100%; display: flex; justify-content: center; }
.bal-ctrl { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.bal-ctrl button { width: 64px; height: 56px; border-radius: 16px; background: #fff; font-size: 30px; font-weight: 800; box-shadow: 0 4px 0 #d5dbe3; border: 2px solid #e3e8ee; }
.bal-x { font-size: 34px; font-weight: 800; min-width: 60px; text-align: center; }
.balance { position: relative; width: 340px; max-width: 100%; height: 200px; margin: 10px auto; }
.beam { position: absolute; left: 20px; right: 20px; top: 40px; height: 10px; background: #8e6e53; border-radius: 6px; transition: transform .5s cubic-bezier(.3,1.6,.6,1); transform-origin: 50% 50%; }
.pan { position: absolute; top: 4px; width: 120px; display: flex; flex-direction: column; align-items: center; transition: transform .5s cubic-bezier(.3,1.6,.6,1); transform-origin: 50% 0; }
.pan-l { left: -40px; } .pan-r { right: -40px; }
.pan-items { position: absolute; bottom: 100%; display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; align-items: flex-end; width: 130px; margin-bottom: -4px; }
.pan::before { content: ''; position: absolute; top: 0; height: 64px; width: 2px; background: #8e6e53; left: 50%; }
.pan-dish { margin-top: 62px; width: 120px; height: 20px; background: linear-gradient(#ffd166, #e09f3e); border-radius: 0 0 60px 60px; }
.pan-items { bottom: auto; top: 36px; }
.fulcrum { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); width: 0; height: 0; border-left: 34px solid transparent; border-right: 34px solid transparent; border-bottom: 140px solid #b08968; }
.weight { display: inline-grid; place-items: center; min-width: 40px; height: 34px; padding: 0 6px; background: #636e72; color: #fff; border-radius: 8px 8px 4px 4px; font-weight: 800; font-size: 18px; }
.weight.w2 { background: #0984e3; } .weight.big { font-size: 15px; }
.weight-e { font-size: 24px; }
.mid-emoji { font-size: 40px; line-height: 1; }
.k-graph { display: grid; gap: 4px; align-items: end; max-width: 520px; width: 100%; }
.g-ax { font-size: 13px; color: var(--muted); text-align: right; padding-right: 4px; }
.g-cell { height: 30px; border-radius: 6px; background: #eef1f5; border: 2px solid #fff; }
.g-cell.on { background: var(--gc); }
.g-lab { text-align: center; font-size: 30px; }
.k-maze { display: grid; gap: 6px; width: 100%; max-width: 480px; }
.mz-c { aspect-ratio: 1; border-radius: 14px; background: #fff; border: 3px solid var(--line); font-weight: 800; font-size: clamp(14px, 3.4vw, 22px); box-shadow: 0 3px 0 #dfe4ea; position: relative; }
.mz-c.vis { background: #d4f8e8; border-color: var(--ok); }
.mz-c.cur::after { content: '🐭'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; background: rgba(212,248,232,.85); border-radius: 10px; }
.mz-c.goal { background: #fff3c4; } .mz-c.wrong { background: #ffd1c7; }
.k-cross { display: grid; gap: 6px; max-width: 380px; width: 100%; }
.cx-c { aspect-ratio: 1; display: grid; place-items: center; font-size: 26px; font-weight: 800; border-radius: 12px; }
.cx-c.num { background: #fff; border: 3px solid var(--line); } .cx-c.op { color: var(--pri); }
.cx-in { width: 100%; height: 100%; text-align: center; font-size: 24px; font-weight: 800; border: 3px dashed var(--pri); border-radius: 12px; outline: none; color: var(--pri); padding: 0; }
.cx-in.bad { border-color: var(--bad); background: #ffe3dc; }

/* ---------- visuals ---------- */
.objs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; max-width: 640px; padding: 6px; }
.obj { position: relative; display: inline-block; line-height: 1.05; transition: transform .15s, opacity .2s; user-select: none; }
.tapcount .obj, .tapx .obj { cursor: pointer; }
.obj.counted { transform: scale(.9); filter: saturate(.6); }
.obj.counted::after { content: attr(data-n); position: absolute; top: -6px; right: -6px; background: var(--pri); color: #fff; font-size: 13px; font-weight: 800; border-radius: 99px; min-width: 22px; height: 22px; display: grid; place-items: center; line-height: 1; }
.obj.crossed { opacity: .35; } .obj.crossed::before { content: '✖'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--bad); font-size: .8em; opacity: 1; z-index: 2; }
.pop-in { animation: popIn .4s backwards; }
.groups { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.grp { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 8px; border: 3px dashed #a29bfe; border-radius: 50%/40%; min-width: 60px; max-width: 160px; background: #f8f7ff; }
.grp.carton { border-radius: 12px; border: 4px solid #d1a46a; background: #f6e3c6; max-width: 130px; }
.grp-sep { font-size: 28px; font-weight: 800; }
.tenframes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tenframe { display: grid; grid-template-columns: repeat(5, 36px); grid-template-rows: repeat(2, 36px); border: 3px solid #2d3436; border-radius: 6px; background: #fff; }
.tf-cell { border: 1px solid #b2bec3; display: grid; place-items: center; } .tf-cell i { width: 24px; height: 24px; border-radius: 50%; }
.base10 { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: center; max-width: 640px; }
.b100 { display: grid; grid-template-columns: repeat(10, 7px); gap: 1px; background: #c0392b; padding: 2px; border-radius: 2px; } .b100 i { width: 7px; height: 7px; background: #ff7675; }
.b10s { display: flex; gap: 4px; } .b10 { display: grid; grid-template-rows: repeat(10, 10px); gap: 1px; background: #0652dd; padding: 2px; border-radius: 2px; } .b10 i { width: 12px; background: #74b9ff; }
.b1s { display: grid; grid-template-columns: repeat(3, 14px); gap: 3px; } .b1 { width: 14px; height: 14px; background: #fdcb6e; border: 2px solid #e1a100; border-radius: 2px; }
.legend { font-size: 14px; color: var(--muted); }
.cuberow { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; max-width: 600px; }
.cube { width: 32px; height: 32px; border-radius: 4px; border: 3px solid rgba(0,0,0,.25); }
.hands { display: flex; gap: 6px; justify-content: center; max-width: 100%; } .hand { width: 92px; max-width: calc(50% - 3px); height: auto; }
svg.blocks { display: block; margin: 0 auto; }
.dominos svg { width: 70px; height: auto; }
.pic-eq { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.pic-eq.col { gap: 18px; }
.pic-eq .objs { max-width: 260px; background: #f8f9fc; border-radius: 18px; }
.op { font-size: 36px; font-weight: 800; color: var(--pri); }
.eq-small { font-size: 22px; font-weight: 800; color: var(--muted); }
.eq-big { font-size: 38px; font-weight: 800; text-align: center; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.eq-big input { width: 110px; text-align: center; font-weight: 800; }
.blank { display: inline-grid; place-items: center; width: 60px; height: 60px; border: 4px dashed #b2bec3; border-radius: 14px; color: #b2bec3; }
.fr { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-weight: 800; vertical-align: middle; }
.fr b { padding: 0 6px 3px; border-bottom: 3px solid currentColor; } .fr i { font-style: normal; padding-top: 3px; }
.fr .ans-box { min-width: 56px; min-height: 48px; font-size: .9em; }
.column { display: inline-block; font-size: 38px; font-weight: 800; font-family: 'Baloo 2', monospace; background: #fffdf3; border-radius: 16px; padding: 8px 18px; border: 3px solid #ffeaa7; }
.col-row { display: flex; justify-content: flex-end; position: relative; } .col-row span { width: 30px; text-align: center; }
.col-op { position: absolute; left: -6px; color: var(--pri); } .col-line { border-top: 4px solid #2d3436; margin: 4px 0; }
.col-row.q span:last-child { color: #b2bec3; }
.bond { display: flex; flex-direction: column; align-items: center; width: 220px; }
.bond-c { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 800; background: #fff; border: 4px solid var(--c1); }
.bond-c.q { border-style: dashed; color: #b2bec3; }
.bond-lines { width: 200px; height: 40px; } .bond-bot { display: flex; justify-content: space-between; width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.chip { min-width: 62px; height: 62px; padding: 0 8px; border-radius: 50%; display: inline-grid; place-items: center; background: #fff; border: 4px solid var(--c1); font-size: 24px; font-weight: 800; }
.chips .ans-box { min-width: 70px; border-radius: 50%; }
.shape-big { display: flex; justify-content: center; } .shape-big svg { max-width: 100%; height: auto; }
.big-emoji { font-size: 80px; line-height: 1.1; text-align: center; }
.shadow { filter: brightness(0) opacity(.75); }
.scatter { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; max-width: 560px; background: #f8f9fc; border-radius: 20px; padding: 10px; }
.rect-dim { position: relative; padding: 10px 50px 30px 10px; }
.rect-box { background: #81ecec; border: 4px solid #00a8a8; border-radius: 4px; }
.dim-w { position: absolute; bottom: 0; left: 10px; right: 50px; text-align: center; font-weight: 800; }
.dim-h { position: absolute; right: 0; top: 40%; font-weight: 800; }
.pos-row { display: flex; gap: 6px; font-size: 48px; } .pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #dfe6e9; padding: 4px; border-radius: 14px; }
.pos-grid span { width: 64px; height: 64px; display: grid; place-items: center; background: #fff; border-radius: 10px; font-size: 38px; }
.pos-grid.g5 span { width: 52px; height: 52px; font-size: 30px; }
.arrows-seq { font-size: 34px; background: #fff3c4; border-radius: 14px; padding: 4px 12px; }
.grow { display: inline-block; line-height: 1; }
.digital { font-family: 'Courier New', monospace; font-weight: 800; background: #2d3436; color: #55efc4; padding: 4px 12px; border-radius: 10px; font-size: 26px; letter-spacing: 1px; }
.week { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; } .week span { background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 2px 8px; font-weight: 700; font-size: 15px; }
.week span.today { background: var(--yellow); border-color: #e1a100; }
.cal { background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 8px; max-width: 360px; width: 100%; }
.cal-title { text-align: center; font-weight: 800; background: var(--bad); color: #fff; border-radius: 10px; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 15px; }
.cal-h { font-weight: 800; color: var(--muted); font-size: 12px; } .cal-d { padding: 4px 0; border-radius: 8px; } .cal-d.hl { background: var(--yellow); font-weight: 800; }
.shop { width: 100%; max-width: 640px; border-radius: 22px; overflow: hidden; box-shadow: var(--sh); background: #fff; }
.shop-awning { height: 26px; background: repeating-linear-gradient(90deg, #ff7675 0 30px, #fff 30px 60px); border-bottom: 4px solid #d63031; border-radius: 0 0 14px 14px; }
.shop-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; padding: 10px; background: linear-gradient(#fff 80%, #f3e5d0); }
.shop-item { display: flex; flex-direction: column; align-items: center; background: #fffaf0; border-radius: 14px; padding: 6px; border: 2px solid #f6e3c6; }
.si-e { font-size: 38px; } .si-n { font-size: 13px; text-align: center; line-height: 1.1; }
.price-tag { background: var(--yellow); border-radius: 8px; padding: 0 8px; font-weight: 800; font-size: 16px; margin-top: 2px; }
.data-title { font-weight: 800; text-align: center; color: var(--muted); font-size: 16px; }
.picto { background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 8px 12px; }
.picto-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.picto-lab { font-size: 32px; width: 44px; } .picto-icons { font-size: 22px; letter-spacing: 2px; }
.picto-key { text-align: right; font-size: 14px; font-weight: 800; color: var(--pri); }
.barchart { width: 100%; max-width: 380px; height: auto; }
.tally { max-width: 100%; height: auto; }
.ruler { width: 100%; max-width: 640px; height: auto; }
.array { display: inline-grid; gap: 4px; background: #f8f9fc; padding: 10px; border-radius: 14px; font-size: 26px; }
.pattern { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 40px; background: #f8f9fc; border-radius: 20px; padding: 10px; }
.pattern span { line-height: 1.1; } .pq { display: inline-grid; place-items: center; width: 52px; height: 52px; border: 4px dashed var(--c1); border-radius: 12px; font-size: 30px; font-weight: 800; color: var(--c1); }
.grow-row { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; justify-content: center; }
.gfig { display: flex; flex-direction: column; align-items: flex-start; font-size: 22px; line-height: 1; } .gfig small { align-self: center; font-size: 14px; color: var(--muted); margin-top: 4px; }
.gfig.q { font-size: 40px; color: var(--c1); align-items: center; }
.riddle { background: #fff8e1; border: 3px dashed #f6b93b; border-radius: 18px; padding: 8px 18px; font-size: 20px; max-width: 560px; }
.riddle p { margin: 4px 0; }
.machine { border-collapse: separate; border-spacing: 6px; font-size: 24px; font-weight: 800; }
.machine th { font-size: 16px; color: var(--muted); text-align: right; } .machine td { background: #fff; border: 3px solid var(--line); border-radius: 12px; width: 60px; height: 50px; text-align: center; }
.sym-eqs { font-size: 32px; font-weight: 800; background: #f8f9fc; border-radius: 18px; padding: 8px 20px; text-align: center; }
.story-topic { background: color-mix(in srgb, var(--c1) 15%, #fff); color: color-mix(in srgb, var(--c1) 80%, #000); border-radius: 99px; padding: 2px 14px; font-weight: 800; font-size: 15px; align-self: center; }
.story-cards { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.scard { display: inline-flex; flex-direction: column; align-items: center; background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 4px 14px; font-size: 34px; } .scard b { font-size: 22px; }
.treasure { font-size: 54px; }
.share { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.share-pool { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; font-size: 30px; min-height: 40px; max-width: 520px; }
.share-plates { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.plate { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.plate-kid { font-size: 36px; } .plate-dish { min-width: 92px; min-height: 52px; max-width: 130px; border-radius: 50%; background: radial-gradient(#fff 55%, #dfe6e9 56%); border: 3px solid #b2bec3; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; font-size: 20px; padding: 6px; }

/* ---------- rewards ---------- */
.wallet-big { display: flex; justify-content: center; gap: 12px; font-size: 24px; font-weight: 800; flex-wrap: wrap; }
.wallet-big span { background: #fff; padding: 4px 18px; border-radius: 99px; box-shadow: var(--sh); }
.tabs { display: flex; gap: 6px; justify-content: center; margin: 16px 0 10px; flex-wrap: wrap; }
.tabs button { padding: 8px 16px; border-radius: 14px; background: #fff; font-weight: 700; box-shadow: 0 3px 0 rgba(0,0,0,.06); min-height: 46px; }
.tabs button.on { background: var(--pri); color: #fff; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 6px; border-radius: 18px; background: #f4f6fb; filter: grayscale(1); opacity: .6; }
.badge.got { filter: none; opacity: 1; background: linear-gradient(160deg, #fff7d6, #fff); box-shadow: 0 0 0 3px #ffd32a inset; }
.badge span { font-size: 42px; } .badge b { font-size: 15px; line-height: 1.1; } .badge small { font-size: 12px; color: var(--muted); }
.badge-grid.small .badge span { font-size: 32px; }
.trophy-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.trophy { text-align: center; padding: 12px; background: #f4f6fb; border-radius: 18px; filter: grayscale(1); opacity: .65; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trophy.got { filter: none; opacity: 1; background: linear-gradient(160deg, #fff7d6, #fff); }
.trophy span { font-size: 56px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-bottom: 14px; }
.item { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 18px; background: #f4f6fb; border: 3px solid transparent; transition: transform .1s; }
.item:hover { transform: translateY(-2px); }
.it-e { font-size: 46px; } .item small { font-size: 13px; font-weight: 700; }
.item:not(.own) .it-e { filter: grayscale(.6) brightness(.95); }
.item.own { background: #e8f8ef; } .item.on { border-color: var(--ok); }
.acc-preview { display: flex; justify-content: center; padding: 30px 0 10px; }

/* ---------- result ---------- */
.result { max-width: 640px; margin: 24px auto; text-align: center; }
.res-stars { font-size: 70px; letter-spacing: 6px; } .res-stars span { color: #dfe6e9; display: inline-block; }
.res-stars span.on { color: #ffc312; animation: starPop .6s backwards; text-shadow: 0 4px 0 #e1a100; }
.res-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.res-grid div { background: #f4f6fb; border-radius: 16px; padding: 8px; } .res-grid b { display: block; font-size: 22px; } .res-grid small { font-size: 12px; color: var(--muted); }
.res-rewards { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; } .res-rewards .pill { font-size: 20px; font-weight: 800; background: #fff7d6; }
.res-badges { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* ---------- parents ---------- */
.gate { max-width: 420px; margin: 40px auto; text-align: center; }
.gate .eq-big input { width: 110px; border: 3px solid var(--line); border-radius: 14px; font-size: 32px; padding: 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.kpi small { color: var(--muted); font-size: 14px; } .kpi b { display: block; font-size: 24px; }
.rec { display: flex; gap: 14px; margin: 16px 0; background: linear-gradient(135deg, #fff, #efecff); align-items: flex-start; }
.rec-ic { font-size: 44px; } .rec h3 { margin: 0; } .rec p { margin: 4px 0 10px; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.chart { width: 100%; height: auto; }
.hbar { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr 44px 34px; gap: 8px; align-items: center; margin: 6px 0; font-size: 14px; }
.hbar > div { height: 12px; background: #eef1f5; border-radius: 9px; overflow: hidden; } .hbar i { display: block; height: 100%; border-radius: 9px; }
.hbar small { color: var(--muted); text-align: right; } .hbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk-list { list-style: none; padding: 0; margin: 0; } .sk-list li { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.sk-list b { color: var(--ok-d); } .sk-list b.warn { color: var(--bad); }
.form h3 { margin-top: 22px; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.chk { display: flex; align-items: center; gap: 8px; background: #f6f7fb; padding: 8px 10px; border-radius: 12px; font-size: 16px; cursor: pointer; }
.chk input { width: 20px; height: 20px; accent-color: var(--pri); }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-sel { padding: 6px 14px; border-radius: 99px; background: #f1f3f7; font-weight: 700; border: 3px solid transparent; font-size: 16px; min-height: 44px; }
.chip-sel.on { background: #efecff; border-color: var(--pri); color: var(--pri); }

/* ---------- animations ---------- */
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes shakeX { 0%,100% { transform: none; } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
.shake { animation: shakeX .4s; }
@keyframes jump { 0%,100% { transform: none; } 40% { transform: translateY(-26px) rotate(-10deg); } 70% { transform: translateY(0) scale(1.1, .9); } }
@keyframes hit { 0%,100% { transform: none; filter: none; } 30% { transform: translateX(14px) rotate(15deg); filter: brightness(2) hue-rotate(-40deg); } }
@keyframes starPop { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.4); } 100% { transform: none; } }
.bob { display: inline-block; animation: bob 2.6s ease-in-out infinite; } .bob.d2 { animation-delay: .4s; } .bob.d3 { animation-delay: .8s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: auto 1fr; } .hero-right { grid-column: 1 / -1; flex-direction: row; justify-content: center; }
  .p-grid { grid-template-columns: 1fr; }
  .stages { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  #app { padding: 0 12px 100px; }
  h1 { font-size: 24px; }
  .tb-name small { display: none; } .tb-name b { font-size: 15px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pill { padding: 2px 8px; font-size: 14px; }
  .tb-btn { padding: 4px 7px; font-size: 13px; }
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero-left { padding-top: 26px; }
  .avatar.xl { width: 90px; height: 90px; font-size: 56px; }
  .hero h1 { font-size: 28px; }
  .row2 { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .world-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .wcard .w-ic { font-size: 40px; } .wcard b { font-size: 15px; }
  .nav-b { min-width: 0; flex: 1; padding: 4px 2px; } .nav-b span { font-size: 22px; } .nav-b small { font-size: 11px; }
  .q-prompt { font-size: 21px; }
  .q-card { padding: 14px 12px 18px; }
  .eq-line { font-size: 28px; } .eq-big { font-size: 28px; }
  .numpad { grid-template-columns: repeat(3, 1fr); width: 100%; max-width: 300px; } .numpad button { height: 56px; }
  .opt { font-size: 22px; min-height: 62px; }
  .k-match { gap: 36px; } .mcard { font-size: 18px; min-height: 60px; }
  .sud-c { width: 56px; height: 56px; } .s6 .sud-c { width: 44px; height: 44px; font-size: 22px; }
  .sud-pal { grid-template-columns: repeat(4, 56px); }
  .map-node { width: 120px; } .mn-ic { width: 64px; height: 64px; font-size: 34px; }
  .res-grid { grid-template-columns: repeat(2, 1fr); }
  .world-head { padding: 14px; } .wh-ic { font-size: 46px; } .world-head h1 { font-size: 23px; }
  .act-grid { grid-template-columns: 1fr 1fr; } .act { min-height: 96px; padding: 10px; } .act b { font-size: 15px; }
  .bins { grid-template-columns: 1fr 1fr; gap: 8px; }
  .big-emoji { font-size: 64px; }
  .k-clock .clock-holder svg { width: 220px; height: 220px; }
  .tenframe { grid-template-columns: repeat(5, 28px); grid-template-rows: repeat(2, 28px); } .tf-cell i { width: 18px; height: 18px; }
  .pos-grid span { width: 54px; height: 54px; font-size: 32px; } .pos-grid.g5 span { width: 44px; height: 44px; font-size: 24px; }
  .chip { min-width: 52px; height: 52px; font-size: 20px; }
  .hbar { grid-template-columns: 100px 1fr 40px 28px; }
}

/* =====================================================================
   v2: activity tools, tutorial player, new games, worksheets
   ===================================================================== */
.btn-row.tight { margin: 0; gap: 8px; }
.act { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.act-main { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 14px 14px 8px; flex: 1; width: 100%; }
.act-tools { display: flex; border-top: 1px dashed var(--line); }
.act-t { flex: 1; padding: 6px 4px; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 4px; color: var(--muted); }
.act-t small { font-size: 12px; font-weight: 700; }
.act-t:hover { background: #f4f6fb; color: var(--ink); }
.act-t + .act-t { border-left: 1px dashed var(--line); }
.q-top .speak + .speak { margin-left: 0; }
.small { font-size: 14px; }
.voice-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.voice-box select { font-family: inherit; font-size: 15px; padding: 8px; border-radius: 12px; border: 2px solid var(--line); max-width: 100%; }
.back.dark { background: #efecff; color: var(--pri); }

/* ---------- tutorial player ---------- */
.tut-back { position: fixed; inset: 0; z-index: 1200; background: rgba(20,20,50,.7); display: grid; place-items: center; padding: 12px; animation: fade .25s; }
.tut { width: 100%; max-width: 860px; max-height: 96vh; display: flex; flex-direction: column; background: #1e1e3a; border-radius: 26px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.tut-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #fff; }
.tut-head b { flex: 1; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tut-badge { background: #ff4757; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 800; letter-spacing: .5px; }
.tut-x { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 18px; }
.tut-screen { position: relative; flex: 1; overflow: auto; background: linear-gradient(180deg, var(--bg1), var(--bg2)); padding: 12px; min-height: 280px; }
.tut-stage { pointer-events: none; }
.tut-stage .q-card { margin: 0; }
.tut-hand { position: absolute; left: 0; top: 0; font-size: 46px; z-index: 5; pointer-events: none; transition: transform .5s cubic-bezier(.4,1.3,.6,1), opacity .3s; filter: drop-shadow(0 4px 4px rgba(0,0,0,.3)); opacity: 0; }
.tut-hand.tap { animation: tapHand .17s; }
@keyframes tapHand { 50% { scale: .8; } }
.tut-sub { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #2a2a4f; color: #fff; min-height: 64px; font-size: 19px; font-weight: 700; }
.tut-mascot { font-size: 40px; }
.tut-ctrl { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #15152b; flex-wrap: wrap; }
.tut-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 18px; }
.tut-prog { flex: 1; min-width: 80px; height: 8px; border-radius: 9px; background: rgba(255,255,255,.2); overflow: hidden; }
.tut-prog i { display: block; height: 100%; width: 0; background: #ff4757; transition: width .4s; }

/* ---------- bingo ---------- */
.k-bingo { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.bg-call { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #ff9f43, #feca57); border-radius: 20px; padding: 8px 22px; font-size: 32px; box-shadow: 0 5px 0 #e17f00; }
.bg-call.pop { animation: popIn .35s; }
.bg-board { display: grid; gap: 8px; width: 100%; max-width: 380px; }
.bg-c { aspect-ratio: 1; border-radius: 16px; background: #fff; border: 3px solid var(--line); font-size: 26px; font-weight: 800; box-shadow: 0 4px 0 #dfe4ea; position: relative; }
.bg-c.on { background: #ffeaa7; border-color: #f6b93b; }
.bg-c.on::after { content: ''; position: absolute; inset: 14%; border-radius: 50%; border: 5px solid rgba(214,48,49,.7); }
.bg-c.win { background: #55efc4; border-color: var(--ok); }

/* ---------- chess board ---------- */
.k-chess { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.ch-status { background: #fff; border-radius: 14px; padding: 6px 14px; font-size: 17px; text-align: center; box-shadow: var(--sh); }
.ch-board { display: grid; width: 100%; max-width: 400px; border: 6px solid #6d4c41; border-radius: 10px; overflow: hidden; }
.ch-c { aspect-ratio: 1; font-size: clamp(18px, 4.5vw, 26px); font-weight: 800; position: relative; color: #3e2723; }
.ch-c.lt { background: #f3e1c4; } .ch-c.dk { background: #c99a6b; }
.ch-c.vis { color: rgba(62,39,35,.35); background-image: radial-gradient(circle, rgba(0,184,148,.45) 30%, transparent 32%); }
.ch-c.legal { box-shadow: inset 0 0 0 4px #0984e3; }
.ch-c.legal::after { content: ''; position: absolute; right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #0984e3; }
.ch-p { font-size: clamp(34px, 8vw, 52px); line-height: 1; color: #1e272e; text-shadow: 0 2px 0 #fff; }

/* ---------- nim ---------- */
.k-nim { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.nim-vs { display: flex; align-items: center; gap: 18px; font-size: 22px; } .nim-bot { font-size: 46px; }
.nim-turn { font-size: 20px; font-weight: 800; }
.nim-stones { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: 34px; min-height: 50px; max-width: 520px; }
.nim-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.nim-log { font-size: 15px; color: var(--muted); text-align: center; }

/* ---------- tangram ---------- */
.tg-name { font-weight: 800; font-size: 20px; }
.tg-svg { width: 100%; max-width: 520px; max-height: 62vh; background: #fff; border-radius: 20px; box-shadow: inset 0 0 0 3px var(--line); touch-action: none; }
.tg-p { cursor: grab; transition: filter .2s; } .tg-p.sel { filter: brightness(1.1) drop-shadow(0 0 .08px #000); stroke-width: .1; }
.tg-p.snapped { cursor: default; } .tg-svg.done .tg-p { animation: fade .5s; }
.tg-ctrl { display: flex; gap: 10px; margin-top: 8px; }

/* ---------- logic grid ---------- */
.k-lgrid { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-start; }
.lg-clues { background: #fff8e1; border: 3px dashed #f6b93b; border-radius: 18px; padding: 10px 14px 10px 34px; font-size: 18px; max-width: 360px; margin: 0; }
.lg-clues li { margin: 4px 0; }
.lg-table { border-collapse: separate; border-spacing: 4px; }
.lg-table th { font-size: 17px; padding: 2px 6px; }
.lg-c { width: 58px; height: 58px; border-radius: 12px; background: #fff; border: 3px solid var(--line); font-size: 26px; font-weight: 800; }
.lg-c.s1 { background: #d4f8e8; border-color: var(--ok); color: var(--ok-d); } .lg-c.s2 { color: var(--bad); background: #fff3f0; }

/* ---------- worksheets ---------- */
.ws-ctrl { margin: 8px auto 16px; max-width: 980px; }
.ws-ctrl-head { display: flex; align-items: center; gap: 10px; font-size: 20px; margin-bottom: 10px; }
.ws-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; }
.ws-form > label, .ws-field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 15px; min-width: 0; }
.ws-form select, .ws-form input[type=text], .ws-form input:not([type]), .ws-form input[type=number] { font-family: inherit; font-size: 16px; padding: 7px 8px; border-radius: 10px; border: 2px solid var(--line); background: #fff; width: 100%; min-width: 0; }
.ws-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .ws-inline input[type=number] { width: 76px !important; }
.seg.sm { display: inline-flex; flex-wrap: wrap; gap: 4px; } .seg.sm button { padding: 6px 12px; font-size: 15px; }
.ws-checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.ws-checks .chk { font-weight: 700; font-size: 15px; display: inline-flex; gap: 6px; align-items: center; }
.ws-status { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; font-size: 16px; }
.ws-note-in { color: #8a6d00; }
.ws-error { margin-top: 12px; background: #ffebee; border: 2px solid var(--bad); border-radius: 14px; padding: 10px 14px; font-size: 16px; color: #8e1b1b; }
.ws-error .btn-row { margin-top: 8px; }
.ws-sheet.ws-empty { text-align: center; color: #636e72; font-size: 18px; padding: 40px 20px; }
.ws-key .ws-grid.maze.mini td { width: 22px; height: 22px; font-size: 11px; padding: 0; } .ws-key .ws-grid.maze.mini { display: inline-table; vertical-align: middle; }
.ws-sheet { background: #fff; width: 100%; max-width: 820px; margin: 0 auto; padding: 28px 34px; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.15); color: #1e272e; }
.ws-sheet.landscape { max-width: 1120px; }
.ws-row { display: flex; gap: 16px; margin-bottom: 14px; break-inside: avoid; page-break-inside: avoid; }
.ws-row > .ws-q { flex: 1 1 0; min-width: 0; }
.ws-q.ghost { visibility: hidden; border: 0; }
.ws-work { margin-top: 8px; font-size: 13px; color: #636e72; } .ws-work span { display: block; height: 28px; border-bottom: 1.5px dotted #95a5a6; }
.ws-line.s { width: 60px; }
.ws-head { border-bottom: 3px solid #1e272e; padding-bottom: 10px; margin-bottom: 14px; }
.ws-brand { font-weight: 800; color: var(--pri); font-size: 15px; }
.ws-head h1 { margin: 2px 0; font-size: 28px; }
.ws-sub { color: #636e72; font-size: 15px; }
.ws-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px; font-size: 16px; }
.ws-line { display: inline-block; width: 110px; border-bottom: 2px dotted #636e72; height: 1em; vertical-align: bottom; } .ws-line.w { width: 210px; }
.ws-qs { display: block; }
.ws-q { border: 2px solid #dfe6e9; border-radius: 14px; padding: 10px 12px; break-inside: avoid; page-break-inside: avoid; }
.ws-prompt { font-weight: 700; font-size: 16px; margin-bottom: 6px; display: flex; gap: 8px; align-items: flex-start; }
.ws-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #1e272e; color: #fff; display: grid; place-items: center; font-size: 14px; }
.ws-vis { display: flex; justify-content: center; flex-wrap: wrap; margin: 4px 0; }
.ws-vis .objs .obj { font-size: 26px !important; } .ws-vis .big-emoji { font-size: 48px; }
.ws-vis svg { max-width: 100%; height: auto; }
.ws-vis .shape-big svg { max-height: 150px; width: auto; }
.ws-eq { font-size: 24px; font-weight: 800; text-align: center; margin: 6px 0; display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.ws-blank { display: inline-flex; align-items: flex-end; gap: 2px; } .ws-blank i { display: inline-block; width: 64px; height: 34px; border: 2px solid #1e272e; border-radius: 8px; }
.ws-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; font-size: 20px; font-weight: 700; }
.ws-opt { display: inline-flex; align-items: center; gap: 6px; } .ws-opt svg { max-height: 70px; width: auto; }
.ws-circle { display: inline-block; width: 18px; height: 18px; border: 2px solid #1e272e; border-radius: 50%; flex: none; }
.ws-items { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; font-size: 28px; font-weight: 700; }
.ws-item { padding: 2px 8px; } .ws-item svg { width: 44px; height: 44px; }
.ws-bank { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0; }
.ws-tile { border: 2px dashed #b2bec3; border-radius: 10px; padding: 2px 10px; font-size: 20px; font-weight: 700; display: inline-flex; align-items: center; } .ws-tile .rt small { font-size: 11px; }
.ws-box { display: inline-block; width: 56px; height: 46px; border: 2px solid #1e272e; border-radius: 8px; } .ws-box.sm { width: 40px; height: 34px; }
.ws-arr { color: #b2bec3; }
.ws-sorttbl { width: 100%; border-collapse: collapse; margin-top: 6px; } .ws-sorttbl th, .ws-sorttbl td { border: 2px solid #1e272e; padding: 6px; } .ws-sorttbl td { height: 90px; }
.ws-match { display: flex; justify-content: space-between; gap: 60px; font-size: 20px; font-weight: 700; }
.ws-match > div { display: flex; flex-direction: column; gap: 8px; } .ws-mc { display: flex; align-items: center; gap: 8px; } .ws-mc i { font-style: normal; } .ws-mc svg { width: 60px; height: 60px; }
.ws-grid { border-collapse: collapse; margin: 6px auto; } .ws-grid td { border: 2px solid #1e272e; width: 44px; height: 44px; text-align: center; font-size: 20px; font-weight: 700; }
.ws-grid.sud.s4 tr:nth-child(2) td { border-bottom-width: 4px; } .ws-grid.sud.s4 td:nth-child(2) { border-right-width: 4px; }
.ws-grid.sud.s6 tr:nth-child(2n) td { border-bottom-width: 4px; } .ws-grid.sud.s6 td:nth-child(3) { border-right-width: 4px; }
.ws-grid.mini td { width: 22px; height: 22px; font-size: 12px; }
.ws-grid.cross td:empty { border: 0; } .ws-grid.graph td:first-child, .ws-grid.graph tr:last-child td { border: 0; font-size: 22px; }
.ws-grid.chess tr:nth-child(odd) td:nth-child(even), .ws-grid.chess tr:nth-child(even) td:nth-child(odd) { background: #e7d3b5; }
.ws-piece { font-size: 30px; } .ws-grid.lgrid td { width: 54px; } .ws-grid.lgrid td:first-child { width: auto; padding: 0 8px; }
.ws-calls { columns: 3; font-size: 16px; font-weight: 700; } .ws-clues { font-size: 16px; }
.ws-tg { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; } .ws-tg svg { max-width: 100%; height: auto; }
.ws-foot { margin-top: 16px; text-align: center; font-size: 22px; color: #b2bec3; } .ws-foot span { display: block; font-size: 14px; color: #636e72; }
.ws-key { margin-top: 30px; border-top: 3px dashed #b2bec3; padding-top: 12px; } .ws-key ol { columns: 2; font-size: 15px; } .ws-key li { break-inside: avoid; margin-bottom: 4px; } .ws-key svg { max-width: 70px; height: auto; vertical-align: middle; }
@media screen and (max-width: 600px) { .ws-sheet { padding: 16px 12px; } .ws-row { flex-direction: column; } .ws-q.ghost { display: none; } .ws-match { gap: 20px; } .ws-key ol { columns: 1; } }
@page { size: A4; margin: 12mm 12mm 14mm; @bottom-center { content: counter(page) " / " counter(pages); font-family: sans-serif; font-size: 10pt; color: #555; } }
@media print {
  html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; background: #fff !important; }
  body { font-size: 15px; }
  #topbar, #bottomnav, #bg-deco, #confetti, .no-print, .toast, .modal-back, .tut-back, .feedback { display: none !important; }
  #app { position: static !important; z-index: auto !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  #screen { animation: none !important; transform: none !important; }
  .ws-sheet { box-shadow: none; padding: 0; max-width: none !important; width: auto; border-radius: 0; overflow: visible; }
  .ws-row { break-inside: avoid; page-break-inside: avoid; }
  .ws-q { border-color: #b2bec3; }
  .ws-brand { color: #1e272e; }
  .ws-num { background: #fff; color: #1e272e; border: 2px solid #1e272e; }
  .ws-foot { color: #95a5a6; }
  .ws-key { break-before: page; page-break-before: always; border: 0; margin-top: 0; padding-top: 0; }
  * { animation: none !important; transition: none !important; -webkit-print-color-adjust: economy; print-color-adjust: economy; }
  .ws-vis, .ws-vis *, .ws-tg, .ws-tg *, .ws-items, .ws-items *, .ws-grid, .ws-grid *, .ws-opt, .ws-opt *, .ws-key svg, .ws-mc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- v3: thinking board in tutorials ---------- */
.tut-screen { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(200px, 1fr); grid-auto-rows: max-content; align-content: start; gap: 12px; align-items: start; }
.tut-board { position: sticky; top: 0; background: #1f3b2c; border: 8px solid #8d6e63; border-radius: 14px; color: #f5f6fa; padding: 8px 12px; min-height: 220px; max-height: 60vh; overflow: auto; box-shadow: inset 0 0 30px rgba(0,0,0,.35); font-family: 'Baloo 2', 'Comic Sans MS', cursive; }
.tb-title { font-weight: 800; color: #ffeaa7; font-size: 15px; border-bottom: 2px dashed rgba(255,255,255,.25); margin-bottom: 6px; }
.tb-lines { margin: 0; padding-left: 22px; font-size: 20px; line-height: 1.35; }
.tb-lines li { margin: 6px 0; animation: chalk .6s ease-out; }
.tb-lines li b { color: #55efc4; font-size: 1.15em; }
.tb-lines .fr { color: #fff; }
@keyframes chalk { from { opacity: 0; transform: translateX(-12px); filter: blur(2px); } }
.tut-hl { outline: 4px solid #ffd32a; outline-offset: 4px; border-radius: 12px; animation: hlPulse 1s ease-in-out infinite alternate; }
@keyframes hlPulse { to { outline-color: #ff9f43; } }
@media (max-width: 700px) { .tut-screen { grid-template-columns: 1fr; } .tut-board { position: static; min-height: 0; max-height: 34vh; order: -1; } .tb-lines { font-size: 17px; } }

/* ---------- installable app (PWA) ---------- */
#app { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); overflow-x: clip; }
.boot-msg { text-align: center; padding: 80px 20px; font-size: 22px; color: var(--muted); }
.upd-banner { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 1500; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; background: #fff; border: 3px solid var(--pri); border-radius: 18px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); width: max-content; max-width: calc(100vw - 24px); font-weight: 700; }
.upd-banner .btn { min-height: 42px; padding: 6px 14px; }
.app-panel h3 { margin-top: 18px; }
.app-panel .ok { color: var(--ok-d, #00a383); }
.steps { margin: 6px 0 10px; padding-left: 22px; } .steps li { margin: 4px 0; }
.kbd { display: inline-block; min-width: 24px; padding: 0 6px; border: 2px solid #dfe4ea; border-radius: 8px; background: #f8f9fb; text-align: center; font-weight: 800; }
.voice-dl { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.voice-dl .vd-status { grid-column: 1 / -1; } .voice-dl .btn { grid-column: 1 / -1; justify-self: start; }
.vd-bar { grid-column: 1 / -1; height: 10px; border-radius: 6px; background: #eef0f6; overflow: hidden; } .vd-bar i { display: block; height: 100%; width: 0; background: var(--ok, #00b894); transition: width .3s; }
@media (display-mode: standalone) { body { -webkit-user-select: none; user-select: none; } input, textarea, select, .ws-sheet { -webkit-user-select: text; user-select: text; } }
@media print { .upd-banner, .toast { display: none !important; } }
