/* QWizAi — "Google for Education" theme: near-white canvas, charcoal type on a narrow grey scale, one blue
   accent for interactive state, pill buttons, 24px card radii, no shadows or gradients. Tokens from
   design/variables-google-edu.css. Other themes: assets/styles-classic.css, assets/styles-syllabus.css. */
:root {
  /* Brand tokens */
  --color-canvas-white: #f8f9fa; --color-charcoal-ink: #202124; --color-graphite: #3c4043; --color-slate: #5f6368;
  --color-mist: #dadce0; --color-cloud-shadow: #c4c6c7; --color-google-blue: #1a73e8; --color-google-blue-deep: #1967d2;
  --color-classroom-green: #188038; --surface-feature-panel-tint: #e8f0fe;
  /* Roles */
  --bg: var(--color-canvas-white); --surface: #ffffff; --surface-2: var(--color-canvas-white); --tint: var(--surface-feature-panel-tint);
  --border: var(--color-mist); --text: var(--color-charcoal-ink); --text-2: var(--color-graphite); --muted: var(--color-slate);
  --primary: var(--color-google-blue); --primary-hover: var(--color-google-blue-deep); --primary-soft: var(--surface-feature-panel-tint);
  --accent: var(--color-google-blue); --accent-soft: var(--surface-feature-panel-tint);
  --good: var(--color-classroom-green); --good-soft: #e6f4ea; --bad: #c5221f; --bad-soft: #fce8e6; --warn: #b06000; --warn-soft: #fef7e0;
  /* Type: Google Sans is not freely available; Inter is the documented substitute. Weights 400 / 500 only; 700 never in body. */
  --font: "Inter", "Google Sans Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter", "Google Sans Display", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-caption: 12px; --tracking-caption: .432px; --text-body-sm: 14px; --tracking-body-sm: .238px; --text-body: 16px; --tracking-body: .272px;
  --text-subheading: 18px; --tracking-subheading: .108px; --text-heading-sm: 22px; --tracking-heading-sm: -.132px; --text-heading: 28px; --tracking-heading: -.168px;
  --text-heading-lg: 48px; --tracking-heading-lg: -.288px; --text-display: 80px; --tracking-display: -.8px;
  /* Spacing (8px base) */
  --s-1: 8px; --s-2: 16px; --s-3: 24px; --s-4: 32px; --s-5: 40px; --s-6: 48px; --s-7: 80px; --s-8: 120px;
  --card-padding: 32px; --page-max: 1200px;
  /* Shape: pills for buttons/chips, 4px inputs, 24px cards, 8px modals and nav items. No shadows. */
  --radius: 24px; --radius-sm: 4px; --radius-nav: 8px; --radius-modal: 8px; --radius-pill: 200px;
  --shadow: none; --shadow-base: none; --shadow-elevated: none; --shadow-floating: none;
  --ring: 0 0 0 3px var(--color-cloud-shadow);
  --ease-spring: cubic-bezier(.2, .8, .2, 1); --t-fast: .12s; --t-med: .2s;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: var(--text-body); line-height: 1.56; letter-spacing: var(--tracking-body); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); margin: 0 0 .4em; color: var(--text); }
h1 { font-size: var(--text-heading-lg); line-height: 1.15; letter-spacing: var(--tracking-heading-lg); font-weight: 400; }
h2 { font-size: var(--text-heading-sm); line-height: 1.29; letter-spacing: var(--tracking-heading-sm); font-weight: 500; }
h3 { font-size: var(--text-subheading); line-height: 1.4; letter-spacing: var(--tracking-subheading); font-weight: 500; }
p { margin-top: 0; }
strong, b { font-weight: 500; }
a { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; border-radius: 4px; }
a:hover { color: var(--primary-hover); }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }
small, .hint, .caption { letter-spacing: var(--tracking-body-sm); }

/* ---------- top bar: white, 64px, hairline, 14px links with blue active underline, one filled pill ---------- */
.topbar { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--s-3); display: flex; align-items: center; justify-content: space-between; height: 64px; gap: var(--s-2); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-family: var(--font-display); font-weight: 500; font-size: var(--text-subheading); letter-spacing: var(--tracking-subheading); }
.brand-text small { font-weight: 400; color: var(--muted); font-size: var(--text-caption); letter-spacing: var(--tracking-caption); }
.name-short { display: none; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav-burger { display: none; font: inherit; font-size: 1.4rem; width: 40px; height: 40px; border-radius: 50%; background: none; border: 0; color: var(--muted); cursor: pointer; }
.nav-burger:hover { background: var(--surface-2); color: var(--text); }
.nav-burger:active { transform: scale(.94); }
.nav-burger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-link { color: var(--text-2); text-decoration: none; white-space: nowrap; padding: 8px 12px; border-radius: var(--radius-nav); font-weight: 400; font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); background: none; border: 0; font-family: inherit; cursor: pointer; position: relative; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:active { transform: translateY(1px); }
.nav-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-link.active { color: var(--text); font-weight: 500; }
.nav-link.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--primary); border-radius: 2px; }
.nav-group { position: relative; }
.nav-group > .nav-link::after { content: " ▾"; font-size: .75em; position: static; background: none; height: auto; }
.nav-menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-modal); padding: 8px; display: none; z-index: 30; }
.nav-group.open .nav-menu, .nav-group:hover .nav-menu { display: block; }
.nav-menu a { display: block; padding: 10px 12px; border-radius: var(--radius-nav); color: var(--text-2); text-decoration: none; font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); }
.nav-menu a:hover { background: var(--surface-2); color: var(--text); }
.nav-menu a:active { background: var(--tint); }
.nav-menu a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nav-upload { background: var(--primary); color: #fff; font-weight: 500; border-radius: var(--radius-pill); padding: 0 24px; height: 40px; display: inline-flex; align-items: center; margin-left: 8px; }
.nav-upload:hover { background: var(--primary-hover); color: #fff; }
.nav-upload.active { background: var(--primary-hover); color: #fff; }
.nav-upload.active::after { display: none; }
.nav-context { color: var(--muted); font-size: var(--text-caption); letter-spacing: var(--tracking-caption); padding: 0 12px 0 4px; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- layout ---------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: var(--s-5) var(--s-3) var(--s-7); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.hero { margin-bottom: var(--s-5); }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.hero-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.lede { color: var(--muted); max-width: 640px; margin: 0; font-size: var(--text-subheading); line-height: 1.67; letter-spacing: var(--tracking-subheading); }
.eyebrow { text-transform: none; letter-spacing: var(--tracking-body-sm); font-size: var(--text-body-sm); font-weight: 500; color: var(--primary); margin: 0 0 8px; }
.section-title { text-align: center; margin: 0 0 var(--s-3); font-size: var(--text-heading); letter-spacing: var(--tracking-heading); font-weight: 400; }
.form-actions { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-2); }
.footer { max-width: var(--page-max); margin: var(--s-7) auto 0; padding: var(--s-3) var(--s-3) var(--s-5); color: var(--muted); font-size: var(--text-caption); letter-spacing: var(--tracking-caption); border-top: 1px solid var(--border); }

/* ---------- forms: 4px radius, hairline, soft grey focus ring ---------- */
label { display: block; font-weight: 500; font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); margin-bottom: 8px; color: var(--text-2); }
select, input[type=text], input[type=search], input[type=number], input[type=email], input[type=password], textarea {
  width: 100%; font: inherit; letter-spacing: var(--tracking-body); padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%235f6368' stroke-width='1.5'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
select:hover:not(:disabled), input:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--color-cloud-shadow); }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
select:disabled, input:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; }
input[type=file] { font: inherit; padding: 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); width: 100%; background: var(--surface-2); }
.hint { color: var(--muted); font-size: var(--text-body-sm); margin: 6px 0 0; min-height: 1.2em; }
.error { color: var(--bad); background: var(--bad-soft); padding: 10px 14px; border-radius: var(--radius-sm); font-size: var(--text-body-sm); margin: 12px 0 0; }

/* Buttons: 40px pills. Filled blue = one primary per viewport; ghost pill = secondary; text = tertiary */
.btn {
  font: inherit; font-weight: 500; font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); height: 40px; padding: 0 24px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; line-height: 1; background: transparent; color: var(--primary);
  transition: transform var(--t-fast) var(--ease-spring);
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--primary); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-lg { height: 48px; padding: 0 32px; font-size: var(--text-body); }
.btn-sm { height: 32px; padding: 0 16px; font-size: var(--text-caption); letter-spacing: var(--tracking-caption); }
.btn-primary, .btn-finish { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled), .btn-finish:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--primary); }
.btn-ghost { border-color: transparent; color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.btn-ghost[aria-pressed=true] { background: var(--tint); color: var(--primary-hover); }
.btn-danger-ghost { color: var(--bad); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-soft); border-color: var(--bad); }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover:not(:disabled) { background: #a50e0e; border-color: #a50e0e; }
.btn-danger:focus-visible { outline-color: var(--bad); }

/* ---------- setup ---------- */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: var(--s-3); align-items: start; }
.setup-card { padding: var(--card-padding); }
.step { display: grid; grid-template-columns: 40px 1fr; gap: var(--s-2); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); transition: opacity var(--t-med) var(--ease-spring); }
.step:first-child { padding-top: 0; }
.step:last-of-type { border-bottom: 0; }
.step[data-disabled] { opacity: .45; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--tint); color: var(--primary-hover); font-weight: 500; display: grid; place-items: center; font-size: var(--text-body-sm); }
.step[data-disabled] .step-num { background: var(--surface-2); color: var(--muted); }
.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.sub-label { font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); font-weight: 400; margin-bottom: 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: var(--s-2); }
.presets .sub-label { margin: 0; }
.chip { font: inherit; font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); font-weight: 400; height: 32px; padding: 0 14px; border-radius: 9999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.chip:hover { background: var(--surface-2); border-color: var(--color-cloud-shadow); }
.chip:active { transform: scale(.97); }
.chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chip.active { background: var(--tint); color: var(--primary-hover); border-color: var(--tint); font-weight: 500; }
.setup-actions { padding-top: var(--s-3); display: flex; justify-content: flex-end; }
.summary-card { padding: var(--card-padding); position: sticky; top: 88px; }
.summary-list { margin: 0 0 var(--s-3); display: grid; gap: 12px; }
.summary-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.summary-list dt { color: var(--muted); font-size: var(--text-body-sm); }
.summary-list dd { margin: 0; font-weight: 500; text-align: right; font-size: var(--text-body-sm); }
.rules { background: var(--surface-2); border-radius: 16px; padding: var(--s-2) var(--s-3); font-size: var(--text-body-sm); color: var(--text-2); }
.rules ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.rules li { margin-bottom: 6px; }

/* ---------- home: centered hero, feature-card pair ---------- */
.home-hero { text-align: center; padding: var(--s-7) 0 var(--s-6); max-width: 800px; margin: 0 auto; }
.home-hero h1 { font-size: var(--text-display); line-height: 1.09; letter-spacing: var(--tracking-display); font-weight: 400; margin-bottom: var(--s-3); }
.home-hero .lede { margin: 0 auto; }
.home-cards, .type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s-3); max-width: var(--page-max); margin: 0 auto; }
.home-card, .type-card { padding: 0; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.home-card:hover, .type-card:hover { border-color: var(--color-cloud-shadow); }
.home-card:active { transform: scale(.995); }
.home-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.home-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--surface); color: var(--primary); display: grid; place-items: center; font-size: 1.3rem; margin: var(--s-4) var(--s-4) 0; }
.home-card h2, .home-card p, .home-cta { padding: 0 var(--s-4); }
.home-card h2 { margin-top: var(--s-2); }
.home-card p { color: var(--muted); margin: 0; flex: 1; }
.home-cta { color: var(--primary); font-weight: 500; margin: var(--s-2) 0 var(--s-4); font-size: var(--text-body-sm); }
.type-card { padding: 0; }
.type-card .type-count { background: var(--tint); color: var(--primary-hover); padding: var(--s-4) var(--s-4) var(--s-3); font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); font-weight: 500; }
.type-card h2 { margin: var(--s-4) var(--s-4) 8px; }
.type-card p { margin: 0 var(--s-4); color: var(--muted); flex: 1; }
.type-actions { display: flex; gap: var(--s-2); margin: var(--s-3) var(--s-4) var(--s-4); flex-wrap: wrap; }
.type-actions .btn { flex: 1; justify-content: center; }
.home-stats { display: flex; justify-content: center; gap: var(--s-7); margin-top: var(--s-7); flex-wrap: wrap; }
.home-stats div { text-align: center; }
.home-stats strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: var(--text-heading-lg); letter-spacing: var(--tracking-heading-lg); line-height: 1.15; color: var(--text); }
.home-stats span { color: var(--muted); font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); }
.rules-ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: var(--text-body-sm); }
.rules-ol li { margin-bottom: 8px; }
.notice { padding: var(--s-3) var(--card-padding); }
.notice p { color: var(--muted); margin: 0; }
.auth-card { padding: var(--card-padding); max-width: 480px; display: grid; gap: 4px; }
.auth-card label { margin-top: 12px; }
.signed-in-bar { padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-3); border-radius: 16px; font-size: var(--text-body-sm); }
.new-type { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; padding: 16px; background: var(--surface-2); border-radius: 16px; }
.preview { margin-top: 12px; padding: 12px 16px; border-radius: 16px; background: var(--tint); color: var(--primary-hover); font-size: var(--text-body-sm); }
.preview.bad { background: var(--bad-soft); color: var(--bad); }
.preview ul { margin: 6px 0 0; padding-left: 18px; }
.format-example { font-family: var(--mono); font-size: 12px; letter-spacing: 0; background: var(--text); color: #fff; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 10px 0 0; }
.manage-card { padding: var(--s-3) var(--card-padding); margin-top: var(--s-3); }
.manage-select { max-width: 340px; }
.manage-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.manage-list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 16px; }
.manage-list li .m-title { flex: 1; font-weight: 500; }
.manage-list li .m-meta { color: var(--muted); font-size: var(--text-body-sm); }
.danger-card { border-color: #f6aea9; }
@media (max-width: 560px) { .manage-list li { flex-wrap: wrap; } .manage-list li .m-meta { width: 100%; } }
.section-card { padding: var(--card-padding); margin-bottom: var(--s-3); }
.section-card-wrap { margin-bottom: var(--s-3); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-2); }
.section-head h2 { margin: 0; }
.section-head .guide-links { margin: 0; }
.section-tag { font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); }
.notice-inline { padding: 14px 18px; background: var(--surface-2); border-radius: 16px; color: var(--muted); }
.notice-inline h2 { font-size: var(--text-body); margin-bottom: 2px; }
.notice-inline p { margin: 0; }
.sub-h { margin: var(--s-3) 0 var(--s-1); font-size: var(--text-body-sm); color: var(--muted); font-weight: 500; }
.req { color: var(--muted); font-weight: 400; }
.radio-row { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: 4px; }
.radio-row .toggle { font-weight: 400; }
.plan-badge { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 9999px; background: var(--tint); color: var(--primary-hover); font-size: var(--text-caption); letter-spacing: var(--tracking-caption); font-weight: 500; vertical-align: middle; }
.plan-badge.full { background: var(--good-soft); color: var(--good); }
.plan-badge.admin { background: var(--surface-2); color: var(--text-2); }
#ai-box .builder-start { padding: 0; margin: 0; }
#ai-box .builder-start .hint { max-width: 60ch; margin: 0; }

/* ---------- contributor guide ---------- */
.guide-links { margin: var(--s-2) 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.guide-aside { padding: var(--s-3); position: sticky; top: 88px; max-height: calc(100vh - 108px); overflow: auto; }
.guide-toggle { display: none; }
.guide-toggle:focus-visible, .map-toggle:focus-visible, .toggle input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.guide-aside h2 { font-size: var(--text-subheading); margin-bottom: 4px; }
.guide-step { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin-top: 10px; opacity: .6; transition: opacity var(--t-med) var(--ease-spring); }
.guide-step.active { opacity: 1; border-color: var(--tint); background: var(--tint); }
.guide-step h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: var(--text-body); }
.g-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: var(--text-caption); font-weight: 500; display: grid; place-items: center; flex-shrink: 0; }
.guide-step ul { margin: 0; padding-left: 18px; font-size: var(--text-body-sm); color: var(--text-2); }
.guide-step li { margin-bottom: 6px; }
.g-fields { margin: 6px 0 0; font-size: var(--text-body-sm); }
.g-fields dt { font-weight: 500; margin-top: 8px; }
.g-fields dd { margin: 2px 0 0; color: var(--muted); }
.guide-step code { background: var(--surface); }
.guide-page { padding: var(--s-5) var(--s-6); max-width: 900px; line-height: 1.67; }
.guide-page h1 { font-size: var(--text-heading); letter-spacing: var(--tracking-heading); margin-bottom: var(--s-2); }
.guide-page h2 { margin-top: var(--s-5); padding-bottom: 8px; }
.guide-page h3 { margin-top: var(--s-3); }
.guide-page p, .guide-page li { color: var(--text-2); }
.guide-page ul, .guide-page ol { padding-left: 22px; }
.guide-page li { margin-bottom: 6px; }
.guide-table { width: 100%; border-collapse: collapse; font-size: var(--text-body-sm); margin: 12px 0 var(--s-2); }
.guide-table th, .guide-table td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
.guide-table th { background: var(--surface-2); font-weight: 500; }

/* ---------- AI builder ---------- */
.tabs { display: inline-flex; gap: 0; margin: var(--s-2) 0 0; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 9999px; }
.tab { padding: 8px 18px; border-radius: 9999px; text-decoration: none; color: var(--muted); font-weight: 400; font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.builder-start { padding: var(--s-3) var(--card-padding); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: var(--s-3); align-items: start; }
.builder-main { display: grid; gap: var(--s-3); }
.source-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.source-box { border: 1px dashed var(--border); border-radius: 16px; padding: var(--s-2); background: var(--surface-2); }
.source-box h3 { margin: 0 0 12px; font-size: var(--text-body); }
.qr-box { width: 168px; height: 168px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; display: grid; place-items: center; padding: 6px; margin-bottom: 8px; }
.qr-box img, .qr-box canvas { width: 152px !important; height: 152px !important; }
.file-grid { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.file-grid li { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); aspect-ratio: 3 / 4; display: grid; place-items: center; }
.file-grid img { width: 100%; height: 100%; object-fit: cover; }
.file-grid .f-pdf { font-weight: 500; color: var(--bad); }
.file-grid .f-name { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(32,33,36,.72); color: #fff; font-size: 10px; letter-spacing: .3px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-grid .f-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(32,33,36,.75); color: #fff; font-size: .8rem; line-height: 1; cursor: pointer; }
.file-grid .f-del:hover { background: var(--bad); }
.file-grid .f-del:active { transform: scale(.9); }
.file-grid .f-del:focus-visible { outline: 2px solid var(--primary); }
.md-editor { font-family: var(--mono); font-size: 13px; letter-spacing: 0; line-height: 1.55; min-height: 440px; margin-top: 12px; border-radius: 8px; }
.revise-box { margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--border); }
.revise-row { justify-content: flex-start; margin-top: 6px; }
.revise-row input { flex: 1; }
.usage-box { margin-top: var(--s-2); padding: 12px 16px; background: var(--surface-2); border-radius: 12px; font-size: var(--text-body-sm); color: var(--muted); }
.capture-page { max-width: 520px; margin: 0 auto; text-align: center; padding: var(--s-3) 0; }
.cap-actions { display: grid; gap: 12px; margin: var(--s-3) 0; }
.cap-btn { justify-content: center; height: 56px; font-size: var(--text-body); cursor: pointer; }
.capture-page .file-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); text-align: left; }
.job-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 6px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.8); } }

/* ---------- library, share, students ---------- */
.share-box { max-width: 560px; }
.share-row { display: grid; grid-template-columns: 180px 1fr; gap: var(--s-3); align-items: start; margin-top: var(--s-2); }
.share-link input { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 9999px; font-size: var(--text-caption); letter-spacing: var(--tracking-caption); font-weight: 500; }
.status-pill.published { background: var(--good-soft); color: var(--good); }
.status-pill.draft { background: var(--surface-2); color: var(--muted); }
.m-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.take-page { max-width: 640px; margin: 0 auto; padding: var(--s-5) 0; }
.take-page .auth-card { max-width: none; margin-top: var(--s-3); }
.student-block { margin: var(--s-2) 0; padding: var(--s-2) var(--s-3); background: var(--tint); border-radius: 16px; }
.student-block p { margin: 0 0 8px; }
@media (max-width: 900px) { .share-row { grid-template-columns: 1fr; } .share-row .qr-box { margin: 0 auto; } .m-actions .btn { flex: 1 1 auto; justify-content: center; } }

/* ---------- quiz ---------- */
.quiz-header { padding: var(--s-2) var(--s-3); margin-bottom: var(--s-3); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-5); position: relative; border-radius: 16px; }
.quiz-exit { position: absolute; top: 12px; right: 16px; font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); text-decoration: none; font-weight: 500; display: inline-block; border-radius: 4px; }
.quiz-exit:hover { color: var(--bad); }
.quiz-exit:active { transform: translateY(1px); }
.quiz-exit:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.map-toggle { font: inherit; background: none; border: 0; padding: 0; display: flex; align-items: center; gap: 6px; cursor: pointer; color: inherit; border-radius: 4px; }
.map-toggle:hover { color: var(--primary); }
.map-toggle:active { transform: translateY(1px); }
.map-toggle h3 { margin: 0; }
.map-toggle .chev { display: none; color: var(--muted); }
.mobile-bar { display: none; }
.quiz-meta { display: flex; gap: var(--s-5); flex-wrap: wrap; flex: 1; }
.quiz-meta div { display: flex; flex-direction: column; }
.quiz-meta strong { font-weight: 500; font-size: var(--text-body-sm); }
.meta-label { font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); }
.progress { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.progress-bar { flex: 1; height: 8px; border-radius: 9999px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; width: 100%; background: var(--primary); transform: scaleX(0); transform-origin: left center; transition: transform .3s var(--ease-spring); }
.progress-text { font-size: var(--text-body-sm); color: var(--muted); white-space: nowrap; }
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s-3); align-items: start; }
.question-card { padding: var(--card-padding); }
.question-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--s-2); }
.q-index { font-weight: 500; color: var(--text); font-size: var(--text-body-sm); }
.q-tag { font-family: var(--mono); letter-spacing: 0; background: var(--tint); color: var(--primary-hover); font-size: var(--text-caption); padding: 3px 10px; border-radius: 9999px; }
.q-type { background: var(--surface-2); color: var(--muted); font-size: var(--text-caption); letter-spacing: var(--tracking-caption); padding: 3px 10px; border-radius: 9999px; }
.question-top .btn { margin-left: auto; }
.q-text { font-family: var(--font-display); font-size: var(--text-heading-sm); font-weight: 400; line-height: 1.4; letter-spacing: var(--tracking-heading-sm); margin: 0 0 var(--s-3); }
.options { display: grid; gap: 12px; }
.option { display: grid; grid-template-columns: 36px 1fr; gap: 16px; align-items: center; padding: 14px 18px; border: 1px solid var(--border); border-radius: 16px; cursor: pointer; background: var(--surface); transition: transform var(--t-fast) var(--ease-spring); }
.option:hover { background: var(--surface-2); border-color: var(--color-cloud-shadow); }
.option:active { transform: scale(.995); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .letter { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; font-weight: 500; font-size: var(--text-body-sm); color: var(--muted); }
.option.selected { background: var(--tint); border-color: var(--primary); }
.option.selected .letter { background: var(--primary); color: #fff; border-color: var(--primary); }
.option:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.question-nav { display: flex; gap: 12px; margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.question-nav .btn-primary { margin-left: auto; }
.map-card { padding: var(--s-3); position: sticky; top: 88px; }
.map-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.map-head h3 { margin: 0; }
.map-legend { display: flex; gap: 14px; font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--border); background: var(--surface); }
.dot-answered { background: var(--primary); border-color: var(--primary); }
.dot-flagged { background: var(--warn); border-color: var(--warn); }
.dot-current { background: var(--surface); border: 2px solid var(--primary); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; max-height: 46vh; overflow: auto; padding: 2px; }
.map-cell { font: inherit; font-size: var(--text-caption); font-weight: 500; height: 36px; border-radius: 9999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; position: relative; }
.map-cell:hover { background: var(--surface-2); border-color: var(--color-cloud-shadow); }
.map-cell:active { transform: scale(.94); }
.map-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.map-cell.answered { background: var(--primary); color: #fff; border-color: var(--primary); }
.map-cell.flagged::after { content: ""; position: absolute; top: 2px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.map-cell.current { outline: 2px solid var(--primary); outline-offset: 1px; }
.map-stats { margin-top: 12px; font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); display: flex; justify-content: space-between; }

/* ---------- score ---------- */
.score-card { padding: var(--card-padding); display: grid; grid-template-columns: 220px 1fr; gap: var(--s-5); align-items: center; margin-bottom: var(--s-3); }
.score-ring { width: 200px; height: 200px; border-radius: 50%; background: conic-gradient(var(--ring-color, var(--primary)) calc(var(--pct) * 1%), var(--border) 0); display: grid; place-items: center; margin: 0 auto; }
.score-ring-inner { width: 164px; height: 164px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; align-content: center; text-align: center; }
.score-ring-inner span { font-family: var(--font-display); font-size: var(--text-heading-lg); letter-spacing: var(--tracking-heading-lg); font-weight: 400; line-height: 1; }
.score-ring-inner small { color: var(--muted); font-weight: 400; margin-top: 6px; font-size: var(--text-caption); letter-spacing: var(--tracking-caption); }
.score-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: var(--s-3) 0; }
.score-stats div { background: var(--surface-2); border-radius: 16px; padding: 12px 16px; }
.score-stats dt { font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); }
.score-stats dd { margin: 2px 0 0; font-size: var(--text-heading-sm); letter-spacing: var(--tracking-heading-sm); font-weight: 500; }
.good { color: var(--good); } .bad { color: var(--bad); }
.save-status { font-size: var(--text-body-sm); color: var(--muted); margin: 0 0 var(--s-2); }
.save-status.ok { color: var(--good); } .save-status.err { color: var(--bad); }
.score-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.review-card { padding: var(--card-padding); }
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--s-2); }
.toggle { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: var(--text-body-sm); margin: 0; cursor: pointer; color: var(--text-2); }
.toggle:hover { color: var(--text); }
.toggle:active { opacity: .8; }
.toggle input { accent-color: var(--primary); width: 16px; height: 16px; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.review-item { border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; }
.review-item.correct { background: #f3faf5; }
.review-item.wrong { background: #fff6f5; }
.review-item.skipped { background: #fffbf0; }
.review-item .rv-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: var(--text-body-sm); }
.rv-badge { padding: 2px 12px; border-radius: 9999px; font-weight: 500; font-size: var(--text-caption); letter-spacing: var(--tracking-caption); }
.rv-badge.correct { background: var(--good-soft); color: var(--good); }
.rv-badge.wrong { background: var(--bad-soft); color: var(--bad); }
.rv-badge.skipped { background: var(--warn-soft); color: var(--warn); }
.rv-q { font-weight: 500; margin: 0 0 12px; }
.rv-opts { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--text-body-sm); }
.rv-opts li { padding: 8px 12px; border-radius: 8px; display: flex; gap: 10px; }
.rv-opts li b { min-width: 18px; }
.rv-opts li.is-correct { background: var(--good-soft); color: var(--good); }
.rv-opts li.is-chosen.is-wrong { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.rv-opts li .tag { margin-left: auto; font-size: var(--text-caption); font-weight: 500; letter-spacing: var(--tracking-caption); }

/* ---------- results ---------- */
.results-toolbar { padding: 12px 20px; display: flex; gap: 16px; align-items: center; margin-bottom: var(--s-2); border-radius: 9999px; }
.results-toolbar input { max-width: 380px; border-radius: 9999px; padding: 8px 16px; }
.table-wrap { overflow: hidden; }
.results-table { width: 100%; border-collapse: collapse; font-size: var(--text-body-sm); letter-spacing: var(--tracking-body-sm); }
.results-table th, .results-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.results-table th { background: var(--surface-2); font-size: var(--text-caption); letter-spacing: var(--tracking-caption); color: var(--muted); font-weight: 500; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr:hover { background: var(--surface-2); }
.results-table .num { text-align: right; }
.results-table td.num { font-variant-numeric: tabular-nums; }
.pct-pill { display: inline-block; padding: 2px 12px; border-radius: 9999px; font-weight: 500; font-size: var(--text-caption); }
.pct-pill.hi { background: var(--good-soft); color: var(--good); }
.pct-pill.mid { background: var(--warn-soft); color: var(--warn); }
.pct-pill.lo { background: var(--bad-soft); color: var(--bad); }
.src-pill { font-size: var(--text-caption); color: var(--muted); background: var(--surface-2); padding: 2px 10px; border-radius: 9999px; }
.empty { padding: var(--s-5); text-align: center; color: var(--muted); margin: 0; }
.back-link { display: inline-block; margin-bottom: var(--s-2); text-decoration: none; font-weight: 400; font-size: var(--text-body-sm); }
.back-link:hover { text-decoration: underline; }
.back-link:active { transform: translateX(-1px); }
.back-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- modal: 8px radius, scrim only ---------- */
.modal { position: fixed; inset: 0; background: rgba(32, 33, 36, .5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { padding: var(--s-3); max-width: 480px; width: 100%; border-radius: var(--radius-modal); }
.modal-box p { color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-3); }

/* ---------- loading ---------- */
.loading { padding: var(--s-7); text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --card-padding: 24px; }
  .nav-burger { display: block; }
  .topbar.inline-nav .nav-burger { display: none; }
  .topbar.inline-nav .nav { display: flex; position: static; flex-direction: row; padding: 0; background: none; border: 0; gap: 0; }
  .topbar.inline-nav .nav-link { padding: 8px 8px; font-size: var(--text-body-sm); }
  .topbar.inline-nav .brand { min-width: 0; flex: 1; }
  .topbar.inline-nav .brand-text { overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
  .topbar.inline-nav .nav-link.active::after { left: 8px; right: 8px; width: auto; }
  .topbar.inline-nav .nav-context { display: none; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; gap: 2px; }
  .nav.open { display: flex; }
  .nav-link { padding: 12px 12px; font-size: var(--text-body); }
  .nav-link.active::after { left: 12px; right: auto; width: 24px; }
  .nav-group > .nav-link { width: 100%; text-align: left; }
  .nav-menu { position: static; display: none; border: 0; padding: 2px 8px 6px 20px; background: var(--surface-2); border-radius: 12px; }
  .nav-group.open .nav-menu { display: block; }
  .nav-group:hover .nav-menu { display: none; }
  .nav-group.open:hover .nav-menu { display: block; }
  .nav-upload { margin: 12px 0 0; justify-content: center; }
  .new-type { grid-template-columns: 1fr; }
  .setup-grid, .quiz-layout, .score-card, .builder-grid, .source-row { grid-template-columns: 1fr; }
  .builder-grid .guide-aside { order: 1; }
  .builder-grid .guide-aside .guide-body { display: block; }
  .builder-grid .guide-toggle { display: none; }
  .revise-row { flex-direction: column; } .revise-row .btn { width: 100%; justify-content: center; }
  .summary-card, .map-card, .guide-aside { position: static; max-height: none; }
  .guide-toggle { display: block; width: 100%; font: inherit; font-weight: 500; font-size: var(--text-body-sm); height: 44px; border-radius: 9999px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); cursor: pointer; }
  .guide-toggle:active { transform: scale(.98); }
  .guide-aside .guide-body { display: none; margin-top: 14px; }
  .guide-aside.open .guide-body { display: block; }
  .guide-aside { padding: 12px; order: -1; }
  .guide-page { padding: 20px; }
  .summary-card .rules { display: none; }
  .home-hero { padding: var(--s-6) 0 var(--s-5); }
  .home-hero h1 { font-size: var(--text-heading-lg); letter-spacing: var(--tracking-heading-lg); line-height: 1.15; }
  .home-stats { gap: var(--s-5); margin-top: var(--s-6); }
  .map-grid { max-height: 220px; }
  .map-toggle .chev { display: inline; }
  .score-stats { grid-template-columns: repeat(2, 1fr); }
  .quiz-header { padding: 14px 16px; gap: 12px 18px; }
  .quiz-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .quiz-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .quiz-exit { top: 10px; right: 12px; }
  .progress { min-width: 0; width: 100%; }
  .question-nav { display: none; }
  .map-card { display: none; }
  .map-card.open { display: block; }
  .mobile-bar { display: grid; grid-template-columns: 56px 1fr 1fr 1.4fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .mobile-bar .btn { justify-content: center; padding: 0 10px; height: 44px; }
  #view-quiz { padding-bottom: 88px; }
  .option { padding: 14px; min-height: 54px; }
  .q-text { font-size: var(--text-subheading); letter-spacing: var(--tracking-subheading); }
  .score-ring { width: 160px; height: 160px; }
  .score-ring-inner { width: 130px; height: 130px; }
  .score-ring-inner span { font-size: var(--text-heading); letter-spacing: var(--tracking-heading); }
  .score-actions .btn { flex: 1 1 45%; justify-content: center; }
  .results-table thead { display: none; }
  .results-table, .results-table tbody, .results-table tr, .results-table td { display: block; width: 100%; }
  .results-table tr { padding: 12px 16px 14px; border-bottom: 1px solid var(--border); position: relative; }
  .results-table td { padding: 2px 0; border: 0; white-space: normal; text-align: left !important; }
  .results-table td.num { display: inline-block; width: auto; margin-right: 14px; }
  .results-table td:first-child { color: var(--muted); font-size: var(--text-caption); }
  .results-table td:nth-child(2) { font-size: var(--text-body); }
  .results-table td:last-child { position: absolute; top: 12px; right: 12px; width: auto; }
  .results-toolbar { flex-direction: column; align-items: stretch; gap: 6px; border-radius: 16px; }
  .results-toolbar input { max-width: none; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 560px) {
  .topbar-inner { padding: 0 16px; height: 56px; gap: 8px; }
  .brand-text small { display: none; }
  .brand-text { font-size: var(--text-body); white-space: nowrap; }
  .name-long { display: none; } .name-short { display: inline; }
  .brand-mark { width: 30px; height: 30px; font-size: 1rem; flex-shrink: 0; }
  .brand { gap: 8px; min-width: 0; }
  .quiz-exit { position: static; width: 100%; text-align: right; order: 3; margin-top: -4px; }
  .page { padding: var(--s-3) 16px var(--s-6); }
  h1 { font-size: var(--text-heading); letter-spacing: var(--tracking-heading); }
  .home-hero h1 { font-size: 36px; letter-spacing: -.3px; }
  .range-row { grid-template-columns: 1fr 1fr; }
  .step { grid-template-columns: 30px 1fr; gap: 12px; }
  .step-num { width: 28px; height: 28px; font-size: var(--text-caption); }
  .setup-actions .btn { width: 100%; justify-content: center; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .footer { padding-bottom: 110px; }
}
@media print {
  .topbar, .footer, .score-actions, .hero-actions, .results-toolbar, .btn, .mobile-bar, .back-link { display: none !important; }
}

/* Account & balance */
.bar-actions { display: inline-flex; gap: 8px; align-items: center; }
.balance-row { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: var(--s-4); align-items: start; }
.balance-big { font-size: var(--text-display, 40px); font-weight: 500; letter-spacing: -0.5px; margin: 4px 0; }
.amount-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.amount-btns input { width: 110px; margin: 0; }
.amount-btns .btn.selected { background: var(--tint); border-color: var(--primary); color: var(--primary-hover); }
.ledger-neg { color: var(--text-2); }
.ledger-pos { color: var(--good); font-weight: 500; }
@media (max-width: 640px) { .balance-row { grid-template-columns: 1fr; } }

/* ---------- Marketing home ---------- */
.mk-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s-6); align-items: center; padding: var(--s-6) 0 var(--s-7); }
.mk-hero h1 { font-size: 56px; line-height: 1.08; letter-spacing: -0.6px; margin-bottom: var(--s-3); }
.mk-cta { display: flex; gap: var(--s-2); flex-wrap: wrap; margin: var(--s-4) 0 var(--s-2); }
.mk-hero-visual { position: relative; min-height: 340px; }
.mock-screen { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 0; width: 88%; box-shadow: 0 20px 60px rgba(32,33,36,.10); }
.mock-bar { display: flex; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.mock-body { padding: 20px 24px 24px; }
.mock-q { font-size: var(--text-caption); color: var(--muted); display: flex; justify-content: space-between; }
.mock-q em { font-style: normal; background: var(--tint); color: var(--primary-hover); padding: 1px 8px; border-radius: 999px; }
.mock-qt { font-size: var(--text-subheading); margin: 10px 0 14px; font-weight: 500; }
.mock-opt { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin: 8px 0; font-size: var(--text-body-sm); }
.mock-opt.sel { border-color: var(--primary); background: var(--tint); color: var(--primary-hover); font-weight: 500; }
.mock-phone { position: absolute; right: 0; bottom: -20px; width: 120px; height: 220px; background: var(--color-charcoal-ink); border-radius: 22px; padding: 14px 10px; box-sizing: border-box; box-shadow: 0 20px 50px rgba(32,33,36,.25); animation: mk-float 6s ease-in-out infinite; }
.mock-cam { width: 40px; height: 6px; background: #555; border-radius: 3px; margin: 0 auto 12px; }
.mock-page { background: #fff; border-radius: 6px; height: 70px; margin-bottom: 10px; background-image: repeating-linear-gradient(#fff 0 6px, #e3e6ea 6px 8px); background-size: 100% 12px; }
@keyframes mk-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.mk-section { padding: var(--s-6) 0; }
.mk-sub { text-align: center; color: var(--muted); max-width: 640px; margin: -8px auto var(--s-4); }
/* walkthrough */
.walk { display: grid; grid-template-columns: 1fr 1.2fr; gap: 0; overflow: hidden; }
.walk-steps { list-style: none; margin: 0; padding: var(--s-2); border-right: 1px solid var(--border); background: var(--surface-2); }
.walk-steps button { all: unset; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; cursor: pointer; position: relative; color: var(--text-2); }
.walk-steps button:hover { background: var(--surface); }
.walk-steps button.active { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.walk-steps button small { display: none; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.walk-steps button.active small { display: block; }
.walk-n { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: inline-grid; place-items: center; font-size: var(--text-caption); font-weight: 500; }
.walk-steps button.active .walk-n { background: var(--primary); color: #fff; border-color: var(--primary); }
.walk-prog { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; background: var(--border); border-radius: 2px; overflow: hidden; display: none; }
.walk-steps button.active .walk-prog { display: block; }
.walk-steps button.active .walk-prog::after { content: ""; display: block; height: 100%; background: var(--primary); width: 0; animation: walk-fill 4.5s linear forwards; }
@keyframes walk-fill { to { width: 100%; } }
.walk-screen { padding: var(--s-4); display: grid; place-items: center; min-height: 360px; background: linear-gradient(180deg, #fff, var(--surface-2)); }
.walk-screen.in > * { animation: walk-in .45s var(--ease-spring) both; }
@keyframes walk-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.ws-split { display: flex; gap: var(--s-3); align-items: center; }
.ws-laptop { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 16px 20px; width: 220px; box-shadow: 0 10px 30px rgba(32,33,36,.08); }
.ws-title { font-weight: 500; margin-bottom: 10px; }
.ws-cap { color: var(--muted); font-size: var(--text-caption); margin-top: 8px; }
.ws-qr { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; width: 112px; aspect-ratio: 1; padding: 6px; border: 1px solid var(--border); border-radius: 6px; }
.ws-qr.small { width: 84px; margin-top: 12px; }
.ws-qr i { background: #fff; }
.ws-qr i:nth-child(3n), .ws-qr i:nth-child(7n+1), .ws-qr i:nth-child(11n+2), .ws-qr i:nth-child(-n+7), .ws-qr i:nth-child(n+43) { background: var(--color-charcoal-ink); }
.ws-qr i:nth-child(2), .ws-qr i:nth-child(4), .ws-qr i:nth-child(6), .ws-qr i:nth-child(45), .ws-qr i:nth-child(47) { background: #fff; }
.ws-phone { width: 96px; height: 180px; background: var(--color-charcoal-ink); border-radius: 18px; padding: 12px 8px; box-sizing: border-box; position: relative; }
.ws-scan { height: 100%; border-radius: 8px; background: #fff; position: relative; overflow: hidden; }
.ws-scan::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--primary); animation: ws-scan 1.6s ease-in-out infinite; }
@keyframes ws-scan { 0%, 100% { top: 10%; } 50% { top: 85%; } }
.ws-phone-cam { background: #333; }
.ws-phone-cam .ws-shutter { position: absolute; left: 50%; bottom: 14px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transform: translateX(-50%); animation: ws-shutter 2s ease-in-out infinite; }
@keyframes ws-shutter { 0%, 70%, 100% { transform: translateX(-50%) scale(1); } 80% { transform: translateX(-50%) scale(.8); } }
.ws-thumbs { display: flex; gap: 8px; }
.ws-thumbs i { width: 44px; height: 58px; border-radius: 6px; background-image: repeating-linear-gradient(#fff 0 5px, #dfe3e8 5px 7px); background-size: 100% 10px; border: 1px solid var(--border); animation: walk-in .4s both; }
.ws-thumbs i:nth-child(2) { animation-delay: .5s; } .ws-thumbs i:nth-child(3) { animation-delay: 1s; }
.ws-form { width: min(100%, 360px); background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 20px 24px; }
.ws-form label { display: block; font-size: var(--text-caption); color: var(--muted); margin: 10px 0 4px; }
.ws-input { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: var(--text-body-sm); }
.ws-text { min-height: 56px; }
.ws-caret { display: inline-block; width: 1px; height: 14px; background: var(--text); margin-left: 2px; vertical-align: middle; animation: ws-caret 1s steps(2) infinite; }
@keyframes ws-caret { to { opacity: 0; } }
.ws-gen { text-align: center; width: min(100%, 320px); }
.ws-spin { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 12px; animation: spin 1s linear infinite; }
.ws-bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.ws-bar i { display: block; height: 100%; width: 0; background: var(--primary); animation: walk-fill 4s ease-out forwards; }
.ws-list { width: min(100%, 380px); background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px; }
.ws-head { display: flex; justify-content: space-between; font-size: var(--text-caption); color: var(--muted); padding: 4px 8px; }
.ws-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px; border-radius: 8px; font-size: var(--text-body-sm); margin: 4px 0; background: var(--surface-2); animation: walk-in .4s both; }
.ws-row:nth-child(2) { animation-delay: .25s; } .ws-row:nth-child(3) { animation-delay: .5s; } .ws-row:nth-child(4) { animation-delay: .75s; }
.ws-row.ok { border-left: 3px solid var(--good); } .ws-row.warn { border-left: 3px solid var(--warn); }
.ws-row em { font-style: normal; padding: 1px 10px; border-radius: 999px; font-weight: 500; }
.ws-row em.hi { background: var(--good-soft); color: var(--good); } .ws-row em.mid { background: var(--warn-soft); color: var(--warn); }
.ws-btns { display: flex; gap: 8px; margin-top: 10px; }
.ws-btns b, .ws-btns span { padding: 6px 14px; border-radius: 999px; font-size: var(--text-body-sm); font-weight: 500; }
.ws-btns b { background: var(--primary); color: #fff; } .ws-btns span { border: 1px solid var(--border); }
.ws-share { width: min(100%, 320px); background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 20px 24px; }
.ws-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: var(--text-body-sm); font-family: var(--mono); }
.ws-link b { background: var(--primary); color: #fff; padding: 4px 12px; border-radius: 999px; font-family: var(--font); font-size: var(--text-caption); }
/* features, pricing, faq */
.mk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.mk-feature { padding: var(--s-4); }
.mk-feature p { color: var(--muted); margin: 0; }
.mk-pricing { display: grid; grid-template-columns: repeat(2, minmax(0, 440px)); justify-content: center; gap: var(--s-3); }
.mk-plan { padding: var(--s-4); display: flex; flex-direction: column; }
.mk-plan-main { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.mk-price { font-size: var(--text-heading-lg); letter-spacing: var(--tracking-heading-lg); margin: 0 0 var(--s-2); font-weight: 400; }
.mk-price span { font-size: var(--text-body); color: var(--muted); }
.mk-plan ul { margin: 0 0 var(--s-3); padding-left: 20px; color: var(--text-2); flex: 1; }
.mk-plan li { margin: 6px 0; }
.mk-faq details { padding: 0 var(--s-3); margin-bottom: 12px; max-width: 800px; margin-left: auto; margin-right: auto; }
.mk-faq summary { cursor: pointer; padding: 16px 0; font-weight: 500; list-style: none; display: flex; justify-content: space-between; }
.mk-faq summary::after { content: "+"; color: var(--muted); }
.mk-faq details[open] summary::after { content: "−"; }
.mk-faq p { margin: 0 0 16px; color: var(--muted); }
.mk-final { text-align: center; padding: var(--s-6); margin: var(--s-6) auto 0; max-width: 720px; background: var(--tint); border-color: transparent; }
.mk-final p { color: var(--text-2); margin-bottom: var(--s-3); }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 900px) { .mk-hero { grid-template-columns: 1fr; } .mk-hero h1 { font-size: 40px; } .mk-hero-visual { min-height: 280px; } .mk-grid { grid-template-columns: 1fr 1fr; } .walk { grid-template-columns: 1fr; } .walk-steps { border-right: 0; border-bottom: 1px solid var(--border); } .walk-screen { min-height: 300px; } }
@media (max-width: 640px) { .mk-grid, .mk-pricing { grid-template-columns: 1fr; } .mk-hero h1 { font-size: 34px; } .mock-screen { width: 100%; } .mock-phone { display: none; } .walk-steps button small { display: none !important; } .ws-split { flex-direction: column; } }
@media (prefers-reduced-motion: reduce) { .mock-phone, .ws-scan::after, .ws-shutter, .ws-caret, .ws-spin, .ws-bar i, .walk-prog::after { animation: none !important; } .ws-bar i { width: 70%; } .walk-screen.in > *, .ws-row, .ws-thumbs i { animation: none !important; } }
