:root {
  --bg: #ffffff;
  --bg2: #f1f3f6;
  --text: #111418;
  --hint: #5b6472;
  --link: #1f6feb;
  --btn: #1f6feb;
  --btn-text: #ffffff;
  --ok: #1a9e55; --bad: #d63b3b; --warn: #e8a400;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d; --bg2: #1f242b; --text: #eef1f5; --hint: #98a2b3; --link: #6aa7ff; --btn: #2563eb;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg2); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Gurmukhi", sans-serif; -webkit-tap-highlight-color: transparent; }
body { padding-bottom: calc(76px + 64px + env(safe-area-inset-bottom)); }
body.no-action { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body { padding-bottom: 88px; } body.no-action { padding-bottom: 24px; } }
#topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid rgba(127,127,127,.15); }
.topbar-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
#brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; }
#brand img { display: block; border-radius: 8px; }
.brand-text { font-weight: 800; letter-spacing: .06em; font-size: 16px; }
#topbar h1 { font-size: 17px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.home #topbar h1 { flex: 1; }
@media (max-width: 899px) { body:not(.home) .brand-text { display: none; } }
#searchForm { flex: 0 1 260px; }
#searchInput { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(127,127,127,.3); background: var(--bg2); color: var(--text); font: inherit; font-size: 15px; }
@media (max-width: 600px) { #searchForm { flex: 1 1 100%; order: 5; } }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.grid .card { margin-bottom: 0; }
@media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; } main { padding: 20px; } }
.card.hero { background: linear-gradient(135deg, #1f6feb, #0b3d91); color: #fff; }
.hero .muted { color: rgba(255,255,255,.8); }
.hero .bar { background: rgba(255,255,255,.25); }
.hero .primary { background: #fff; color: #0b3d91; }
.hero .secondary { background: rgba(255,255,255,.15); color: #fff; }
mark { background: #ffe58a; color: #111; border-radius: 3px; padding: 0 1px; }
.result { display: block; text-decoration: none; color: inherit; }
.result .snip { font-size: 14px; color: var(--hint); margin-top: 4px; }
.two-col { display: grid; gap: 12px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 3fr 2fr; align-items: start; } }
.icon-btn { border: 0; background: none; color: var(--link); font-size: 30px; line-height: 1; padding: 0 8px 4px 0; cursor: pointer; }
main { max-width: 980px; margin: 0 auto; padding: 12px; }
.pad { padding: 12px; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.card { background: var(--bg); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.hero h2 { margin: 0 0 4px; font-size: 22px; }
.hero p { margin: 0; }
.bar { height: 8px; border-radius: 8px; background: rgba(127,127,127,.2); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; width: 100%; height: 100%; background: var(--ok); border-radius: 8px; transform: scaleX(0); transform-origin: left center; transition: transform .5s var(--ease-out, ease); will-change: transform; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.tile { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; }
.tile .emoji { font-size: 28px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--bg2); border-radius: 12px; flex: none; }
.tile .t { font-weight: 600; }
.chev { color: var(--hint); font-size: 22px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
button.primary, a.primary, button.secondary, a.secondary { display: inline-flex; justify-content: center; align-items: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 16px; font: 600 15px/1.2 inherit; font-family: inherit; text-decoration: none; cursor: pointer; }
button.primary, a.primary { background: var(--btn); color: var(--btn-text); }
button.secondary, a.secondary { background: var(--bg2); color: var(--link); }
.full { width: 100%; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg2); color: var(--hint); }
.badge.soon { background: #fff3cd; color: #8a6100; }
.hero .badge { background: rgba(255,255,255,.18); color: #fff; }
.badge.done { background: #d9f5e5; color: #11703b; }
.banner { border-left: 4px solid var(--warn); }
.section-h { margin: 14px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); }
ul.check { list-style: none; margin: 0; padding: 0; }
ul.check li { margin: 0; }
ul.check label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid rgba(127,127,127,.12); cursor: pointer; }
ul.check li:last-child label { border-bottom: 0; }
ul.check input { appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 0; border: 2px solid var(--hint); border-radius: 7px; display: grid; place-items: center; cursor: pointer; }
ul.check input:checked { background: var(--ok); border-color: var(--ok); }
ul.check input:checked::after { content: "✓"; color: #fff; font-weight: 700; font-size: 16px; }
ul.check input:checked + span { color: var(--hint); text-decoration: line-through; }
.video { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.video .play { width: 44px; height: 44px; border-radius: 12px; background: #ff0033; color: #fff; display: grid; place-items: center; font-size: 18px; flex: none; }
figure { margin: 0 0 12px; }
figure img { width: 100%; border-radius: 12px; display: block; }
figcaption { font-size: 13px; color: var(--hint); margin-top: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid rgba(127,127,127,.15); }
th { color: var(--hint); font-weight: 600; }
.choices { display: grid; gap: 8px; margin-top: 12px; }
.choice { text-align: left; padding: 13px 14px; border-radius: 12px; border: 2px solid transparent; background: var(--bg2); color: var(--text); font: inherit; cursor: pointer; }
.choice.correct { border-color: var(--ok); background: rgba(26,158,85,.12); }
.choice.wrong { border-color: var(--bad); background: rgba(214,59,59,.12); }
.choice:disabled { cursor: default; }
.feedback { margin-top: 12px; padding: 12px; border-radius: 12px; }
.feedback.ok { background: rgba(26,158,85,.12); }
.feedback.bad { background: rgba(214,59,59,.12); }
.score { font-size: 44px; font-weight: 800; margin: 6px 0; }
#actionbar { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 6; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid rgba(127,127,127,.15); }
.actionbar-inner { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; }
.actionbar-inner button { flex: 1; }
.actionbar-inner button[hidden] { display: none; }
.steps-dots { display: flex; gap: 3px; margin-top: 8px; }
.steps-dots i { flex: 1; height: 5px; border-radius: 3px; background: rgba(127,127,127,.25); }
.steps-dots i.on { background: var(--btn); }
.steps-dots i.done { background: var(--ok); }

/* ---------- robot teacher ---------- */
.robot-cta { display: flex; align-items: center; gap: 12px; width: 100%; margin: 12px 0 4px; padding: 12px 14px; border: 2px dashed var(--btn); border-radius: 14px; background: rgba(31,111,235,.07); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.robot-cta .mini-bot { font-size: 28px; }
.robot-cta .small { color: var(--hint); }
body.robot-on { padding-bottom: 290px; }
body.robot-on #actionbar { display: none; }
ul.check li.robot-active label { background: rgba(255,210,63,.28); border-radius: 10px; box-shadow: 0 0 0 2px #ffd23f inset; padding-left: 8px; padding-right: 8px; transition: background .2s; }
#robot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bg); border-top: 1px solid rgba(127,127,127,.2); box-shadow: 0 -6px 24px rgba(0,0,0,.12); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
@media (min-width: 900px) {
  body.robot-on { padding-bottom: 24px; }
  body.robot-on main { padding-right: 440px; max-width: 1400px; }
  body.robot-on .two-col { grid-template-columns: 1fr; }
  #robot { left: auto; right: 20px; bottom: 20px; width: 400px; border-radius: 20px; border: 1px solid rgba(127,127,127,.2); }
}
.robot-top { display: flex; gap: 8px; align-items: flex-start; }
.robot-figure { flex: none; width: 78px; }
.robot-svg { width: 78px; height: 91px; display: block; overflow: visible; }
.robot-bubble { position: relative; flex: 1; min-width: 0; background: var(--bg2); border-radius: 14px; padding: 9px 12px; min-height: 78px; }
.robot-bubble::before { content: ""; position: absolute; left: -8px; top: 22px; border: 8px solid transparent; border-left: 0; border-right-color: var(--bg2); }
.rb-meta { color: var(--hint); margin-bottom: 3px; }
.rb-text { font-size: 17px; font-weight: 600; line-height: 1.35; }
.rb-close { font-size: 18px; padding: 2px 4px; color: var(--hint); }
.robot-main { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.robot-main button { padding: 13px 10px; font-size: 16px; }
.rb-next { border: 2px solid var(--btn); border-radius: 12px; background: var(--bg); color: var(--btn); font: 700 16px/1.2 inherit; font-family: inherit; cursor: pointer; }
.robot-controls { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; }
.rc { flex: 1; min-width: 0; height: 40px; border: 0; border-radius: 10px; background: var(--bg2); color: var(--text); font: 600 17px/1 inherit; font-family: inherit; cursor: pointer; }
select.rc { font-size: 13px; padding: 0 4px; text-align: center; }
.rc:disabled { opacity: .4; cursor: default; }
.rc.on { background: #ffd9d9; color: #b00020; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
/* animation parts (transform-origin in SVG viewBox units) */
.robot-svg * { transform-box: view-box; }
.r-arm-r { transform-origin: 86px 92px; transition: transform .45s cubic-bezier(.3,1.6,.5,1); }
.r-arm-l { transform-origin: 34px 92px; transition: transform .45s cubic-bezier(.3,1.6,.5,1); }
.r-eyes { transform-origin: 60px 45px; animation: blink 4s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.r-bulb { fill: #ffd23f; }
#robot.talking .r-bulb { animation: bulb .5s infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes bulb { from { opacity: 1; transform: scale(1); } to { opacity: .55; transform: scale(1.25); } }
.r-mouth { transform-origin: 60px 60px; }
#robot.talking .r-mouth { animation: talk .22s infinite alternate; }
@keyframes talk { from { transform: scaleY(.4); } to { transform: scaleY(1.8); } }
#robot[data-gesture="point"] .r-arm-r { transform: rotate(-115deg); }
#robot[data-gesture="wave"] .r-arm-r { animation: wave 0.9s ease-in-out 3; transform: rotate(-140deg); }
@keyframes wave { 0%, 100% { transform: rotate(-150deg); } 50% { transform: rotate(-105deg); } }
#robot[data-gesture="listen"] .r-arm-r { transform: rotate(-160deg); }
#robot[data-gesture="listen"] .robot-svg { transform: rotate(-6deg); }
#robot[data-gesture="think"] .r-arm-l { transform: rotate(125deg); }
#robot[data-gesture="celebrate"] .r-arm-r { transform: rotate(-150deg); }
#robot[data-gesture="celebrate"] .r-arm-l { transform: rotate(150deg); }
#robot[data-gesture="celebrate"] .robot-svg { animation: hop .5s ease-in-out 4; }
@keyframes hop { 50% { transform: translateY(-8px); } }
.robot-figure.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.92); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
#robot.nod .robot-svg { animation: nod .45s ease-in-out; }
@keyframes nod { 30% { transform: translateY(4px); } 60% { transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .robot-svg *, .robot-svg, .robot-figure { animation: none !important; transition: none !important; } }

/* ---------- fonts (self-hosted Noto Sans Gurmukhi, SIL OFL: fonts/OFL.txt) ---------- */
@font-face { font-family: "Noto Sans Gurmukhi"; src: url("fonts/NotoSansGurmukhi.ttf") format("truetype"); font-weight: 400; font-display: swap; unicode-range: U+0A00-0A7F, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Gurmukhi"; src: url("fonts/NotoSansGurmukhi-Bold.ttf") format("truetype"); font-weight: 600 800; font-display: swap; unicode-range: U+0A00-0A7F, U+200C-200D, U+25CC; }
html.lang-pa body { line-height: 1.6; }
html.lang-pa .rb-text { line-height: 1.5; }

.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--btn); color: #fff; padding: 8px 12px; z-index: 99; }
.skip:focus { inset-inline-start: 8px; }
:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }
.center { text-align: center; } .btn-row.center { justify-content: center; }
.mt6 { margin-top: 6px; } .mb12 { margin-bottom: 12px; } .ml4 { margin-left: 4px; }
.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.lesson-h { margin: 2px 0 0; font-size: 20px; }
.q-h { font-size: 19px; margin: 14px 0 0; }
.prog-row { margin-top: 8px; }
button.tiny, a.tiny { padding: 6px 10px; font-size: 13px; }
.card.hero h2 { margin-top: 10px; }
.tile { text-decoration: none; }
.tile.locked { opacity: .72; }
.lock-s { font-size: 14px; }
#langSel { border: 1px solid rgba(127,127,127,.3); background: var(--bg2); color: var(--text); border-radius: 10px; padding: 8px; font: inherit; font-size: 14px; }
@media (max-width: 600px) { #langSel { order: 3; } }

/* ---------- nav ---------- */
#topnav { display: none; gap: 4px; }
@media (min-width: 900px) {
  #topnav { display: flex; }
  #bottomnav { display: none !important; }
  #actionbar { bottom: 0 !important; }
  .toplink { position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; color: var(--hint); text-decoration: none; font-weight: 600; font-size: 14px; }
  .toplink svg { width: 18px; height: 18px; }
  .toplink.active { color: var(--btn); background: rgba(31,111,235,.1); }
}
#bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); background: var(--bg); border-top: 1px solid rgba(127,127,127,.18); padding-bottom: env(safe-area-inset-bottom); height: calc(60px + env(safe-area-inset-bottom)); }
#bottomnav .tab { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--hint); text-decoration: none; font-size: 11px; font-weight: 600; transition: color .2s; }
#bottomnav svg, #topnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#bottomnav .tab.active { color: var(--btn); }
#bottomnav .tab.active svg { transform: translateY(-1px) scale(1.08); transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.nav-ind { position: absolute; top: 6px; left: 0; height: 32px; width: calc(100% / var(--n, 5)); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .35s cubic-bezier(.3,1.3,.5,1); pointer-events: none; }
.nav-ind::before { content: ""; position: absolute; left: 50%; width: 56px; height: 32px; margin-left: -28px; border-radius: 16px; background: rgba(31,111,235,.12); }
.nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.toplink .nav-badge { top: -2px; left: auto; right: -4px; }
.nav-badge.inline { position: static; display: inline-block; }
body.robot-on #bottomnav, body.focus #bottomnav { display: none; }
body.robot-on { padding-bottom: 300px; }

/* ---------- access / trial ---------- */
.badge.free { background: #ffe9a8; color: #6b4a00; }
.free-tile { border: 2px solid #ffd23f; }
.lock-card { text-align: center; max-width: 560px; margin: 24px auto; }
.lock-ico { font-size: 44px; animation: wiggle 1.6s ease-in-out 1; }
@keyframes wiggle { 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); } }

/* ---------- robot extras ---------- */
.robot-ctas { display: grid; gap: 8px; margin: 12px 0 4px; }
@media (min-width: 560px) { .robot-ctas { grid-template-columns: 1fr 1fr; } }
.robot-ctas .robot-cta { margin: 0; }
.robot-cta.say { border-color: #1a9e55; background: rgba(26,158,85,.07); }
.rb-side { display: flex; flex-direction: column; gap: 4px; }
.rb-focus { font-size: 18px; padding: 2px 4px; color: var(--hint); }
.rb-notice { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fff3cd; color: #6b4a00; }
.rb-say { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(127,127,127,.12); }
.rb-say.ok { background: rgba(26,158,85,.15); } .rb-say.bad { background: rgba(232,164,0,.18); }
.rb-sayit { width: 100%; margin-top: 8px; }
#robot.listening .rb-sayit { background: #ffd9d9; color: #b00020; animation: pulse 1.2s infinite; }
#robot.listening .r-head { animation: tilt 1.2s ease-in-out infinite; transform-origin: 60px 48px; }
@keyframes tilt { 50% { transform: rotate(-5deg); } }
body.focus #topbar, body.focus main, body.focus #actionbar { display: none; }
body.focus #robot { top: 0; bottom: 0; left: 0; right: 0; width: auto; border-radius: 0; display: flex; flex-direction: column; justify-content: center; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
body.focus .robot-top { flex-direction: column; align-items: center; text-align: center; }
body.focus .robot-figure, body.focus .robot-svg { width: 130px; height: 150px; }
body.focus .robot-bubble::before { display: none; }
body.focus .rb-text { font-size: 26px; }
body.focus .rb-side { position: absolute; top: 12px; right: 12px; flex-direction: row; }
body.focus .robot-main button { padding: 18px 10px; font-size: 18px; }
@media (min-width: 900px) { body.focus #robot { max-width: none; } body.focus .robot-top, body.focus .robot-main, body.focus .robot-controls, body.focus .rb-sayit, body.focus .rb-notice { max-width: 640px; width: 100%; margin-left: auto; margin-right: auto; } }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -12px; left: var(--x); width: 9px; height: 14px; background: hsl(var(--h) 90% 55%); border-radius: 2px; animation: fall var(--d) ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(var(--r)); opacity: .8; } }

/* ---------- forms / account ---------- */
.form label { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-weight: 600; font-size: 14px; }
.form label.row { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form input, .form select, .msg-form textarea, .pay input { width: 100%; padding: 11px 12px; border: 1px solid rgba(127,127,127,.35); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.form input[type=checkbox] { width: 20px; height: 20px; }
.form-err { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: rgba(214,59,59,.12); color: var(--bad); font-size: 14px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--btn); color: #fff; font-weight: 800; font-size: 20px; flex: none; }
.avatar.big { width: 72px; height: 72px; font-size: 32px; margin: 0 auto 12px; background: var(--bg2); }
.profile-head { display: flex; gap: 12px; align-items: center; }
.profile-head h2 { margin: 0; font-size: 20px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-chip { padding: 5px 10px; border-radius: 99px; background: var(--bg2); font-size: 13px; font-weight: 600; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.seg > button, .seg > a { flex: 1; min-width: 80px; padding: 10px; border-radius: 10px; border: 2px solid transparent; background: var(--bg2); color: var(--text); font: 600 15px/1.2 inherit; font-family: inherit; text-align: center; text-decoration: none; cursor: pointer; }
.seg > .on { border-color: var(--btn); color: var(--btn); background: rgba(31,111,235,.08); }
.admin-tabs { margin: 0 0 12px; }
.adm-table td, .adm-table th { vertical-align: top; }
.ledger { list-style: none; padding: 0; margin: 8px 0 0; }
.ledger li { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(127,127,127,.12); }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.wallet-hero .score { color: #fff; }
.chat { display: flex; flex-direction: column; min-height: 60vh; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 10px; max-height: 60vh; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: var(--bg2); white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--btn); color: var(--btn-text); }
.msg.me .muted { color: rgba(255,255,255,.75); }
.msg.bc { border: 2px solid #ffd23f; }
.msg-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.msg-form textarea { flex: 1; min-width: 200px; resize: vertical; }

/* ---------- payments ---------- */
.plan { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--bg2); margin: 10px 0; }
.price { font-size: 20px; font-weight: 800; }
.methods { display: grid; gap: 8px; margin: 12px 0; }
.method { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 2px solid rgba(127,127,127,.25); border-radius: 12px; cursor: pointer; }
.method:has(input:checked) { border-color: var(--btn); background: rgba(31,111,235,.06); }
.method input { margin-top: 4px; width: 18px; height: 18px; }
.brands { display: inline-flex; gap: 4px; align-items: center; vertical-align: middle; margin-left: 4px; }
.cb { display: inline-grid; place-items: center; height: 20px; min-width: 32px; padding: 0 4px; border-radius: 4px; font: 800 10px/1 Arial, sans-serif; letter-spacing: .02em; }
.cb.visa { background: #1a1f71; color: #fff; font-style: italic; }
.cb.amex { background: #2e77bc; color: #fff; }
.cb.mc { background: #222; position: relative; width: 32px; }
.cb.mc i { position: absolute; top: 4px; width: 12px; height: 12px; border-radius: 50%; }
.cb.mc i:first-child { left: 6px; background: #eb001b; } .cb.mc i:last-child { left: 13px; background: #f79e1b; opacity: .9; }
.pp-box { margin-top: 8px; } .pp-card > div { margin: 6px 0; min-height: 44px; }
.pp-demo { width: 100%; padding: 12px; margin: 4px 0; border: 0; border-radius: 22px; background: #ffc439; color: #003087; font: 800 16px/1 inherit; font-family: inherit; }
.pp-demo.card { background: #2c2e2f; color: #fff; }
.tips .tip-other { display: flex; align-items: center; gap: 4px; flex: 1.4; font-weight: 600; }
.tips .tip-other input { width: 80px; padding: 8px; border-radius: 8px; border: 1px solid rgba(127,127,127,.35); background: var(--bg); color: var(--text); font: inherit; }
.coins { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.coin { display: flex; gap: 8px; align-items: center; padding: 10px; border: 2px solid rgba(127,127,127,.25); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.coin:hover { border-color: var(--btn); }
.pay .warn { margin: 12px 0; padding: 10px 12px; border-radius: 12px; background: #fff1f0; color: #8a1c14; border: 2px solid #f5a8a2; }
@media (prefers-color-scheme: dark) { .pay .warn { background: #3a1614; color: #ffd0cc; border-color: #7a2e28; } }
.qr-wrap { display: grid; place-items: center; margin: 12px 0; }
.qr { width: min(240px, 70vw); height: auto; border-radius: 10px; background: #fff; padding: 6px; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; }
.copy-row code { flex: 1; min-width: 0; padding: 10px; border-radius: 10px; background: var(--bg2); font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
code.addr { font-size: 13px; font-weight: 600; }
.timer { font-weight: 700; margin: 6px 0; } .timer.urgent { color: var(--bad); }
.status { margin: 10px 0; }
.st-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 6px; }
.st-line i { height: 6px; border-radius: 3px; background: rgba(127,127,127,.25); }
.st-line i.done { background: var(--ok); } .st-line i.on { background: var(--btn); animation: pulse 1.2s infinite; }
.st-text { font-weight: 700; } .st-confirmed { color: var(--ok); font-size: 20px; } .st-review, .st-expired { color: #8a6100; }
.ok-banner { border-left-color: var(--ok); }
.thanks .score { font-size: 64px; }

/* ---------- motion: page transitions, scroll reveal, micro-interactions ---------- */
:root { --ease-out: cubic-bezier(.2,.8,.2,1); --spring: cubic-bezier(.3,1.5,.5,1); }
#app.enter { animation: pageIn .18s var(--ease-out) both; }
@keyframes pageIn { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rv { opacity: 0; transform: translateY(8px); transition: opacity .2s var(--ease-out), transform .2s var(--ease-out); }
.rv.in { opacity: 1; transform: none; }
button, .tile, .toplink, #bottomnav .tab, .coin, .method, .seg > *, .chk, a.primary, a.secondary { transition: transform .15s var(--spring), box-shadow .2s, background-color .2s, border-color .2s, color .2s; }
button:not(:disabled):active, a.primary:active, a.secondary:active, .coin:active, .seg > *:active { transform: scale(.96); }
#bottomnav .tab:active svg { transform: scale(.85); }
@media (hover: hover) {
  .card.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,23,42,.10); }
  button.primary:hover, a.primary:hover { filter: brightness(1.06); }
  .coin:hover, .method:hover { transform: translateY(-1px); }
}
input[type=checkbox] { accent-color: var(--ok); }
input[type=checkbox]:checked { animation: tick .3s var(--spring); }
@keyframes tick { 40% { transform: scale(1.25); } }
.step.done, li.done { animation: doneFlash .5s var(--ease-out); }
@keyframes doneFlash { 0% { background-color: rgba(26,158,85,.22); } 100% { background-color: transparent; } }
.nav-badge { animation: badgePop .35s var(--spring); }
@keyframes badgePop { from { transform: scale(0); } }
.muted.pad:only-child { animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: .45; } }
#robot { animation: robotIn .4s var(--spring); }
@keyframes robotIn { from { transform: translateY(30px); opacity: 0; } }
.robot-bubble { animation: bubbleIn .3s var(--spring); transform-origin: left center; }
@keyframes bubbleIn { from { transform: scale(.9); opacity: 0; } }
.empty { text-align: center; padding: 28px 16px; color: var(--hint); }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

/* Respect reduced motion everywhere (QA P2-8). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .rv { opacity: 1; transform: none; }
}
.nf { margin-top: 40px; }
/* admin tabs: one scrollable row */
.seg.admin-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.seg.admin-tabs::-webkit-scrollbar { display: none; }
.seg.admin-tabs > a { flex: 0 0 auto; min-width: 0; padding: 9px 14px; white-space: nowrap; }
.ledger li.new { background: rgba(255,210,63,.12); border-radius: 8px; padding-left: 6px; }
.row .num { max-width: 120px; padding: 10px; border-radius: 10px; border: 1px solid rgba(127,127,127,.35); background: var(--bg); color: var(--text); font: inherit; }
.card.empty { color: var(--hint); }

/* ================= QA polish pass (P1-7, P1-9, P2-20…27) ================= */
:root { --gap: 12px; --fs-s: 13px; --fs-m: 14px; --fs-b: 16px; --fs-l: 20px; --fs-xl: 28px; }
/* Type scale: 13 / 14 / 16 / 20 / 28. Form controls inherit the page font. */
button, input, select, textarea { font: inherit; }
.small, figcaption, .badge, .badge-chip, code.addr, select.rc, .form-err, button.tiny, a.tiny, #bottomnav .tab, .nav-badge { font-size: var(--fs-s); }
.section-h, .form label, table, #langSel, .toplink, .result .snip, .lock-s { font-size: var(--fs-m); }
#searchInput, .rb-text, .robot-main button, .copy-row code, #topbar h1, .brand-text { font-size: var(--fs-b); }
.hero h2, .lesson-h, .q-h, .profile-head h2, .price, .st-confirmed, .card h2 { font-size: var(--fs-l); }
body.focus .rb-text { font-size: var(--fs-xl); }
.robot-cta .small { font-size: var(--fs-s); }
#bottomnav .tab span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.nav-badge { font-size: 12px; } /* counter digits only */

/* Branding: KNGX crown + "AZ Class" everywhere. */
.brand-text { letter-spacing: 0; font-weight: 800; }
#brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex: none; min-height: 44px; }

/* P1-7: active nav contrast ≥ 4.5:1 in both themes. */
#topnav .toplink.active, #bottomnav .tab.active { color: #1a5fd0; }
@media (prefers-color-scheme: dark) { #topnav .toplink.active, #bottomnav .tab.active { color: #8ab8ff; } .toplink.active { background: rgba(106,167,255,.12); } }

/* P1-9: desktop top bar never crushes the title. */
@media (min-width: 900px) {
  .topbar-inner { max-width: 1200px; flex-wrap: nowrap; gap: 12px; }
  #topbar h1 { flex: 1 1 180px; min-width: 120px; }
  #topnav { flex: 0 1 auto; min-width: 0; }
  #searchForm { flex: 0 1 220px; min-width: 140px; }
  #backBtn { margin-left: 4px; }
}
@media (min-width: 900px) and (max-width: 1239px) { .toplink span.lbl, .toplink > span:not(.nav-badge):not(.nav-ind) { display: none; } .toplink { padding: 10px; } }

/* P2-23: 44px tap targets (glyph size unchanged). */
.icon-btn, #backBtn { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; padding: 0; }
button.tiny, a.tiny { min-height: 44px; min-width: 44px; padding: 8px 14px; }
.rc { min-height: 44px; min-width: 44px; }
ul.check label { min-height: 44px; }
#langSel { min-height: 44px; }
.seg > button, .seg > a { min-height: 44px; }

/* P2-22: one rhythm. */
.card { margin: 0 0 var(--gap); }
.grid, .two-col { gap: var(--gap); }
.grid > .card, .two-col .card { margin: 0; }
.two-col > div { display: flex; flex-direction: column; gap: var(--gap); }
figure { margin: 0; }
.banner + .card, .card + .banner { margin-top: 0; }
.login-nudge { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); border-left: 4px solid var(--btn); }

/* P2-20: photos never dominate; tap to open full size. */
figure img { max-height: 360px; object-fit: contain; background: var(--bg2); cursor: zoom-in; }
@media (min-width: 900px) { figure img { max-height: 320px; } }

/* P2-24: robot text capped (~5 lines, scrolls). */
.rb-text { max-height: calc(1.35em * 5); overflow-y: auto; overscroll-behavior: contain; }
body.focus .rb-text { max-height: 50vh; }
.rb-sayit.on { background: rgba(26,158,85,.15); color: var(--ok); }

/* P2-25: chat fills the screen, composer pinned at the bottom. */
body.chat-page #searchForm { display: none; }
body.chat-page main { padding-bottom: 0; }
.chat { display: flex; flex-direction: column; height: calc(100dvh - 64px - 60px - env(safe-area-inset-bottom) - 24px); min-height: 320px; margin: 0; }
@media (min-width: 900px) { .chat { height: calc(100dvh - 64px - 48px); } }
.msgs { flex: 1 1 auto; max-height: none; min-height: 0; }
.msg-form { flex: none; align-items: flex-end; border-top: 1px solid rgba(127,127,127,.15); padding-top: 10px; }
.msg-form textarea { min-height: 44px; max-height: 140px; }
.msg-form button { min-height: 44px; }
figure picture { display: block; } figure img { width: 100%; height: auto; }
details.setup { margin: 8px 0; } details.setup summary { cursor: pointer; color: var(--link); min-height: 44px; display: flex; align-items: center; }
.robot-cta.focus-cta { border-style: solid; }
@media (min-width: 560px) { .robot-ctas .focus-cta { grid-column: 1 / -1; } }
/* chat hub + friends + DMs */
.seg.chat-tabs { margin: 0 0 10px; flex-wrap: nowrap; }
.seg.chat-tabs > a { display: flex; align-items: center; justify-content: center; gap: 6px; }
.chat .seg.chat-tabs { flex: none; }
.person { display: flex; align-items: center; gap: 10px; }
.person .grow { min-width: 0; }
.person .snip1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .tiny + .tiny { margin-left: 6px; }
.found { padding: 8px 0; border-bottom: 1px solid rgba(127,127,127,.12); }
#found { margin-top: 6px; }
.dm-head { flex: none; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(127,127,127,.15); }
.dm-head .avatar { width: 36px; height: 36px; font-size: 16px; }
.dm-menu { position: relative; }
.dm-menu summary { list-style: none; font-size: 22px; color: var(--hint); }
.dm-menu summary::-webkit-details-marker { display: none; }
.dm-menu .menu { position: absolute; right: 0; top: 46px; z-index: 3; display: grid; gap: 6px; padding: 8px; min-width: 180px; background: var(--bg); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: bubbleIn .15s var(--spring); }
.msg { animation: msgIn .2s var(--ease-out); }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.row { display: flex; align-items: center; gap: 8px; }
[hidden] { display: none !important; }
