/* Gia sư Mochi - bright, rounded, big touch targets */

:root {
  --bg: #FFF8F0;
  --bg2: #FFFFFF;
  --card: #FFFFFF;
  --ink: #2B2340;
  --muted: #7A7290;
  --line: #EDE6F5;
  --brand: #7C5CFF;
  --brand-2: #FF7AB6;
  --brand-ink: #FFFFFF;
  --good: #22B573;
  --good-bg: #E3F8EE;
  --bad: #F0566B;
  --bad-bg: #FFE8EC;
  --warn: #F5A524;
  /* Subject colours: one family (same depth and softness) so they sit well together */
  --c-maths: #4F7CD9;
  --c-english: #DC5E80;
  --c-science: #2E9E75;
  --c-gp: #D98A2B;
  --c-vn: #C2185B;
  --c-hg: #6D4C9F;
  --mochi: #FFE3C7;
  --mochi-belly: #FFF4E8;
  --mochi-line: #3B2C4F;
  --shadow: 0 6px 0 rgba(60, 40, 110, 0.08), 0 10px 24px rgba(60, 40, 110, 0.08);
  --radius: 22px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17142A; --bg2: #1F1B36; --card: #24203F; --ink: #F3F0FF; --muted: #A9A2C6; --line: #352F57;
    --brand: #9B83FF; --good-bg: #173A2C; --bad-bg: #44202A;
    --mochi: #F6D4B4; --mochi-belly: #FCE9D6;
    --shadow: 0 6px 0 rgba(0, 0, 0, 0.25), 0 10px 24px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17142A; --bg2: #1F1B36; --card: #24203F; --ink: #F3F0FF; --muted: #A9A2C6; --line: #352F57;
  --brand: #9B83FF; --good-bg: #173A2C; --bad-bg: #44202A;
  --mochi: #F6D4B4; --mochi-belly: #FCE9D6;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.25), 0 10px 24px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink);
  /* theme wallpaper: layers include position/size, so use the shorthand, then the colour */
  background: var(--pattern, none); background-color: var(--bg); background-attachment: fixed;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 600;
  font-size: 17px; line-height: 1.45; min-height: 100dvh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body.no-nav { padding-bottom: 0; }
h1, h2, h3 { font-weight: 900; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.1rem; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .center { text-align: center; }
.grow { flex: 1; min-width: 0; } .row { display: flex; align-items: center; } .gap { gap: 10px; } .wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.bad-text { color: var(--bad); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

.view { max-width: 760px; margin: 0 auto; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); }
.page > * + * { margin-top: 14px; }
.page-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.page-head h1 { margin: 0; flex: 1; }
.section-title { margin-top: 22px !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 16px; padding: 12px 20px; font-weight: 800;
  background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line);
  transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line); }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--brand) 70%, #000); }
.btn.primary:active { box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 70%, #000); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.big { padding: 16px 24px; font-size: 1.15rem; width: 100%; margin-top: 8px; }
.btn.block { display: flex; width: 100%; margin-top: 10px; }
.btn.small { padding: 8px 14px; font-size: .9rem; }
.btn.tiny { padding: 4px 12px; font-size: .85rem; margin-top: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; border: 0;
  background: var(--card); box-shadow: inset 0 0 0 2px var(--line); font-size: 1.1rem; color: var(--ink); flex: none;
}
.icon-btn.big { width: 46px; height: 46px; font-size: 1.3rem; cursor: pointer; }
.icon-btn.on { background: var(--bad-bg); box-shadow: inset 0 0 0 2px var(--bad); animation: pulse 1s infinite; }

.chip, .sub-chip, .mode-chip, .seg-btn {
  border: 0; border-radius: 999px; padding: 8px 14px; background: var(--card); color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line); font-weight: 700; white-space: nowrap;
}
.chip.on, .seg-btn.on { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.chip.tiny { padding: 2px 8px; font-size: .75rem; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { display: flex; align-items: center; gap: 8px; }
details.card summary { cursor: pointer; font-size: 1.05rem; list-style-position: inside; }
.tip { display: flex; gap: 12px; align-items: center; }
.note { background: var(--bad-bg); padding: 8px 12px; border-radius: 12px; font-size: .9rem; }

/* ---------- Mochi ---------- */
.mochi { display: block; overflow: visible; }
.m-body { fill: var(--mb, var(--mochi)); stroke: var(--mochi-line); stroke-width: 3; }
.m-ear { fill: var(--mb, var(--mochi)); stroke: var(--mochi-line); stroke-width: 3; }
.m-belly { fill: var(--mbelly, var(--mochi-belly)); }
.m-blush { fill: #FF9BB0; opacity: .7; }
.m-line { fill: none; stroke: var(--mochi-line); stroke-width: 3.5; stroke-linecap: round; }
.m-eye { fill: var(--mochi-line); }
.m-mouth { fill: #E8566E; stroke: var(--mochi-line); stroke-width: 3; }
.m-shadow { fill: rgba(60, 40, 110, .12); }
.m-z { fill: var(--brand); font: 900 16px Nunito, sans-serif; } .m-z.small { font-size: 11px; }
.m-bubble { fill: var(--card); stroke: var(--mochi-line); stroke-width: 2; }
.m-arm { fill: none; stroke: var(--mochi-line); stroke-width: 5; stroke-linecap: round; transform-origin: 104px 58px; animation: wave 1s ease-in-out infinite; }
.mochi.mood-happy .m-body, .mochi.mood-wave .m-body { animation: breathe 3s ease-in-out infinite; transform-origin: 60px 106px; }
.mochi.mood-sleep { animation: breathe 4s ease-in-out infinite; }

/* ---------- Home ---------- */
.hero { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 28px; padding: 20px; box-shadow: var(--shadow); }
.hero h1 { margin: 2px 0 4px; font-size: 1.9rem; }
.hero p { margin: 0; opacity: .95; }
.hero .muted { color: rgba(255,255,255,.85); }
.hero-text { flex: 1; min-width: 0; }
.hero-mochi { background: none; border: 0; padding: 0; flex: none; }
.hero-mochi.jump { animation: jump .5s; }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pill { display: flex; align-items: center; gap: 6px; background: var(--card); padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow); font-size: .95rem; }
.pill span { color: var(--muted); font-size: .85rem; }
.pill.streak.lit { background: #FFF1DD; color: #B85C00; } .pill.streak.lit span { color: #B85C00; }
.xp-bar { position: relative; height: 22px; background: var(--line); border-radius: 999px; overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, #FFD93D, #FF9F45); border-radius: 999px; transition: width .6s; }
.xp-bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .78rem; font-weight: 800; }
.quest { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 2px dashed var(--line); }
.quest:first-of-type { border-top: 0; }
.quest.done .grow { text-decoration: line-through; color: var(--muted); }
.quest-icon { font-size: 1.3rem; } .quest-count { font-weight: 900; color: var(--brand); }

.big-action { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--card); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.big-action:active { transform: translateY(2px); }
.ba-emoji { font-size: 2rem; } .ba-go { font-size: 1.2rem; color: var(--brand); }
.mochi-action { background: linear-gradient(135deg, #FFF1DD, #FFE3F0); color: #2B2340; }
.mochi-action .small { color: #5A4F70; }

.subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.subject-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); color: #fff; min-height: 100px; justify-content: flex-end;
  background: linear-gradient(150deg, color-mix(in srgb, var(--sc) 78%, #fff), var(--sc) 70%); box-shadow: 0 5px 0 color-mix(in srgb, var(--sc) 65%, #000), 0 10px 22px color-mix(in srgb, var(--sc) 30%, transparent); text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.subject-card .sc-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.sc-name { display: flex; flex-direction: column; line-height: 1.15; min-height: 2.5em; justify-content: flex-end; }
.sc-name b { font-size: 1.05rem; font-weight: 900; letter-spacing: .6px; white-space: nowrap; }
.sc-name span { font-size: .74rem; font-weight: 800; letter-spacing: 1px; opacity: .85; }
.sc-emoji { font-size: 2rem; }
.subject-list { display: grid; gap: 12px; }
.subject-row-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--card); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); border-left: 8px solid var(--sc); }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.topic-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--card); color: var(--ink); border: 0;
  border-radius: var(--radius); box-shadow: var(--shadow); text-align: left; border-top: 6px solid var(--sc);
  -webkit-touch-callout: none; user-select: none;
}
.topic-card:active { transform: translateY(2px); }
.tc-emoji { font-size: 1.8rem; } .tc-name { font-weight: 800; line-height: 1.25; flex: 1; } .tc-meta { font-size: .8rem; color: var(--muted); }
.meter { display: block; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter > * { display: block; height: 100%; background: var(--sc, var(--good)); border-radius: 999px; }

/* ---------- Practice ---------- */
.practice-top { display: flex; align-items: center; gap: 12px; }
.bar { flex: 1; height: 16px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--good); border-radius: 999px; transition: width .4s; }
.combo { font-weight: 900; color: var(--muted); min-width: 48px; text-align: right; }
.combo.hot { color: #FF7A00; animation: pop .4s; }
.practice-title { margin: 14px 0 8px; font-weight: 800; color: var(--muted); }
.q-card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.q-text { font-size: 1.2rem; font-weight: 800; }
.q-text p { margin: 0 0 6px; }
.passage { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: .95rem; font-weight: 600; max-height: 40vh; overflow: auto; border-left: 5px solid var(--c-english); }
.passage p { margin: 0 0 6px; }
.q-figure { margin: 10px 0; display: flex; justify-content: center; }
.q-svg { width: 100%; max-width: 360px; height: auto; }
.q-svg.grid { max-width: 300px; }
.svg-shape { fill: color-mix(in srgb, var(--c-maths) 22%, transparent); stroke: var(--c-maths); stroke-width: 3; }
.svg-label { fill: var(--ink); font: 800 14px Nunito, sans-serif; } .svg-label.small { font-size: 11px; font-weight: 700; } .svg-label.bold { font-size: 16px; fill: var(--bad); }
.svg-grid { stroke: var(--line); stroke-width: 1.5; } .svg-axis { stroke: var(--ink); stroke-width: 2.5; }
.svg-point { fill: var(--bad); }
.svg-bar { fill: var(--c-maths); } .svg-bar.b1 { fill: var(--c-english); } .svg-bar.b2 { fill: var(--c-science); } .svg-bar.b3 { fill: var(--c-gp); }
.choices { display: grid; gap: 10px; margin-top: 14px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px; border: 0; border-radius: 16px;
  background: var(--bg2); box-shadow: inset 0 0 0 2.5px var(--line), 0 4px 0 var(--line); font-weight: 700; font-size: 1.02rem; color: var(--ink);
}
.choice:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 0 0 2.5px var(--line); }
.choice-key { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--line); font-weight: 900; flex: none; }
.choice.right { background: var(--good-bg); box-shadow: inset 0 0 0 3px var(--good); animation: pop .35s; }
.choice.right .choice-key { background: var(--good); color: #fff; }
.choice.wrong { background: var(--bad-bg); box-shadow: inset 0 0 0 3px var(--bad); animation: shake .35s; }
.choice.wrong .choice-key { background: var(--bad); color: #fff; }
.choice:disabled { cursor: default; }
.num-form { display: flex; gap: 10px; margin-top: 14px; }
.num-input { flex: 1; min-width: 0; font-size: 1.4rem; font-weight: 900; padding: 12px 16px; border-radius: 16px; border: 0; background: var(--bg2); box-shadow: inset 0 0 0 2.5px var(--line); text-align: center; }
.num-input.right { background: var(--good-bg); box-shadow: inset 0 0 0 3px var(--good); }
.num-input.wrong { background: var(--bad-bg); box-shadow: inset 0 0 0 3px var(--bad); }
.shake { animation: shake .35s; }
.feedback { margin-top: 14px; border-radius: var(--radius); padding: 0; max-height: 0; overflow: hidden; transition: max-height .3s; }
.feedback.show { max-height: 900px; padding: 16px; animation: slideUp .3s; }
.feedback.good { background: var(--good-bg); } .feedback.bad { background: var(--bad-bg); }
.fb-head { display: flex; align-items: center; gap: 10px; }
.fb-title { font-weight: 900; font-size: 1.15rem; }
.xp-pop { color: #C77700; font-weight: 900; animation: pop .4s; }
.fb-explain { margin: 8px 0 12px; } .fb-explain p { margin: 0; }
.fb-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.center-screen { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 440px; margin: 6px auto; }
.result-grid.four { grid-template-columns: repeat(4, 1fr); max-width: none; }
.stat { background: var(--bg); border-radius: 16px; padding: 10px 6px; text-align: center; }
.card .stat { background: var(--bg); }
.stat-num { font-size: 1.35rem; font-weight: 900; } .stat-label { font-size: .75rem; color: var(--muted); }
.stars { font-size: 3rem; letter-spacing: 6px; }
.star { color: var(--line); display: inline-block; }
.star.on { color: #FFC531; animation: starIn .5s both; }

/* ---------- Chat ---------- */
.view-chat { padding-bottom: 0; display: flex; flex-direction: column; height: calc(100dvh - 84px - env(safe-area-inset-bottom)); }
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head { display: grid; gap: 8px; }
.mode-row, .subject-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; align-items: center; }
.mode-row::-webkit-scrollbar, .subject-row::-webkit-scrollbar { display: none; }
.mode-chip { padding: 10px 14px; }
.mode-chip.on { background: var(--brand); color: #fff; box-shadow: none; }
.sub-chip { font-size: .85rem; padding: 6px 12px; }
.sub-chip.on { background: var(--chip, var(--ink)); color: #fff; box-shadow: none; }
.mode-hint { padding-left: 4px; }
.messages { flex: 1; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.msg.user { align-self: flex-end; flex-direction: column; align-items: flex-end; }
.msg.bot .mochi { flex: none; }
.bubble { position: relative; padding: 12px 14px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); word-wrap: break-word; overflow-wrap: anywhere; }
.bubble p { margin: 0 0 6px; } .bubble p:last-of-type { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 6px; padding-left: 22px; }
.msg.user .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.bot .bubble { border-bottom-left-radius: 6px; padding-right: 40px; }
.bubble.error { background: var(--bad-bg); }
.img-tag { font-size: 1.4rem; }
.speak-btn { position: absolute; right: 6px; bottom: 6px; border: 0; background: none; font-size: 1.05rem; opacity: .6; padding: 4px; }
.speak-btn.on { opacity: 1; animation: pulse 1s infinite; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.chat-empty { margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 10px; }
.bubble-intro { background: var(--card); padding: 12px 16px; border-radius: 20px; box-shadow: var(--shadow); margin: 0; font-weight: 800; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggest-chip { border: 0; padding: 10px 14px; border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); font-weight: 700; }
.composer { padding: 8px 0 12px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; background: var(--card); padding: 8px; border-radius: 24px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; padding: 11px 6px; font-weight: 700; max-height: 140px; font-size: 16px; }
.composer textarea:focus { outline: none; }
.send-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 1.2rem; flex: none; }
.send-btn.stop { background: var(--bad); }
.photo-preview { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 8px; }
.photo-preview img { max-height: 110px; max-width: 70%; border-radius: 14px; box-shadow: var(--shadow); }

/* ---------- Sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 12, 40, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .2s; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 80dvh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); animation: slideUp .25s; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h3 { margin: 0; }
.history-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: var(--card); padding: 12px; border-radius: 14px; margin-top: 8px; box-shadow: inset 0 0 0 2px var(--line); color: var(--ink); }
.history-item .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 800; }
.field-label { font-weight: 800; margin-bottom: -6px; }
.form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]), .form select {
  width: 100%; border: 0; border-radius: 14px; padding: 12px 14px; background: var(--bg2); box-shadow: inset 0 0 0 2px var(--line); font-weight: 700; font-size: 16px;
}
.form input:focus, .form select:focus { outline: none; box-shadow: inset 0 0 0 2.5px var(--brand); }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-btn { aspect-ratio: 1; border: 0; border-radius: 16px; background: var(--bg2); font-size: 1.8rem; box-shadow: inset 0 0 0 2px var(--line); }
.avatar-btn.on { background: #EFE9FF; box-shadow: inset 0 0 0 3px var(--brand); transform: scale(1.06); }
.welcome-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.welcome-hero h1 { margin: 8px 0 0; font-size: 2rem; }
.pin-form { display: flex; gap: 10px; }
.pin-input { width: 150px; font-size: 1.8rem; letter-spacing: 10px; text-align: center; border: 0; border-radius: 16px; padding: 10px; background: var(--card); box-shadow: inset 0 0 0 2.5px var(--line); }

/* ---------- Me ---------- */
.me-head { display: flex; align-items: center; gap: 14px; }
.me-head h1 { margin: 0; }
.big-avatar { font-size: 3rem; width: 80px; height: 80px; display: grid; place-items: center; background: var(--card); border-radius: 26px; box-shadow: var(--shadow); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; background: var(--bg); text-align: center; opacity: .55; }
.badge.got { opacity: 1; background: #FFF6D8; color: #5A4300; }
.badge-emoji { font-size: 2rem; } .badge-name { font-size: .72rem; font-weight: 800; line-height: 1.15; }
.parent-link { background: var(--bg2); }

/* ---------- Parent ---------- */
.kid-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 130px; align-items: end; margin: 14px 0 8px; }
.wc-col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.wc-bar { width: 70%; min-height: 4px; background: var(--brand); border-radius: 8px 8px 4px 4px; position: relative; }
.wc-bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .72rem; }
.wc-label { font-size: .72rem; color: var(--muted); }
.mastery-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.mastery-table td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: middle; font-size: .92rem; }
.mastery-table td:last-child { width: 30%; }
ul.plain { margin: 0; padding-left: 20px; }
.chat-review { border-top: 1px solid var(--line); padding: 8px 0; }
.chat-review summary { cursor: pointer; }
.review-msgs { display: grid; gap: 6px; padding: 8px 0 4px 10px; font-size: .92rem; }
.rv p { display: inline; margin: 0; }
.rv.assistant { color: var(--muted); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(10px);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line);
}
.nav-item { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; border-radius: 16px; color: var(--muted); font-size: .76rem; font-weight: 800; }
.nav-icon { font-size: 1.5rem; transition: transform .2s; }
.nav-item.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.nav-item.on .nav-icon { transform: scale(1.15) translateY(-1px); }

/* ---------- Toast & confetti ---------- */
.toast {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translate(-50%, -140%); z-index: 100;
  display: flex; align-items: center; gap: 12px; background: var(--card); color: var(--ink); padding: 12px 18px; border-radius: 20px;
  box-shadow: 0 12px 30px rgba(40, 20, 90, .25); transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }
.toast-big { font-size: 2rem; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

/* ---------- Animations ---------- */
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.97) scaleX(1.02); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-25deg); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-18px) rotate(-6deg); } 70% { transform: translateY(0) scale(1.05, .95); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3); } to { transform: scale(1); } }
.pop-in { animation: slideUp .3s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 420px) {
  body { font-size: 16px; }
  .result-grid.four { grid-template-columns: repeat(2, 1fr); }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 1.6rem; }
  .q-text { font-size: 1.1rem; }
}
@media (min-width: 700px) {
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
  .choices { grid-template-columns: 1fr 1fr; }
}

/* ================= v2: lessons, report cards, prizes, style, parents ================= */
:root[data-font="large"] body { font-size: 19.5px; }
:root[data-font="large"] .q-text { font-size: 1.35rem; }
.input { width: 100%; border: 0; border-radius: 14px; padding: 12px 14px; background: var(--bg2); box-shadow: inset 0 0 0 2px var(--line); font-weight: 700; font-size: 16px; }
.center-row { justify-content: center; }
.badge-dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 900; vertical-align: middle; }
.nav-icon { position: relative; }
.nav-icon .badge-dot { position: absolute; top: -4px; right: -12px; }
.glass { background: rgba(255,255,255,.22) !important; color: #fff !important; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35) !important; backdrop-filter: blur(6px); }
.big-emoji { font-size: 1.7rem; }
.hw-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.hw-row:first-of-type { border-top: 0; }
.card h3 + .hw-row { border-top: 0; }
.score-chip { display: inline-grid; place-items: center; min-width: 46px; height: 46px; border-radius: 14px; font-weight: 900; font-size: 1.1rem; color: #fff; background: var(--muted); flex: none; }
.score-chip.good { background: var(--good); } .score-chip.ok { background: var(--warn); } .score-chip.low { background: var(--bad); }

/* Home */
.hero-greet { opacity: .9; }
.hero-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.hero-stats span { background: rgba(255,255,255,.22); padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: .9rem; }
.start-card {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 18px 18px 18px 12px; border-radius: 26px; color: #fff; overflow: hidden;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); box-shadow: 0 8px 0 color-mix(in srgb, var(--brand) 60%, #000), 0 14px 30px color-mix(in srgb, var(--brand) 35%, transparent);
  animation: glow 2.4s ease-in-out infinite;
}
.start-card b { display: block; font-size: 1.35rem; font-weight: 900; }
.start-card .small { opacity: .92; }
.start-card .sc-go { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #fff; color: var(--brand); font-size: 1.4rem; flex: none; animation: pulse 1.6s infinite; }
.start-card .sc-buddy { flex: none; }
.start-card:active { transform: translateY(4px); box-shadow: 0 3px 0 color-mix(in srgb, var(--brand) 60%, #000); }
.start-card.slim { padding: 14px 16px; animation: none; }
.start-card.slim b { font-size: 1.1rem; }
.start-card.slim .sc-go { width: 40px; height: 40px; }
.hw-card { border: 3px solid color-mix(in srgb, var(--warn) 60%, transparent); }
.last-report { display: flex; align-items: center; gap: 12px; }

/* Lesson launcher */
.view-study { max-width: none; padding: 0; }
.launch { min-height: 100dvh; background: linear-gradient(180deg, var(--brand), var(--brand-2) 55%, var(--bg) 55.1%); display: flex; flex-direction: column; }
.launch-top { display: flex; align-items: center; gap: 8px; padding: calc(14px + env(safe-area-inset-top)) 16px 0; max-width: 760px; width: 100%; margin: 0 auto; }
.launch-top .pill { box-shadow: none; }
.launch-hero { display: flex; flex-direction: column; align-items: center; padding: 6px 16px 0; }
.launch-buddy { background: none; border: 0; padding: 0; animation: float 3s ease-in-out infinite; }
.launch-buddy.jump { animation: jump .5s; }
.speech { position: relative; background: #fff; color: #2B2340; font-weight: 800; padding: 12px 18px; border-radius: 22px; max-width: 320px; text-align: center; box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.speech::after { content: ""; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; }
.launch-sheet { background: var(--bg); border-radius: 30px 30px 0 0; margin-top: -10px; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); flex: 1; max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; box-shadow: 0 -10px 30px rgba(0,0,0,.08); }
.launch-label { font-weight: 900; font-size: 1.1rem; margin: 4px 0 10px; }
.subject-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.sp { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; padding: 12px 4px; border-radius: 18px; background: var(--card); color: var(--ink); font-weight: 800; font-size: .85rem; box-shadow: inset 0 0 0 2.5px var(--line), 0 4px 0 var(--line); }
.sp { gap: 4px; line-height: 1.1; }
.sp b { font-size: .82rem; font-weight: 900; letter-spacing: .4px; white-space: nowrap; }
.sp small { font-size: .66rem; font-weight: 800; letter-spacing: .8px; opacity: .75; }
.sp .subj-icon { color: var(--sc); margin-bottom: 2px; }
.sp.on .subj-icon { color: #fff; }
.sp.on { background: var(--sc); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--sc) 60%, #000); transform: translateY(-2px); }
.journey { list-style: none; margin: 0 0 18px; padding: 0 0 0 4px; position: relative; }
.journey::before { content: ""; position: absolute; left: 25px; top: 20px; bottom: 20px; border-left: 4px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); }
.stop { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 0; animation: slideUp .35s both; animation-delay: var(--d, 0s); }
.stop-dot { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 4px var(--bg), inset 0 0 0 3px var(--brand); font-size: 1.3rem; flex: none; z-index: 1; }
.stop.main .stop-dot { background: var(--brand); width: 50px; height: 50px; margin-left: -3px; }
.stop.homework .stop-dot { box-shadow: 0 0 0 4px var(--bg), inset 0 0 0 3px var(--warn); }
.stop.finish .stop-dot { background: #FFC531; box-shadow: 0 0 0 4px var(--bg); }
.start-btn {
  display: block; width: 100%; border: 0; border-radius: 24px; padding: 20px; font-size: 1.6rem; font-weight: 900; letter-spacing: .5px; color: #fff;
  background: linear-gradient(135deg, #FF9F45, #FF5C8A); box-shadow: 0 8px 0 #C7356A, 0 16px 30px rgba(255,92,138,.4); animation: pulse 1.8s infinite;
}
.start-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #C7356A; }
.countdown { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 88%, transparent); }
.cd-num { font-size: 7rem; font-weight: 900; color: #fff; animation: zoomPop .6s both; text-shadow: 0 8px 0 rgba(0,0,0,.15); text-align: center; }
.topic-list { display: grid; gap: 8px; margin-top: 10px; }
.topic-row { display: flex; align-items: center; gap: 10px; border: 0; background: var(--card); color: var(--ink); padding: 10px 12px; border-radius: 14px; box-shadow: inset 0 0 0 2px var(--line); font-weight: 700; text-align: left; }

/* Lesson runner */
.step-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; flex-wrap: wrap; }
.step-row .practice-title { margin: 0; }
.step-dots { display: flex; gap: 4px; }
.sd { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--line); font-size: .9rem; filter: grayscale(1); opacity: .6; }
.sd.done { background: var(--good-bg); filter: none; opacity: 1; }
.sd.now { background: var(--brand); filter: none; opacity: 1; transform: scale(1.15); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.clock { font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.interlude h2 { margin-top: 6px; }
.big-num { font-size: 2.6rem; font-weight: 900; margin: 0; color: var(--brand); }

/* Report card */
.report { display: grid; gap: 14px; padding-bottom: 30px; }
.report-card { background: var(--card); border-radius: 26px; padding: 18px; box-shadow: var(--shadow); border-top: 10px solid var(--brand); position: relative; }
.rc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rc-label { font-weight: 900; letter-spacing: 2px; color: var(--brand); font-size: .9rem; }
.rc-sub { color: var(--muted); font-size: .85rem; }
.rc-subject { font-weight: 900; text-align: right; }
.rc-score { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 18px 0 10px; flex-wrap: wrap; }
.score-ring { --pct: 0; width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--line) 0); animation: zoomPop .7s both; }
.score-ring > div { width: 118px; height: 118px; border-radius: 50%; background: var(--card); display: grid; place-items: center; align-content: center; }
.score-num { font-size: 2.9rem; font-weight: 900; line-height: 1; color: var(--ink); }
.score-max { font-weight: 800; color: var(--muted); text-align: center; display: block; }
.rc-grade { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 1.3rem; }
.stamp { font-size: 2.6rem; animation: stamp .5s .5s both; }
.rc-grade .stars { font-size: 2rem; letter-spacing: 2px; }
.rc-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.rc-table td { padding: 8px 4px; border-top: 1px dashed var(--line); }
.rc-table .num { text-align: right; font-weight: 900; white-space: nowrap; }
.rc-total td { font-weight: 800; }
.rc-earn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.earn { background: var(--bg); border-radius: 16px; padding: 10px 4px; text-align: center; font-weight: 800; }
.earn-num { font-size: 1.5rem; font-weight: 900; }
.rc-comment { display: flex; gap: 10px; align-items: center; background: color-mix(in srgb, var(--brand) 10%, transparent); padding: 10px 12px; border-radius: 16px; }
.rc-comment p { margin: 0; }
.rc-sponsor { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .85rem; color: var(--muted); }
.rc-sponsor img { max-height: 32px; max-width: 80px; object-fit: contain; }

/* Prizes */
.wallet { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #FFD93D, #FF9F45); color: #4A2C00; border-radius: 26px; padding: 14px 18px; box-shadow: var(--shadow); }
.wallet .muted { color: #6A4A10; }
.wallet-num { font-size: 2.2rem; font-weight: 900; }
.prize-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.prize { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--card); border-radius: 22px; padding: 14px 10px; box-shadow: var(--shadow); }
.prize.locked { opacity: .75; }
.prize-emoji { font-size: 2.6rem; }
.prize-title { font-weight: 800; line-height: 1.25; }
.prize-cost { font-weight: 900; color: #C77700; }
.prize-sponsor { display: flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--muted); }
.prize-sponsor img { max-height: 18px; max-width: 50px; }
.mine-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.mine-row:first-child { border-top: 0; }
.mine-row > span:first-child { font-size: 1.6rem; }

/* Style */
.style-preview .hero.mini { justify-content: center; }
.style-preview .hero.mini h2 { margin: 0; }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.style-item { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; padding: 10px 6px; border-radius: 18px; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--line); font-weight: 700; }
.style-item.on { box-shadow: inset 0 0 0 3.5px var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.style-item.locked { opacity: .8; }
.style-item.locked .mochi, .style-item.locked .swatch { filter: grayscale(.6); }
.swatch { width: 54px; height: 54px; border-radius: 16px; display: block; }
.si-name { font-size: .8rem; line-height: 1.2; text-align: center; }
.si-tag { font-size: .72rem; color: var(--muted); font-weight: 800; }
.style-item.on .si-tag { color: var(--brand); }
.me-buddy { flex: none; }

/* Who / welcome */
.who-grid { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.who-kid { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; color: var(--ink); font-size: 1rem; }
.who-avatar { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 30px; background: var(--card); box-shadow: var(--shadow); font-size: 3rem; transition: transform .15s; }
.who-kid:hover .who-avatar, .who-kid:focus .who-avatar { transform: scale(1.06); }
.check { display: flex !important; grid-template-columns: none !important; gap: 10px !important; align-items: flex-start; font-weight: 600 !important; font-size: .88rem; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--brand); }

/* Parent & admin */
.ptabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ptabs::-webkit-scrollbar { display: none; }
.ptab { border: 0; border-radius: 14px; padding: 10px 14px; background: var(--card); color: var(--ink); font-weight: 800; white-space: nowrap; box-shadow: inset 0 0 0 2px var(--line); }
.ptab.on { background: var(--ink); color: var(--bg); box-shadow: none; }
#ptab > * + *, #atab > * + * { margin-top: 14px; }
.banner { display: flex; align-items: center; gap: 10px; }
.banner.expired { background: var(--bad-bg); } .banner.trial { background: #FFF6D8; color: #5A4300; }
.highlight { box-shadow: inset 0 0 0 3px var(--warn), var(--shadow); }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick label { display: block; }
.emoji-pick input { position: absolute; opacity: 0; pointer-events: none; }
.emoji-pick span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; font-size: 1.5rem; background: var(--bg2); box-shadow: inset 0 0 0 2px var(--line); cursor: pointer; }
.emoji-pick input:checked + span { box-shadow: inset 0 0 0 3px var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--bg2)); }
.report-row { border-top: 1px solid var(--line); padding: 8px 0; }
.report-row:first-child { border-top: 0; }
.report-row summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.pay { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--bg); border-radius: 16px; padding: 12px; margin: 10px 0; }
.pay img { width: 180px; max-width: 100%; border-radius: 12px; background: #fff; }
.view-admin { max-width: 1100px; }
.table-wrap { overflow-x: auto; padding: 6px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th { text-align: left; color: var(--muted); font-size: .8rem; padding: 6px; }
.admin-table td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.admin-table .actions { display: flex; flex-wrap: wrap; gap: 4px; min-width: 200px; }
.admin-table .actions .btn { margin: 0; }
.status { font-weight: 800; padding: 2px 8px; border-radius: 999px; font-size: .8rem; background: var(--line); }
.status.active, .status.free { background: var(--good-bg); color: var(--good); } .status.expired { background: var(--bad-bg); color: var(--bad); } .status.trial { background: #FFF6D8; color: #8A6500; }
.logo-sm { max-height: 28px; max-width: 60px; object-fit: contain; }

@keyframes glow { 50% { filter: brightness(1.08) saturate(1.1); } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes zoomPop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes stamp { 0% { transform: scale(3) rotate(-20deg); opacity: 0; } 70% { transform: scale(.9) rotate(5deg); opacity: 1; } 100% { transform: scale(1) rotate(-8deg); } }
@media (max-width: 420px) {
  .subject-pick { grid-template-columns: repeat(2, 1fr); }
  .score-ring { width: 130px; height: 130px; } .score-ring > div { width: 102px; height: 102px; } .score-num { font-size: 2.4rem; }
  .start-card .sc-buddy { display: none; }
}

/* ================= Theme skin: Tank Squad (original design) ================= */
:root[data-skin="tank"] {
  --bg: #F3F6E6; --bg2: #FFFFFF; --card: #FFFFFF; --ink: #24301B; --muted: #66704F; --line: #DCE5C4;
  --hazard: repeating-linear-gradient(-45deg, #E8B23A 0 12px, #2B2A1E 12px 24px);
  --stencil: "Black Ops One", "Nunito", system-ui, sans-serif;
  /* Earthy field colours to match the camo theme: steel blue, terracotta, moss, ochre */
  --c-maths: #3F6F94; --c-english: #B9573F; --c-science: #5B8A36; --c-gp: #B5812A; --c-vn: #9C3D5A; --c-hg: #6A5A8C;
}
@media (prefers-color-scheme: dark) {
  :root[data-skin="tank"]:not([data-theme="light"]) { --bg: #12241C; --bg2: #1A3328; --card: #1C3529; --ink: #F3F6EA; --muted: #AAC4B2; --line: #2F5040; --good-bg: #134430; --bad-bg: #4A2229; color-scheme: dark; }
}
:root[data-skin="tank"][data-theme="dark"] { --bg: #12241C; --bg2: #1A3328; --card: #1C3529; --ink: #F3F6EA; --muted: #AAC4B2; --line: #2F5040; --good-bg: #134430; --bad-bg: #4A2229; color-scheme: dark; }
:root[data-skin="tank"][data-theme="dark"] .nav { background: color-mix(in srgb, #1A3328 96%, transparent); }
:root[data-skin="tank"][data-theme="dark"] .nav-item { color: #AAC4B2; }
:root[data-skin="tank"][data-theme="dark"] .nav-item.on { color: #FFC233; }
@media (prefers-color-scheme: dark) {
  :root[data-skin="tank"]:not([data-theme="light"]) .nav { background: color-mix(in srgb, #1A3328 96%, transparent); }
  :root[data-skin="tank"]:not([data-theme="light"]) .nav-item { color: #AAC4B2; }
  :root[data-skin="tank"]:not([data-theme="light"]) .nav-item.on { color: #FFC233; }
}
:root[data-skin="tank"] h1, :root[data-skin="tank"] h2, :root[data-skin="tank"] .section-title,
:root[data-skin="tank"] .start-card b, :root[data-skin="tank"] .start-btn, :root[data-skin="tank"] .rc-label,
:root[data-skin="tank"] .launch-label, :root[data-skin="tank"] .cd-num, :root[data-skin="tank"] .score-num,
:root[data-skin="tank"] .wallet-num, :root[data-skin="tank"] .fb-title, :root[data-skin="tank"] .big-num {
  font-family: var(--stencil); font-weight: 400; letter-spacing: .5px;
}
:root[data-skin="tank"] .card, :root[data-skin="tank"] .q-card, :root[data-skin="tank"] .report-card, :root[data-skin="tank"] .big-action {
  border: 2px solid color-mix(in srgb, var(--brand) 35%, transparent);
  background-image:
    radial-gradient(circle at 10px 10px, color-mix(in srgb, var(--brand) 45%, transparent) 2.5px, transparent 3.5px),
    radial-gradient(circle at calc(100% - 10px) 10px, color-mix(in srgb, var(--brand) 45%, transparent) 2.5px, transparent 3.5px),
    radial-gradient(circle at 10px calc(100% - 10px), color-mix(in srgb, var(--brand) 45%, transparent) 2.5px, transparent 3.5px),
    radial-gradient(circle at calc(100% - 10px) calc(100% - 10px), color-mix(in srgb, var(--brand) 45%, transparent) 2.5px, transparent 3.5px);
  border-radius: 14px;
}
:root[data-skin="tank"] .hero {
  border-radius: 18px; color: #F6F0D8;
  background: radial-gradient(ellipse 90px 50px at 15% 30%, #9CCC65 98%, transparent), radial-gradient(ellipse 70px 40px at 70% 80%, #4E8F2A 98%, transparent),
    radial-gradient(ellipse 60px 45px at 85% 20%, #C9A04A 98%, transparent), linear-gradient(135deg, #6FB33A, #4E9A2E);
  border-bottom: 8px solid transparent; border-image: var(--hazard) 0 0 8 0;
}
:root[data-skin="tank"] .hero-mochi.is-tank { margin: -10px -14px -16px 0; }
:root[data-skin="tank"] .hero-stats span { background: rgba(0,0,0,.22); }
:root[data-skin="tank"] .start-card {
  border-radius: 16px; background: linear-gradient(135deg, #4E9A2E, #7CB342); color: #FFFDF0;
  box-shadow: 0 7px 0 #3A7420, 0 14px 30px rgba(60, 110, 30, .3); border-top: 10px solid transparent; border-image: var(--hazard) 10 0 0 0; animation: none;
}
:root[data-skin="tank"] .start-card .sc-go { background: #E8B23A; color: #2B2A1E; border-radius: 12px; }
:root[data-skin="tank"] .start-btn {
  border-radius: 14px; background: linear-gradient(#E8B23A, #D19A22); color: #2B2A1E; box-shadow: 0 8px 0 #8C6512, 0 16px 30px rgba(140, 101, 18, .35);
  border: 4px solid #2B2A1E; outline: 6px solid transparent; position: relative;
}
:root[data-skin="tank"] .start-btn:active { box-shadow: 0 2px 0 #8C6512; }
:root[data-skin="tank"] .launch { background: linear-gradient(180deg, #6FB33A, #A5D46A 55%, var(--bg) 55.1%); }
:root[data-skin="tank"] .launch-sheet { border-radius: 18px 18px 0 0; border-top: 10px solid transparent; border-image: var(--hazard) 10 0 0 0; }
:root[data-skin="tank"] .launch-buddy.is-tank { animation: rumble .35s ease-in-out infinite alternate; margin-top: 4px; }
:root[data-skin="tank"] .speech { border-radius: 10px; border: 3px solid #2B2A1E; background: #FBF3D2; }
:root[data-skin="tank"] .speech::after { border-top-color: #2B2A1E; }
:root[data-skin="tank"] .stop-dot { border-radius: 0; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); box-shadow: inset 0 0 0 30px color-mix(in srgb, var(--brand) 16%, var(--card)); }
:root[data-skin="tank"] .stop.main .stop-dot { box-shadow: inset 0 0 0 30px var(--brand); }
:root[data-skin="tank"] .stop.finish .stop-dot { box-shadow: inset 0 0 0 30px #E8B23A; }
:root[data-skin="tank"] .journey::before { border-left: 10px solid transparent; border-image: repeating-linear-gradient(180deg, #6D6B55 0 6px, transparent 6px 12px) 0 0 0 10; left: 22px; }
:root[data-skin="tank"] .sp { border-radius: 12px; }
:root[data-skin="tank"] .sp.on { background: var(--brand); box-shadow: 0 4px 0 #3A7420; }
:root[data-skin="tank"] .choice { border-radius: 10px; }
:root[data-skin="tank"] .choice-key { border-radius: 4px; background: #2B2A1E; color: #E8B23A; font-family: var(--stencil); font-weight: 400; }
:root[data-skin="tank"] .bar { height: 22px; border-radius: 6px; background: repeating-linear-gradient(90deg, var(--line) 0 10px, color-mix(in srgb, var(--line) 70%, #000) 10px 12px); overflow: visible; }
:root[data-skin="tank"] .bar-fill { position: relative; border-radius: 6px; background: linear-gradient(#7E9440, #56682B); }
:root[data-skin="tank"] .bar-fill::after {
  content: ""; position: absolute; right: -20px; top: -10px; width: 40px; height: 30px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 30'%3E%3Crect x='20' y='8' width='18' height='4' rx='2' fill='%2345541F' stroke='%232E2A1C'/%3E%3Cpath d='M9 15 Q10 6 20 6 L26 6 Q30 7 30 15 Z' fill='%23647A31' stroke='%232E2A1C' stroke-width='1.5'/%3E%3Cpath d='M2 15 H38 L35 21 H5 Z' fill='%2356682B' stroke='%232E2A1C' stroke-width='1.5'/%3E%3Crect x='2' y='20' width='36' height='8' rx='4' fill='%233A3A2E'/%3E%3C/svg%3E") center / contain no-repeat;
}
:root[data-skin="tank"] .sd { border-radius: 4px; }
:root[data-skin="tank"] .feedback.good { background: color-mix(in srgb, #7E9440 22%, var(--card)); }
:root[data-skin="tank"] .report-card { border-top: 12px solid transparent; border-image: var(--hazard) 12 0 0 0; }
:root[data-skin="tank"] .rc-label { color: var(--brand); letter-spacing: 1.5px; }
:root[data-skin="tank"] .score-ring { background: conic-gradient(#E8B23A calc(var(--pct) * 1%), var(--line) 0); }
:root[data-skin="tank"] .stamp { font-size: 3rem; }
:root[data-skin="tank"] .nav { background: color-mix(in srgb, #FFFFFF 96%, transparent); border-top: 6px solid transparent; border-image: var(--hazard) 6 0 0 0; }
:root[data-skin="tank"] .nav-item { color: #6B7458; }
:root[data-skin="tank"] .nav-item.on { color: #3A7420; background: rgba(111, 179, 58, .16); }
:root[data-skin="tank"] .xp-bar { border-radius: 6px; }
:root[data-skin="tank"] .xp-fill { background: repeating-linear-gradient(-45deg, #E8B23A 0 10px, #D19A22 10px 20px); }
:root[data-skin="tank"] .pill, :root[data-skin="tank"] .chip, :root[data-skin="tank"] .btn { border-radius: 10px; }
.tank .t-name { font-family: "Black Ops One", "Nunito", sans-serif; font-size: 19px; fill: #F2E8C9; letter-spacing: 1.5px; }
.tank .t-track { animation: tread .6s linear infinite; }
.tank .t-wheel { animation: spin 1.2s linear infinite; }
.tank .t-flag { transform-origin: 190px 13px; animation: flap 1.2s ease-in-out infinite; }
.drive-in { animation: driveIn .9s cubic-bezier(.2, .9, .3, 1.05) both; }
@keyframes tread { to { stroke-dashoffset: -26; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flap { 50% { transform: skewY(-10deg) scaleX(.9); } }
@keyframes rumble { from { transform: translateY(0); } to { transform: translateY(-2px) rotate(-.4deg); } }
@keyframes driveIn { from { transform: translateX(-120vw); } to { transform: none; } }
@media (max-width: 420px) { :root[data-skin="tank"] .hero-mochi.is-tank svg { width: 140px; height: auto; } }

/* Theme picker when creating a profile */
.theme-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tp { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; padding: 10px 6px 8px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: inset 0 0 0 3px transparent; opacity: .75; transition: transform .15s, opacity .15s; }
.tp.on { opacity: 1; transform: scale(1.04); box-shadow: inset 0 0 0 4px #fff, 0 0 0 3px var(--a); }
.tp-art { height: 80px; display: grid; place-items: center; }
:root[data-skin="tank"] .mochi-action { color: var(--ink); }
:root[data-skin="tank"] .mochi-action .small { color: var(--muted); }

/* ================= Lesson: width, timer, colourful answers, unit & mode picker ================= */
.view-study .practice, .view-study .report, .view-study .center-screen { max-width: 760px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px 24px; }
.choices { max-width: 680px; }
.choice { min-height: 64px; font-size: 1.1rem; transition: transform .12s; }
.choice:hover:not(:disabled) { transform: translateY(-2px); }
.choices .choice:nth-child(1) { --k: #FF5C6C; } .choices .choice:nth-child(2) { --k: #3D8BFF; }
.choices .choice:nth-child(3) { --k: #1FBF75; } .choices .choice:nth-child(4) { --k: #FFB020; }
.choice { box-shadow: inset 0 0 0 2.5px color-mix(in srgb, var(--k, var(--line)) 45%, var(--line)), 0 4px 0 color-mix(in srgb, var(--k, var(--line)) 55%, transparent); }
.choice .choice-key, :root[data-skin="tank"] .choice .choice-key { background: var(--k, var(--line)); color: #fff; font-family: inherit; font-weight: 900; border-radius: 10px; width: 34px; height: 34px; }
.choice.right, :root[data-skin="tank"] .choice.right { background: var(--good-bg); box-shadow: inset 0 0 0 3px var(--good), 0 0 0 4px color-mix(in srgb, var(--good) 25%, transparent); }
.choice.right .choice-key { background: var(--good); }
.choice.wrong .choice-key { background: var(--bad); }
.choice:disabled:not(.right):not(.wrong) { opacity: .55; }

.q-timer { --p: 1; display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.qt-track { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.qt-fill { display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: 999px; background: linear-gradient(90deg, #1FBF75, #FFC233); transition: width .1s linear; }
.qt-num { font-weight: 900; font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.qt-num b { font-size: 1.35rem; }
.q-timer.low .qt-fill { background: linear-gradient(90deg, #FF5C6C, #FF8A3D); }
.q-timer.low .qt-num { color: #FF5C6C; animation: pop .5s infinite; }
.xp-pop .mult { background: #FFC233; color: #2B2A1E; border-radius: 8px; padding: 0 6px; font-size: .85em; }

.mode-chip { display: inline-flex; align-items: center; gap: 4px; border: 0; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: .8rem; font-weight: 900; letter-spacing: .5px; color: #fff; background: var(--mc, var(--brand)); vertical-align: middle; }
button.mode-chip { cursor: pointer; margin-left: 6px; }
.m-easy { --mc: #1FBF75; } .m-medium { --mc: #3D8BFF; } .m-hard { --mc: #FF5C6C; }
.rc-subject .mode-chip { margin-top: 4px; }

.setup-sheet { max-width: 640px; }
.setup-q { font-weight: 900; font-size: 1.1rem; margin: 16px 0 8px; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.unit-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 0; padding: 10px 12px; border-radius: 14px; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line); }
.unit-btn b { font-size: 1.05rem; } .unit-btn span { font-size: .8rem; color: var(--muted); font-weight: 700; line-height: 1.25; }
.unit-btn.on { background: var(--brand); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--brand) 60%, #000); }
.unit-btn.on span { color: #fffd; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; padding: 14px 8px; border-radius: 18px; background: var(--card); color: var(--ink); text-align: center;
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--mc) 50%, transparent), 0 4px 0 color-mix(in srgb, var(--mc) 50%, transparent); }
.mode-btn b { font-size: 1.2rem; letter-spacing: 1px; color: var(--mc); }
.mode-emoji { font-size: 2rem; }
.mode-meta { font-size: .75rem; font-weight: 800; color: var(--muted); margin-top: 4px; }
.mode-btn.on { background: var(--mc); color: #fff; transform: translateY(-2px); box-shadow: 0 5px 0 color-mix(in srgb, var(--mc) 60%, #000); }
.mode-btn.on b, .mode-btn.on .mode-meta { color: #fff; }
.setup-go { margin-top: 18px; font-size: 1.3rem; padding: 16px; }
.setup-go:disabled { opacity: .45; animation: none; filter: grayscale(.6); cursor: not-allowed; }
@media (max-width: 420px) { .mode-grid { grid-template-columns: 1fr; } .mode-btn { flex-direction: row; justify-content: flex-start; gap: 10px; text-align: left; flex-wrap: wrap; } }

:root[data-skin="tank"] .bar-fill { background: linear-gradient(#9CCB3B, #5F8F23); }

/* School LMS: this week's class work and open tasks */
.school-card h3 { margin-bottom: 6px; }
.school-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.school-row:first-of-type { border-top: 0; }
.school-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; flex: none; color: #fff; background: var(--sc); }
.school-note { color: var(--warn); font-weight: 800; }
.school-tasks { margin-top: 8px; padding-top: 8px; border-top: 2px solid var(--line); display: grid; gap: 4px; }
.school-task { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: .88rem; padding: 6px 8px; border-radius: 10px; background: var(--bg); }
.school-hint { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--good) 14%, var(--card)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--good) 35%, transparent); }
.lms-steps { padding-left: 20px; margin: 6px 0 10px; } .lms-steps li { margin: 3px 0; }
.lms-renew { margin-top: 10px; } .lms-renew summary { cursor: pointer; } .lms-renew .form { margin-top: 8px; }

/* ================= Parent area: calm cards with one clear focus each ================= */
.parent { font-weight: 600; }
.p-card { display: grid; gap: 12px; background: var(--card); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.p-card + .p-card, #ptab > * + * { margin-top: 14px; }
.p-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p-title { font-size: 1.12rem; font-weight: 900; }
.p-tag { font-size: .78rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.p-tag.active, .p-tag.free { background: var(--good-bg); color: var(--good); }
.p-tag.trial { background: color-mix(in srgb, var(--warn) 18%, var(--card)); color: color-mix(in srgb, var(--warn) 70%, #000); }
.p-tag.expired { background: var(--bad-bg); color: var(--bad); }
.p-hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.p-hero b { font-size: 2rem; font-weight: 900; line-height: 1; }
.p-hero span, .p-sub, .p-foot, .p-hint { color: var(--muted); font-size: .88rem; font-weight: 600; }
.p-foot { border-top: 1px solid var(--line); padding-top: 10px; }
.p-meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; font-size: .88rem; }
.p-meter > span { color: var(--muted); }
.p-alert { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-weight: 700; font-size: .9rem; }
.p-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.p-tiles > div { background: var(--bg); border-radius: 14px; padding: 12px 8px; text-align: center; display: grid; gap: 2px; }
.p-tiles b { font-size: 1.6rem; font-weight: 900; line-height: 1.1; }
.p-tiles span { font-size: .75rem; color: var(--muted); font-weight: 700; line-height: 1.2; }
.p-more { border-top: 1px solid var(--line); padding-top: 10px; }
.p-more > summary { cursor: pointer; font-weight: 800; font-size: .92rem; color: var(--brand); list-style: none; }
.p-more > summary::-webkit-details-marker { display: none; }
.p-more > summary::before { content: "›"; display: inline-block; width: 14px; transition: transform .15s; }
.p-more[open] > summary::before { transform: rotate(90deg); }
.p-more[open] > summary { margin-bottom: 10px; }
.p-more .form { gap: 10px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); font-weight: 600; }
.p-head + .set-row { border-top: 0; padding-top: 0; }
.set-row > span:first-child { display: grid; gap: 2px; min-width: 0; }
.set-row b { font-weight: 800; }
.set-row small { color: var(--muted); font-size: .8rem; font-weight: 600; }
.set-input { width: 96px; text-align: center; }
.set-select { width: auto; min-width: 170px; }
.set-unit { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; }
.lms-steps { padding-left: 20px; margin: 0 0 4px; font-size: .9rem; font-weight: 600; } .lms-steps li { margin: 4px 0; }
@media (max-width: 480px) { .set-row { flex-direction: column; align-items: stretch; } .set-input, .set-select { width: 100%; } .p-hero b { font-size: 1.7rem; } }
.school-more > summary { cursor: pointer; font-weight: 800; font-size: .88rem; color: var(--brand); padding: 6px 8px; list-style: none; }
.school-more > summary::-webkit-details-marker { display: none; }
.school-more .school-task { margin-top: 4px; }

/* Chat: photo shown in the child's own message; drop target */
.msg-img { display: block; max-width: min(260px, 70vw); max-height: 260px; border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 4px; object-fit: cover; }
.composer.drop { outline: 3px dashed var(--brand); outline-offset: 4px; border-radius: 22px; }

/* School books (LMS materials by subject and week) */
.book-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; }
.book-tabs::-webkit-scrollbar { display: none; }
.book-tab { display: flex; align-items: center; gap: 6px; border: 0; border-radius: 12px; padding: 9px 12px; background: var(--card); color: var(--ink); font-weight: 800; font-size: .85rem; white-space: nowrap; box-shadow: inset 0 0 0 2px var(--line); }
.book-tab .subj-icon { color: var(--sc); }
.book-tab.on { background: var(--sc); color: #fff; box-shadow: none; } .book-tab.on .subj-icon { color: #fff; }
.book-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: color-mix(in srgb, var(--sc) 14%, var(--card)); }
.book-head .grow { display: grid; } .book-head b { font-size: 1.1rem; }
.book-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--sc); color: #fff; flex: none; font-size: 1.4rem; }
.book-week > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.book-week > summary::-webkit-details-marker { display: none; }
.week-chip { flex: none; font-size: .75rem; font-weight: 900; padding: 4px 8px; border-radius: 8px; background: var(--bg); color: var(--muted); }
.book-note { margin: 0; color: var(--warn); font-weight: 800; font-size: .9rem; }
.book-items { display: grid; gap: 6px; }
.book-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); color: var(--ink); font-weight: 700; font-size: .92rem; }
.book-item:hover { background: color-mix(in srgb, var(--brand) 10%, var(--bg)); }
.bi-icon { flex: none; font-size: 1.15rem; } .bi-go { color: var(--muted); flex: none; }
.unit-more { margin-top: 10px; } .unit-more > summary { cursor: pointer; font-weight: 800; font-size: .9rem; color: var(--brand); margin-bottom: 8px; }

/* Theme suggestion after choosing a favourite thing */
.theme-suggest { text-align: center; display: grid; gap: 10px; justify-items: center; }
.theme-suggest p { margin: 0; }
.ts-preview { position: relative; width: 100%; display: grid; place-items: center; padding: 18px 0 14px; border-radius: 20px; background: linear-gradient(135deg, var(--a), var(--b)); }
.ts-motif { position: absolute; top: 10px; right: 14px; font-size: 1.4rem; letter-spacing: 4px; opacity: .9; }
.theme-suggest .row { width: 100%; }
.unit-gap { opacity: .45; cursor: default; box-shadow: inset 0 0 0 2px var(--line); background: transparent; border: 2px dashed var(--line); }
.unit-gap { cursor: help; }
.unit-info { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: .88rem; }
.unit-info > summary { cursor: pointer; font-weight: 800; color: var(--brand); list-style: none; }
.unit-info > summary::-webkit-details-marker { display: none; }
.unit-info p { margin: 8px 0 0; }

/* Plans */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.plan-card { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 14px 10px; border-radius: 16px; background: var(--bg); box-shadow: inset 0 0 0 2px var(--line); }
.plan-card.vip { box-shadow: inset 0 0 0 2px #FFB020; background: color-mix(in srgb, #FFB020 10%, var(--bg)); }
.plan-card b { font-size: 1.05rem; } .plan-price { font-size: 1.3rem; font-weight: 900; }
.plan-card img { width: 170px; max-width: 100%; border-radius: 12px; background: #fff; margin-top: 6px; }

/* About / credit */
.credit { display: block; text-align: center; font-size: .78rem; color: var(--muted); margin: 18px auto 6px; max-width: 520px; line-height: 1.5; }
.credit b { color: var(--ink); }
.credit span { white-space: nowrap; }
@media (max-width: 360px) { .credit span { white-space: normal; } }
.about-hero { grid-template-columns: auto 1fr; align-items: center; gap: 16px; }
.about-hero p { margin: 0 0 8px; }
.about-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: .92rem; }
.invest { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, var(--card)), var(--card)); }
@media (max-width: 480px) { .about-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* Large screens (computer): home and "Của tớ" use two columns; lessons and chat stay narrow to read easily */
@media (min-width: 1100px) {
  .view-home, .view-me { max-width: 1120px; }
  .page.me { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
  .page.me > * { margin-top: 0 !important; min-width: 0; }
  .page.me > .me-head, .page.me > .credit, .page.me > .logout-btn { grid-column: 1 / -1; }
  .home-mid { grid-template-columns: 1.15fr 1fr; align-items: start; }
  .hm-col { display: grid; gap: 14px; align-content: start; min-width: 0; }
}
/* Phones: six tabs in the bottom bar, one line each */
@media (max-width: 480px) {
  .nav { padding-left: 4px; padding-right: 4px; gap: 0; }
  .nav-item { padding: 6px 1px; font-size: .62rem; letter-spacing: -.2px; white-space: nowrap; min-width: 0; }
  .nav-item > span:last-child { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav-icon { font-size: 1.3rem; }
}

/* Grade / curriculum / data mode picker */
.learner { display: grid; gap: 10px; }
.learner .field-label { margin: 4px 0 -4px; }
.learner select { width: 100%; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mp { display: grid; gap: 4px; justify-items: start; text-align: left; border: 0; padding: 14px; border-radius: 16px; background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.mp span { font-size: 1.6rem; } .mp b { font-size: 1rem; } .mp small { color: var(--muted); font-weight: 600; line-height: 1.35; }
.mp.on { box-shadow: inset 0 0 0 3px var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--bg)); }
@media (max-width: 480px) { .mode-pick { grid-template-columns: 1fr; } }

/* Upload class work */
.upload-box { display: grid; gap: 6px; justify-items: start; padding: 14px; border-radius: 16px; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--brand) 6%, var(--card)); }
a.school-row { color: var(--ink); }
.learner label { display: grid; gap: 6px; font-weight: 800; }

/* Weekly plan */
.plan-card-home { display: flex; align-items: center; gap: 12px; color: var(--ink); border-left: 6px solid var(--sc, var(--brand)); }
.pc-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--sc, var(--brand)); color: #fff; flex: none; font-size: 1.3rem; }
.plan-hero { grid-template-columns: auto 1fr; align-items: center; }
.plan-hero p { margin: 0 0 4px; }
.plan-days { display: grid; gap: 8px; }
.plan-day { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--bg); border-left: 5px solid var(--sc); }
.plan-day.on { box-shadow: inset 0 0 0 2px var(--sc); background: color-mix(in srgb, var(--sc) 10%, var(--bg)); }
.pd-day { width: 100%; font-size: .78rem; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.pd-icon { color: var(--sc); display: grid; }
.plan-q .setup-q { margin-top: 4px; }

/* Weekly report, feedback, help */
.p-tiles.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 480px) { .p-tiles.four { grid-template-columns: repeat(2, 1fr); } }
.p-tiles .up { color: var(--good); } .p-tiles .down { color: var(--bad); }
.weekly-comment { margin: 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 10%, var(--bg)); font-weight: 700; }
.fb-card { border: 2px solid color-mix(in srgb, var(--warn) 50%, transparent); }
.fb-card label { display: grid; gap: 6px; font-weight: 800; }
.stars-pick { display: flex; gap: 6px; }
.star-btn { border: 0; background: none; font-size: 2rem; color: var(--line); cursor: pointer; padding: 0 2px; }
.star-btn.on { color: #FFB020; }
.help-msgs { display: grid; gap: 8px; max-height: 50vh; overflow: auto; }
.help-msg { padding: 10px 12px; border-radius: 14px; max-width: 90%; }
.help-msg.user { justify-self: end; background: var(--brand); color: #fff; }
.help-msg.assistant { background: var(--bg); } .help-msg.assistant p { margin: 0 0 6px; }

/* Home middle: one column on phones/iPad; two independent columns on computers (no gaps between cards) */
.home-mid { display: grid; gap: 14px; }
.hm-col { display: contents; }
.hm-col > * { margin: 0 !important; }
@media (min-width: 1100px) { .home-mid { gap: 16px; } .hm-col { display: grid; } }
@media (min-width: 1100px) { .home-mid.one { grid-template-columns: 1fr; } }

/* Phones/iPad: one list in a sensible order (school week near the top, subjects last) */
.home-mid > .hm-col > .hw-card { order: 1; } .home-mid .plan-card-home { order: 2; } .home-mid .school-card { order: 3; }
.home-mid .quests { order: 4; } .home-mid .last-report { order: 5; } .home-mid .mochi-action { order: 6; } .home-mid .hm-subjects { order: 7; }
.hm-subjects .section-title { margin: 6px 0 10px; }
@media (min-width: 1100px) { .home-mid .hm-col > * { order: 0; } }

/* Last lesson card */
.last-report { display: grid; gap: 10px; }
.lr-head { display: flex; justify-content: space-between; align-items: center; }
.lr-label { font-weight: 900; font-size: 1.02rem; }
.lr-body { display: flex; align-items: center; gap: 14px; }
.lr-ring { --pct: 0; --c: var(--good); flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; align-content: center;
  background: radial-gradient(closest-side, var(--card) 76%, transparent 78%), conic-gradient(var(--c) calc(var(--pct) * 1%), var(--line) 0); }
.last-report.ok .lr-ring { --c: var(--warn); } .last-report.low .lr-ring { --c: var(--bad); }
.lr-ring b { font-size: 1.6rem; font-weight: 900; line-height: 1; } .lr-ring span { font-size: .72rem; color: var(--muted); font-weight: 800; }
.lr-word { font-size: 1.15rem; }
.lr-subj { display: flex; align-items: center; gap: 6px; color: var(--sc); font-weight: 800; margin: 2px 0 4px; }
.lr-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .85rem; color: var(--muted); font-weight: 700; }
.last-report .btn.block { margin-top: 0; }
.hm-subjects { display: grid; gap: 12px; }
.hm-subjects > h3 { margin: 0; }

/* Top row: greeting + last lesson side by side on computers */
.top-row { display: grid; gap: 14px; }
.top-row > * { margin: 0 !important; }
@media (min-width: 1100px) { .top-row { grid-template-columns: 1.7fr 1fr; align-items: stretch; } .top-row.solo { grid-template-columns: 1fr; } .top-row .last-report { align-content: center; } }

/* Log out from "Của tớ" */
.logout-btn { margin-top: 10px; }
.logout-sheet { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.logout-sheet .row { width: 100%; }

/* "Install Mochi" pop-up */
.install-pop { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; justify-content: center; padding: 0 12px calc(86px + env(safe-area-inset-bottom)); pointer-events: none; animation: fade .2s; }
.no-nav .install-pop { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.ip-card { pointer-events: auto; position: relative; width: 100%; max-width: 440px; background: var(--card); color: var(--ink); border-radius: 22px; padding: 16px; box-shadow: 0 14px 40px rgba(20, 12, 40, .28), inset 0 0 0 2px var(--line); animation: slideUp .3s; }
.ip-top { display: flex; gap: 12px; align-items: center; padding-right: 22px; }
.ip-top b { display: block; font-size: 1.1rem; }
.ip-top span { color: var(--muted); font-size: .9rem; }
.ip-x { position: absolute; top: 10px; right: 10px; border: 0; background: transparent; color: var(--muted); font-size: 1rem; padding: 4px 6px; cursor: pointer; }
.ip-row { display: flex; gap: 8px; margin-top: 12px; }
.ip-steps { margin: 10px 0 0; padding-left: 22px; display: grid; gap: 4px; font-size: .95rem; }
.ip-ico { font-size: .9em; }

/* Home: "Kết nối trường của con" (no LMS / uploads yet) */
.connect-card { display: block; color: var(--ink); text-decoration: none; }
.connect-card p { margin: 0 0 6px; }
.cc-list { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--muted); }

/* Eye button in password boxes */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 46px !important; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--brand); background: var(--bg2); outline: none; }
.pin-form .pw-wrap { flex: 1; }
