/* g1-test.ca — shared light and dark themes with mobile-friendly quiz controls. */
:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --surface: #eef0f6;
  --surface-2: #e6eaf2;
  --fg: #0f1b33;
  --muted: #26324d;
  --subtle: #5d6882;
  --border: #e3e6ee;
  --border-strong: #d4d9e4;
  --accent: #c52134;
  --accent-hover: #a81c2c;
  --accent-soft: #fdeced;
  --accent-ink: #a81c2c;
  --on-accent: #ffffff;
  --focus: #2563eb;
  --header-height: 68px;
  --ok: #146c2e;
  --ok-soft: #e6f4ea;
  --ok-line: #8fd1a4;
  --bad: #b3261e;
  --bad-soft: #fce8e6;
  --bad-line: #f1a39d;
  --warn: #7a5200;
  --warn-soft: #fef3d6;
  --gold: #f5b400;
  --shadow-sm: 0 1px 2px rgba(15, 27, 51, .06), 0 1px 3px rgba(15, 27, 51, .05);
  --shadow: 0 1px 3px rgba(15, 27, 51, .06), 0 8px 24px rgba(15, 27, 51, .07);
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1180px;
  --font: Inter, "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans TC", system-ui, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --panel: #121b2d; --surface: #162036; --surface-2: #202c45; --fg: #edf1f8; --muted: #d4d9e4;
    --subtle: #a7b3cb; --border: #233049; --border-strong: #3e4e6c; --accent: #ff7886; --accent-hover: #ffa0aa;
    --accent-soft: #3a1a22; --accent-ink: #ffadb6; --on-accent: #351018; --focus: #9bbaff; --ok: #6dd58c; --ok-soft: #10331c; --ok-line: #2c6b3f;
    --bad: #f2b8b5; --bad-soft: #3d1614; --bad-line: #7d2b26; --warn: #f5cf74; --warn-soft: #3a2c08;
    --shadow-sm: none; --shadow: 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --panel: #121b2d; --surface: #162036; --surface-2: #202c45; --fg: #edf1f8; --muted: #d4d9e4;
  --subtle: #a7b3cb; --border: #233049; --border-strong: #3e4e6c; --accent: #ff7886; --accent-hover: #ffa0aa;
  --accent-soft: #3a1a22; --accent-ink: #ffadb6; --on-accent: #351018; --focus: #9bbaff; --ok: #6dd58c; --ok-soft: #10331c; --ok-line: #2c6b3f;
  --bad: #f2b8b5; --bad-soft: #3d1614; --bad-line: #7d2b26; --warn: #f5cf74; --warn-soft: #3a2c08;
  --shadow-sm: none; --shadow: 0 8px 24px rgba(0, 0, 0, .35); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 16px); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 650; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding-inline: 16px; } }
.narrow { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--subtle); }
.small { font-size: .875rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: var(--header-height); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); font-weight: 700; font-size: 1.06rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(145deg, #d62839, #9e1424); color: #fff; box-shadow: 0 5px 12px -5px #9e1424; font-weight: 800; font-size: .9rem; letter-spacing: -.02em; }
.brand small { color: var(--subtle); font-weight: 500; }
.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav a { white-space: nowrap; color: var(--muted); padding: 7px 9px; border-radius: 9px; font-size: .94rem; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface); color: var(--fg); text-decoration: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-menu { position: relative; }
.icon-btn { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--panel); color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.icon-btn:hover { background: var(--surface); }
.menu { position: absolute; right: 0; top: 46px; min-width: 170px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.menu a, .menu button { display: flex; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--fg); font: inherit; font-size: .94rem; background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface); text-decoration: none; }
.menu a[aria-current="true"] { color: var(--accent); font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar-initial { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: .85rem; }
.menu-toggle { display: none; }
@media (max-width: 1130px) {
  .nav { display: none; position: absolute; left: 0; right: 0; top: var(--header-height); flex-direction: column; background: var(--panel); border-bottom: 1px solid var(--border); padding: 8px 12px 14px; margin: 0; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 1rem; border-radius: 10px; }
  .menu-toggle { display: inline-grid; }
  .topbar .wrap { gap: 8px; }
  .top-actions { gap: 6px; }
  .hide-sm { display: none !important; }
}

/* ---------- Buttons, chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--fg); box-shadow: var(--shadow-sm); font: inherit; font-weight: 600; font-size: .96rem; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 7px 16px -9px var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-tonal { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.btn-tonal:hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent)); }
.btn-ghost { box-shadow: none; border-color: transparent; background: transparent; color: var(--muted); }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 1.05rem; }
.btn-sm { min-height: 34px; padding: 6px 14px; font-size: .86rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-google { background: var(--panel); color: var(--fg); border-color: var(--border-strong); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.eyebrow { display: inline-block; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- Cards, sections ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.card-tight { padding: 16px; }
.section { padding: 56px 0; }
.section-alt { background: var(--panel); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head p { margin: 0; color: var(--subtle); }
.section-head.center { display: block; max-width: 680px; margin-inline: auto; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.page-head { padding: 40px 0 8px; }
.page-head p { color: var(--subtle); font-size: 1.05rem; max-width: 720px; }
.crumbs { font-size: .86rem; color: var(--subtle); margin-bottom: 8px; }
.crumbs a { color: var(--subtle); }

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 80px;
  background:
    radial-gradient(ellipse at 85% 12%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 48%),
    radial-gradient(ellipse at 0% 100%, color-mix(in srgb, var(--focus) 9%, transparent), transparent 45%);
}
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 52px; align-items: center; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 0; background: none; color: var(--accent); }
.hero .eyebrow::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px var(--accent-soft); }
.hero h1 { margin: 18px 0 20px; font-size: clamp(2.25rem, 4.7vw, 3.75rem); line-height: 1.08; letter-spacing: -.035em; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lead { font-size: 1.16rem; color: var(--muted); max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 14px; }
.hero-note { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--subtle); font-size: .9rem; }
.hero-note span::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 6px; }
@media (max-width: 920px) {
  .hero { padding: 44px 0 52px; }
  .hero .wrap { grid-template-columns: minmax(0, 1fr); gap: 30px; }
}
.preview { background: var(--panel); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 20px 44px -16px color-mix(in srgb, var(--fg) 22%, transparent), 6px 7px 0 var(--surface); padding: clamp(16px, 3vw, 24px); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.preview-head strong { display: block; }
.preview-head small { display: block; color: var(--subtle); }
.preview .progress { margin: 0 0 14px; }
.preview-question { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.preview-question .q-sign-wrap { flex: none; padding: 10px; margin: 0; }
.preview-question .q-sign { width: 64px; height: 64px; }
.preview-question .q-text { font-size: 1.06rem; margin: 0; }
.preview .opt { min-height: 44px; padding: 8px 10px; cursor: inherit; font-size: .94rem; }
.preview .explain { font-size: .9rem; }
.preview .explain p { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats .card { padding: 18px; }
.stats b { display: block; margin-bottom: 6px; font-size: clamp(1.25rem, 2.5vw, 1.7rem); line-height: 1.1; color: var(--accent); }
.stats span { color: var(--subtle); font-size: .9rem; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .preview-question .q-sign { width: 48px; height: 48px; }
  .preview .mark { display: none; }
  .stats .card { padding: 14px; }
}

/* ---------- Set grid ---------- */
.tier-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; font-weight: 650; }
.tier-head .line { flex: 1; height: 1px; background: var(--border); }
.sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.set { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--fg); transition: border-color .15s, box-shadow .15s, transform .15s; min-height: 108px; }
.set:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }
.set-no { font-size: .78rem; font-weight: 700; color: var(--subtle); letter-spacing: .04em; text-transform: uppercase; }
.set-title { font-weight: 700; font-size: 1.1rem; }
.set-meta { margin-top: auto; font-size: .82rem; color: var(--subtle); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.set-bar { height: 5px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.set-bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.set.done .set-bar i { background: var(--ok); }
.set.failed .set-bar i { background: var(--bad); }
.set.locked { background: var(--surface); color: var(--subtle); }
.set.locked .set-title::after { content: " 🔒"; font-size: .85rem; }
.set .badge-pass { color: var(--ok); font-weight: 700; }
.set .badge-fail { color: var(--bad); font-weight: 700; }

/* ---------- Features ---------- */
.feature { display: flex; flex-direction: column; gap: 6px; }
.feature .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 1.25rem; margin-bottom: 6px; }
.feature p { color: var(--subtle); margin: 0; font-size: .95rem; }
.steps { counter-reset: s; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { list-style: none; counter-increment: s; position: relative; padding: 22px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.steps li::before { content: counter(s); width: 34px; height: 34px; margin-bottom: 14px; border-radius: 50%; background: var(--fg); color: var(--panel); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.steps { padding: 0; margin: 0; }
.steps p { margin: 0; }

/* ---------- Quiz ---------- */
.quiz-shell { max-width: 760px; margin: 0 auto; padding: 0 16px 120px; }
.quiz-top { position: sticky; top: var(--header-height); z-index: 20; background: var(--bg); padding: 14px 0 10px; }
.quiz-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.quiz-title h1 { font-size: 1.15rem; margin: 0; }
.quiz-title .spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.seg button { border: 0; background: none; font: inherit; font-size: .84rem; font-weight: 600; color: var(--subtle); padding: 5px 11px; border-radius: 999px; cursor: pointer; min-width: 38px; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--accent); box-shadow: var(--shadow-sm); }
.progress { display: flex; gap: 6px; margin-top: 12px; }
.progress .part { flex: 1; }
.progress .part-label { display: flex; justify-content: space-between; font-size: .76rem; color: var(--subtle); font-weight: 600; margin-bottom: 4px; }
.progress .track { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: flex; }
.progress .track i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.q-card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 22px; box-shadow: var(--shadow-sm); margin-top: 6px; }
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.q-meta .count { margin-left: auto; font-size: .86rem; color: var(--subtle); font-weight: 600; }
.q-head { display: flex; align-items: flex-start; gap: 12px; }
.q-head .q-text { flex: 1; }
.speak-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--accent); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; }
.speak-btn:hover { background: var(--surface); }
.speak-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
@media (max-width: 560px) { .speak-btn span { display: none; } .speak-btn { min-width: 40px; justify-content: center; } }
.q-sign-wrap { display: grid; place-items: center; background: var(--surface); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.q-sign { width: 168px; height: 168px; }
.q-text { font-size: 1.22rem; font-weight: 600; line-height: 1.45; margin: 0 0 16px; }
.q-sub { font-size: .95rem; color: var(--subtle); margin: -8px 0 14px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--fg); font: inherit; font-size: 1.02rem; line-height: 1.4; text-align: left; cursor: pointer; transition: border-color .12s, background .12s; }
.opt:hover:not([disabled]) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 35%, var(--panel)); }
.opt .key { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface); color: var(--muted); font-weight: 700; font-size: .9rem; }
.opt .txt { flex: 1; }
.opt .sub { display: block; color: var(--subtle); font-size: .88rem; margin-top: 2px; }
.opt .mark { flex: none; font-weight: 700; font-size: .85rem; }
.opt.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--panel)); }
.opt.selected .key { background: var(--accent); color: var(--on-accent); }
.opt.correct { border-color: var(--ok-line); background: var(--ok-soft); }
.opt.correct .key { background: var(--ok); color: var(--panel); }
.opt.correct .mark { color: var(--ok); }
.opt.wrong { border-color: var(--bad-line); background: var(--bad-soft); }
.opt.wrong .key { background: var(--bad); color: var(--panel); }
.opt.wrong .mark { color: var(--bad); }
.opt[disabled] { cursor: default; }
.feedback { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-weight: 650; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.explain { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface); font-size: .98rem; }
.explain p { margin: 0 0 6px; }
.explain .alt { color: var(--subtle); border-top: 1px dashed var(--border-strong); padding-top: 8px; margin-top: 8px; }
.explain .src { font-size: .82rem; color: var(--subtle); margin-top: 6px; }
.q-tools { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.q-tools .btn { color: var(--subtle); }
.q-tools .btn[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.quiz-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.quiz-bar .inner { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.quiz-bar .grow { flex: 1; }
.quiz-bar .btn-primary { min-width: 140px; }
.navgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-top: 12px; }
.navgrid button { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--subtle); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; padding: 0; }
.navgrid button.ans { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.navgrid button.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.navgrid button.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.navgrid button.cur { outline: 2px solid var(--focus); outline-offset: 1px; }
.navgrid .split { grid-column: 1 / -1; font-size: .74rem; color: var(--subtle); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.timer.low { color: var(--bad); }
@media (max-width: 560px) {
  .q-card { padding: 16px; border-radius: 16px; }
  .q-sign { width: 136px; height: 136px; }
  .q-text { font-size: 1.1rem; }
  .navgrid { grid-template-columns: repeat(8, 1fr); }
}

/* ---------- Results ---------- */
.result-hero { text-align: center; padding: 26px 18px; }
.result-hero .verdict { font-size: 1.9rem; font-weight: 800; margin: 8px 0 4px; }
.result-hero .verdict.pass { color: var(--ok); }
.result-hero .verdict.fail { color: var(--bad); }
.parts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.part-score { border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: center; background: var(--panel); }
.part-score b { display: block; font-size: 2rem; line-height: 1.1; }
.part-score.pass b { color: var(--ok); }
.part-score.fail b { color: var(--bad); }
.part-score .need { font-size: .82rem; color: var(--subtle); }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-size: 2rem; font-weight: 800; }
.review-list { display: grid; gap: 12px; margin-top: 12px; }
.review-item { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--panel); }
.review-item.bad { border-left: 4px solid var(--bad); }
.review-item.ok { border-left: 4px solid var(--ok); }
.review-item .head { display: flex; gap: 12px; align-items: start; }
.review-item img { width: 56px; height: 56px; flex: none; }
.review-item .ans { font-size: .92rem; margin-top: 6px; }

/* ---------- Signs ---------- */
.sign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sign-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); color: var(--fg); text-align: center; font-size: .9rem; font-weight: 600; line-height: 1.3; }
.sign-tile:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.sign-tile img { width: 92px; height: 92px; }
.flash { perspective: 1200px; max-width: 420px; margin: 0 auto; }
.flash-inner { position: relative; min-height: 360px; transition: transform .45s; transform-style: preserve-3d; cursor: pointer; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 12px; }
.flash-face.back { transform: rotateY(180deg); }
.flash-face img { width: 190px; height: 190px; }
.sign-detail { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
.sign-detail .art { background: var(--surface); border-radius: 18px; padding: 28px; display: grid; place-items: center; }
@media (max-width: 680px) { .sign-detail { grid-template-columns: 1fr; } .sign-detail .art img { width: 180px; } }

/* ---------- Pricing ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan.featured { border: 2px solid var(--accent); position: relative; }
.plan .price { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.plan .price small { font-size: .95rem; color: var(--subtle); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; gap: 8px; }
.plan li { padding-left: 26px; position: relative; font-size: .95rem; }
.plan li::before { content: "✓"; position: absolute; left: 2px; color: var(--ok); font-weight: 800; }
.plan .btn { margin-top: auto; }
.ribbon { position: absolute; top: -12px; left: 22px; background: var(--accent); color: var(--on-accent); font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }

/* ---------- Tables, forms, misc ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--panel); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: var(--surface); font-weight: 650; color: var(--muted); font-size: .86rem; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.callout { padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); margin: 16px 0; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .92rem; }
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--panel); color: var(--fg); font: inherit; }
textarea.input { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .92rem; z-index: 90; box-shadow: var(--shadow); }
dialog { border: 1px solid var(--border); border-radius: 18px; padding: 22px; background: var(--panel); color: var(--fg); max-width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
.lock-card { text-align: center; padding: 36px 22px; }
.lock-card .ico { font-size: 2.2rem; }
.empty { text-align: center; padding: 40px 16px; color: var(--subtle); }
details { border: 1px solid var(--border); border-radius: 12px; padding: 0 16px; background: var(--panel); margin-bottom: 10px; }
details summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details summary::after { content: "+"; color: var(--subtle); font-size: 1.2rem; line-height: 1; }
details[open] summary::after { content: "–"; }
details > :not(summary) { margin-top: 0; padding-bottom: 12px; color: var(--muted); }

/* ---------- Guide articles ---------- */
.guide { font-size: 1.04rem; }
.guide h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: 14px; }
.guide .lead { font-size: 1.15rem; color: var(--muted); }
.guide h2 { margin-top: 1.8em; }
.guide ul, .guide ol { padding-left: 1.3em; }
.guide li { margin-bottom: 6px; }
.guide table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .95rem; }
.guide table th, .guide table td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
.guide table th { background: var(--surface); }
.guide .cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 26px 0; padding: 20px; border-radius: 16px; background: var(--surface); }
.guide .sources { font-size: .86rem; color: var(--subtle); margin-top: 28px; }
.guide-card { display: flex; flex-direction: column; gap: 6px; color: var(--fg); }
.guide-card:hover { text-decoration: none; border-color: var(--accent); }
.guide-card p { color: var(--subtle); font-size: .93rem; margin: 0; }
.promo { margin-top: 28px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: 12px; font-size: .93rem; color: var(--subtle); }
.promo p { margin: 4px 0 6px; color: var(--fg); }
.promo-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Last checked line, change log ---------- */
.verified { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--subtle); margin: 14px 0 0; }
.verified .tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: .7rem; font-weight: 800; }
.changelog { list-style: none; padding: 0; margin: 20px 0; border-left: 2px solid var(--border); }
.changelog li { position: relative; padding: 0 0 22px 22px; }
.changelog li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.changelog time { font-weight: 700; font-size: .92rem; }
.changelog p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { margin-top: 64px; border-top: 1px solid var(--border); background: var(--panel); padding: 48px 0 32px; font-size: .92rem; color: var(--subtle); }
.footer .cols { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; }
.footer h4 { margin: 0 0 12px; color: var(--subtle); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer a:not(.brand) { color: var(--subtle); }
.disclaimer { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); font-size: .84rem; }
@media (max-width: 760px) { .footer .cols { grid-template-columns: 1fr 1fr; } .footer .cols > :first-child { grid-column: 1 / -1; } }
/* Sister sites (Richscripts cluster B). Open on wide screens via app.js; a tap-to-open list on phones. */
.family { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.family summary { cursor: pointer; color: var(--subtle); font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.family ul { margin-top: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 18px; }
.family a { display: flex; flex-direction: column; text-decoration: none; }
.family a strong { color: var(--fg); font-weight: 600; }
.family a span { font-size: .84rem; }
.family a strong small { font-weight: 400; font-size: .8rem; color: var(--subtle); }
.family a:hover strong { color: var(--accent); text-decoration: underline; }
.family a[aria-current="page"] strong { color: var(--accent); }
/* Results: newcomer journey bar (step N of 10) + side trip card. */
.next-step { display: grid; gap: 14px; margin-top: 18px; }
.next-step h2 { font-size: 1.1rem; margin: 8px 0 4px; }
.next-step p { margin: 0 0 10px; color: var(--muted); }
.journey-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.journey-bar { list-style: none; display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; padding: 0; margin: 14px 0 10px; }
.journey-bar li { height: 6px; border-radius: 3px; background: var(--surface-2); }
.journey-bar li.done { background: var(--ok); }
.journey-bar li.here { background: var(--accent); }
.journey-prev { margin: 0 0 12px; }
.journey-prev a { color: var(--subtle); }
.journey-next { border-top: 1px solid var(--border); padding-top: 12px; }
.side-trip { display: flex; gap: 16px; align-items: flex-start; }
.side-trip .ico { font-size: 1.8rem; line-height: 1; padding-top: 4px; }

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.kpi b { display: block; font-size: 1.6rem; }
.kpi span { color: var(--subtle); font-size: .86rem; }
.bar-cell { position: relative; min-width: 110px; }
.bar-cell i { position: absolute; left: 0; top: 50%; height: 6px; transform: translateY(-50%); border-radius: 6px; background: var(--bad); opacity: .3; }
.lang-edit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 980px) { .lang-edit { grid-template-columns: 1fr; } }
.print-only { display: none; }
@media print {
  .topbar, .footer, .no-print { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; color: #000; }
}

/* Language navigation and translated layouts */
.language-toggle { gap: 6px; grid-auto-flow: column; min-height: 40px; }
.language-panel { top: calc(var(--header-height) - 5px); inset-inline: auto max(16px, calc((100% - var(--max)) / 2 + 24px)); width: min(390px, calc(100% - 32px)); padding: 12px; max-height: calc(100dvh - var(--header-height) - 12px); overflow: auto; }
.language-panel p { margin: 0 0 8px; padding-inline: 8px; font-weight: 700; }
.language-options, .home-languages { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.language-options a { align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 1px solid transparent; }
.language-options a[aria-current="true"], .language-card[aria-current="page"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 26%, var(--border)); color: var(--accent-ink); }
.lang-code { display: inline-grid; place-items: center; flex: none; min-width: 32px; min-height: 28px; padding-inline: 5px; border-radius: 7px; background: var(--surface); color: var(--subtle); font-size: .75rem; font-weight: 700; direction: ltr; }
.languages-section { padding-block: 40px; }
.home-languages { gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.language-card { display: flex; min-height: 48px; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--fg); font-size: .9rem; font-weight: 650; box-shadow: var(--shadow-sm); }
.language-card:hover { border-color: var(--accent); text-decoration: none; }
.translation-note { margin: 14px 0 0; }
.quiz-translation { margin: -7px 0 12px; }
.question-language { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; color: var(--subtle); font-size: .84rem; font-weight: 600; }
.question-language select { max-width: 100%; min-height: 38px; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--panel); color: var(--fg); font: inherit; }
.q-head .q-text, .opt .txt { min-width: 0; overflow-wrap: anywhere; }
.opt, .menu button, .opt .txt { text-align: start; }
.q-meta .count, .top-actions { margin-left: 0; margin-inline-start: auto; }
[dir="rtl"] .top-actions .menu:not(.language-panel) { right: auto; left: 0; }
[dir="rtl"] .quiz-bar .grow, [dir="rtl"] .q-meta .count { unicode-bidi: isolate; }
.btn-block, .hero-cta .btn, .quiz-bar .btn, .q-tools .btn { white-space: normal; text-align: center; }
.nav { margin-left: 0; margin-inline-start: 12px; }
.tier-head { flex-wrap: wrap; }
.tier-head .chip { white-space: normal; max-width: 100%; }
.tier-head .line { min-width: 12px; }
[dir="rtl"] .hero-note span::before { margin-right: 0; margin-inline-end: 6px; }
@media (min-width: 1131px) { .nav a { white-space: normal; text-align: center; line-height: 1.2; } }
@media (max-width: 1130px) { .nav { margin-inline-start: 0; } }
@media (max-width: 850px) { .home-languages { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .home-languages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: clamp(1.9rem, 8vw, 2.45rem); }
  .hero-cta .btn { flex: 1 1 135px; padding-inline: 12px; }
  .quiz-bar .btn { min-width: 0; padding-inline: 10px; }
  .top-actions > .btn { padding-inline: 9px; }
  .language-toggle { padding-inline: 8px; }
}
@media (max-width: 360px) {
  .topbar .brand { font-size: .94rem; gap: 6px; }
  .topbar .brand-mark { width: 30px; height: 30px; }
  .topbar .brand small { display: none; }
  .top-actions > .btn { white-space: normal; text-align: center; line-height: 1.2; max-width: 100px; min-width: 0; }
  .language-toggle svg { display: none; }
}

/* ---------- Server-rendered study content (sign, topic, test and chapter pages) ---------- */
.study { margin-top: 36px; }
.study h2 { font-size: 1.25rem; margin: 0 0 12px; }
.study-list { display: grid; gap: 12px; }
.study-q { display: flex; gap: 16px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.study-q img { flex: none; }
.study-q-text { font-weight: 600; margin: 0 0 8px; color: var(--fg); }
.study-opts { margin: 0 0 8px; padding-left: 22px; color: var(--muted); }
.study-opts li { margin: 2px 0; }
.study-opts li.ok { color: var(--ok); font-weight: 600; }
.study-explain { margin: 0; color: var(--muted); font-size: .94rem; }
.study-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.study-faq details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.study-faq summary { cursor: pointer; font-weight: 600; color: var(--fg); }
.study-faq details p { margin: 8px 0 0; color: var(--muted); }
@media (max-width: 560px) { .study-q { flex-direction: column; } }
.quiz-shell:has(+ .test-about) { padding-bottom: 8px; }
.key-points { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.key-points li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.key-points li img { flex: none; }
.study-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
