/* مسار الإنجليزية — v2 styles. Mobile-first, RTL, two skins: kids (Zon Heroes sea-blue) / adults (teal & sand). */

:root {
  --maxw: 440px;
  --radius: 18px;
  --ok: #22a866; --retry: #f0a020; --help: #e2574c; --self: #7c6cf0; --none: #b9c3cc;
  --font-ar: 'Baloo Bhaijaan 2', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-en: 'Baloo Bhaijaan 2', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
body[data-track="kids"] {
  --bg: linear-gradient(180deg, #0a5ea8 0%, #1688cf 45%, #3fc0ea 100%);
  --ink: #12324a; --ink-soft: #4b6578; --on-bg: #fff; --on-bg-soft: rgba(255, 255, 255, .85);
  --card: #ffffff; --card-2: #eef8ff; --line: #d5e8f5;
  --primary: #ffc93c; --primary-ink: #3f2a00; --primary-shadow: #d99a00;
  --accent: #ff7a59; --focus: #ffdf6b; --ring: #ffd23f;
}
body[data-track="adults"] {
  --bg: linear-gradient(180deg, #f5efe5 0%, #efe6d7 100%);
  --ink: #1d2b2a; --ink-soft: #5b6865; --on-bg: #1d2b2a; --on-bg-soft: #5b6865;
  --card: #fffdf9; --card-2: #f4eee4; --line: #e3d9c8;
  --primary: #1f6f68; --primary-ink: #ffffff; --primary-shadow: #154f4a;
  --accent: #b88a4a; --focus: #1f6f68; --ring: #f2d48a;
  --font-ar: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-en: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-ar); color: var(--ink);
  background: var(--bg); background-attachment: fixed;
  line-height: 1.6; font-size: 17px;
}
body[data-track="kids"]::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, .14) 0 22px, transparent 23px),
    radial-gradient(circle at 85% 12%, rgba(255, 255, 255, .10) 0 34px, transparent 35px),
    radial-gradient(circle at 78% 72%, rgba(255, 255, 255, .10) 0 16px, transparent 17px),
    radial-gradient(circle at 20% 86%, rgba(255, 255, 255, .12) 0 28px, transparent 29px);
}
#app {
  position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto;
  padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) calc(28px + var(--safe-b)) calc(14px + var(--safe-l));
  outline: none;
}
.skip-link { position: absolute; top: -60px; right: 8px; background: #fff; color: #000; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip-link:focus { top: 8px; }
h1, h2, h3 { line-height: 1.3; margin: .2em 0 .4em; }
h1 { font-size: 1.5rem; }
p { margin: .35em 0; }
.en { font-family: var(--font-en); unicode-bidi: isolate; direction: ltr; }
.ltr-num, #pCount { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--ink-soft); font-size: .92rem; }
.center { text-align: center; }
img { max-width: 100%; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
body[data-track="kids"] :focus-visible { outline-color: #ffdf6b; box-shadow: 0 0 0 6px rgba(10, 60, 110, .45); }

/* ---------------------------------------------------------------- buttons */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 48px; padding: .55em 1.1em; border-radius: 14px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 1rem; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .2s;
}
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; box-shadow: 0 4px 0 var(--primary-shadow); }
.btn.primary:active { box-shadow: 0 1px 0 var(--primary-shadow); }
body[data-track="adults"] .btn.primary { box-shadow: 0 2px 6px rgba(31, 111, 104, .25); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.big { width: 100%; min-height: 56px; font-size: 1.08rem; margin-top: .6rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 44px; height: 44px; min-width: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--card);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 1.15rem; padding: 0;
}
.icon-btn.sm { width: 40px; height: 40px; min-width: 40px; font-size: 1rem; }
.link-btn { background: none; border: 0; color: var(--on-bg-soft); text-decoration: underline; cursor: pointer; padding: 12px; min-height: 44px; display: block; margin: .8rem auto 0; font-size: .95rem; }
.item .link-btn, .scene-ctrl .link-btn { color: var(--ink-soft); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: .5rem; }
.row.col { flex-direction: column; align-items: stretch; }
.row .btn { flex: 1 1 auto; }

/* ---------------------------------------------------------------- topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; color: var(--on-bg); }
.topbar > strong { font-size: 1.1rem; }
.hello { display: flex; align-items: center; gap: 10px; }
.hello small { display: block; color: var(--on-bg-soft); font-size: .85rem; line-height: 1.2; }
.hello strong { font-size: 1.15rem; }
.stats { display: flex; gap: 6px; }
.pill { background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: .95rem; box-shadow: 0 2px 0 rgba(0, 0, 0, .08); white-space: nowrap; }
.pill b { font-family: var(--font-en); }
.pill.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }

.lesson-top { gap: 6px; }
.stepper { display: flex; gap: 4px; flex: 1; justify-content: center; }
.step {
  display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 44px; padding: 2px 4px;
  background: transparent; border: 0; cursor: pointer; color: var(--on-bg-soft); font-size: .68rem; line-height: 1.2; flex: 1; max-width: 76px;
}
.step i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .25); color: var(--on-bg); font-weight: 800; font-size: .8rem; }
body[data-track="adults"] .step i { background: var(--card-2); color: var(--ink-soft); }
.step.current { color: var(--on-bg); font-weight: 800; }
.step.current i { background: var(--primary); color: var(--primary-ink); box-shadow: 0 0 0 3px rgba(255, 255, 255, .5); }
.step.done i { background: var(--ok); color: #fff; }
.step.locked { opacity: .5; cursor: not-allowed; }
.lesson-top .stats .pill:last-child { display: none; }

/* ---------------------------------------------------------------- avatars */
.av { width: 52px; height: 52px; min-width: 52px; border-radius: 50%; overflow: hidden; background: #fff; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); display: grid; place-items: center; }
.av img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.av.sm { width: 40px; height: 40px; min-width: 40px; border-width: 2px; }
.av.lg { width: 92px; height: 92px; margin: 0 auto; }
.av.xl { width: 130px; height: 130px; margin: 0 auto; }
.av.guest { background: #e9eef2; font-size: 1.5rem; }
body[data-track="adults"] .av { border-color: var(--card); box-shadow: 0 2px 8px rgba(29, 43, 42, .15); }
.av-fallback { font-size: 1.6rem; }
.guide-av.cheer { animation: hero-bounce .8s cubic-bezier(.3, 1.6, .5, 1); }
body[data-track="adults"] .guide-av.cheer { animation: smile 1s ease; }
@keyframes hero-bounce { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-14px) scale(1.12) rotate(-6deg); } 60% { transform: translateY(0) scale(.96) rotate(4deg); } 100% { transform: none; } }
@keyframes smile { 40% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(34, 168, 102, .25); } }

/* ---------------------------------------------------------------- entry */
.entry { color: var(--on-bg); }
.brand { text-align: center; padding: 18px 0 8px; }
.brand h1 { font-size: 2.1rem; margin: 0; font-weight: 800; }
.brand-en { margin: 0; font-family: var(--font-en); letter-spacing: .08em; color: var(--on-bg-soft); font-weight: 600; }
.brand-line { color: var(--on-bg-soft); font-size: .98rem; max-width: 30ch; margin: .6em auto 0; }
.field { display: block; margin: 16px 0; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 2px solid var(--line); padding: 10px 14px;
  font: inherit; font-size: 1.1rem; background: var(--card); color: var(--ink);
}
.tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.track-card {
  background: var(--card); color: var(--ink); border: 3px solid transparent; border-radius: 18px; padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; min-height: 170px; text-align: center;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .12); transition: transform .15s, border-color .15s;
}
.track-card[aria-pressed="true"] { border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 6px 0 var(--primary-shadow); }
body[data-track="adults"] .track-card[aria-pressed="true"] { box-shadow: 0 6px 18px rgba(31, 111, 104, .25); }
.track-card strong { font-size: 1.2rem; }
.track-card span { font-size: .82rem; color: var(--ink-soft); line-height: 1.4; }
.track-art { display: flex; justify-content: center; margin-bottom: 4px; }
.track-art img { width: 66px; height: 66px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); background: #fff; }
.track-art img + img { margin-inline-start: -18px; }
.track-adults .track-art img { border-radius: 16px; }
.form-msg { min-height: 1.4em; text-align: center; font-weight: 700; color: var(--on-bg); }

/* ---------------------------------------------------------------- home */
.home { color: var(--on-bg); }
.continue { font-size: 1.05rem; }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.card-btn {
  background: var(--card); color: var(--ink); border: 2px solid transparent; border-radius: var(--radius); padding: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; min-height: 104px; box-shadow: 0 3px 0 rgba(0, 0, 0, .1);
}
.card-btn .big-ic { font-size: 1.6rem; }
.card-btn strong { font-size: 1.05rem; }
.card-btn span:last-child { font-size: .85rem; color: var(--ink-soft); }
.card-btn b { font-family: var(--font-en); color: var(--accent); font-size: 1.05rem; }
.sec-title { font-size: 1.1rem; margin: 18px 0 8px; color: var(--on-bg); }
.units-road { list-style: none; margin: 0; padding: 0; position: relative; }
.units-road::before { content: ''; position: absolute; inset-inline-start: 34px; top: 20px; bottom: 20px; border-inline-start: 4px dashed rgba(255, 255, 255, .5); }
body[data-track="adults"] .units-road::before { border-color: var(--line); }
.unit-node { position: relative; margin-bottom: 10px; }
.unit {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 76px;
  background: var(--card); color: var(--ink); border: 2px solid transparent; border-radius: var(--radius); cursor: pointer; text-align: start;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .1);
}
.unit-icon { width: 46px; height: 46px; min-width: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--card-2); }
.unit-text { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.unit-text small { color: var(--ink-soft); font-size: .78rem; }
.unit-text strong { font-size: 1.15rem; }
.unit-en { font-size: .8rem; color: var(--ink-soft); }
.unit-state { display: flex; flex-direction: column; align-items: flex-end; font-size: .8rem; }
.unit-state em { font-style: normal; color: var(--ink-soft); }
.mini-stars { color: #f5b301; letter-spacing: 1px; font-size: 1rem; }
.unit-node.new .unit { border-color: var(--primary); }
.unit-node.new .unit-icon, .unit-node.progress .unit-icon { background: var(--primary); }
.unit-node.done .unit-icon { background: #d8f5e6; }
.unit-node.locked .unit { opacity: .72; cursor: not-allowed; }
.unit-node.locked .unit-state em { background: var(--card-2); padding: 1px 8px; border-radius: 999px; }

/* ---------------------------------------------------------------- stage shell */
.stage { color: var(--ink); }
.stage-head { color: var(--on-bg); }
.stage-head p { color: var(--on-bg-soft); }
.kicker { font-size: .85rem; font-weight: 700; letter-spacing: .02em; color: var(--accent); margin: 0; }
.stage-head .kicker { color: var(--on-bg-soft); }
.title-card { background: var(--card); border-radius: 22px; overflow: hidden; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); animation: rise .5s ease both; }
.tc-art { aspect-ratio: 3 / 2; overflow: hidden; position: relative; }
.tc-art img { width: 100%; height: 100%; object-fit: cover; display: block; animation: kb 18s ease-in-out infinite alternate; }
.tc-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, .25)); }
.title-card.mastery .tc-art img { filter: saturate(.85); }
.tc-body { padding: 14px 16px 18px; }
.tc-body h1 { font-size: 1.7rem; }
.tc-steps { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.tc-steps li { background: var(--card-2); border-radius: 12px; padding: 8px 10px; font-size: .95rem; }
.tc-guide { display: flex; align-items: center; gap: 10px; margin-top: 8px; color: var(--ink-soft); font-size: .95rem; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- scene */
.scene-stage { display: flex; flex-direction: column; gap: 8px; }
.scene-stage.enter .scene { animation: scene-in .9s ease both; }
@keyframes scene-in { from { opacity: 0; transform: scale(.96); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.scene {
  position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 18px;
  background: linear-gradient(135deg, #cfe9f7, #f7e7c9); box-shadow: 0 8px 22px rgba(0, 0, 0, .22); user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
body[data-track="adults"] .scene { box-shadow: 0 6px 18px rgba(29, 43, 42, .18); border-radius: 14px; }
.cam { position: absolute; inset: 0; transform-origin: 0 0; transition: transform 1.1s cubic-bezier(.45, .05, .2, 1); will-change: transform; }
.kbl { position: absolute; inset: 0; transform-origin: 50% 50%; }
.scene.kb .kbl { animation: kb 30s ease-in-out infinite alternate; }
@keyframes kb { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.07) translate(-1.5%, -1%); } }
.kbl img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.scene.noimg .kbl img { visibility: hidden; }
.scene.noimg::after { content: '🖼️'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; opacity: .4; pointer-events: none; }
.hot-layer { position: absolute; inset: 0; }
.hot { position: absolute; background: transparent; border: 0; padding: 0; margin: 0; cursor: pointer; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
.hot:hover { background: rgba(255, 255, 255, .12); }
body[data-stage="stage3"] .hot:hover { background: transparent; }
.hot:focus-visible { outline: 3px solid #fff; box-shadow: 0 0 0 5px var(--primary); }
.hot.done-hit { animation: hit .7s ease; }
@keyframes hit { 0% { background: rgba(255, 255, 255, .55); } 100% { background: transparent; } }
.ring {
  position: absolute; pointer-events: none; border-radius: 14px; opacity: 0; transition: opacity .3s, left .5s, top .5s, width .5s, height .5s;
  border: 3px solid var(--ring); box-shadow: 0 0 0 4px rgba(255, 210, 63, .35), 0 0 22px 6px rgba(255, 230, 120, .7), inset 0 0 18px rgba(255, 240, 170, .6);
}
.ring.on { opacity: 1; animation: pulse 1.2s ease-in-out infinite; }
.ring.reveal { border-color: #fff; box-shadow: 0 0 0 4px rgba(34, 168, 102, .6), 0 0 26px 8px rgba(34, 168, 102, .55); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.hot-label {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; opacity: 0; transition: opacity .25s;
  background: #fff; color: #12324a; font-family: var(--font-en); font-weight: 800; font-size: .9rem; padding: 0 9px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25); white-space: nowrap; direction: ltr;
}
.hot-label.on { opacity: 1; animation: label-in .35s ease; }
@keyframes label-in { from { transform: translate(-50%, -60%); opacity: 0; } }
.tap-pop { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 1.4rem; pointer-events: none; animation: tpop .9s ease forwards; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
@keyframes tpop { to { transform: translate(-50%, -160%) scale(1.5); opacity: 0; } }

.bubble-bar { min-height: 64px; }
.bubble-row { display: flex; align-items: flex-end; gap: 8px; animation: guide-in .45s cubic-bezier(.3, 1.4, .5, 1) both; }
.bubble-row.from-guest { flex-direction: row-reverse; }
@keyframes guide-in { from { opacity: 0; transform: translateY(10px) scale(.95); } to { opacity: 1; transform: none; } }
.bubble {
  position: relative; flex: 1; background: var(--card); border-radius: 18px; padding: 8px 14px; box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
}
.bubble::before { content: ''; position: absolute; bottom: 12px; inset-inline-start: -8px; border: 8px solid transparent; border-inline-end-color: var(--card); border-inline-start: 0; }
.from-guest .bubble { background: #fff6dd; }
.from-guest .bubble::before { inset-inline-start: auto; inset-inline-end: -8px; border-inline-end-color: transparent; border-inline-start: 8px solid #fff6dd; border-inline-end: 0; }
body[data-track="adults"] .from-guest .bubble { background: #eef4f1; }
body[data-track="adults"] .from-guest .bubble::before { border-inline-start-color: #eef4f1; }
.bubble small { display: block; color: var(--ink-soft); font-size: .78rem; line-height: 1.2; }
.bubble .line { display: block; font-size: 1.25rem; font-weight: 800; text-align: left; line-height: 1.35; }
body[data-track="adults"] .bubble .line { font-weight: 600; }
.bubble .sub { font-size: .85rem; color: var(--ink-soft); margin: 2px 0 0; }

.scene-ctrl { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-top: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.ctrl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ctrl-head .count { color: var(--ink-soft); font-size: .9rem; }
.help { color: var(--ink-soft); font-size: .92rem; margin: .3em 0; }
.hint { min-height: 1.6em; font-weight: 700; color: #a2560b; margin: .4em 0 0; }
body[data-track="adults"] .hint { color: #8a5a17; }
.tour-dots { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; direction: ltr; }
.tour-dots i { width: 12px; height: 6px; border-radius: 3px; background: var(--line); transition: background .3s, width .3s; }
.tour-dots i.seen { background: var(--ok); }
.tour-dots i.now { background: var(--primary); width: 22px; }
body[data-track="kids"] .tour-dots i.now { background: #ff9f1c; }
.replies { display: grid; gap: 8px; margin-top: 6px; }
.reply {
  min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--card-2); cursor: pointer; padding: 8px 14px;
  font-family: var(--font-en); font-size: 1.08rem; font-weight: 700; text-align: left; direction: ltr;
}
.reply.right { background: #d8f5e6; border-color: var(--ok); }
.reply.wrong { background: #fde3e0; border-color: var(--help); }
.reply.reveal { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(34, 168, 102, .3); animation: pulse 1.1s infinite; }
.done-card { text-align: center; }
.done-card strong { font-size: 1.2rem; display: block; }
.done-card.big { background: var(--card); border-radius: 22px; padding: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); margin-bottom: 14px; animation: rise .5s ease both; }
.score-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; direction: ltr; }
.score-dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .4); border: 2px solid rgba(255, 255, 255, .7); }
body[data-track="adults"] .score-dots i { background: var(--card-2); border-color: var(--line); }
.score-dots i.did { background: var(--ok); border-color: var(--ok); }
.score-dots i.now { background: var(--primary); border-color: var(--primary); }

/* ---------------------------------------------------------------- stage 2 */
.banner { background: #d8f5e6; color: #0f5132; border-radius: 12px; padding: 8px 12px; font-weight: 700; margin-bottom: 10px; }
.path-road { list-style: none; padding: 0; margin: 10px 0 6px; position: relative; display: grid; gap: 10px; }
.path-road::before { content: ''; position: absolute; inset-inline-start: 22px; top: 18px; bottom: 18px; border-inline-start: 4px dotted rgba(255, 255, 255, .55); }
body[data-track="adults"] .path-road::before { border-color: var(--line); }
.path-node { position: relative; }
.path-card {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: start; cursor: pointer; padding: 10px 12px; min-height: 68px;
  background: var(--card); color: var(--ink); border: 2px solid transparent; border-radius: var(--radius); box-shadow: 0 3px 0 rgba(0, 0, 0, .1);
}
.path-card .pn { width: 26px; height: 26px; min-width: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--card-2); }
.path-card .pi { font-size: 1.7rem; }
.path-card .pt { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.path-card .pt strong { font-size: 1.12rem; }
.path-card .pt small { color: var(--ink-soft); font-size: .82rem; }
.path-card .ps { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }
.path-node.done .pn { background: var(--ok); color: #fff; }
.path-node.done .ps { color: var(--ok); font-weight: 700; }
.path-node.next .path-card { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 201, 60, .35), 0 3px 0 rgba(0, 0, 0, .1); }
body[data-track="adults"] .path-node.next .path-card { box-shadow: 0 0 0 4px rgba(31, 111, 104, .15); }
.path-node.next .pn { background: var(--primary); color: var(--primary-ink); }
.path-node.locked .path-card { opacity: .62; cursor: not-allowed; }
.cta-card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-top: 14px; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); }
.sticky-cta { position: sticky; bottom: calc(10px + var(--safe-b)); z-index: 5; }

/* word × path map */
.map-wrap { background: var(--card); border-radius: var(--radius); padding: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .1); overflow-x: auto; }
.word-map { width: 100%; border-collapse: separate; border-spacing: 0 3px; font-size: .85rem; }
.word-map thead th { font-weight: 700; font-size: .68rem; color: var(--ink-soft); padding: 2px; text-align: center; vertical-align: bottom; }
.word-map thead th .mi { display: block; font-size: 1.05rem; }
.word-map thead th .mt { display: block; white-space: nowrap; }
.word-map tbody th { text-align: start; font-weight: 700; padding: 2px 4px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.word-map tbody tr.hl th { color: var(--accent); }
.word-map td { text-align: center; padding: 0; }
.c { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-style: normal; font-weight: 800; font-size: .95rem; position: relative; }
td.c { display: table-cell; width: auto; height: 32px; border-radius: 0; background: none; }
/* cells drawn as round badges (radial background keeps table layout simple) */
.word-map td.c.none { color: var(--none); }
.word-map td.c.ok, .word-map td.c.retry, .word-map td.c.help, .word-map td.c.self { color: #fff; }
.word-map td.c.ok { background: radial-gradient(circle, var(--ok) 0 13px, transparent 14px); }
.word-map td.c.retry { background: radial-gradient(circle, var(--retry) 0 13px, transparent 14px); }
.word-map td.c.help { background: radial-gradient(circle, var(--help) 0 13px, transparent 14px); }
.word-map td.c.self { background: radial-gradient(circle, var(--self) 0 13px, transparent 14px); }
.word-map td.c.ok, .word-map td.c.retry, .word-map td.c.help, .word-map td.c.self { animation: cell-in .45s ease; }
@keyframes cell-in { from { transform: scale(.4); opacity: 0; } }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .74rem; color: var(--ink-soft); padding: 6px 4px 0; }
.legend .c { width: 18px; height: 18px; font-size: .7rem; color: #fff; }
.legend .c.ok { background: var(--ok); } .legend .c.retry { background: var(--retry); } .legend .c.help { background: var(--help); }
.legend .c.self { background: var(--self); } .legend .c.none { background: transparent; color: var(--none); border: 1px solid var(--none); }

/* path play */
.path-head { display: flex; align-items: center; gap: 8px; color: var(--on-bg); }
.ph-title { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 1.1rem; }
.ph-count { font-size: .95rem; color: var(--on-bg-soft); }
.ph-count #pCount { font-weight: 800; color: var(--on-bg); font-family: var(--font-en); }
.pbar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .3); margin: 8px 0; overflow: hidden; }
body[data-track="adults"] .pbar { background: var(--line); }
.pbar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s; }
body[data-track="kids"] .pbar i { background: #ffdf6b; }
.mini-map { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 6px 8px; display: grid; gap: 3px; margin-bottom: 10px; }
body[data-track="adults"] .mini-map { background: var(--card-2); }
.mm-row { display: flex; align-items: center; gap: 3px; direction: ltr; }
.mm-ic { width: 20px; font-size: .75rem; text-align: center; }
.mm { flex: 1; max-width: 14px; height: 9px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
body[data-track="adults"] .mm { background: #ddd3c2; }
.mm.ok { background: var(--ok); } .mm.retry { background: var(--retry); } .mm.help { background: var(--help); } .mm.self { background: var(--self); }
.mm.cur { outline: 2px solid #fff; outline-offset: 1px; }
body[data-track="adults"] .mm.cur { outline-color: var(--primary); }
.path-tag { color: var(--on-bg); text-align: center; font-weight: 700; margin: 4px 0 8px; }

.item { background: var(--card); border-radius: 22px; padding: 14px; box-shadow: 0 8px 22px rgba(0, 0, 0, .14); animation: rise .35s ease both; }
body[data-track="adults"] .item { border-radius: 16px; }
.item-guide { display: flex; align-items: center; gap: 10px; }
.prompt { font-weight: 800; font-size: 1.08rem; margin: 0; }
.item-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 12px 0; }
.thumb { width: 100%; aspect-ratio: 6 / 5; background-repeat: no-repeat; border-radius: 14px; background-color: #f6efe4; }
.thumb.hero { width: 70%; max-width: 250px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.thumb.sm { width: 64px; min-width: 64px; border-radius: 10px; }
.thumb.xs { width: 30px; min-width: 30px; border-radius: 6px; }
.thumb.emoji { display: grid; place-items: center; font-size: 3rem; }
.thumb.xs.emoji { font-size: 1rem; } .thumb.sm.emoji { font-size: 1.6rem; }
.speaker { width: 96px; height: 96px; border-radius: 50%; border: 0; font-size: 2.6rem; cursor: pointer; background: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 0 var(--primary-shadow); }
.speaker:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--primary-shadow); }
body[data-track="kids"] .speaker { animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.05); } }
.answers { display: grid; gap: 10px; }
.answers.grid2 { grid-template-columns: 1fr 1fr; }
.choice {
  border: 3px solid var(--line); background: var(--card); border-radius: 16px; cursor: pointer; padding: 6px; min-height: 56px;
  transition: transform .12s, border-color .2s, background .2s;
}
.choice:active { transform: scale(.97); }
.choice.word { font-family: var(--font-en); font-size: 1.3rem; font-weight: 800; direction: ltr; }
body[data-track="adults"] .choice.word { font-weight: 600; }
.choice.right { border-color: var(--ok); background: #d8f5e6; }
.choice.wrong { border-color: var(--help); background: #fde3e0; }
.choice.reveal { border-color: var(--ok); box-shadow: 0 0 0 5px rgba(34, 168, 102, .3); animation: pulse 1.1s infinite; }
.tools { margin-top: 10px; }
.tools .btn { min-height: 44px; font-size: .92rem; padding: .4em .8em; }
.item.solved .answers { pointer-events: none; }
.model { display: flex; align-items: center; gap: 8px; }
.model small { color: var(--ink-soft); }
.big-en { font-size: 1.6rem; font-weight: 800; }
.btn.mic { width: 100%; min-height: 64px; font-size: 1.15rem; background: var(--accent); color: #fff; border: 0; box-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.btn.mic.listening { animation: pulse 1s infinite; background: var(--help); }
.heard .compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: center; background: var(--card-2); border-radius: 12px; padding: 8px; }
.heard .compare small { display: block; color: var(--ink-soft); }
.heard .compare .en { font-size: 1.15rem; font-weight: 700; }
.fallback .note { background: #fff4d6; border-radius: 12px; padding: 8px 10px; font-weight: 600; color: #6b4a00; }
body[data-track="adults"] .fallback .note { background: #f4ecdc; }
.slots { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.slot {
  width: 44px; height: 52px; border-radius: 10px; border: 0; border-bottom: 4px solid var(--line); background: var(--card-2);
  font-family: var(--font-en); font-size: 1.5rem; font-weight: 800; cursor: pointer; position: relative;
}
.slot.filled { border-bottom-color: var(--primary); background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.slot.ghost::after { content: attr(data-ghost); position: absolute; inset: 0; display: grid; place-items: center; color: var(--none); }
.tiles, .bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.tile, .wtile {
  min-width: 46px; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer;
  font-family: var(--font-en); font-size: 1.35rem; font-weight: 800; box-shadow: 0 3px 0 var(--line); padding: 0 10px;
}
.wtile { font-size: 1.1rem; }
.tile:disabled, .wtile:disabled { opacity: .25; box-shadow: none; cursor: default; }
.tile.nexthint, .wtile.nexthint { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(34, 168, 102, .3); animation: pulse 1s infinite; }
.type-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.type-row .or { font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
.type-in { flex: 1; min-width: 0; min-height: 46px; border-radius: 12px; border: 2px solid var(--line); padding: 6px 10px; font-family: var(--font-en); font-size: 1.1rem; }
.sentence { font-family: var(--font-en); font-size: 1.35rem; font-weight: 700; text-align: center; line-height: 1.6; margin: 6px 0; }
.blank { display: inline-block; min-width: 3.4em; border-bottom: 3px dashed var(--accent); color: var(--none); }
.blank.filled { color: var(--ok); border-bottom-style: solid; border-color: var(--ok); }
.build-line { min-height: 60px; width: 100%; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-radius: 14px; background: var(--card-2); border: 2px dashed var(--line); justify-content: flex-start; }
.wtile.placed { box-shadow: none; border-color: var(--primary); }
.placeholder { color: var(--none); }
.feedback { margin-top: 10px; }
.fb { background: var(--card); border-radius: 18px; padding: 12px; text-align: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .12); animation: rise .35s ease both; border-top: 6px solid var(--ok); }
.fb.retry { border-top-color: var(--retry); } .fb.help { border-top-color: var(--help); } .fb.self { border-top-color: var(--self); }
.fb-word { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; }
.same-word { color: var(--on-bg); text-align: center; font-weight: 700; margin: 10px 0 4px; }
.row-mini { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 8px 10px; box-shadow: 0 3px 10px rgba(0, 0, 0, .1); }
.row-mini .rw { font-weight: 800; font-size: 1.1rem; min-width: 4.2em; }
.rm-cells { display: flex; gap: 4px; flex: 1; justify-content: space-between; }
.rm { width: 40px; height: 44px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; font-weight: 800; color: var(--none); background: var(--card-2); }
.rm small { font-size: .8rem; margin-bottom: 2px; }
.rm.ok { background: var(--ok); color: #fff; } .rm.retry { background: var(--retry); color: #fff; }
.rm.help { background: var(--help); color: #fff; } .rm.self { background: var(--self); color: #fff; }
.rm.just { animation: just 1s ease; box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ok); }
@keyframes just { 0% { transform: scale(.5); } 60% { transform: scale(1.15); } 100% { transform: none; } }

/* ---------------------------------------------------------------- win / review / info */
.win, .empty { background: var(--card); border-radius: 24px; padding: 22px 18px; text-align: center; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); animation: rise .5s ease both; }
.win-stars { font-size: 3rem; letter-spacing: 6px; color: #d5dbe0; margin: 6px 0; direction: ltr; }
.win-stars .on { color: #f5b301; display: inline-block; animation: star-in .6s cubic-bezier(.3, 1.6, .5, 1) both; text-shadow: 0 3px 0 #d08e00; }
.win-stars .on:nth-child(2) { animation-delay: .25s; } .win-stars .on:nth-child(3) { animation-delay: .5s; }
@keyframes star-in { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.win-note { background: var(--card-2); border-radius: 14px; padding: 10px 12px; margin: 12px 0; }
.leitner { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; direction: rtl; }
.lbox { background: var(--card-2); border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; font-size: .76rem; line-height: 1.3; border-bottom: 4px solid var(--primary); }
.lbox b { font-size: 1.2rem; font-family: var(--font-en); }
.lbox:nth-child(1) { border-color: var(--help); } .lbox:nth-child(2) { border-color: var(--retry); } .lbox:nth-child(3) { border-color: #e3c84a; }
.lbox:nth-child(4) { border-color: #6cc48b; } .lbox:nth-child(5) { border-color: var(--ok); }
.review { color: var(--ink); }
.info { background: var(--card); border-radius: 22px; padding: 18px 16px; box-shadow: 0 8px 22px rgba(0, 0, 0, .15); }
.info h2 { font-size: 1.15rem; margin-top: 1.2em; }
.lead { font-size: 1.1rem; font-weight: 700; }
.stages-diagram { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; position: relative; }
.stages-diagram li { background: var(--card-2); border-radius: 14px; padding: 10px 12px 10px 12px; padding-inline-start: 52px; position: relative; }
.stages-diagram li + li::before { content: '⬇'; position: absolute; top: -16px; inset-inline-start: 18px; font-size: .9rem; color: var(--ink-soft); }
.sd-n { position: absolute; inset-inline-start: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 800; }
.stages-diagram strong { font-size: 1.05rem; }
.stages-diagram p { margin: 2px 0 0; font-size: .93rem; color: var(--ink-soft); }
.five { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 8px 0; }
.five-p { background: var(--card-2); border-radius: 12px; padding: 6px 3px; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.25; }
.five-p span { font-size: 1.4rem; }
.five-p strong { font-size: .72rem; }
.five-p small { font-size: .62rem; color: var(--ink-soft); }
.word-map.demo { background: var(--card-2); border-radius: 12px; padding: 4px; }

/* ---------------------------------------------------------------- fx */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 105vh, 0) rotate(var(--rot)); opacity: .9; } }
.star-pop { position: absolute; font-style: normal; font-size: 1.8rem; animation: star-pop 1.2s ease-out forwards; }
@keyframes star-pop { 0% { transform: scale(.3); opacity: 0; } 25% { opacity: 1; transform: scale(1.2); } 100% { transform: translate(var(--dx), var(--dy)) scale(.8); opacity: 0; } }
.calm-check { position: absolute; inset: 0; display: grid; place-items: center; }
.calm-check span { width: 86px; height: 86px; border-radius: 50%; background: rgba(31, 111, 104, .92); color: #fff; display: grid; place-items: center; font-size: 2.6rem; animation: calm 1.1s ease forwards; box-shadow: 0 8px 26px rgba(31, 111, 104, .35); }
@keyframes calm { 0% { transform: scale(.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1.04); } }
.shake { animation: shake .45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
#toast {
  position: fixed; bottom: calc(18px + var(--safe-b)); left: 50%; transform: translate(-50%, 30px); opacity: 0; transition: .3s; z-index: 120;
  background: #12324a; color: #fff; padding: 10px 16px; border-radius: 999px; font-weight: 700; max-width: 92vw; text-align: center; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 720px) {
  body { font-size: 18px; }
  #app { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .scene.kb .kbl, .tc-art img { animation: none !important; }
  .cam { transition: none; }
}
