/* PIMSO Reviewer · Golden International School
   Layout: phone-first single column; cards widen to two columns on tablets and up.
   One deliberate light theme: a bright classroom look for young learners. */
:root {
  --paper: #F2F5FF;
  --paper-2: #E4EAFB;
  --card: #FFFFFF;
  --ink: #1F2546;
  --ink-2: #545C80;
  --ink-3: #8B92B5;
  --line: #DCE2F7;
  --sky: #5B7CFA;
  --sky-deep: #3D5BD9;

  --math: #FF8A1F;
  --math-deep: #D9640A;
  --math-soft: #FFE6CC;
  --math-tint: #FFF6EC;
  --sci: #1FB070;
  --sci-deep: #0E8752;
  --sci-soft: #D2F3E3;
  --sci-tint: #EEFAF4;
  --board: #1F563C;

  --right: #16A34A;
  --right-deep: #0F7A36;
  --right-soft: #DCFCE7;
  --wrong: #E5484D;
  --wrong-soft: #FFE4E4;
  --gold: #FFC21A;

  --accent: var(--sky);
  --accent-deep: var(--sky-deep);
  --accent-soft: #E3E9FF;
  --accent-tint: #F5F7FF;

  --r-xl: 30px;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;
  --lift: 0 1px 0 rgba(31, 37, 70, .05), 0 14px 30px -18px rgba(61, 78, 160, .35);
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));

  --f-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --f-body: "Nunito", system-ui, sans-serif;
  --f-lao: "Noto Sans Lao Looped", "Noto Sans Lao", "Phetsarath OT", sans-serif;
  color-scheme: light;
}
[data-subject="math"] { --accent: var(--math); --accent-deep: var(--math-deep); --accent-soft: var(--math-soft); --accent-tint: var(--math-tint); }
[data-subject="science"] { --accent: var(--sci); --accent-deep: var(--sci-deep); --accent-soft: var(--sci-soft); --accent-tint: var(--sci-tint); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 600 17px/1.55 var(--f-body); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 12px; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { text-wrap: balance; }
[hidden] { display: none !important; }

/* language: .ex = English-only text, .lo = Lao text */
.lo, .lao-label { font-family: var(--f-lao); font-weight: 500; line-height: 1.75; }
[data-lang="en"] .lo { display: none !important; }
[data-lang="lo"] .ex, [data-lang="lo"] .bi .en { display: none !important; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding-block: 0 56px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }

/* page transitions */
.view { animation: viewUp .35s cubic-bezier(.2, .8, .3, 1) both; }
.view.enter-fwd { animation-name: viewFwd; }
.view.enter-back { animation-name: viewBack; }
.view.enter-none { animation: none; }
@keyframes viewUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes viewFwd { from { opacity: 0; transform: translateX(48px); } }
@keyframes viewBack { from { opacity: 0; transform: translateX(-48px); } }

/* ---------- shared controls ---------- */
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--card); color: var(--ink);
  display: grid; place-items: center; box-shadow: var(--lift); flex: none; transition: transform .12s ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn[data-sound][aria-pressed="false"] { color: var(--ink-3); }

.lang { display: inline-flex; background: var(--card); border-radius: 999px; padding: 4px; box-shadow: var(--lift); }
.lang button { border: 0; background: none; padding: 6px 11px; border-radius: 999px; font-weight: 800; font-size: 14px; color: var(--ink-2); white-space: nowrap; transition: background .15s ease, color .15s ease; }
.lang button .lao-label { font-size: 14px; line-height: 1.3; font-weight: 600; }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.btn {
  border: 0; border-radius: 18px; padding: 13px 20px; font: 600 18px/1.2 var(--f-display);
  background: var(--accent); color: #fff; box-shadow: 0 5px 0 var(--accent-deep);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px;
  transition: transform .1s ease, box-shadow .1s ease, background .2s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--accent-deep); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn .lo { font-size: 15px; font-weight: 600; opacity: .9; }
[data-lang="both"] .btn .ex + .lo::before { content: "· "; opacity: .6; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--line); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--line); }
.btn.square { width: 54px; padding: 0; flex: none; }
.btn.grow { flex: 1; }

.speak {
  border: 0; background: rgba(255, 255, 255, .25); color: inherit; border-radius: 99px; padding: 6px 12px 6px 8px;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; flex: none;
}
.speak span { font-family: inherit; }
.speak svg { width: 20px; height: 20px; }
.speak.on { background: #fff; color: var(--accent-deep); }

/* ---------- home ---------- */
.bar { display: flex; align-items: center; gap: 10px; padding: 14px 0 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-right: auto; min-width: 0; }
.brand img { width: 40px; height: auto; }
.brand b { font: 600 19px/1.1 var(--f-display); display: block; }
.brand small { font-size: 13px; color: var(--ink-2); font-weight: 700; display: block; }
.bar-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; padding: 22px 0 8px; }
.hero-text { flex: 1 1 320px; min-width: 0; }
.hero h1 { font: 600 clamp(32px, 7vw, 48px)/1.05 var(--f-display); margin: 0; letter-spacing: -.01em; }
.hero-lo { margin: 4px 0 0; font-size: clamp(17px, 3.6vw, 20px); color: var(--ink-2); }
[data-lang="lo"] .hero-lo { font: 700 clamp(26px, 6vw, 38px)/1.45 var(--f-lao); color: var(--ink); margin: 0; }
.hero-sub { margin: 10px 0 0; color: var(--ink-2); max-width: 46ch; }
.hero-sub-lo { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; max-width: 54ch; }

.countdown { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--r-lg); padding: 10px 16px 10px 10px; box-shadow: var(--lift); }
.cd-num { min-width: 58px; height: 58px; padding: 0 8px; border-radius: 16px; background: var(--ink); color: #fff; display: grid; place-items: center; font: 600 30px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.cd-txt b { display: block; font: 600 17px/1.2 var(--f-display); }
.cd-txt .lo { display: block; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.cd-txt small { display: block; color: var(--ink-3); font-size: 13px; font-weight: 700; }

.label { font: 600 16px/1.2 var(--f-display); color: var(--ink-2); margin: 22px 0 0; display: flex; gap: 8px; }
.label .lo { font-size: 15px; font-weight: 600; }
[data-lang="both"] .label .lo::before { content: "· "; }

.levels { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 16px; margin: 0 -2px; scrollbar-width: none; scroll-snap-type: x proximity; }
.levels::-webkit-scrollbar { display: none; }
.lvl {
  position: relative; flex: none; border: 0; background: var(--card); border-radius: 16px; scroll-snap-align: center;
  padding: 9px 14px 7px; text-align: center; box-shadow: var(--lift); min-width: 78px; transition: transform .15s ease, background .15s ease;
}
.lvl b { display: block; font: 600 17px/1.2 var(--f-display); }
.lvl .lo { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.lvl[aria-pressed="true"] { background: var(--ink); color: #fff; transform: translateY(-2px); }
.lvl[aria-pressed="true"] .lo { color: #C9CEEA; }
.lvl.soon { color: var(--ink-3); }
.soon-dot { position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }

.subjects { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 700px) { .subjects { grid-template-columns: 1fr 1fr; } }

.subject {
  position: relative; overflow: hidden; border: 0; text-align: left; border-radius: var(--r-xl); color: #fff;
  min-height: 228px; padding: 0; display: flex; isolation: isolate;
  transition: transform .18s cubic-bezier(.2, .8, .3, 1.3), box-shadow .18s ease;
}
.subject.math { background: linear-gradient(140deg, #FFB347 0%, #FF8A1F 55%, #F2700E 100%); box-shadow: 0 7px 0 var(--math-deep), 0 26px 40px -24px var(--math-deep); }
.subject.science { background: var(--board); box-shadow: 0 7px 0 #123827, 0 26px 40px -24px #123827; }
.subject:hover:not(:disabled) { transform: translateY(-3px); }
.subject:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 var(--math-deep); }
.subject.science:active:not(:disabled) { box-shadow: 0 2px 0 #123827; }
.subject .art { position: absolute; z-index: -1; pointer-events: none; }
.subject.math .art { width: 46%; max-width: 210px; height: auto; right: -4%; top: 50%; transform: translateY(-50%) rotate(-8deg); filter: drop-shadow(0 18px 18px rgba(140, 50, 0, .35)); animation: bob 4.5s ease-in-out infinite; }
.subject .art.board { inset: 0 0 0 auto; width: 56%; background: url(img/science-card.jpg) center / cover no-repeat; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 55%); mask-image: linear-gradient(90deg, transparent 0, #000 55%); }
@keyframes bob { 50% { transform: translateY(calc(-50% - 8px)) rotate(-5deg); } }
.sub-text { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 22px; width: 64%; }
.sub-title { font: 600 38px/1 var(--f-display); text-shadow: 0 2px 0 rgba(0, 0, 0, .08); }
.sub-lo { font-size: 18px; opacity: .95; }
[data-lang="lo"] .sub-lo { font-size: 24px; font-weight: 700; opacity: 1; }
.sub-meta { margin-top: auto; padding-top: 18px; font-size: 15px; font-weight: 800; }
.sub-meta .lo { display: block; font-size: 14px; font-weight: 600; }
[data-lang="both"] .sub-meta .lo { opacity: .85; }
.meter { display: block; height: 9px; border-radius: 99px; background: rgba(255, 255, 255, .3); margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.cta { margin-top: 14px; align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; background: #fff; color: var(--ink); border-radius: 99px; padding: 7px 10px 7px 16px; font: 600 16px var(--f-display); }
.subject.math .cta { color: var(--math-deep); }
.subject.science .cta { color: var(--sci-deep); }
.cta svg { width: 18px; height: 18px; }
.subject.locked { filter: saturate(.35); opacity: .75; }
.subject.locked .art { animation: none; }

.note { margin-top: 22px; color: var(--ink-2); font-size: 15px; max-width: 64ch; }
.note .lo { display: block; font-size: 14px; }

/* ---------- sets ---------- */
.head { display: flex; align-items: center; gap: 14px; padding: 16px 0 8px; }
.head > div:not(.bar-tools) { min-width: 0; }
.head h1 { font: 600 clamp(24px, 5vw, 30px)/1.1 var(--f-display); margin: 0; }
.head-lo { display: block; font-size: 15px; color: var(--ink-2); }
[data-lang="lo"] .head-lo { font-size: 24px; font-weight: 700; color: var(--ink); }

.banner { position: relative; overflow: hidden; height: clamp(120px, 18vw, 170px); border-radius: var(--r-lg); margin-top: 8px; }
.banner.math { background: linear-gradient(120deg, #FFB347, #FF8A1F 60%, #F2700E); }
.banner.math img { position: absolute; right: 6%; top: 50%; height: 150%; width: auto; transform: translateY(-50%) rotate(-10deg); filter: drop-shadow(0 12px 14px rgba(140, 50, 0, .35)); }
.banner.science { background: var(--board) url(img/science-banner.jpg) center / cover no-repeat; }
.banner .sym { position: absolute; font: 600 34px/1 var(--f-display); color: rgba(255, 255, 255, .45); }
.banner-text { position: absolute; left: 16px; bottom: 12px; background: rgba(255, 255, 255, .92); color: var(--ink); border-radius: 99px; padding: 4px 12px; font: 600 14px var(--f-display); }

.sets { display: grid; gap: 14px; margin-top: 16px; }
@media (min-width: 760px) { .sets { grid-template-columns: 1fr 1fr; } }
.set {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 14px; text-align: left;
  background: var(--card); border: 0; border-radius: var(--r-lg); padding: 16px; box-shadow: var(--lift); transition: transform .15s ease;
}
.set:hover { transform: translateY(-2px); }
.set:active { transform: scale(.98); }
.badge { width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent-deep); }
.badge svg { width: 30px; height: 30px; }
.set-text { min-width: 0; display: flex; flex-direction: column; }
.set h3 { font: 600 20px/1.2 var(--f-display); margin: 0; }
.set-lo { font-size: 15px; color: var(--ink-2); }
[data-lang="lo"] .set-lo { font-size: 19px; font-weight: 700; color: var(--ink); }
.set-blurb { color: var(--ink-2); font-size: 14px; }
.set-blurb .lo { display: block; font-size: 13px; }
.set-state { margin-top: 6px; display: inline-flex; align-items: center; gap: 2px; color: var(--accent-deep); font: 600 15px var(--f-display); }
.set-state svg { width: 16px; height: 16px; }
.mini-stars { display: flex; gap: 2px; margin-top: 4px; }
.mini-stars svg { width: 18px; height: 18px; }
.ring { width: 56px; height: 56px; position: relative; }
.ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.ring-fill { animation: ringIn .8s ease-out both; }
@keyframes ringIn { from { stroke-dasharray: 0 200; } }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 12px var(--f-display); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- quiz ---------- */
.qbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--paper); box-shadow: 0 8px 16px -14px rgba(31, 37, 70, .4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
body:has(.qbar)::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--paper); }
.qbar-in { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding-block: 10px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.qbar .icon-btn { width: 40px; height: 40px; border-radius: 12px; }
.track { flex: 1; height: 14px; border-radius: 99px; background: var(--paper-2); overflow: hidden; min-width: 60px; }
.track i { display: block; height: 100%; border-radius: 99px; background: var(--accent); background-image: linear-gradient(180deg, rgba(255, 255, 255, .35) 0 40%, transparent 40%); transition: width .5s cubic-bezier(.2, .8, .3, 1); }
.streak { display: none; align-items: center; gap: 2px; font: 600 16px var(--f-display); color: #E25E00; }
.streak.show { display: inline-flex; }
.streak svg { width: 22px; height: 22px; }
.streak.bump { animation: bump .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 40% { transform: scale(1.35) rotate(-6deg); } }
.lang-cycle { border: 0; background: var(--card); box-shadow: var(--lift); border-radius: 12px; height: 40px; padding: 0 10px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.lang-cycle .lao-label { font-size: 13px; font-weight: 600; }

.quiz { padding-bottom: 120px; }
.crumb { margin: 2px 0 10px; color: var(--ink-3); font-size: 13px; font-weight: 800; }
.crumb .lo { font-size: 13px; }
[data-lang="both"] .crumb .lo { display: none !important; }

.qcard { background: var(--card); border-radius: var(--r-xl); box-shadow: var(--lift); overflow: hidden; }
.qhead { background: var(--accent); color: #fff; display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; }
.qhead .num { font: 600 24px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.qhead .num small { font-size: 15px; opacity: .8; }
.qhead .tag { font-size: 13px; font-weight: 800; background: rgba(255, 255, 255, .22); padding: 3px 10px; border-radius: 99px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.qhead .speak { margin-left: auto; }

.bi { display: grid; grid-template-columns: 1fr; }
.bi > div { padding: 18px 20px; min-width: 0; }
.bi .en { font-size: 20px; line-height: 1.5; }
.bi .lo { font-size: 19px; line-height: 1.8; background: var(--accent-tint); border-top: 2px dashed var(--accent-soft); }
.bi small { font-size: .82em; color: var(--ink-2); }
@media (min-width: 760px) { .bi.both { grid-template-columns: 1fr 1fr; } .bi.both .lo { border-top: 0; border-left: 2px dashed var(--accent-soft); } }
[data-lang="lo"] .bi .lo { border: 0; background: none; }

.figure { padding: 4px 18px 20px; display: flex; justify-content: center; }
.figure > svg { width: 100%; max-width: 520px; height: auto; max-height: 300px; }
.figure.wide > svg { max-width: 760px; max-height: 340px; }
.fig-note { text-align: center; color: var(--ink-3); font-size: 13px; padding: 0 20px 14px; margin: -6px 0 0; }
.figure:has(.tbl) { overflow-x: auto; justify-content: flex-start; }
@media (min-width: 560px) { .figure:has(.tbl) { justify-content: center; } }
.tbl { border-collapse: separate; border-spacing: 0; font-size: 16px; min-width: 60%; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; font-variant-numeric: tabular-nums; }
.tbl th { background: var(--accent-soft); font: 600 15px var(--f-display); padding: 8px 14px; text-align: left; }
.tbl td { padding: 7px 14px; border-top: 1px solid var(--line); }
.tbl tr.hi td { background: var(--accent-tint); font-weight: 800; }

.opts { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
@media (min-width: 560px) { .opts { grid-template-columns: 1fr 1fr; } }
.opt {
  position: relative; display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 12px; text-align: left;
  border: 2.5px solid var(--line); background: var(--card); border-radius: var(--r-md); padding: 12px 14px;
  box-shadow: 0 5px 0 var(--line); min-height: 68px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .15s ease, background .2s ease, opacity .25s ease;
}
.opt:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 5px 0 var(--accent-soft); }
.opt:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.key { width: 44px; height: 44px; border-radius: 13px; background: var(--paper-2); display: grid; place-items: center; font: 600 19px var(--f-display); transition: background .2s ease, color .2s ease; }
.txt { font-size: 19px; line-height: 1.35; min-width: 0; }
.txt .lo { display: block; font-size: 16px; color: var(--ink-2); line-height: 1.6; }
[data-lang="lo"] .txt .lo { font-size: 18px; color: var(--ink); }
.opts:has(.pic) { grid-template-columns: 1fr 1fr; }
.opt.pic { grid-template-columns: 1fr; padding: 12px 10px 10px; }
.opt.pic .key { position: absolute; top: 8px; left: 8px; width: 36px; height: 36px; border-radius: 11px; font-size: 17px; }
.opt.pic .txt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 8px; }
.opt.pic .txt svg { height: 96px; width: auto; max-width: 100%; }
.opt.pic .cap { font-size: 15px; color: var(--ink-2); }
.opt.right { border-color: var(--right); background: var(--right-soft); box-shadow: 0 5px 0 #A7E8BD; }
.opt.right .key { background: var(--right); color: #fff; }
.opt.wrong { border-color: var(--wrong); background: var(--wrong-soft); box-shadow: 0 5px 0 #F6B8BA; }
.opt.wrong .key { background: var(--wrong); color: #fff; }
.opt.dim { opacity: .5; }
.opt.right.just { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.opt.wrong.just { animation: shake .45s ease; }
.opt.reveal { animation: glow 1.2s ease .35s 2; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes glow { 50% { box-shadow: 0 5px 0 #A7E8BD, 0 0 0 6px rgba(22, 163, 74, .25); } }

.sheet { margin-top: 18px; background: var(--card); border-radius: var(--r-xl); box-shadow: var(--lift); overflow: hidden; animation: sheetIn .45s cubic-bezier(.2, .9, .3, 1.15) both; outline: none; }
@keyframes sheetIn { from { transform: translateY(30px) scale(.98); opacity: 0; } }
.verdict { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 18px; }
.mark { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.mark svg { width: 26px; height: 26px; }
.is-right .mark { background: var(--right); animation: markIn .45s cubic-bezier(.2, 1.6, .4, 1) .1s both; }
.is-right .mark .draw { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .4s ease .35s forwards; }
.is-wrong .mark { background: var(--wrong); }
@keyframes markIn { from { transform: scale(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.verdict h3 { margin: 0; font: 600 21px/1.2 var(--f-display); }
[data-lang="lo"] .verdict h3 { font: 700 20px/1.5 var(--f-lao); }
.verdict p { margin: 0; color: var(--ink-2); font-size: 15px; }
.is-right .verdict { background: var(--right-soft); }
.is-wrong .verdict { background: var(--wrong-soft); }
.verdict .speak { margin-left: auto; background: #fff; color: var(--ink); }

.explain h4 { margin: 0 0 8px; font: 600 16px var(--f-display); color: var(--accent-deep); }
.explain .lo h4 { font-family: var(--f-lao); }
.explain .bi .en, .explain .bi .lo { font-size: 17px; }
.explain p { margin: 0 0 8px; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { counter-increment: s; position: relative; padding-left: 36px; min-height: 26px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); font: 600 14px/26px var(--f-display); text-align: center; }
.sheet .figure { padding-top: 0; }
.tip { margin: 0 18px 18px; background: #FFF6D1; border-radius: var(--r-md); padding: 12px 14px; font-size: 15px; display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.tip svg { width: 24px; height: 24px; color: #C99A00; }
.tip .lo { display: block; font-size: 15px; }

.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: linear-gradient(180deg, transparent, var(--paper) 35%); padding-top: 18px; }
.actions-in { max-width: 960px; margin: 0 auto; display: flex; gap: 12px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.square-gap { width: 54px; flex: none; }
.btn.skip { color: var(--ink-2); font-size: 17px; }
.btn.ready { animation: ready .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes ready { 40% { transform: scale(1.04); } }

/* question map */
.map { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; justify-items: center; }
.map-back { position: absolute; inset: 0; background: rgba(31, 37, 70, .35); opacity: 0; transition: opacity .2s ease; }
.map-card { position: relative; width: 100%; max-width: 560px; background: var(--card); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 18px var(--gutter-r) calc(20px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .3, 1); }
@media (min-width: 600px) { .map { align-items: center; } .map-card { border-radius: var(--r-xl); transform: translateY(20px) scale(.97); opacity: 0; transition: transform .2s ease, opacity .2s ease; } }
.map.open .map-back { opacity: 1; }
.map.open .map-card { transform: none; opacity: 1; }
.map-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.map-head h3 { margin: 0; font: 600 20px var(--f-display); }
.map-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.map-grid button { aspect-ratio: 1; border: 0; border-radius: 12px; background: var(--paper-2); font: 600 16px var(--f-display); color: var(--ink-2); max-width: 100%; }
.map-grid button.ok { background: var(--right); color: #fff; }
.map-grid button.no { background: var(--wrong); color: #fff; }
.map-grid button.here { outline: 3px solid var(--accent); outline-offset: 2px; }
.map-key { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 14px 0 0; font-size: 14px; color: var(--ink-2); }
.map-key i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--paper-2); vertical-align: -2px; margin-right: 4px; }
.map-key i.ok { background: var(--right); } .map-key i.no { background: var(--wrong); }

/* ---------- results ---------- */
.result { text-align: center; padding: 26px 18px 22px; background: var(--card); border-radius: var(--r-xl); box-shadow: var(--lift); margin-top: 10px; }
.score-ring { position: relative; width: 168px; height: 168px; margin: 0 auto; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-fill { animation: scoreIn 1s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes scoreIn { from { stroke-dasharray: 0 var(--C); } }
.score { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 52px; }
.score b { font: 700 56px/1 var(--f-display); color: var(--accent); font-variant-numeric: tabular-nums; }
.score small { font: 600 24px var(--f-display); color: var(--ink-3); }
.stars { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.stars svg { width: 44px; height: 44px; }
.stars .pop { animation: starPop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.stars .pop:nth-child(1) { animation-delay: .7s; } .stars .pop:nth-child(2) { animation-delay: .9s; } .stars .pop:nth-child(3) { animation-delay: 1.1s; }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); } }
.result h2 { font: 600 26px/1.2 var(--f-display); margin: 12px 0 2px; }
[data-lang="lo"] .result h2 { font: 700 24px/1.5 var(--f-lao); }
.result > .lo { color: var(--ink-2); margin: 0; }
.left-note { color: var(--ink-2); margin: 10px 0 0; font-size: 15px; }
.left-note .lo { font-size: 14px; }
[data-lang="both"] .left-note .lo { display: block; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 20px; }

.credit { margin-top: 28px; text-align: center; font-size: 12px; line-height: 1.6; color: var(--ink-3); font-weight: 700; }
.credit .lo { font-size: 12px; }
[data-lang="both"] .credit .lo { display: none !important; }
.credit a { color: var(--ink-2); text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.credit a:hover { text-decoration: underline; }
/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.login { width: 100%; max-width: 420px; margin: 18px auto 0; background: var(--card); border-radius: var(--r-xl); box-shadow: var(--lift); padding: 24px 22px 22px; display: flex; flex-direction: column; }
.login.shake { animation: shake .45s ease; }
.login-art { position: relative; height: 92px; margin: -6px 0 6px; }
.login-art img { position: absolute; left: 50%; top: 0; height: 92px; width: auto; transform: translateX(-75%) rotate(-10deg); filter: drop-shadow(0 10px 12px rgba(140, 50, 0, .3)); z-index: 1; }
.login-art .board { position: absolute; left: 50%; top: 14px; width: 92px; height: 72px; border-radius: 18px; background: var(--board) url(img/science-card.jpg) center / cover; transform: translateX(-5%) rotate(8deg); box-shadow: 0 10px 18px -8px rgba(18, 56, 39, .5); }
.login h1 { font: 600 28px/1.15 var(--f-display); margin: 6px 0 0; text-align: center; }
.login-lo { text-align: center; margin: 2px 0 0; color: var(--ink-2); font-size: 17px; }
[data-lang="lo"] .login-lo { font: 700 26px/1.5 var(--f-lao); color: var(--ink); }
.login-note { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: #FFF6D1; font-size: 15px; }
.login-note .lo { display: block; font-size: 14px; }
.field { margin-top: 18px; font: 600 16px var(--f-display); display: flex; gap: 8px; align-items: baseline; }
.field .lo { font-size: 15px; font-weight: 600; color: var(--ink-2); }
[data-lang="both"] .field .lo::before { content: "· "; }
.input, .pin input { font: 700 20px var(--f-body); color: var(--ink); }
.input { margin-top: 6px; height: 56px; border: 2.5px solid var(--line); border-radius: var(--r-md); padding: 0 16px; background: var(--paper); outline: none; transition: border-color .15s ease, background .15s ease; }
.input:focus { border-color: var(--sky); background: #fff; }
.pin { position: relative; margin-top: 6px; height: 64px; }
.pin input { position: absolute; inset: 0; width: 100%; height: 100%; border: 2.5px solid var(--line); border-radius: var(--r-md); background: var(--paper); color: transparent; caret-color: transparent; letter-spacing: 1em; padding: 0 16px; outline: none; transition: border-color .15s ease, background .15s ease; }
.pin input:focus { border-color: var(--sky); background: #fff; }
.pin-dots { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; gap: 18px; pointer-events: none; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--ink-3); transition: transform .15s cubic-bezier(.2, 1.6, .4, 1), background .15s ease, border-color .15s ease; }
.pin-dots i.on { background: var(--sky); border-color: var(--sky); transform: scale(1.15); }
.login-error { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--wrong-soft); color: #A61B21; font-size: 15px; font-weight: 700; }
.login-error .lo { display: block; font-size: 14px; }
[data-lang="both"] .login-error .lo { font-weight: 500; }
.login-btn { margin-top: 20px; width: 100%; background: var(--sky); box-shadow: 0 5px 0 var(--sky-deep); }
.login-btn:active { box-shadow: 0 1px 0 var(--sky-deep); }
.login-btn:disabled { opacity: .6; }
.login-btn.busy svg { animation: nudgeR .7s ease-in-out infinite; }
@keyframes nudgeR { 50% { transform: translateX(5px); } }
.login-help { margin: 16px 0 0; text-align: center; color: var(--ink-2); font-size: 14px; }
.login-help .lo { display: block; font-size: 13px; }
.login-wrap .credit { margin-top: auto; padding-top: 28px; }

/* ---------- signed-in bits ---------- */
.who { margin: 10px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-block; background: var(--ink); color: #fff; border-radius: 99px; padding: 4px 12px; font: 600 15px var(--f-display); }
.who .lo { font-size: 15px; color: var(--ink-2); }
.hero { padding-bottom: 18px; }
.account { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding: 12px 16px; background: var(--card); border-radius: var(--r-md); box-shadow: var(--lift); font-size: 14px; }
.sync { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 700; }
.sync i { width: 10px; height: 10px; border-radius: 50%; background: var(--right); }
.sync.wait i { background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
[data-lang="both"] .sync .lo, [data-lang="both"] .link-btn .lo { display: none !important; }
.link-btn { border: 0; background: none; padding: 6px 0; color: var(--sky-deep); font-weight: 800; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.loading { text-align: center; padding: 80px 16px; color: var(--ink-2); }
.loading h2 { font: 600 22px var(--f-display); color: var(--ink); margin: 0 0 4px; }
.loading .btn { margin-top: 18px; }
.dots { display: inline-flex; gap: 8px; margin-bottom: 14px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--math); animation: hop .9s ease-in-out infinite; }
.dots i:nth-child(2) { background: var(--sci); animation-delay: .15s; } .dots i:nth-child(3) { background: var(--sky); animation-delay: .3s; }
@keyframes hop { 30% { transform: translateY(-12px); } 60% { transform: none; } }

.empty { text-align: center; padding: 40px 18px; color: var(--ink-2); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

@media (max-width: 480px) {
  .brand small { display: none; }
  .brand b { font-size: 17px; }
  .lang button { padding: 6px 8px; font-size: 13px; }
  .sub-title { font-size: 34px; }
  .bi > div { padding: 16px 16px; }
  .bi .en { font-size: 19px; }
  .qhead .tag { display: none; }
  .qbar-in { gap: 6px; }
  .lang-cycle { padding: 0 8px; }
}
@media (max-width: 400px) { .brand span { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .is-right .mark .draw { stroke-dashoffset: 0; }
}
