/* QuantaPrism AI Lab. Mobile first: works from 360 px with 16 px side gutters. Same warm
   look as the Kids Library (same colours and font), its own layout. */
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSans-SemiBold-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansDevanagari-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0900-097F, U+1CD0-1CFF, U+200C-200D, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FF; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansBengali-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+200C-200D, U+25CC; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansGurmukhi-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0A01-0A76, U+200C-200D, U+25CC; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansGujarati-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0A80-0AFF, U+200C-200D, U+25CC; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansTamil-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+25CC; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansTelugu-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0C00-0C7F, U+200C-200D, U+25CC; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansKannada-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0C80-0CF3, U+200C-200D, U+25CC; }
@font-face { font-family: "LabSans"; src: url("../fonts/NotoSansMalayalam-SemiBold.woff2") format("woff2"); font-weight: 400 800; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0D00-0D7F, U+200C-200D, U+25CC; }

:root {
  --paper: #fff6e6;
  --paper-2: #ffeccc;
  --card: #ffffff;
  --ink: #2b2240;
  --ink-soft: #6a5f7d;
  --accent: #e0563f;
  --accent-dark: #b83e2a;
  --sun: #ffd54a;
  --sky: #3f8fe0;
  --sky-dark: #2a6db3;
  --leaf: #2f9e6b;
  --leaf-dark: #217a51;
  --plum: #7a4fb5;
  --plum-dark: #573585;
  --line: #f0dcb8;
  --ok-bg: #e2f6ea;
  --ok-ink: #1f6e47;
  --try-bg: #fff0d6;
  --try-ink: #8a5a00;
  --red-dot: #e5484d;
  --blue-dot: #2f7fe0;
  --focus: #1d5fd1;
  --shadow: 0 6px 20px rgba(80, 50, 10, .12);
  --radius: 22px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "LabSans", "Noto Sans", system-ui, sans-serif; font-size: 18px; line-height: 1.5; overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
button { font: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 8px; }
main:focus { outline: none; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.soft { color: var(--ink-soft); }
.small { font-size: 15px; }

/* ---- header and footer ---- */
.top { background: var(--paper-2); border-bottom: 3px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.15; }
.brand img { width: 44px; height: 44px; border-radius: 12px; }
.brand b { color: var(--accent); display: block; font-size: 22px; }
.starcount { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; background: var(--card); border: 3px solid var(--sun); border-radius: 999px; padding: 4px 14px 4px 8px; white-space: nowrap; }
.starcount svg { width: 24px; height: 24px; }
.foot { margin-top: 40px; padding: 24px 0 32px; color: var(--ink-soft); font-size: 15px; border-top: 3px solid var(--line); }
.foot a { color: var(--ink-soft); }
.loading { padding: 48px var(--gutter); text-align: center; color: var(--ink-soft); }

/* ---- icons ---- */
.star { width: 22px; height: 22px; flex: none; }
.star path { fill: #eadfca; }
.star.on path { fill: #ffb400; stroke: #e09a00; stroke-width: 1; }
.stars { display: inline-flex; gap: 2px; }

/* ---- home ---- */
.hero { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: center; padding: 22px 0 6px; }
.hero-pic { width: 120px; margin: 0 auto; border-radius: 50%; overflow: hidden; border: 6px solid var(--card); box-shadow: var(--shadow); aspect-ratio: 1 / 1; }
.hero-pic img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: clamp(30px, 7vw, 50px); color: var(--accent); text-align: center; margin-bottom: .2em; }
.hero p { font-size: clamp(18px, 3.4vw, 22px); color: var(--ink-soft); text-align: center; max-width: 620px; margin: 0 auto; }
@media (min-width: 760px) {
  .hero { grid-template-columns: 200px 1fr; gap: 28px; }
  .hero-pic { width: 200px; }
  .hero h1, .hero p { text-align: left; margin-left: 0; }
}
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 0; padding: 0; list-style: none; }
@media (min-width: 760px) { .chips-row { justify-content: flex-start; } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--card); border: 2px solid var(--line); color: var(--ink-soft); }
.pill svg { width: 18px; height: 18px; }

.sec-title { font-size: 24px; margin: 26px 0 4px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 12px 0 8px; list-style: none; margin: 0; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 960px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { display: flex; flex-direction: column; height: 100%; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; overflow: hidden; border: 3px solid transparent; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-3px); border-color: var(--sun); }
.card-pic { position: relative; aspect-ratio: 4 / 3; background: var(--paper-2); }
.card-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-num { position: absolute; top: 8px; left: 8px; font-size: 14px; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--ink); }
.card-cam { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--plum); color: #fff; }
.card-cam svg { width: 14px; height: 14px; }
.card-text { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { font-size: 18px; font-weight: 800; line-height: 1.25; }
.card-sub { font-size: 15px; color: var(--ink-soft); line-height: 1.35; flex: 1; }
.card .stars { margin-top: 4px; }

.grown { margin: 28px 0 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border-top: 8px solid var(--plum); }
.grown h2 { color: var(--plum); font-size: 22px; }
.grown ul { margin: 0 0 8px; padding-left: 1.2em; }
.grown li { margin: 4px 0; }

/* ---- buttons ---- */
.btn { font-weight: 800; font-size: 19px; padding: 10px 22px; border-radius: 999px; border: 0; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 0 var(--accent-dark); min-height: 50px; line-height: 1.2; text-align: center; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-dark); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn.sky { background: var(--sky); box-shadow: 0 4px 0 var(--sky-dark); }
.btn.leaf { background: var(--leaf); box-shadow: 0 4px 0 var(--leaf-dark); }
.btn.plum { background: var(--plum); box-shadow: 0 4px 0 var(--plum-dark); }
.btn.ghost { background: var(--card); color: var(--ink); border: 3px solid var(--line); box-shadow: none; }
.btn.small { font-size: 16px; min-height: 44px; padding: 6px 16px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn[aria-pressed="true"] { outline: 4px solid var(--sun); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.center { justify-content: center; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; background: var(--paper-2); padding: 5px; border-radius: 999px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 16px; color: var(--ink-soft); cursor: pointer; min-height: 40px; }
.seg button[disabled] { opacity: .5; cursor: progress; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 2px 6px rgba(80, 50, 10, .15); }

/* ---- lesson page ---- */
.lesson { padding-top: 14px; }
.lbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lbar h1 { font-size: clamp(22px, 5vw, 32px); color: var(--accent); margin: 0; flex: 1; min-width: 0; }
.iconbtn { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 3px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.iconbtn svg { width: 24px; height: 24px; }
.talk { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; margin: 10px 0 16px; }
.talk-pic { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; border: 4px solid var(--card); box-shadow: var(--shadow); }
.talk-pic img { width: 100%; height: 100%; object-fit: cover; }
.bubble { position: relative; background: var(--card); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); font-size: 18px; }
.bubble::before { content: ""; position: absolute; left: -10px; top: 22px; border: 10px solid transparent; border-right-color: var(--card); border-left: 0; }
.bubble p:last-child { margin-bottom: 0; }
@media (min-width: 760px) { .talk { grid-template-columns: 96px 1fr; } .talk-pic { width: 96px; height: 96px; } .bubble { font-size: 19px; } }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 16px 0; }
.panel h2 { font-size: 22px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.panel h2 .num { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; background: var(--sun); align-items: center; justify-content: center; font-size: 17px; flex: none; }
.goal { display: flex; align-items: center; gap: 10px; background: var(--try-bg); color: var(--try-ink); border-radius: 14px; padding: 8px 12px; font-weight: 700; font-size: 16px; margin: 0 0 12px; }
.goal.done { background: var(--ok-bg); color: var(--ok-ink); }
.goal svg { width: 22px; height: 22px; flex: none; }
.status { min-height: 1.5em; font-weight: 700; }
.note { font-size: 15px; color: var(--ink-soft); }
.privacy { display: flex; gap: 10px; align-items: flex-start; background: #f3ecfb; color: #4b2f7a; border-radius: 14px; padding: 10px 12px; font-size: 16px; margin: 0 0 12px; }
.privacy svg { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.err { background: #fde8e4; color: #8a2a17; border-radius: 14px; padding: 10px 12px; font-weight: 700; }
.next-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin: 20px 0 0; }

/* ---- quiz ---- */
.quiz ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.q-text { font-weight: 800; margin-bottom: 8px; }
.q-opts { display: grid; gap: 8px; }
@media (min-width: 640px) { .q-opts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.q-opt { text-align: left; border: 3px solid var(--line); background: var(--paper); border-radius: 16px; padding: 10px 14px; cursor: pointer; font-size: 17px; font-weight: 700; color: var(--ink); min-height: 52px; }
.q-opt:hover:not([disabled]) { border-color: var(--sky); }
.q-opt.right { border-color: var(--leaf); background: var(--ok-bg); color: var(--ok-ink); }
.q-opt.wrong { border-color: var(--accent); background: #fde8e4; color: #8a2a17; }
.q-opt[disabled] { cursor: default; }
.q-why { margin-top: 8px; font-size: 16px; border-radius: 12px; padding: 8px 12px; background: var(--paper-2); }
.q-result { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-weight: 800; font-size: 19px; }
.q-result .star { width: 30px; height: 30px; }

/* ---- celebration ---- */
.cheer { position: fixed; left: 50%; top: 12px; transform: translateX(-50%) translateY(-160%); font-size: 16px; white-space: nowrap; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 800; display: flex; align-items: center; gap: 8px; z-index: 20; transition: transform .3s; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.cheer.show { transform: translateX(-50%) translateY(0); }
.cheer svg { width: 26px; height: 26px; }
@media (prefers-reduced-motion: reduce) { .cheer, .card { transition: none; } }

/* grid children may shrink below their content (no sideways scroll on phones) */
.learn-grid > *, .nw-grid > *, .bts-grid > *, .cam-grid > *, .tok-cards > *, .classes > * { min-width: 0; }

/* ---- lesson: watch a computer learn ---- */
.learn-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .learn-grid { grid-template-columns: minmax(0, 440px) 1fr; align-items: start; } }
.board { position: relative; width: 100%; max-width: 440px; margin: 0 auto; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden; box-shadow: inset 0 0 0 3px var(--line); background: #faf7f0; touch-action: manipulation; }
.board canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.pick { display: flex; gap: 8px; }
.pick button { display: inline-flex; align-items: center; gap: 8px; border: 3px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 800; cursor: pointer; min-height: 46px; }
.pick button[aria-pressed="true"] { border-color: var(--ink); }
.dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.dot.red { background: var(--red-dot); }
.dot.blue { background: var(--blue-dot); }
.meter { height: 16px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sun), var(--leaf)); border-radius: 999px; transition: width .2s; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 16px; }
.kv b { font-weight: 800; }
.ctl h3 { font-size: 17px; margin: 12px 0 6px; color: var(--ink-soft); }

/* ---- lesson: next word ---- */
.sentence { min-height: 64px; background: var(--paper); border: 3px dashed var(--line); border-radius: 16px; padding: 10px 12px; font-size: clamp(20px, 4.6vw, 26px); line-height: 1.5; }
.sentence .w { display: inline; }
.sentence .w.ai { background: #e8f1fd; border-radius: 6px; padding: 0 3px; }
.sentence .caret { display: inline-block; width: 3px; height: 1.1em; background: var(--accent); vertical-align: -0.15em; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.typebox { width: 100%; font: inherit; font-size: 19px; padding: 10px 14px; border-radius: 14px; border: 3px solid var(--line); background: var(--card); color: var(--ink); }
.typebox:focus { border-color: var(--sky); outline: none; }
.guesses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.guess { width: 100%; display: grid; grid-template-columns: minmax(84px, 34%) 1fr 56px; align-items: center; gap: 10px; border: 3px solid var(--line); background: var(--card); border-radius: 14px; padding: 6px 10px; cursor: pointer; text-align: left; color: var(--ink); min-height: 48px; }
.guess:hover { border-color: var(--sky); }
.guess .gw { font-weight: 800; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guess .gb { height: 14px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.guess .gb i { display: block; height: 100%; background: var(--sky); border-radius: 999px; }
.guess .gp { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.guess:first-child .gb i { background: var(--leaf); }
.why { background: var(--paper-2); border-radius: 14px; padding: 10px 12px; font-size: 16px; }
.nw-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .nw-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---- lesson: tokens ---- */
.tok-cards { display: grid; gap: 12px; }
@media (min-width: 900px) { .tok-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tok-card { border: 3px solid var(--line); border-radius: 18px; padding: 12px; background: var(--paper); min-width: 0; }
.tok-card h3 { font-size: 17px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin: 0 0 4px; }
.tok-card .src { font-size: 18px; margin: 0 0 8px; }
.tok-count { font-size: 15px; font-weight: 800; color: var(--ink); background: var(--sun); border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.toks { display: flex; flex-wrap: wrap; gap: 4px; }
.tok { display: inline-block; padding: 1px 6px; border-radius: 7px; font-size: 17px; line-height: 1.5; white-space: pre; border: 2px solid transparent; }
.tok.part { border: 2px dashed #9b86c2; background: #fff !important; text-align: center; }
.tok .pcs { display: block; font-size: 10px; line-height: 1; letter-spacing: 1px; color: #7a4fb5; text-align: center; }
.tok .tid { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 700; text-align: center; line-height: 1.1; }
.bars { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0; }
.bar { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; }
.bar .bt { height: 22px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.bar .bt i { display: block; height: 100%; border-radius: 999px; background: var(--sky); transition: width .4s; }
.bar.hi .bt i { background: var(--plum); }
.bar.ta .bt i { background: var(--accent); }
.bar .bn { text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 15px; color: var(--ink-soft); margin: 8px 0 0; align-items: center; }
.legend .tok { font-size: 14px; }
.tok-text { width: 100%; min-height: 84px; font: inherit; font-size: 19px; padding: 10px 14px; border-radius: 14px; border: 3px solid var(--line); background: var(--card); color: var(--ink); resize: vertical; }
.tok-text:focus { border-color: var(--sky); outline: none; }

/* ---- lesson: real or AI ---- */
.rf { max-width: 720px; margin: 0 auto; }
.rf-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; font-weight: 800; margin-bottom: 8px; }
.rf-top .rf-dots { order: 3; width: 100%; justify-content: center; }
.rf-pic { position: relative; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: #ddd; aspect-ratio: 4 / 3; }
.rf-pic img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; cursor: zoom-in; }
.rf-pic.zoom img { transform: scale(2); cursor: zoom-out; }
.rf-flag { position: absolute; left: 12px; top: 12px; font-weight: 800; padding: 4px 14px; border-radius: 999px; color: #fff; font-size: 17px; }
.rf-flag.ai { background: var(--plum); }
.rf-flag.real { background: var(--leaf); }
.rf-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.rf-choices .btn { width: 100%; font-size: 18px; padding: 10px; }
.rf-answer { border-radius: 16px; padding: 12px 14px; margin: 10px 0; }
.rf-answer.right { background: var(--ok-bg); color: var(--ok-ink); }
.rf-answer.wrong { background: #fde8e4; color: #8a2a17; }
.rf-answer b { display: block; font-size: 20px; margin-bottom: 4px; }
.rf-answer p { color: var(--ink); margin: 0 0 4px; }
.rf-credit { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; word-break: break-word; }
.rf-dots { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.rf-dots li { width: 14px; height: 14px; border-radius: 50%; background: #e3d6bf; }
.rf-dots li.right { background: var(--leaf); }
.rf-dots li.wrong { background: var(--accent); }
.tips { margin: 0; padding-left: 1.3em; }
.tips li { margin: 6px 0; }

/* ---- lesson: behind the scenes ---- */
.bts-grid { display: grid; gap: 14px; }
@media (min-width: 820px) { .bts-grid { grid-template-columns: minmax(0, 460px) 1fr; align-items: start; } }
.bts-stage { position: relative; width: 100%; max-width: 460px; margin: 0 auto; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden; background: #241a33; box-shadow: var(--shadow); }
.bts-stage canvas { width: 100%; height: 100%; display: block; }
.steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.steps button { border: 3px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px; font-weight: 800; font-size: 15px; cursor: pointer; color: var(--ink-soft); min-height: 40px; }
.steps button[aria-current="step"] { border-color: var(--accent); color: var(--accent); }
.steps button.seen { color: var(--ink); }
.bts-text h3 { font-size: 22px; color: var(--accent); }
.mouths { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.mouth { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 3px solid var(--line); border-radius: 14px; padding: 6px 8px; background: var(--paper); font-weight: 800; font-size: 15px; min-width: 64px; }
.mouth.on { border-color: var(--accent); background: #fff1ec; }
.mouth svg { width: 46px; height: 30px; }
.pipeline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; font-weight: 800; font-size: 15px; }
.pipeline span { background: var(--paper-2); border-radius: 999px; padding: 4px 10px; }
.pipeline span.on { background: var(--sun); }
.pipeline i { font-style: normal; color: var(--ink-soft); }

/* ---- camera lessons ---- */
.cam-grid { display: grid; gap: 14px; }
@media (min-width: 820px) { .cam-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.game { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: linear-gradient(#bfe3ff, #eaf6ff 70%); box-shadow: var(--shadow); touch-action: manipulation; }
.game canvas { width: 100%; height: 100%; display: block; }
.camview { position: relative; width: 100%; max-width: 420px; aspect-ratio: 4 / 3; margin: 0 auto; border-radius: 18px; overflow: hidden; background: #2b2240; box-shadow: var(--shadow); }
.camview video, .camview canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camview .camoff { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 16px; font-weight: 700; }
.armstate { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: var(--paper-2); }
.armstate.up { background: var(--ok-bg); color: var(--ok-ink); }
.classes { display: grid; gap: 10px; }
.klass { border: 3px solid var(--line); border-radius: 16px; padding: 10px; background: var(--paper); }
.klass-top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.klass-top input { flex: 1; min-width: 0; font: inherit; font-weight: 800; font-size: 18px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.klass-count { font-weight: 800; white-space: nowrap; }
.thumbs { display: flex; gap: 4px; min-height: 40px; overflow: hidden; }
.thumbs canvas { width: 40px; height: 40px; border-radius: 8px; flex: none; transform: scaleX(-1); }
.hold { user-select: none; -webkit-user-select: none; touch-action: none; width: 100%; margin-top: 8px; }
.hold.on { filter: brightness(1.12); transform: translateY(2px); }
.pred { display: grid; grid-template-columns: minmax(80px, 30%) 1fr 56px; gap: 10px; align-items: center; font-weight: 800; }
.pred .bt { height: 22px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.pred .bt i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .15s; }
.pred.k1 .bt i { background: var(--sky); }
.pred .bn { text-align: right; font-variant-numeric: tabular-nums; }
.bigguess { font-size: clamp(22px, 5vw, 30px); font-weight: 800; text-align: center; color: var(--accent); min-height: 1.4em; }
/* "How to play" steps above a lesson's board */
.howbox { background: var(--card); border: 3px solid var(--line); border-radius: 18px; padding: 10px 16px; margin: 0 0 14px; }
.howbox h3 { margin: 0 0 4px; }
.howsteps { margin: 0; padding-left: 1.4em; }
.howsteps li { margin: 3px 0; line-height: 1.4; }
.tok-card .tok-text { margin: 0 0 8px; min-height: 72px; }
.tok-cards.own + .bars { margin-top: 12px; }
/* Real or AI-made? warm-up: the AI models and real-vs-AI rows */
.rf-models { display: grid; gap: 10px; }
@media (min-width: 640px) { .rf-models { grid-template-columns: 1fr 1fr; } }
.rf-model { border: 3px solid var(--line); border-radius: 16px; padding: 8px 12px; background: var(--paper); }
.rf-model p { margin: 2px 0 0; font-size: 15px; }
.rf-compare { display: grid; gap: 12px; }
@media (min-width: 640px) { .rf-compare { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rf-fig { margin: 0; min-width: 0; }
.rf-fig .rf-flag { font-size: 14px; padding: 3px 10px; left: 8px; top: 8px; }
.rf-fig figcaption p { margin: 6px 0 0; font-size: 15px; }
/* Camera lessons: the first choice (with or without camera) */
.chooser { text-align: center; }
.choose-q { font-size: clamp(20px, 4.6vw, 24px); font-weight: 800; margin: 4px 0 12px; }
.choices { display: grid; gap: 14px; }
@media (min-width: 640px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 16px 20px; border-radius: var(--radius); border: 0; cursor: pointer; color: #fff; font: inherit; text-align: center; min-height: 150px; }
.choice.plum { background: var(--plum); box-shadow: 0 6px 0 var(--plum-dark); }
.choice.leaf { background: var(--leaf); box-shadow: 0 6px 0 var(--leaf-dark); }
.choice:active { transform: translateY(3px); }
.choice-icon { display: inline-flex; width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .2); align-items: center; justify-content: center; }
.choice-icon svg { width: 32px; height: 32px; }
.choice-title { font-size: 24px; font-weight: 800; line-height: 1.2; }
.choice-text { font-size: 17px; line-height: 1.35; opacity: .95; }
.choice-warn { font-size: 14px; line-height: 1.3; background: rgba(255, 255, 255, .92); color: #4b2f7a; border-radius: 12px; padding: 6px 10px; margin-top: 4px; }
.camfail { background: #fde8e4; color: #8a2a17; border-radius: 14px; padding: 10px 12px; margin-top: 12px; font-weight: 700; text-align: center; }
.camfail p { margin: 0 0 8px; }
/* Move-to-play without camera, and the end of the game */
.game-solo { max-width: 760px; margin: 0 auto; }
/* the photo cards sit right next to (or under) the game, so the child sees Bina while tapping */
.nocam-grid { display: grid; gap: 10px; grid-template-areas: "game" "cards" "ctl" "out" "how" "credits"; }
@media (min-width: 900px) {
  .nocam-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); grid-template-areas: "game cards" "ctl cards" "out how" "out credits"; align-items: start; column-gap: 16px; }
}
.kid-pick { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; }
.kid-q { font-weight: 800; }
.kid-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border: 3px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; min-height: 48px; }
.kid-btn img { width: 34px; height: 48px; object-fit: contain; }
.kid-btn[aria-pressed="true"] { border-color: var(--plum); box-shadow: 0 0 0 3px var(--plum); }
.pose-saw { margin: 8px 0 0; font-weight: 800; min-height: 1.4em; }
.pose-saw.yes { color: var(--ok-ink); }
.pose-cards.waiting .pose-card:not([disabled]) { animation: pose-wait 1s ease-in-out infinite; }
@keyframes pose-wait { 50% { border-color: var(--leaf); box-shadow: 0 0 0 4px var(--leaf); } }
@media (prefers-reduced-motion: reduce) { .pose-cards.waiting .pose-card:not([disabled]) { animation: none; border-color: var(--leaf); } }
.na-game { grid-area: game; } .na-ctl { grid-area: ctl; } .na-cards { grid-area: cards; } .na-out { grid-area: out; } .na-how { grid-area: how; } .na-credits { grid-area: credits; }
.na-ctl .row { margin-top: 4px !important; }
.na-ctl .status { margin: 6px 0 0; }
/* Move-to-play without camera: MoveNet on photo cards */
.pose-out { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; align-items: center; background: var(--card); border: 3px solid var(--line); border-radius: 18px; padding: 10px; }
@media (min-width: 640px) { .pose-out { grid-template-columns: 190px minmax(0, 1fr); } }
.pose-view { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #ece6f5; }
.pose-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pose-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.pose-found { margin: 0 0 4px; font-weight: 800; font-size: 17px; }
.pose-rule { margin: 0 0 4px; font-size: 17px; line-height: 1.35; }
.pose-rule b { display: inline-block; padding: 1px 10px; border-radius: 999px; }
.pose-rule b.yes { background: var(--ok-bg); color: var(--ok-ink); }
.pose-rule b.no { background: var(--paper-2); color: var(--ink); }
.pose-same { margin: 0; font-size: 14px; }
.pose-panel { background: var(--card); border: 3px solid var(--line); border-radius: 18px; padding: 10px 14px 12px; }
.pose-panel h3 { margin: 0 0 6px; }
.mn-how { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.mn-how li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; line-height: 1.35; font-size: 15px; }
.mn-num { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--plum); color: #fff; font-weight: 800; align-items: center; justify-content: center; font-size: 14px; }
.pose-lead { margin: 0 0 8px; font-weight: 800; }
.pose-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pose-card { position: relative; display: block; padding: 0; border: 3px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; cursor: pointer; aspect-ratio: 1 / 1; font: inherit; }
.pose-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pose-card[disabled] { opacity: .55; cursor: progress; }
.pose-card:not([disabled]):hover { border-color: var(--plum); }
.pose-card.picked { border-color: var(--plum); box-shadow: 0 0 0 3px var(--plum); }
.pose-num { position: absolute; left: 4px; top: 4px; min-width: 22px; height: 22px; border-radius: 999px; background: rgba(43, 34, 64, .75); color: #fff; font-size: 13px; font-weight: 800; line-height: 22px; text-align: center; }
.pose-tag { position: absolute; left: 2px; right: 2px; bottom: 2px; font-size: 11px; letter-spacing: -.2px; text-align: center; font-weight: 800; line-height: 1.5; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pose-tag:empty { display: none; }
@media (max-width: 480px) { .pose-tag { font-size: 10px; letter-spacing: -.3px; left: 1px; right: 1px; } }
.pose-card.up .pose-tag { background: var(--ok-bg); color: var(--ok-ink); }
.pose-card.down .pose-tag { background: var(--paper-2); color: var(--ink); }
.pose-credits { margin-top: 8px; }
.pose-credits .rf-credit { font-size: 12px; margin: 2px 0 0; }
.win { text-align: center; background: var(--ok-bg); color: var(--ok-ink); border: 3px solid var(--leaf); border-radius: 18px; padding: 12px; margin-top: 10px; }
.win-title { font-size: clamp(24px, 5vw, 32px); font-weight: 800; margin: 0; }
.win-text { margin: 4px 0 10px; font-weight: 700; }
.win-stars .star { width: 40px; height: 40px; }
/* Teach the computer with pictures */
.pics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pic { position: relative; border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: 6px 4px 20px; cursor: pointer; min-height: 72px; }
.pic img { display: block; width: 100%; max-width: 72px; height: auto; margin: 0 auto; aspect-ratio: 1 / 1; }
.pic[disabled] { opacity: .5; cursor: default; }
.pic-tag { position: absolute; left: 2px; right: 2px; bottom: 2px; font-size: 12px; font-weight: 800; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 8px; }
.pic.ex.k0 { border-color: var(--accent); }
.pic.ex.k0 .pic-tag { background: var(--accent); color: #fff; }
.pic.ex.k1 { border-color: var(--sky); }
.pic.ex.k1 .pic-tag { background: var(--sky); color: #fff; }
.pic.asked.right { border-color: var(--leaf); border-style: dashed; }
.pic.asked.right .pic-tag { background: var(--ok-bg); color: var(--ok-ink); }
.pic.asked.wrong { border-color: var(--accent); border-style: dashed; }
.pic.asked.wrong .pic-tag { background: #fde8e4; color: #8a2a17; }
.pics[data-tool="ask"] .pic:not(.ex):not([disabled]):hover { border-color: var(--leaf); }
.thumbs.pics-thumbs canvas { transform: none; background: #fff; }
.btn.hold[aria-pressed="true"] { outline: 4px solid var(--sun); outline-offset: 2px; }
.verdict { text-align: center; font-weight: 800; min-height: 1.4em; margin: 0 0 8px; }
.verdict.ok { color: var(--ok-ink); }
.verdict.no { color: #8a2a17; }

/* ---------- "Page looks old? Get the newest version" (js/fresh.js) ---------- */
.fresh-link { background: none; border: 0; padding: 8px 0; margin: 0; font: inherit; font-size: 15px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; min-height: 44px; }
.fresh-link:hover { color: var(--ink); }
dialog.fresh { width: min(580px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 0; border-radius: 26px; padding: 22px 20px 18px; background: var(--card); color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); font: inherit; line-height: 1.45; }
dialog.fresh::backdrop { background: rgba(43, 34, 64, .45); }
.fresh h2 { margin: 0 40px 8px 0; font-size: 24px; line-height: 1.2; }
.fresh h3 { margin: 18px 0 6px; font-size: 19px; }
.fresh h4 { margin: 10px 0 2px; font-size: 16px; color: var(--plum); }
.fresh p { margin: 6px 0; }
.fresh ol { margin: 2px 0 6px; padding-left: 24px; }
.fresh li { margin: 3px 0; }
.fresh-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--line); background: var(--card); color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; }
.fresh-go { display: flex; width: 100%; align-items: center; justify-content: center; min-height: 60px; margin: 14px 0 6px; padding: 10px 22px; border: 0; border-radius: 999px; background: var(--leaf); color: #fff; font: inherit; font-weight: 800; font-size: 21px; cursor: pointer; box-shadow: 0 4px 0 var(--leaf-dark); }
.fresh-go:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--leaf-dark); }
.fresh-go[disabled] { opacity: .6; cursor: wait; }
.fresh-bar { height: 12px; border-radius: 999px; background: var(--paper-2, #ffeccc); overflow: hidden; margin: 8px 0 2px; }
.fresh-bar i { display: block; height: 100%; width: 0; background: var(--sun); }
.fresh-bar[hidden] { display: none; }
.fresh-status { min-height: 1.45em; font-weight: 800; }
.fresh-status.ok { color: var(--ok-ink, #1f6e47); }
.fresh-status.bad { color: var(--accent-dark); }
.fresh-hand { border-top: 3px solid var(--line); margin-top: 12px; }
.fresh-group { background: var(--paper); border-radius: 16px; padding: 4px 14px 6px; margin: 8px 0; }
.fresh-note { font-size: 15px; color: var(--ink-soft); }
.fresh-note.warn { background: var(--try-bg, #fff0d6); color: var(--try-ink, #8a5a00); border-radius: 12px; padding: 8px 12px; }
.fresh-close { display: block; margin: 12px auto 0; min-height: 44px; padding: 6px 22px; border-radius: 999px; border: 3px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; }
.fresh-toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); background: var(--ok-bg, #e2f6ea); color: var(--ok-ink, #1f6e47); border: 3px solid var(--leaf); border-radius: 18px; padding: 10px 18px; font-weight: 800; z-index: 60; box-shadow: var(--shadow); transition: opacity .5s; text-align: center; }
.fresh-toast.gone { opacity: 0; }

/* ---- narration (js/narration.js): speaker buttons, the text being read, the "Read to me" switch ---- */
/* The button is 44 px to tap but takes only a 26 px line: it never pushes the lines apart. */
.nar-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -9px -6px -9px 2px; padding: 0; border: 0; background: none; color: var(--sky-dark); cursor: pointer; vertical-align: middle; flex: none; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.nar-btn svg { width: 32px; height: 32px; padding: 5px; border-radius: 50%; background: #e3effc; }
.nar-btn:hover svg, .nar-btn[data-nar-reading] svg { background: var(--sky); color: #fff; }
.nar-btn:focus-visible { outline-offset: -4px; border-radius: 50%; }
[data-nar-host] { position: relative; }
.nar-btn.nar-corner { position: absolute; right: 6px; bottom: 5px; margin: 0; }
.nar-btn.nar-corner svg { background: #e3effc; box-shadow: 0 0 0 3px var(--card); }
.cards [data-nar-host] .card-text { padding-bottom: 14px; }
.cards [data-nar-host] .stars { margin-right: 40px; }
[data-nar-on] { background-color: #fff3bf; box-shadow: 0 0 0 4px #fff3bf; border-radius: 8px; transition: background-color .25s, box-shadow .25s; }
.nar-switch { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; min-height: 44px; padding: 4px 10px 4px 8px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font-weight: 800; font-size: 15px; cursor: pointer; white-space: nowrap; }
.nar-switch svg { width: 24px; height: 24px; flex: none; color: var(--ink-soft); }
.nar-switch i { position: relative; width: 34px; height: 20px; flex: none; border-radius: 999px; background: #d9cdb6; }
.nar-switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.nar-switch[aria-checked="true"] { border-color: var(--leaf); background: var(--ok-bg); color: var(--ok-ink); }
.nar-switch[aria-checked="true"] svg { color: var(--leaf-dark); }
.nar-switch[aria-checked="true"] i { background: var(--leaf); }
.nar-switch[aria-checked="true"] i::after { transform: translateX(14px); }
/* phone: no room for the words next to the stars; the speaker and the switch stay */
/* the teacher (js/narration.js): Pause next to the switch, "Start with the teacher", the gentle pulse
   on what the teacher waits for (a still ring with reduced motion) */
.nar-pause { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 6px 16px 6px 12px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; white-space: nowrap; }
.nar-pause[hidden] { display: none; }
.nar-pause svg { width: 22px; height: 22px; flex: none; }
.nar-pause svg + svg { margin-left: -4px; }
.nar-pause[aria-pressed="true"] { border-color: var(--sky); color: var(--sky-dark); }
.teach-start { display: flex; align-items: center; justify-content: center; gap: 12px; width: min(100% - 32px, 520px); min-height: 64px; margin: 16px auto 4px; padding: 12px 26px; border: 0; border-radius: 999px; background: var(--leaf); box-shadow: 0 5px 0 var(--leaf-dark); color: #fff; font: inherit; font-weight: 800; font-size: 22px; line-height: 1.2; cursor: pointer; }
.teach-start svg { width: 30px; height: 30px; flex: none; }
.teach-start:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--leaf-dark); }
[data-teach-cue] { outline: 4px solid rgba(255, 184, 0, .95); outline-offset: 3px; animation: teach-cue 1.6s ease-in-out infinite; }
@keyframes teach-cue { 50% { outline-color: rgba(255, 184, 0, .2); outline-offset: 7px; } }
@media (max-width: 519px) { .nar-pause-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .nar-pause { padding: 6px 12px; } }
@media (max-width: 519px) { .nar-switch-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .top-in { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { [data-nar-on], .nar-switch i::after { transition: none; } [data-teach-cue] { animation: none; } }

/* The free part (js/app.js locked): membership lessons */
.card-lock { position: absolute; left: 8px; bottom: 8px; display: inline-flex; gap: 4px; align-items: center;
  background: #fff3c4; color: #6b4e00; border-radius: 999px; padding: 2px 10px; font-size: 14px; font-weight: 700; }
.card.locked .card-pic img { filter: grayscale(0.35); }
.lock-panel h2 { display: flex; gap: 8px; align-items: center; }
.lock-panel h2 svg, .card-lock svg { width: 1.1em; height: 1.1em; flex: none; }
