:root {
  --bg: #fff8ee;
  --ink: #23263a;
  --ink-2: #5d6178;
  --muted: #9a9db0;
  --line: #ece4d6;
  --card: #ffffff;
  --green: #34c77b; --green-d: #1f9e5c; --green-s: #e3f9ec;
  --red: #ff5d6c; --red-d: #d93f4f; --red-s: #ffe6e9;
  --gold: #ffc83d; --gold-d: #e3a500;
  --kid: #7c5cff; --kid-d: #5b3fd6; --kid-s: #efeaff;
  --r: 22px;
  --shadow: 0 2px 0 rgba(35, 38, 58, .06), 0 12px 30px -12px rgba(35, 38, 58, .18);
  --font: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fredoka', 'Nunito', ui-rounded, system-ui, sans-serif;
  color-scheme: light;
}
body[data-theme="ocean"], .theme-ocean { --kid: #1aa7ec; --kid-d: #0b82bf; --kid-s: #e0f4ff; }
body[data-theme="sunset"], .theme-sunset { --kid: #ff8a2b; --kid-d: #dc6a0c; --kid-s: #fff0df; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-weight: 700; font-size: 17px; line-height: 1.4;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: .2px; }
small { font-weight: 700; color: var(--ink-2); }
.muted { color: var(--muted); }
kbd { display: none; }
@media (hover: hover) and (pointer: fine) {
  kbd { display: inline-grid; place-items: center; position: absolute; top: 8px; left: 10px; font: 800 11px var(--font); color: var(--muted); border: 2px solid var(--line); border-radius: 7px; width: 22px; height: 22px; }
}

/* floating background blobs */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; animation: float 18s ease-in-out infinite; }
.bg-blobs span:nth-child(1) { width: 340px; height: 340px; background: radial-gradient(circle at 30% 30%, #c9f5dc, transparent 70%); top: -80px; left: -90px; }
.bg-blobs span:nth-child(2) { width: 280px; height: 280px; background: radial-gradient(circle at 30% 30%, #ffe2a8, transparent 70%); top: 30%; right: -100px; animation-delay: -6s; }
.bg-blobs span:nth-child(3) { width: 320px; height: 320px; background: radial-gradient(circle at 30% 30%, #ffd3de, transparent 70%); bottom: -120px; left: 20%; animation-delay: -11s; }
.bg-blobs span:nth-child(4) { width: 220px; height: 220px; background: radial-gradient(circle at 30% 30%, var(--kid-s), transparent 70%); top: 55%; left: -60px; animation-delay: -3s; }
@keyframes float { 50% { transform: translate(30px, -24px) scale(1.06); } }

#app { max-width: 980px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }

/* animations */
.pop-in { animation: popIn .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.bob { animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
@media (prefers-reduced-motion: reduce) { .pop-in, .bob, .bg-blobs span { animation: none; } }

/* buttons */
.btn {
  --b: #fff; --bd: var(--line); --t: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 20px; border-radius: 16px;
  background: var(--b); color: var(--t); font-weight: 800; letter-spacing: .3px;
  border: 2px solid var(--bd); border-bottom-width: 5px;
  transition: transform .08s, filter .15s, border-bottom-width .08s; user-select: none; text-align: center;
}
.btn:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 2px; }
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { --b: var(--green); --bd: var(--green-d); --t: #fff; }
body:not([data-theme="home"]) .btn-primary { --b: var(--green); --bd: var(--green-d); }
.btn-secondary { --b: var(--kid-s); --bd: color-mix(in srgb, var(--kid) 45%, white); --t: var(--kid-d); }
.btn-ghost { --b: #fff; --bd: var(--line); --t: var(--ink-2); }
.btn-ghost.danger { --t: var(--red-d); }
.btn-big { min-height: 58px; font-size: 19px; padding: 12px 26px; border-radius: 18px; }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: 15px; border-radius: 13px; border-bottom-width: 4px; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center; font-size: 20px; background: #fff; border: 2px solid var(--line); border-bottom-width: 4px; color: var(--ink-2); }
.icon-btn:active { transform: translateY(2px); border-bottom-width: 2px; }

/* home */
.home { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 28px 0 24px; }
.home-head { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 30px; }
.home-head .tota { width: 112px; height: 120px; flex: none; }
.logo { font-size: clamp(44px, 9vw, 72px); line-height: 1; color: var(--ink); font-weight: 700; }
.logo span { color: var(--green); }
.tag { margin: 6px 0 0; font-size: 20px; color: var(--ink-2); }
.kid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.kid-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px 22px;
  border-radius: 30px; background: linear-gradient(160deg, color-mix(in srgb, var(--kid) 82%, white), var(--kid));
  color: #fff; border-bottom: 8px solid var(--kid-d); box-shadow: var(--shadow); overflow: hidden;
  transition: transform .15s;
}
.kid-card::before { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .14); top: -90px; right: -70px; }
.kid-card::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .1); bottom: -40px; left: -30px; }
.kid-card:hover { transform: translateY(-4px) rotate(-.5deg); }
.kid-card:active { transform: translateY(3px); border-bottom-width: 4px; }
.kid-avatar { font-size: 76px; line-height: 1; width: 120px; height: 120px; display: grid; place-items: center; background: rgba(255, 255, 255, .25); border-radius: 50%; border: 4px solid rgba(255, 255, 255, .55); z-index: 1; }
.kid-name { font-family: var(--display); font-size: 40px; font-weight: 700; z-index: 1; text-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.kid-stats { display: flex; gap: 8px; z-index: 1; flex-wrap: wrap; justify-content: center; }
.kid-stats span { background: rgba(255, 255, 255, .22); padding: 4px 12px; border-radius: 99px; font-size: 16px; }
.kid-go { margin-top: 6px; background: #fff; color: var(--kid-d); padding: 10px 22px; border-radius: 99px; font-weight: 900; z-index: 1; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); }
.home-foot { text-align: center; color: var(--muted); margin-top: 28px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 0 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.topbar-title { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 20px; font-family: var(--display); }
.topbar-title b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--kid-s); border: 3px solid var(--kid); font-size: 24px; display: grid; place-items: center; flex: none; }
.topbar-stats { display: flex; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 99px; background: #fff; border: 2px solid var(--line); font-weight: 900; font-size: 15px; white-space: nowrap; }
.chip-fire { color: #f2690d; }
.chip-fire.hot { background: #fff1e3; border-color: #ffc89a; animation: pulse 1s ease-in-out infinite; }
.chip-star { color: var(--gold-d); }
@keyframes pulse { 50% { transform: scale(1.08); } }

.page { padding-top: 8px; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-title { font-size: 30px; margin: 4px 0 0; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card { background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); border: 2px solid #f3ece0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h3 { font-size: 20px; }

/* kid page */
.hero { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #fff, var(--kid-s)); }
.hero-tota { width: 104px; height: 112px; flex: none; }
.bubble { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 14px 16px; flex: 1; }
.bubble::before { content: ''; position: absolute; left: -11px; top: 30px; width: 18px; height: 18px; background: #fff; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.bubble p { margin: 0; color: var(--ink-2); }
.bubble .bubble-big { font-family: var(--display); font-size: 23px; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cta-row .btn { flex: 1 1 220px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 18px; border-radius: var(--r); background: #fff; border: 2px solid var(--line); border-bottom-width: 6px; transition: transform .1s; }
.tile:active { transform: translateY(3px); border-bottom-width: 3px; }
.tile:hover { border-color: color-mix(in srgb, var(--kid) 40%, white); }
.tile-ico { font-size: 34px; margin-bottom: 4px; }
.tile b { font-size: 18px; font-family: var(--display); font-weight: 600; }
.switch-kid { align-self: center; padding: 10px 18px; border-radius: 99px; background: #fff; border: 2px dashed var(--line); color: var(--ink-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 14px; background: var(--kid-s); border: 2px solid color-mix(in srgb, var(--kid) 22%, white); }
.wchip .e { font-size: 20px; }
.wchip b { font-weight: 900; }
.wchip small { color: var(--ink-2); font-weight: 700; }
.wchip.more { color: var(--ink-2); padding: 6px 12px; }
.stars { display: inline-flex; gap: 0; font-style: normal; font-size: 13px; }
.stars i { color: #dcd6cb; font-style: normal; }
.stars i.on { color: var(--gold); text-shadow: 0 1px 0 var(--gold-d); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.day .dot { display: grid; place-items: center; width: 38px; height: 38px; margin: 0 auto 4px; border-radius: 50%; background: #f4efe6; border: 2px solid var(--line); font-size: 18px; }
.day.on .dot { background: #fff4d1; border-color: var(--gold); }
.day.today .dot { outline: 3px solid var(--kid); outline-offset: 2px; }
.day small { color: var(--muted); }

/* setup */
.step { display: flex; align-items: center; gap: 10px; font-size: 20px; margin-bottom: 14px; }
.step span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--kid); color: #fff; font-size: 16px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 1px; padding: 14px; border-radius: 18px; background: #fff; border: 2px solid var(--line); border-bottom-width: 5px; min-height: 104px; transition: transform .08s; }
.choice:active:not(:disabled) { transform: translateY(2px); }
.choice-ico { font-size: 28px; margin-bottom: 4px; }
.choice b { font-size: 17px; }
.choice small { font-size: 13.5px; }
.choice.on { background: var(--kid-s); border-color: var(--kid); color: var(--kid-d); }
.choice:disabled { opacity: .5; }
.lesson-picks { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick .box { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.pick.on { border-color: var(--kid); background: var(--kid-s); }
.pick.on .box { background: var(--kid); border-color: var(--kid-d); color: #fff; }
.pick-t { display: flex; flex-direction: column; }
.count-row { display: flex; flex-wrap: wrap; gap: 10px; }
.count { min-width: 64px; height: 56px; padding: 0 16px; border-radius: 16px; background: #fff; border: 2px solid var(--line); border-bottom-width: 5px; font-size: 20px; font-weight: 900; font-family: var(--display); }
.count.on { background: var(--kid); color: #fff; border-color: var(--kid-d); }
.count-custom { display: inline-flex; align-items: center; padding: 0 8px; }
.count-custom input { width: 84px; border: 0; background: transparent; font-size: 18px; text-align: center; outline: none; font-weight: 900; }
.count-custom.on input { color: #fff; }
.count-custom.on input::placeholder { color: rgba(255, 255, 255, .7); }
.toggle { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 4px; border-bottom: 2px solid #f4eee4; }
.toggle:last-child { border-bottom: 0; }
.toggle:disabled { opacity: .45; }
.toggle-ico { font-size: 28px; width: 40px; text-align: center; }
.toggle-t { flex: 1; display: flex; flex-direction: column; }
.toggle-t small { font-size: 14px; }
.switch { width: 56px; height: 34px; border-radius: 99px; background: #e6dfd3; position: relative; flex: none; transition: background .2s; }
.switch i { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s cubic-bezier(.3, 1.5, .5, 1); }
.toggle.on .switch { background: var(--green); }
.toggle.on .switch i { transform: translateX(22px); }
.sticky-cta { position: sticky; bottom: 0; padding: 12px 0 calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); display: flex; flex-direction: column; gap: 8px; z-index: 5; }

/* quiz */
body.in-quiz .bg-blobs { opacity: .5; }
.quiz { display: flex; flex-direction: column; min-height: 100dvh; max-width: 720px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 0 8px; }
.bar { flex: 1; height: 18px; border-radius: 99px; background: #ece5d8; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(180deg, #5fe39b, var(--green)); border-radius: 99px; transition: width .5s cubic-bezier(.3, 1.4, .5, 1); position: relative; min-width: 18px; }
.bar span::after { content: ''; position: absolute; left: 10px; right: 10px; top: 4px; height: 4px; border-radius: 9px; background: rgba(255, 255, 255, .45); }
.bar.wide { width: 100%; flex: none; margin: 14px 0 8px; }
.quiz-body { flex: 1; padding: 18px 0 200px; display: flex; flex-direction: column; gap: 18px; }
.q-label { margin: 0; font-family: var(--display); font-size: 25px; font-weight: 600; }
.q-prompt { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.q-emoji { font-size: 66px; line-height: 1; width: 104px; height: 104px; display: grid; place-items: center; background: #fff; border-radius: 26px; border: 2px solid var(--line); box-shadow: var(--shadow); }
.q-big { font-family: var(--display); font-size: clamp(28px, 7vw, 40px); font-weight: 600; color: var(--kid-d); }
.q-sub { width: 100%; color: var(--ink-2); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt-grid.one-col { grid-template-columns: 1fr; }
.opt {
  position: relative; min-height: 70px; padding: 14px 16px; border-radius: 18px; background: #fff;
  border: 2px solid var(--line); border-bottom-width: 5px; font-size: 21px; font-weight: 800; transition: transform .08s, background .15s;
}
.opt:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 3px; }
.opt.sel { background: var(--kid-s); border-color: var(--kid); color: var(--kid-d); }
.opt.good { background: var(--green-s); border-color: var(--green); color: var(--green-d); animation: jump .4s; }
.opt.bad { background: var(--red-s); border-color: var(--red); color: var(--red-d); animation: shake .4s; }
.opt.gone { opacity: .2; transform: scale(.94); }
@keyframes jump { 40% { transform: translateY(-6px) scale(1.03); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.pic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pic { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 150px; }
.pic-e { font-size: 64px; line-height: 1; }
.pic-l { font-size: 16px; color: var(--ink-2); visibility: hidden; }
.pic.reveal .pic-l { visibility: visible; }

.learn { position: relative; text-align: center; background: #fff; border-radius: 30px; padding: 34px 20px 26px; border: 3px solid var(--kid); border-bottom-width: 8px; box-shadow: var(--shadow); }
.badge-new { position: absolute; top: -16px; left: 50%; transform: translateX(-50%) rotate(-3deg); background: var(--gold); color: #6b4a00; padding: 6px 16px; border-radius: 99px; font-weight: 900; border-bottom: 3px solid var(--gold-d); white-space: nowrap; }
.learn-emoji { font-size: 92px; line-height: 1.1; }
.learn-ur { font-family: var(--display); font-size: clamp(40px, 11vw, 60px); font-weight: 700; color: var(--kid-d); margin-top: 8px; }
.learn-en { font-size: 24px; color: var(--ink-2); }
.learn-type { display: inline-block; margin-top: 8px; background: var(--kid-s); padding: 2px 10px; border-radius: 99px; }
.learn-tota { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--ink-2); }
.learn-tota p { margin: 0; }
.tota.small { width: 64px; height: 70px; }
.tota.big { width: 150px; height: 162px; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match .opt { min-height: 60px; font-size: 18px; padding: 10px; }
.match .opt.done { background: var(--green-s); border-color: var(--green); color: var(--green-d); opacity: .55; pointer-events: none; }
.flash-good { animation: jump .4s; }
.flash-bad { background: var(--red-s) !important; border-color: var(--red) !important; animation: shake .4s; }

.build { display: flex; flex-direction: column; gap: 22px; }
.build-line { min-height: 74px; padding: 10px 0; border-bottom: 3px solid var(--line); border-top: 3px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; transition: border-color .2s; }
.build-line.good { border-color: var(--green); }
.build-line.bad { border-color: var(--red); animation: shake .4s; }
.build-ph { color: var(--muted); }
.build-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile-w { padding: 12px 18px; border-radius: 15px; background: #fff; border: 2px solid var(--line); border-bottom-width: 5px; font-size: 20px; font-weight: 800; transition: transform .08s; }
.tile-w:active { transform: translateY(2px); }
.tile-w.used { background: #eee8dd; color: transparent; border-color: #eee8dd; box-shadow: none; pointer-events: none; }
.tile-w.in { animation: popIn .25s both; }

.type-wrap { display: flex; }
.type-in { width: 100%; font-size: 24px; font-weight: 800; padding: 18px 20px; border-radius: 18px; border: 3px solid var(--line); background: #fff; outline: none; transition: border-color .15s; }
.type-in:focus { border-color: var(--kid); }
.type-in.good { border-color: var(--green); background: var(--green-s); }
.type-in.bad { border-color: var(--red); background: var(--red-s); animation: shake .4s; }

.quiz-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: #fff; border-top: 2px solid var(--line); transition: background .2s; }
.quiz-foot > * { max-width: 720px; margin: 0 auto; }
.foot-btns { display: flex; gap: 10px; }
.foot-btns #check { flex: 1; }
.feedback:empty { display: none; }
.feedback { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; font-size: 17px; animation: popIn .3s both; position: relative; }
.fb-title { font-family: var(--display); font-size: 26px; font-weight: 700; }
.fb-ans { font-size: 20px; }
.fb-tip { font-size: 15px; opacity: .9; }
.fb-xp { position: absolute; right: 0; top: 2px; font-weight: 900; font-size: 18px; color: var(--gold-d); background: #fff; padding: 4px 12px; border-radius: 99px; }
.quiz-foot.is-good { background: var(--green-s); border-color: #bcebd0; color: var(--green-d); }
.quiz-foot.is-bad { background: var(--red-s); border-color: #ffc4cb; color: var(--red-d); }
.quiz-foot.is-bad #check { --b: var(--red); --bd: var(--red-d); }

/* results */
.results { text-align: center; padding-top: calc(28px + env(safe-area-inset-top)); }
.results-hero h2 { font-size: 34px; margin-top: 6px; }
.results-hero p { color: var(--ink-2); margin: 6px 0 0; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { position: relative; border-radius: 18px; padding: 30px 6px 12px; border: 3px solid; background: #fff; }
.stat small { position: absolute; top: 0; left: 0; right: 0; padding: 4px; color: #fff; font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.stat b { display: block; font-family: var(--display); font-size: 26px; }
.stat span { font-size: 18px; }
.s-xp { border-color: var(--gold); } .s-xp small { background: var(--gold); color: #6b4a00; }
.s-acc { border-color: var(--green); } .s-acc small { background: var(--green); }
.s-fire { border-color: #ff8a3d; } .s-fire small { background: #ff8a3d; }
.s-time { border-color: #4cc2ff; } .s-time small { background: #4cc2ff; }
.results .card { text-align: left; }

/* upload / review */
.for-kid { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seg { display: flex; gap: 8px; }
.seg-b { padding: 10px 16px; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 4px; font-weight: 900; background: #fff; color: var(--ink-2); }
.seg-b.on { background: var(--kid); color: #fff; border-color: var(--kid-d); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 30px 20px; border-radius: 28px; border: 3px dashed color-mix(in srgb, var(--kid) 50%, white); background: color-mix(in srgb, var(--kid-s) 60%, white); cursor: pointer; transition: transform .15s, background .15s; }
.drop:hover, .drop.over { transform: scale(1.01); background: var(--kid-s); }
.drop b { font-size: 21px; font-family: var(--display); font-weight: 600; }
.drop .btn { margin-top: 10px; pointer-events: none; }
.drop .tota { width: 80px; height: 86px; }
.or { text-align: center; color: var(--muted); }
.hint-text { color: var(--ink-2); font-size: 15px; text-align: center; margin: 0; }
.reading { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 20px; }
.reading h3 { font-size: 24px; }
.reading p { margin: 6px 0; }
.reading-tota { animation: bob 1s ease-in-out infinite; }
.note { margin: 0; padding: 12px 16px; border-radius: 16px; background: #fff7dc; border: 2px solid #ffe49a; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--ink-2); font-size: 15px; }
.field input, .wrow input, .wrow select { border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 17px; font-weight: 800; outline: none; min-width: 0; }
.field input:focus, .wrow input:focus, .wrow select:focus { border-color: var(--kid); }
.wlist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.wrow { display: grid; grid-template-columns: 54px 1fr auto 36px; gap: 8px; align-items: center; padding: 8px; border-radius: 16px; background: #fbf8f3; border: 2px solid #f1eadf; }
.wrow .w-emoji { text-align: center; font-size: 24px; padding: 8px 2px; }
.w-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.w-ur { color: var(--kid-d); }
.w-side { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.w-side select { padding: 6px 8px; font-size: 14px; }
.w-del { width: 36px; height: 36px; border-radius: 10px; color: var(--muted); font-size: 18px; }
.w-del:hover { background: var(--red-s); color: var(--red-d); }
.tag-new, .tag-known { font-size: 11px; font-weight: 900; text-align: center; padding: 2px 6px; border-radius: 7px; letter-spacing: .5px; }
.tag-new { background: var(--gold); color: #6b4a00; }
.tag-known { background: #eee8dd; color: var(--ink-2); }

/* words */
.lesson-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.deleted summary { cursor: pointer; font-weight: 900; color: var(--ink-2); }
.del-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 2px solid #f4eee4; margin-top: 10px; }
.empty { display: flex; align-items: center; gap: 12px; }

/* modal + toast */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(35, 38, 58, .4); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); }
.modal-card { background: #fff; border-radius: 26px; padding: 22px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatar-grid button { font-size: 30px; aspect-ratio: 1; border-radius: 14px; background: #f8f4ec; border: 2px solid transparent; }
.avatar-grid button.on { border-color: var(--kid); background: var(--kid-s); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 14px; background: var(--ink); color: #fff; padding: 12px 14px 12px 20px; border-radius: 18px; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .45); max-width: calc(100% - 32px); width: max-content; }
.toast[hidden] { display: none; }
.toast.show { animation: toastIn .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes toastIn { from { transform: translate(-50%, 30px); opacity: 0; } }
.toast-btn { background: var(--gold); color: #5a3d00; font-weight: 900; padding: 8px 14px; border-radius: 12px; white-space: nowrap; }
body.in-quiz .toast { bottom: 170px; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; display: none; }

/* phones */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .home-head { flex-direction: column; text-align: center; gap: 6px; margin-bottom: 22px; }
  .home-head .tota { width: 92px; height: 100px; }
  .kid-cards { gap: 14px; }
  .kid-card { padding: 20px 16px 18px; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .kid-avatar { width: 84px; height: 84px; font-size: 52px; }
  .kid-name { font-size: 34px; width: calc(100% - 100px); text-align: left; padding-left: 8px; }
  .kid-card .kid-name { width: auto; }
  .kid-stats span { font-size: 14px; }
  .topbar-stats .chip { padding: 5px 8px; font-size: 14px; }
  .hero { gap: 6px; padding: 14px 12px; }
  .hero-tota { width: 70px; height: 76px; }
  .bubble { padding: 10px 12px; }
  .bubble .bubble-big { font-size: 19px; }
  .bubble p { font-size: 15px; }
  .tiles { gap: 10px; }
  .tile { padding: 14px; }
  .q-emoji { width: 84px; height: 84px; font-size: 52px; border-radius: 22px; }
  .opt { font-size: 19px; min-height: 64px; padding: 12px; }
  .pic { min-height: 124px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .wrow { grid-template-columns: 46px 1fr 36px; }
  .w-side { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .w-del { grid-row: 1; grid-column: 3; }
  .quiz-body { padding-bottom: 210px; }
  .page-title { font-size: 26px; }
}
@media (max-width: 340px) {
  .choice-grid, .tiles { grid-template-columns: 1fr; }
  .choice { min-height: 0; }
}
@media (min-width: 900px) {
  .q-label { font-size: 28px; }
}
.w-side select { padding: 5px 6px; font-size: 13px; }
.sticky-cta #cancel { min-height: 38px; border: 0; background: transparent; color: var(--ink-2); }

/* ---- auto-save + resume */
.quiz-meta { display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: 14px; margin-top: -2px; }
.save-dot { font-size: 13px; padding: 2px 10px; border-radius: 99px; background: var(--green-s); color: var(--green-d); transition: all .2s; }
.save-dot.offline { background: #fff3d6; color: #a46a00; }
.resume { display: flex; align-items: center; gap: 12px; border-color: var(--gold); background: linear-gradient(135deg, #fff, #fff7dc); }
.resume-ico { font-size: 34px; }
.resume-t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resume-t b { font-family: var(--display); font-weight: 600; font-size: 19px; }
.mini-bar { height: 10px; border-radius: 99px; background: #efe7d6; overflow: hidden; margin-top: 4px; }
.mini-bar span { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.link { color: var(--kid-d); font-weight: 800; font-size: 15px; }
a.chip:active { transform: scale(.96); }

/* ---- progress page */
.progress .stat span { font-size: 13px; color: var(--ink-2); font-weight: 800; }
.seg-bar { display: flex; height: 26px; border-radius: 99px; overflow: hidden; background: #f1ebe0; gap: 3px; }
.seg-bar span { display: block; height: 100%; transition: width .6s; }
.st-m { background: var(--gold); } .st-l { background: var(--green); } .st-t { background: var(--red); } .st-n { background: #d9d2c5; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 15px; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }
.legend b { color: var(--ink); }
.small-note { font-size: 13.5px; margin: 10px 0 0; }
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; height: 170px; align-items: end; }
.chart .col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; text-align: center; }
.chart .b { width: 100%; max-width: 30px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, color-mix(in srgb, var(--kid) 70%, white), var(--kid)); }
.chart .v { font-size: 11px; color: var(--ink-2); font-weight: 900; }
.chart small { font-size: 10.5px; line-height: 1.15; color: var(--muted); }
.chart .today small { color: var(--kid-d); font-weight: 900; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 14px 8px; border-radius: 18px; background: #f6f2ea; border: 2px dashed #e4dccd; color: var(--muted); }
.badge span { font-size: 34px; filter: grayscale(1); opacity: .6; }
.badge b { font-size: 14.5px; }
.badge small { font-size: 12px; color: var(--muted); }
.badge.ok { background: linear-gradient(160deg, #fffaf0, #fff1c9); border: 2px solid var(--gold); color: var(--ink); box-shadow: 0 3px 0 var(--gold-d); }
.badge.ok span { filter: none; opacity: 1; animation: popIn .5s both; }
.badge.ok small { color: var(--ink-2); }
.lesson-prog { display: grid; grid-template-columns: 1fr 120px 44px; gap: 12px; align-items: center; padding: 10px 4px; border-top: 2px solid #f4eee4; }
.lesson-prog:first-of-type { border-top: 0; }
.lp-t { display: flex; flex-direction: column; min-width: 0; }
.lp-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-bar { height: 14px; border-radius: 99px; background: #efe7d9; overflow: hidden; }
.lp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 99px; }
.lp-pct { font-weight: 900; text-align: right; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.filter { white-space: nowrap; padding: 8px 14px; border-radius: 99px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 14.5px; }
.filter.on { background: var(--kid); border-color: var(--kid-d); color: #fff; }
.word-table { display: flex; flex-direction: column; margin-top: 6px; }
.wt-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 9px 2px; border-top: 2px solid #f6f0e6; }
.wt-row .e { font-size: 24px; text-align: center; }
.wt-w, .wt-s { display: flex; flex-direction: column; min-width: 0; }
.wt-w b { color: var(--kid-d); }
.wt-s { align-items: flex-end; }
.wt-s small { font-size: 12.5px; }
.hist-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; padding: 10px 2px; border-top: 2px solid #f6f0e6; }
.hist-row:first-child { border-top: 0; }
.hist-d, .hist-l, .hist-r { display: flex; flex-direction: column; }
.hist-d small, .hist-l small, .hist-r small { font-size: 12.5px; }
.hist-r { align-items: flex-end; font-weight: 900; font-size: 18px; }
@media (max-width: 560px) {
  .tiles.three { grid-template-columns: 1fr 1fr; }
  .tiles.three .tile:first-child { grid-column: span 2; }
  .resume { flex-wrap: wrap; }
  .resume .btn { flex: 1; }
  .chart { height: 140px; gap: 3px; }
  .chart .v { font-size: 9.5px; }
  .lesson-prog { grid-template-columns: 1fr 70px 40px; gap: 8px; }
  .hist-row { grid-template-columns: 72px 1fr auto; }
}
.resume { display: grid; grid-template-columns: auto 1fr auto; gap: 10px 12px; }
.resume #dropResume { grid-row: 1; grid-column: 3; }
.resume #resume { grid-row: 2; grid-column: 1 / -1; }
@media (max-width: 560px) { .resume { display: grid; } }

/* ---- practice vs test mode */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 16px 12px; border-radius: 22px; background: #fff; border: 3px solid var(--line); border-bottom-width: 6px; transition: transform .08s; }
.mode span { font-size: 36px; }
.mode b { font-family: var(--display); font-weight: 600; font-size: 22px; }
.mode small { font-size: 13.5px; }
.mode:active { transform: translateY(2px); }
.mode.on { border-color: var(--green); background: var(--green-s); }
.mode.mode-test.on { border-color: #7c5cff; background: #efeaff; }
.mode.mode-test.on b { color: #5b3fd6; }
.mode.on:not(.mode-test) b { color: var(--green-d); }
.btn-test { --b: #7c5cff; --bd: #5b3fd6; --t: #fff; }
.test-note { margin: 10px 0 0; padding: 10px 14px; border-radius: 14px; background: #efeaff; color: #4a32b8; font-size: 15px; }
.test-pill { background: #efeaff; color: #5b3fd6; padding: 2px 9px; border-radius: 99px; font-size: 13px; }
.score-ring { --p: 0; width: 150px; height: 150px; border-radius: 50%; margin: 6px auto 4px; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--bg) 78%, transparent 79%), conic-gradient(#7c5cff calc(var(--p) * 1%), #e9e3f9 0); animation: popIn .6s both; }
.score-ring b { font-family: var(--display); font-size: 44px; font-weight: 700; color: #5b3fd6; }
.score-ring small { font-size: 22px; color: var(--ink-2); }
.test-row { display: grid; grid-template-columns: 1fr 110px 64px; gap: 12px; align-items: center; padding: 10px 2px; border-top: 2px solid #f6f0e6; }
.test-row:first-child { border-top: 0; }
.test-score { display: flex; flex-direction: column; align-items: flex-end; font-weight: 900; font-size: 18px; }
.test-score small { font-size: 12.5px; }
.lp-bar.good span { background: var(--green); } .lp-bar.ok span { background: var(--gold); } .lp-bar.low span { background: var(--red); }
@media (max-width: 560px) { .mode b { font-size: 19px; } .mode span { font-size: 30px; } .test-row { grid-template-columns: 1fr 70px 56px; gap: 8px; } }
