/* Lionheart English. Indigo cloth and Sahara gold.
   English text is indigo ink, Hausa text is gold-brown, everywhere.
   Rule: the Hausa is ALWAYS on its own line under the English (.ha is a block). */

:root {
  --bg: #F2F4FA; --surface: #FFFFFF; --surface2: #E8EBF8; --ink: #141A44; --muted: #59618A; --line: #D6DBEF;
  --primary: #3340A8; --primary-deep: #232B7E; --on-primary: #FFFFFF; --primary-soft: #E3E6FA;
  --gold: #F4B223; --gold-deep: #B97F00; --on-gold: #2A1D00; --gold-soft: #FFF0C7;
  --good: #1B9A66; --good-soft: #D9F3E6; --bad: #D6453D; --bad-soft: #FCE3E1;
  --ha: #7A4B00;
  --hero-bg: #2B3590; --hero-ink: #FFFFFF; --hero-card: #FFFFFF; --hero-card-ink: #141A44;
  --pat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M14 1 27 14 14 27 1 14Z' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M14 8 20 14 14 20 8 14Z'/%3E%3Cpath d='M0 0h4v4H0zM24 0h4v4h-4zM0 24h4v4H0zM24 24h4v4h-4z'/%3E%3C/svg%3E");
  --font: ui-rounded, "Nunito", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --col: 680px;
}
[data-theme="dark"] {
  --bg: #0D1030; --surface: #171B45; --surface2: #1F2456; --ink: #EEF0FF; --muted: #A5ABD8; --line: #2C3270;
  --primary: #8E9BFF; --primary-deep: #4F5CCB; --on-primary: #0D1030; --primary-soft: #232A66;
  --gold: #FFC83D; --gold-deep: #C99400; --on-gold: #2A1D00; --gold-soft: #3A3010;
  --good: #46D39A; --good-soft: #12392E; --bad: #FF7A72; --bad-soft: #431C26;
  --ha: #FFD479;
  --hero-bg: #1A2060; --hero-ink: #EEF0FF; --hero-card: #232A66; --hero-card-ink: #EEF0FF;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open { overflow: hidden; }
h1, h2, h3 { margin: 0 0 4px; line-height: 1.15; letter-spacing: -0.01em; font-weight: 800; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0 0 8px; }
a { color: var(--primary); }
button { font-family: inherit; }
code { background: var(--surface2); padding: 2px 6px; border-radius: 6px; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.ha { display: block; color: var(--ha); font-weight: 600; }
h1 .ha { margin-top: 2px; font-size: 0.6em; line-height: 1.25; letter-spacing: 0; }
h2 .ha { margin-top: 2px; font-size: 0.72em; line-height: 1.25; letter-spacing: 0; }
h3 .ha { margin-top: 2px; font-size: 0.83em; line-height: 1.25; letter-spacing: 0; }
.muted { color: var(--muted); } .small { font-size: 14px; } .center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.big-emoji { font-size: 56px; margin: 0; line-height: 1; }

/* ---------------------------------------------------------------- shell */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px max(16px, calc((100% - var(--col)) / 2)); padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--bg); border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--gold); font-size: 22px; flex: none; }
.brand-name { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.stat { display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px; border-radius: 999px; background: var(--surface); border: 2px solid var(--line); font-size: 14px; }
.stat b { font-weight: 800; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-size: 18px; cursor: pointer; display: grid; place-items: center; }
.when-dark { display: none; }
[data-theme="dark"] .when-light { display: none; } [data-theme="dark"] .when-dark { display: inline; }

.page { max-width: var(--col); margin: 0 auto; padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 2px solid var(--line);
}
.tabbar a { flex: 1; max-width: 200px; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 8px; border-radius: 14px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.tabbar a span { font-size: 22px; line-height: 1.2; }
.tabbar a.on { background: var(--primary-soft); color: var(--primary); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --bgc: var(--primary); --edge: var(--primary-deep); --fg: var(--on-primary);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 48px;
  padding: 10px 20px; border: 0; border-radius: 14px; background: var(--bgc); color: var(--fg); font-size: 16px; font-weight: 800;
  text-decoration: none; text-align: center; cursor: pointer; box-shadow: 0 4px 0 var(--edge); transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn b { font-weight: 800; } .btn small { font-size: 12.5px; font-weight: 600; opacity: 0.88; }
.btn.gold { --bgc: var(--gold); --edge: var(--gold-deep); --fg: var(--on-gold); }
.btn.good { --bgc: var(--good); --edge: #12714A; --fg: #fff; }
.btn.ghost { --bgc: var(--surface); --edge: var(--line); --fg: var(--primary); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.big { min-height: 62px; font-size: 18px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.cta-row { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }

/* ---------------------------------------------------------------- forms */
.auth { max-width: 460px; margin: 10px auto 0; }
.auth.center { text-align: center; padding-top: 30px; }
.form { margin-top: 16px; display: grid; gap: 18px; }
.field label { display: block; font-weight: 800; margin-bottom: 6px; }
.field input[type="text"], .field select, .select {
  width: 100%; min-height: 54px; padding: 10px 14px; font: inherit; font-size: 18px; color: var(--ink);
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; appearance: none; -webkit-appearance: none;
}
.field select, .select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 24px, calc(100% - 14px) 24px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
.field input:focus, .field select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
.dob { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.err { color: var(--bad); font-weight: 700; font-size: 15px; margin: 6px 0 0; }
.err .ha { color: inherit; font-weight: 600; }
.field label .ha { font-size: 14px; }
.alt { text-align: center; margin-top: 18px; }
.alt.ha { margin-top: 2px; }

/* ---------------------------------------------------------------- home */
.hero { position: relative; overflow: hidden; margin: -16px -16px 0; padding: 28px 20px 34px; background: var(--hero-bg); color: var(--hero-ink); }
.hero-in { position: relative; max-width: 520px; margin: 0 auto; }
.hero h1 { font-size: 36px; }
.hero .ha, .hero-ha { color: #FFD479; font-size: 18px; }
.hero-text { margin-top: 18px; font-size: 16px; opacity: 0.95; }
.pattern { position: absolute; inset: 0; color: #fff; opacity: 0.1; pointer-events: none; -webkit-mask: var(--pat) 0 0 / 28px 28px; mask: var(--pat) 0 0 / 28px 28px; }
.demo { margin-top: 22px; padding: 20px 16px 14px; border-radius: 24px; background: var(--hero-card); color: var(--hero-card-ink); text-align: center; }
.demo-en { margin: 0 0 6px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.dw { font: inherit; color: inherit; background: none; border: 0; padding: 0 6px; border-radius: 10px; cursor: pointer; transition: background 0.18s, color 0.18s; }
.dw.lit { background: var(--gold); color: var(--on-gold); }
.demo-ha { margin: 0; font-size: 20px; }
.demo .ha { color: var(--ha); }
.demo-tip { margin: 10px 0 0; font-size: 15px; color: var(--muted); min-height: 52px; }
.demo-tip > b { display: block; color: var(--hero-card-ink); font-size: 18px; }
.demo-tip .ha { font-size: 16px; }
.how { padding: 28px 0 6px; }
.how-list { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 12px; }
.how-list li { display: flex; gap: 14px; padding: 14px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); }
.how-ico { font-size: 30px; line-height: 1; }
.how-list b { display: block; }
.how-list p { margin: 4px 0 0; font-size: 15px; }
.how-list p + p { margin-top: 0; }
.rule-note { margin-top: 8px; padding: 14px 16px; border-radius: 16px; background: var(--gold-soft); }
.rule-note p { margin: 0 0 4px; }
.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 22px 0 0; }

/* ---------------------------------------------------------------- dashboard */
.greet { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.greet h1 { font-size: 26px; }
.level { min-width: 150px; max-width: 190px; text-align: right; font-size: 14px; }
.level b { display: block; font-size: 17px; } .level small { color: var(--muted); }
.bar { height: 12px; border-radius: 99px; background: var(--surface2); overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width 0.5s; }
.bar.gold i { background: var(--gold); } .bar.slim { height: 8px; margin: 0; }
.goal { margin: 14px 0; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); }
.goal-text { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.goal-text .ha { font-size: 14px; }
.goal-xp { color: var(--muted); font-size: 15px; font-weight: 700; text-align: right; }
.continue { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 22px; background: var(--gold); color: var(--on-gold); text-decoration: none; box-shadow: 0 5px 0 var(--gold-deep); margin: 8px 0 20px; }
.continue:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--gold-deep); }
.continue-ico { display: grid; place-items: center; width: 64px; height: 64px; flex: none; border-radius: 20px; background: rgba(255, 255, 255, 0.55); font-size: 34px; }
.continue-text { display: grid; gap: 1px; min-width: 0; }
.continue-text small { font-size: 14px; font-weight: 700; }
.continue-text b { font-size: 21px; line-height: 1.15; }
.continue .ha { color: #6A4000; font-size: 14px; }
.continue-text b + .ha { font-size: 16px; }
.next-step { display: block; margin-top: 6px; font-size: 14px; font-weight: 800; }
.continue .next-step-ha { font-size: 13.5px; }
.card { padding: 18px; border-radius: 20px; background: var(--surface); border: 2px solid var(--line); margin-bottom: 14px; }
.card.win { text-align: center; background: var(--gold-soft); }
.overall { margin: 4px 0 0; } .overall .ha { display: block; font-size: 14px; }

/* Every step of 10 lessons is a <details>: the step the learner is on is open, the others are folded (tap to open). */
.town { margin-top: 14px; scroll-margin-top: 76px; }
.town-head { position: relative; overflow: hidden; display: block; padding: 14px 16px; border-radius: 18px; background: var(--hero-bg); color: var(--hero-ink); list-style: none; cursor: pointer; -webkit-user-select: none; user-select: none; }
.town-head::-webkit-details-marker { display: none; }
.town-head::marker { content: ""; }
.town-row { position: relative; display: flex; align-items: center; gap: 10px; }
.town-name { flex: 1; min-width: 0; }
.town-name h2 { font-size: 20px; margin: 0; }
.town-name .ha { color: #FFD479; font-weight: 700; font-size: 15px; }
.town-count { flex: none; font-weight: 800; padding: 4px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); white-space: nowrap; }
.town-chev { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.town-chev::before { content: ""; width: 8px; height: 8px; margin-top: -4px; border-right: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: rotate(45deg); transition: transform 0.2s, margin-top 0.2s; }
.town[open] .town-chev::before { margin-top: 4px; transform: rotate(-135deg); }
.town.here .town-head { box-shadow: 0 0 0 3px var(--gold); }
.road { list-style: none; margin: 0; padding: 18px 0 0; position: relative; display: flex; flex-direction: column; align-items: center; }
.road::before { content: ""; position: absolute; top: 0; bottom: 30px; left: 50%; border-left: 4px dashed var(--gold); opacity: 0.6; transform: translateX(-2px); }
.stop { position: relative; width: 190px; margin: 0 0 22px; text-align: center; transform: translateX(var(--x, 0)); }
.node { position: relative; display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; border: 0; text-decoration: none; font-size: 32px; cursor: pointer; background: var(--surface2); color: var(--muted); box-shadow: 0 5px 0 var(--line); }
.node:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.stop.open .node { background: var(--primary-soft); color: var(--primary); box-shadow: 0 5px 0 var(--primary); }
.stop.done .node { background: var(--good); color: #fff; font-weight: 800; box-shadow: 0 5px 0 #12714A; }
.stop.current .node { background: var(--gold); color: var(--on-gold); box-shadow: 0 5px 0 var(--gold-deep); animation: pulse 1.8s infinite; }
.stop.locked .node { font-size: 26px; }
@keyframes pulse { 0% { outline: 0 solid rgba(244, 178, 35, 0.6); } 70% { outline: 14px solid rgba(244, 178, 35, 0); } 100% { outline: 0 solid rgba(244, 178, 35, 0); } }
.node.shake, .shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.stop-label { margin: 10px 0 0; font-weight: 700; line-height: 1.2; font-size: 15px; }
.stop-label b { color: var(--primary); }
.stop.locked .stop-label { color: var(--muted); font-weight: 600; }
.stop-stars { margin: 2px 0 0; color: var(--gold-deep); letter-spacing: 2px; }
[data-theme="dark"] .stop-stars { color: var(--gold); }
.stop-start { margin: 6px auto 0; display: block; width: max-content; max-width: 100%; padding: 4px 14px; border-radius: 16px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 800; line-height: 1.25; }
.stop-start .ha { color: var(--gold); font-size: 12px; font-weight: 700; }
[data-theme="dark"] .stop-start .ha { color: #7A4B00; }

/* ---------------------------------------------------------------- lesson hub */
.back-link { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 700; }
.back-link .ha { font-size: 13px; }
.hub-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.hub-head p { margin: 0; }
.hub-emoji { display: grid; place-items: center; width: 76px; height: 76px; flex: none; border-radius: 24px; background: var(--gold); font-size: 42px; }
.stars { color: var(--gold-deep); letter-spacing: 2px; font-size: 20px; } [data-theme="dark"] .stars { color: var(--gold); }
.stars.big { font-size: 38px; margin: 6px 0; }
.passed-note { padding: 12px 14px; border-radius: 14px; background: var(--good-soft); }
.passed-note .stars { display: block; }
.passed-note p { margin: 2px 0 0; }
.steps { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 10px; }
.step-in { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.step.current .step-in { border-color: var(--gold); background: var(--gold-soft); }
.step.done .step-in { border-color: var(--good); }
.step.locked .step-in { opacity: 0.6; }
.step-ico { font-size: 28px; }
.step-text { flex: 1; display: grid; }
.step-text small { color: var(--muted); font-size: 14px; }
.step-state { font-size: 20px; font-weight: 800; color: var(--primary); }
.step.done .step-state { color: var(--good); }
.words-box { margin-top: 24px; }
.checklist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 28px auto 1fr; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 2px solid var(--line); }
.checklist .pron { grid-column: 3; grid-row: 1; justify-self: end; color: var(--muted); font-size: 14px; }
.checklist .ha { grid-column: 2 / 4; grid-row: 2; font-size: 15px; }
.tick { display: grid; place-items: center; grid-row: 1 / 3; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); font-weight: 800; color: #fff; }
.checklist li.on .tick { background: var(--good); border-color: var(--good); }
.checklist b { font-size: 18px; }

/* ---------------------------------------------------------------- step pages */
.stephead { display: grid; grid-template-columns: 44px 1fr; gap: 4px 12px; align-items: center; margin-bottom: 14px; }
.stephead .back { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); text-decoration: none; font-size: 26px; font-weight: 800; }
.stephead-t b { display: block; font-size: 21px; line-height: 1.15; } .stephead-t .ha { font-size: 16px; line-height: 1.2; } .stephead-t small { display: block; color: var(--muted); font-size: 14px; }
.stephead .bar { grid-column: 1 / 3; }
.lead { margin: 0 0 4px; }
.lead.ha { margin-bottom: 14px; font-size: 15px; }

.wlist { display: grid; gap: 10px; margin: 10px 0 16px; }
.wchip { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; gap: 0 12px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 16px; }
.wchip-n { grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); font-weight: 800; }
.wchip-w { font-size: 22px; font-weight: 800; } .wchip-ha { font-size: 15px; }
.wchip.now { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 4px rgba(244, 178, 35, 0.28); }
.wchip.now .wchip-n { background: var(--gold); color: var(--on-gold); }
.wchip.done { border-color: var(--good); } .wchip.done .wchip-n { background: var(--good); color: #fff; }
.wchip.locked { opacity: 0.55; }
.guide { margin: 24px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); }
.guide summary { cursor: pointer; font-weight: 800; }
.guide summary .ha { font-size: 14px; }
.guide p { margin: 8px 0 0; }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; font-size: 15px; }
.legend li { padding: 6px 10px; border-radius: 10px; background: var(--surface2); }
.legend b { color: var(--primary); }

/* word sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 38, 0.6); opacity: 0; transition: opacity 0.2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: var(--col); margin: 0 auto; max-height: 94vh; overflow-y: auto; border-radius: 28px 28px 0 0; background: var(--bg); transform: translateY(100%); transition: transform 0.22s ease-out; outline: none; padding-bottom: env(safe-area-inset-bottom); }
.sheet-wrap.show .sheet-backdrop { opacity: 1; } .sheet-wrap.show .sheet { transform: none; }
.wsheet { padding: 16px 18px 24px; text-align: center; }
.wsheet-top { display: flex; justify-content: space-between; align-items: center; }
.chip { padding: 4px 12px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 14px; }
.bigword { font-size: 46px; margin: 8px 0 0; letter-spacing: -0.02em; }
.pron { font-size: 22px; font-weight: 800; color: var(--primary); margin: 0; letter-spacing: 0.03em; }
.meaning { font-size: 22px; margin: 4px 0 6px; }
.gem { margin-top: 14px; padding: 16px; border-radius: 22px; background: var(--surface); border: 2px solid var(--line); position: relative; }
.gem.ok { border-color: var(--good); }
.gem.locked { opacity: 0.45; pointer-events: none; }
.gem.locked h3 { padding-right: 26px; }
.gem.locked::after { content: "🔒"; position: absolute; top: 10px; right: 12px; font-size: 16px; }
.ex { font-size: 24px; font-weight: 700; line-height: 1.3; margin: 8px 0 2px; }
.ex-ha { font-size: 17px; margin: 0; }
.mic-row { display: flex; justify-content: center; margin: 12px 0 6px; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); font-size: 34px; box-shadow: 0 5px 0 var(--primary-deep); cursor: pointer; display: grid; place-items: center; }
.mic[data-state="listening"] { background: var(--bad); color: #fff; animation: ring 1.2s infinite; }
.mic[data-state="checking"] { opacity: 0.6; }
.mic[data-state="done"] { background: var(--good); color: #fff; box-shadow: 0 5px 0 #12714A; }
@keyframes ring { 0% { box-shadow: 0 5px 0 #8E2620, 0 0 0 0 rgba(214, 69, 61, 0.55); } 100% { box-shadow: 0 5px 0 #8E2620, 0 0 0 24px rgba(214, 69, 61, 0); } }
.status { min-height: 22px; margin: 4px 0; font-size: 15px; color: var(--muted); }
.status.warn { color: var(--gold-deep); font-weight: 700; } [data-theme="dark"] .status.warn { color: var(--gold); }
.status.bad { color: var(--bad); font-weight: 700; }
.status .ha, .chunk-msg .ha { font-size: 14px; }
.status.warn .ha, .status.bad .ha, .chunk-msg.ok .ha, .chunk-msg.bad .ha, .chunk-msg.warn .ha { color: inherit; }
.result { margin-top: 8px; padding: 12px 14px; border-radius: 16px; text-align: left; }
.result.ok { background: var(--good-soft); } .result.bad { background: var(--bad-soft); }
.result b { display: block; font-size: 18px; } .result b .ha { font-size: 15px; } .result p { margin: 6px 0 0; font-size: 15px; }
.meter { position: relative; height: 12px; margin: 8px 0 2px; border-radius: 99px; background: rgba(0, 0, 0, 0.12); }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.result.ok .meter i { background: var(--good); } .result.bad .meter i { background: var(--bad); }
.meter-tick { position: absolute; top: -3px; width: 3px; height: 18px; border-radius: 2px; background: var(--ink); }
.wsheet-foot { margin-top: 16px; }

/* ---------------------------------------------------------------- grammar */
.rule-card { padding: 18px; border-radius: 22px; background: var(--surface); border: 2px solid var(--line); }
.rule-en { font-size: 19px; line-height: 1.55; margin: 12px 0 10px; }
.rule-ha { padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); font-size: 17px; line-height: 1.5; margin: 0; }
.sub { margin: 22px 0 4px; }
.gex { list-style: none; margin: 10px 0 18px; padding: 0; display: grid; gap: 10px; }
.gex-i { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); }
.gex-i.heard { border-color: var(--good); }
.speak { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 0; font-size: 22px; background: var(--primary-soft); cursor: pointer; }
.gex-t { flex: 1; } .gex-t p { margin: 0; } .gex-t .en { font-size: 21px; font-weight: 800; line-height: 1.25; } .gex-t .ha { font-size: 16px; }
.gex-tick { font-weight: 800; color: var(--good); font-size: 20px; }

/* ---------------------------------------------------------------- story */
.story-title { margin-bottom: 14px; }
.slow-toggle { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 2px solid var(--line); font-size: 15px; font-weight: 700; cursor: pointer; }
.slow-toggle input { flex: none; width: 18px; height: 18px; }
.slow-text { display: grid; line-height: 1.25; }
.slow-text .ha { font-size: 13px; }
.chunks { display: grid; gap: 14px; margin-bottom: 18px; }
.chunk { position: relative; padding: 16px; border-radius: 22px; background: var(--surface); border: 2px solid var(--line); }
.chunk.now { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(244, 178, 35, 0.28); }
.chunk.done { border-color: var(--good); }
.chunk-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 800; font-size: 14px; color: var(--muted); }
.chunk-st { font-size: 20px; }
.chunk.done .chunk-st { color: var(--good); }
.chunk-text { font-size: 23px; line-height: 1.8; margin: 0 0 12px; }
.w { padding: 2px 3px; border-radius: 8px; cursor: pointer; transition: background 0.07s, color 0.07s; }
.w:active { background: var(--primary-soft); }
.w.now { background: var(--gold); color: var(--on-gold); box-shadow: 0 0 0 2px var(--gold); }
.w.ok { background: var(--good-soft); color: var(--good); }
.w.miss { background: var(--bad-soft); text-decoration: underline wavy var(--bad); }
.chunk-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.chunk-actions .btn { flex: 1; min-width: 140px; }
.mic-btn { --bgc: var(--primary); flex-direction: row; gap: 8px; }
.mic-dot { display: none; width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
.mic-btn[data-state="listening"] { --bgc: var(--bad); --edge: #8E2620; --fg: #fff; } .mic-btn[data-state="listening"] .mic-dot { display: inline-block; }
.mic-btn[data-state="listening"] .mic-text, .mic-btn[data-state="checking"] .mic-text, .mic-btn[data-state="done"] .mic-text { font-size: 0; }
.mic-btn[data-state="listening"] .mic-text::after { content: "Tap to stop"; font-size: 16px; }
.mic-btn[data-state="checking"] .mic-text::after { content: "Checking…"; font-size: 16px; }
.mic-btn[data-state="done"] { --bgc: var(--good); --edge: #12714A; --fg: #fff; } .mic-btn[data-state="done"] .mic-text::after { content: "✓ Read it again"; font-size: 16px; }
.chunk-msg { min-height: 22px; margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.chunk-msg.ok { color: var(--good); font-weight: 800; } .chunk-msg.bad { color: var(--bad); font-weight: 800; } .chunk-msg.warn { color: var(--gold-deep); font-weight: 700; }
[data-theme="dark"] .chunk-msg.warn { color: var(--gold); }
.ha-toggle { display: inline-flex; flex-direction: column; align-items: center; margin-top: 6px; padding: 8px 14px; border-radius: 10px; border: 2px dashed var(--ha); background: none; color: var(--ha); font-weight: 800; font-size: 15px; line-height: 1.25; cursor: pointer; }
.ha-toggle small, .hint-btn small { font-size: 12.5px; font-weight: 600; }
.chunk-ha { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); font-size: 18px; line-height: 1.55; }
.lock-note { display: none; margin: 8px 0 0; color: var(--muted); font-weight: 700; font-size: 15px; }
.chunk.locked .chunk-text { filter: blur(6px); user-select: none; } .chunk.locked .chunk-actions, .chunk.locked .ha-toggle { display: none; }
.chunk.locked .lock-note { display: block; }
.word-tip { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 30; transform: translateX(-50%); display: grid; gap: 2px; justify-items: center; text-align: center; max-width: min(92vw, 520px); padding: 10px 18px; border-radius: 18px; background: var(--ink); color: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }
.tip-main { display: flex; gap: 10px; align-items: baseline; justify-content: center; flex-wrap: wrap; }
.word-tip b { font-size: 20px; } .word-tip .pron { font-size: 15px; color: var(--bg); opacity: 0.8; } .word-tip .ha { color: var(--gold); font-size: 18px; }
[data-theme="dark"] .word-tip .ha { color: #7A4B00; }

/* ---------------------------------------------------------------- questions */
.q-count { color: var(--muted); font-weight: 800; font-size: 14px; margin: 4px 0; }
.q-count .ha { font-size: 13px; }
.q-text { font-size: 25px; line-height: 1.3; margin: 6px 0 12px; }
.blank { display: inline-block; min-width: 64px; margin: 0 4px; border-bottom: 4px solid var(--gold); text-align: center; color: var(--gold-deep); }
.hint-btn { display: inline-flex; flex-direction: column; align-items: center; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 15px; line-height: 1.25; cursor: pointer; }
.q-ha { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); font-size: 17px; }
.options { display: grid; gap: 10px; margin: 16px 0; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px; text-align: left; font-size: 19px; font-weight: 700; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--line); cursor: pointer; }
.opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt-k { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.opt:disabled { cursor: default; }
.opt.right { background: var(--good-soft); border-color: var(--good); box-shadow: 0 3px 0 var(--good); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad); box-shadow: 0 3px 0 var(--bad); }
.feedback { padding: 14px; border-radius: 18px; margin-top: 8px; }
.feedback.ok { background: var(--good-soft); } .feedback.bad { background: var(--bad-soft); }
.feedback b { display: block; font-size: 19px; } .feedback b .ha { font-size: 15px; } .feedback p { margin: 6px 0 0; } .feedback .btn { margin-top: 14px; }

.result-card { text-align: center; padding: 22px 16px; border-radius: 26px; background: var(--surface); border: 2px solid var(--line); }
.result-card.pass { border-color: var(--good); } .result-card.fail { border-color: var(--bad); }
.ring { --p: 0; display: grid; place-items: center; width: 130px; height: 130px; margin: 0 auto 12px; border-radius: 50%; background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--surface2) 0); position: relative; }
.result-card.fail .ring { background: conic-gradient(var(--bad) calc(var(--p) * 1%), var(--surface2) 0); }
.ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font-size: 32px; }
.unlock { font-weight: 800; padding: 10px 14px; border-radius: 14px; background: var(--gold-soft); }
.result-card .stack { margin-top: 16px; text-align: left; }

/* ---------------------------------------------------------------- ranks and profile */
.your-rank { margin: 10px 0; padding: 12px 14px; border-radius: 16px; background: var(--gold-soft); }
.your-rank p { margin: 0; }
.tabs { display: flex; gap: 8px; margin: 14px 0; }
.tabs button { flex: 1; padding: 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 15px; cursor: pointer; }
.tabs button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.tabs button .ha { font-size: 12.5px; font-weight: 600; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); }
.rank li.me { border-color: var(--gold); background: var(--gold-soft); }
.rank li.empty { display: block; color: var(--muted); }
.pos { width: 34px; text-align: center; font-weight: 800; font-size: 20px; } .who { flex: 1; font-weight: 800; }
.me-card { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.me-card p { margin: 0 0 2px; }
.me-avatar { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 26px; background: var(--gold); font-size: 44px; flex: none; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.stats-grid div { padding: 12px 14px; border-radius: 18px; background: var(--surface); border: 2px solid var(--line); }
.stats-grid b { display: block; font-size: 28px; line-height: 1.1; } .stats-grid span { display: block; font-size: 14px; color: var(--muted); }
.stats-grid .ha { font-size: 13px; color: var(--ha); }
.badges { list-style: none; margin: 12px 0 22px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badges li { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 14px 10px; border-radius: 18px; border: 2px dashed var(--line); background: var(--surface); opacity: 0.6; }
.badges li.on { opacity: 1; border: 2px solid var(--gold); background: var(--gold-soft); }
.badge-ico { font-size: 36px; line-height: 1.2; } .badges small { color: var(--muted); font-size: 13px; line-height: 1.3; }
.badges .ha { font-size: 13px; line-height: 1.25; }
.actions { display: grid; gap: 12px; }

/* ---------------------------------------------------------------- toasts, XP, confetti */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 8px; justify-items: center; padding: 0 14px; pointer-events: none; }
.toast { max-width: 520px; padding: 12px 16px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); transition: opacity 0.3s, transform 0.3s; }
.toast.warn { background: var(--gold); color: var(--on-gold); } .toast.bad { background: var(--bad); color: #fff; } .toast.badge { background: var(--primary); color: var(--on-primary); }
.toast .ha { color: #FFD479; font-size: 14px; font-weight: 600; }
[data-theme="dark"] .toast .ha { color: #7A4B00; }
.toast.warn .ha, .toast.bad .ha, .toast.badge .ha { color: inherit; opacity: 0.9; }
.toast.out { opacity: 0; transform: translateY(10px); }
.xp-pop { position: fixed; left: 50%; top: 30%; z-index: 70; transform: translateX(-50%); padding: 8px 18px; border-radius: 99px; background: var(--gold); color: var(--on-gold); font-size: 24px; font-weight: 800; pointer-events: none; animation: rise 1.4s ease-out forwards; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 20px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60px); } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 80; pointer-events: none; }

@media (min-width: 700px) {
  .stat { font-size: 16px; } .tabbar { gap: 12px; }
  .hero { margin: -16px -16px 0; border-radius: 0 0 32px 32px; }
  .cta-row { flex-direction: row; } .cta-row .btn { flex: 1; }
  .badges { grid-template-columns: repeat(3, 1fr); } .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
