/* ═══════════════════════════════════════════════════════════════════════════
   MockTestPro — Material Design 3 theme
   Legacy token names (--brand, --ink, …) are kept because the JS uses them in
   inline styles; Material tokens (--elev-*, --primary*, shape) are layered on.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Brand / primary (kept names for JS inline styles) */
  --brand:        #0d9eb5;
  --brand-dark:   #0a7f92;
  --brand-light:  #d4f1f6;
  --primary:      #0d9eb5;
  --on-primary:   #ffffff;
  --primary-container:    #b6ecf3;
  --on-primary-container: #00363f;

  /* Neutral / text */
  --ink:          #1b1c1e;
  --ink-soft:     #44474a;
  --muted:        #74777b;
  --line:         #e0e3e7;
  --outline:      #c3c7cd;

  /* Surfaces (M3 tonal) */
  --bg:           #f7f9fb;
  --card:         #ffffff;
  --surface-1:    #f2f5f8;
  --surface-2:    #ecf1f5;

  /* Semantic */
  --green:        #2e7d32;
  --green-bg:     #d7f5da;
  --red:          #ba1a1a;
  --red-bg:       #ffdad6;
  --amber:        #b26a00;
  --purple:       #6750a4;

  /* Shape (M3 corner scale) */
  --r-xs: 8px;  --r-sm: 12px;  --r-md: 16px;  --r-lg: 24px;  --r-full: 999px;
  --radius: 16px;

  /* Elevation (M3 dual-shadow) */
  --elev-1: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px 1px rgba(0,0,0,.08);
  --elev-2: 0 1px 2px rgba(0,0,0,.08), 0 2px 6px 2px rgba(0,0,0,.10);
  --elev-3: 0 4px 8px 3px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.12);
  --shadow:    var(--elev-1);
  --shadow-lg: var(--elev-3);

  --font: 'Roboto Flex', 'Roboto', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Loaders ─────────────────────────────────────────────────────────────── */
.boot-loader { display: grid; place-items: center; height: 100vh; }
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 4px solid var(--primary-container); border-top-color: var(--primary);
  animation: spin .7s cubic-bezier(.5,.1,.5,.9) infinite;
}
.spinner.sm { width: 20px; height: 20px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-pad { display: grid; place-items: center; padding: 60px 16px; gap: 12px; color: var(--muted); }

/* ── Buttons (M3: pill, state layer, ripple) ─────────────────────────────── */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; letter-spacing: .01em; cursor: pointer;
  border: none; border-radius: var(--r-full); padding: 10px 22px; min-height: 40px;
  transition: box-shadow .2s, background .2s, opacity .2s; white-space: nowrap; user-select: none;
}
.btn:hover { text-decoration: none; }
/* state layer */
.btn::before { content: ''; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; }
.btn:hover::before  { opacity: .08; }
.btn:active::before { opacity: .12; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--elev-1); }
.btn-primary:hover { box-shadow: var(--elev-2); }
.btn-ghost { background: transparent; color: var(--brand-dark); border: 1px solid var(--outline); }
.btn-light { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.5); }
.btn-danger { background: var(--red); color: #fff; box-shadow: var(--elev-1); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 16px; font-size: 13px; min-height: 34px; }
.btn:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.btn:disabled::before { opacity: 0; }
/* ripple */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25; pointer-events: none; animation: ripple .5s ease-out; }
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }

/* ── Top app bar ─────────────────────────────────────────────────────────── */
.nav {
  display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 64px;
  background: var(--card); box-shadow: var(--elev-1); position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; color: var(--brand-dark); }
.brand .logo { width: 36px; height: 36px; display: grid; place-items: center; background: var(--primary); color: #fff; border-radius: 50%; font-size: 18px; }
.nav .links { display: flex; gap: 6px; margin-left: 10px; }
.nav .links a { color: var(--ink-soft); font-weight: 500; padding: 8px 14px; border-radius: var(--r-full); transition: background .15s; }
.nav .links a:hover { background: var(--surface-2); text-decoration: none; }
.nav-burger { display: none; background: none; border: none; font-size: 24px; cursor: pointer; padding: 8px; border-radius: 50%; color: var(--ink); }
.nav-burger:hover { background: var(--surface-2); }
.nav .spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; font-weight: 600; }

/* Navigation drawer (M3) */
.drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 49; opacity: 0; transition: opacity .25s; }
.drawer-overlay.open { display: block; opacity: 1; }
.drawer { position: fixed; top: 0; left: 0; height: 100%; width: 300px; background: var(--card); z-index: 50;
  border-top-right-radius: var(--r-md); border-bottom-right-radius: var(--r-md);
  box-shadow: var(--elev-3); transform: translateX(-100%); transition: transform .26s cubic-bezier(.2,0,0,1); padding: 16px 12px; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.drawer-links { display: flex; flex-direction: column; gap: 2px; }
.drawer-links a { padding: 14px 16px; border-radius: var(--r-full); color: var(--ink-soft); font-weight: 500; }
.drawer-links a:hover { background: var(--surface-2); text-decoration: none; }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 4px; }
.page-sub { color: var(--muted); margin-bottom: 22px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Cards (M3 elevated / filled) ────────────────────────────────────────── */
.card { background: var(--card); border: none; border-radius: var(--r-md); box-shadow: var(--elev-1); }
.card-pad { padding: 20px; }
.cat-card { cursor: pointer; transition: box-shadow .2s, transform .2s; display: flex; flex-direction: column; gap: 6px; }
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--elev-2); }
.cat-card .ic { width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; font-size: 24px; margin-bottom: 6px; }
.cat-card h3 { font-size: 16px; font-weight: 600; }
.cat-card p { color: var(--muted); font-size: 13px; }

.test-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; transition: background .15s; }
.test-row + .test-row { border-top: 1px solid var(--line); }
.test-row:hover { background: var(--surface-1); }
.test-row .meta { flex: 1; }
.test-row .meta h4 { font-size: 15px; font-weight: 600; }
.test-row .meta .sub { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-xs); letter-spacing: .02em; }
.badge.free { background: var(--green-bg); color: var(--green); }
/* Translucent tints so badges stay readable in both light & dark themes */
.badge.premium { background: rgba(178,106,0,.16); color: var(--amber); }
.badge.new { background: rgba(103,80,164,.16); color: var(--purple); }

/* Chips (M3 filter chips) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 8px 16px; border-radius: var(--r-xs); border: 1px solid var(--outline); background: transparent; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-soft); transition: .15s; }
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { padding: 12px 18px; cursor: pointer; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; transition: color .15s; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--primary); }

/* ── Landing ─────────────────────────────────────────────────────────────── */
.hero { background: linear-gradient(135deg, #0a7f92, #0d9eb5); color: #fff; }
.hero-inner { max-width: 1080px; margin: 0 auto; padding: 72px 20px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 44px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
.hero p.lead { font-size: 18px; opacity: .95; margin: 18px 0 26px; max-width: 520px; }
.hero .cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-card { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: var(--r-lg); padding: 22px; backdrop-filter: blur(6px); }
.hero-stats { display: flex; gap: 26px; margin-top: 30px; }
.hero-stats .n { font-size: 28px; font-weight: 800; }
.hero-stats .l { opacity: .85; font-size: 13px; }
.section { padding: 64px 20px; }
.section h2 { font-size: 30px; font-weight: 700; text-align: center; }
.section .sub { text-align: center; color: var(--muted); margin: 8px auto 40px; max-width: 560px; }
.feature { text-align: center; padding: 26px; }
.feature .ic { width: 60px; height: 60px; border-radius: var(--r-md); background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; font-size: 28px; margin: 0 auto 14px; }
.feature h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 14px; }
.cta-band { background: #1b1c1e; color: #fff; text-align: center; padding: 56px 20px; }
.cta-band h2 { font-size: 28px; font-weight: 700; }

footer.site { background: #1b1c1e; color: #c8cace; padding: 44px 20px 24px; }
footer.site .cols { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
footer.site h4 { color: #fff; margin-bottom: 12px; font-size: 15px; }
footer.site a { color: #c8cace; display: block; padding: 4px 0; }
footer.site .copy { max-width: 1080px; margin: 26px auto 0; padding-top: 18px; border-top: 1px solid #34363a; font-size: 13px; color: #9a9da1; }

/* ── Auth ────────────────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--primary-container), var(--bg)); }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--elev-3); padding: 36px 30px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; }
.auth-card h1 { text-align: center; font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-card .muted { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }

/* Material outlined text fields */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--ink-soft); }
.field input, .field textarea, .field select,
select, input[type="file"] { font: inherit; }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 14px; border: 1px solid var(--outline); border-radius: var(--r-xs);
  background: var(--card); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary);
}
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px; border: 1px solid var(--outline); border-radius: var(--r-full); background: var(--card); cursor: pointer; font: inherit; font-weight: 500; transition: background .15s; }
.google-btn:hover { background: var(--surface-2); }
.alert { padding: 12px 16px; border-radius: var(--r-xs); font-size: 14px; margin-bottom: 16px; }
.alert.err { background: var(--red-bg); color: var(--red); }
.alert.ok { background: var(--green-bg); color: var(--green); }
.forgot-link { font-size: 13px; }

/* ── Test engine ─────────────────────────────────────────────────────────── */
.exam { position: fixed; inset: 0; background: var(--card); display: flex; flex-direction: column; z-index: 100; }
.exam-top { display: flex; align-items: center; gap: 16px; padding: 12px 20px; box-shadow: var(--elev-1); z-index: 1; }
.exam-top .title { font-weight: 600; flex: 1; }
.timer { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.timer .clock { background: #2f3033; color: #fff; padding: 5px 10px; border-radius: var(--r-xs); font-variant-numeric: tabular-nums; }
.timer.low .clock { background: var(--red); }
.exam-body { flex: 1; display: grid; grid-template-columns: 1fr 300px; min-height: 0; }
.q-pane { padding: 28px 32px; overflow-y: auto; }
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.q-head .qno { font-weight: 700; font-size: 17px; }
.q-marks { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.q-marks .pos { background: var(--green-bg); color: var(--green); padding: 3px 9px; border-radius: var(--r-xs); font-weight: 600; }
.q-marks .neg { background: var(--red-bg); color: var(--red); padding: 3px 9px; border-radius: var(--r-xs); font-weight: 600; }
.q-text { font-size: 17px; line-height: 1.7; margin-bottom: 22px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--outline); border-radius: var(--r-sm); margin-bottom: 12px; cursor: pointer; transition: .15s; }
.opt:hover { border-color: var(--primary); background: var(--surface-1); }
.opt.sel { border-color: var(--primary); background: var(--primary-container); }
.opt .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex-shrink: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.opt.sel .dot { border-color: var(--primary); background: var(--primary); color: #fff; }
.opt .ltr { font-weight: 600; margin-right: 2px; }
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.correct .dot { border-color: var(--green); background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-bg); }
.opt.wrong .dot { border-color: var(--red); background: var(--red); color: #fff; }
.explanation { margin-top: 18px; padding: 14px 16px; background: var(--primary-container); border-radius: var(--r-sm); font-size: 14px; color: var(--on-primary-container); }

.exam-side { border-left: 1px solid var(--line); background: var(--surface-1); display: flex; flex-direction: column; min-height: 0; }
.side-user { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 14px 16px; font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.palette { padding: 14px 16px; overflow-y: auto; flex: 1; }
.palette h5 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.pal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pal-btn { aspect-ratio: 1; border: 1px solid var(--outline); border-radius: var(--r-xs); background: var(--card); cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink); transition: .12s; }
.pal-btn:hover { background: var(--surface-2); }
.pal-btn.answered { background: var(--green); color: #fff; border-color: var(--green); }
.pal-btn.review { background: var(--purple); color: #fff; border-color: var(--purple); }
.pal-btn.review-ans { background: var(--purple); color: #fff; border-color: var(--purple); box-shadow: inset 0 -8px 0 var(--green); }
.pal-btn.notvisited { background: var(--card); }
.pal-btn.current { outline: 3px solid var(--primary); outline-offset: 1px; }
.pal-btn.skipped { background: var(--red); color: #fff; border-color: var(--red); }
.exam-foot { display: flex; gap: 10px; padding: 14px 32px; box-shadow: 0 -1px 2px rgba(0,0,0,.06); align-items: center; }
.exam-foot .spacer { flex: 1; }

/* ── Result ──────────────────────────────────────────────────────────────── */
.score-hero { text-align: center; padding: 32px; background: linear-gradient(135deg, #0a7f92, #0d9eb5); color: #fff; border-radius: var(--r-lg); margin-bottom: 22px; box-shadow: var(--elev-2); }
.score-ring { font-size: 52px; font-weight: 800; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border: none; border-radius: var(--r-md); padding: 18px; text-align: center; box-shadow: var(--elev-1); }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat.green .n { color: var(--green); } .stat.red .n { color: var(--red); } .stat.muted .n { color: var(--muted); }

table.lb { width: 100%; border-collapse: collapse; }
table.lb th, table.lb td { padding: 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.lb th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.lb tr.you { background: var(--primary-container); font-weight: 700; }
.rank-medal { font-size: 18px; }

/* ── Legal ───────────────────────────────────────────────────────────────── */
.legal { max-width: 820px; }
.legal h1 { font-size: 30px; font-weight: 700; margin-bottom: 6px; }
.legal .updated { color: var(--muted); margin-bottom: 24px; }
.legal h2 { font-size: 20px; font-weight: 600; margin: 26px 0 10px; }
.legal p, .legal li { color: var(--ink-soft); margin-bottom: 10px; }
.legal ul { padding-left: 22px; }

/* ── Dialog / modal (M3 basic dialog) ────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 200; padding: 20px; }
.modal { background: var(--card); border-radius: var(--r-lg); max-width: 380px; width: 100%; padding: 28px 24px; text-align: center; box-shadow: var(--elev-3); }
.modal .app-ic { width: 76px; height: 76px; border-radius: var(--r-md); background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 36px; margin: 0 auto 16px; }
.modal h2 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.modal p { color: var(--muted); margin-bottom: 20px; font-size: 14px; }
.play-badge { display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 22px; border-radius: var(--r-full); font-weight: 500; }
.play-badge:hover { text-decoration: none; opacity: .9; }
.modal .dismiss { display: block; margin-top: 16px; color: var(--muted); font-size: 13px; cursor: pointer; background: none; border: none; width: 100%; }

/* ── Snackbar (toast) ────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); background: #2f3033; color: #f1f1f1; padding: 14px 20px; border-radius: var(--r-xs); z-index: 300; opacity: 0; transition: .25s; pointer-events: none; box-shadow: var(--elev-3); font-size: 14px; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════════════════════════════════════════
   Dark theme (Material 3) — token overrides only; components inherit via vars.
   Applies automatically with the OS preference, unless the user explicitly
   chose light (data-theme="light"); a manual data-theme="dark" forces it.
   ═══════════════════════════════════════════════════════════════════════════ */
/* Dark-mode home hero — deep teal instead of washed-out light cyan */
[data-theme="dark"] .home-hero { background: linear-gradient(135deg, #00252e 0%, #00424f 60%, #015464 100%) !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .home-hero { background: linear-gradient(135deg, #00252e 0%, #00424f 60%, #015464 100%) !important; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #4fd4e8; --brand-dark: #6fdcec; --brand-light: #123c44;
    --primary: #4fd4e8; --on-primary: #00363f;
    --primary-container: #004e5a; --on-primary-container: #a6eef9;
    --ink: #e3e2e6; --ink-soft: #c5c6cb; --muted: #9a9da1;
    --line: #34373b; --outline: #8d9196;
    --bg: #111416; --card: #1b1e20; --surface-1: #222629; --surface-2: #2a2e31;
    --green: #7fd99a; --green-bg: #143524;
    --red: #ffb4ab; --red-bg: #4e1512;
    --amber: #f0bf6b; --purple: #cfbcff;
  }
}
[data-theme="dark"] {
  --brand: #4fd4e8; --brand-dark: #6fdcec; --brand-light: #123c44;
  --primary: #4fd4e8; --on-primary: #00363f;
  --primary-container: #004e5a; --on-primary-container: #a6eef9;
  --ink: #e3e2e6; --ink-soft: #c5c6cb; --muted: #9a9da1;
  --line: #34373b; --outline: #8d9196;
  --bg: #111416; --card: #1b1e20; --surface-1: #222629; --surface-2: #2a2e31;
  --green: #7fd99a; --green-bg: #143524;
  --red: #ffb4ab; --red-bg: #4e1512;
  --amber: #f0bf6b; --purple: #cfbcff;
}
/* ── Home page — Material Design 3 ──────────────────────────────────────── */
.home-wrap { padding-bottom: 64px; }

/* Hero banner */
.home-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #086475 0%, #0d9eb5 60%, #14b8d4 100%);
  color: #fff;
  padding: 30px 24px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
/* Soft decorative circles for depth (M3 expressive surface) */
.home-hero-deco {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 88% -10%, rgba(255,255,255,.22), transparent 42%),
    radial-gradient(circle at 70% 130%, rgba(255,255,255,.12), transparent 40%);
}
.home-hero-text { position: relative; flex: 1; min-width: 0; z-index: 1; }
.home-greeting { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.home-sub { opacity: .9; font-size: 14px; margin: 5px 0 16px; }
.home-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.hs-pill {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.32);
  backdrop-filter: blur(2px);
  border-radius: var(--r-full); padding: 5px 14px; font-size: 12px;
  font-weight: 600; white-space: nowrap; line-height: 1.4;
}
.home-avatar-lg {
  position: relative; z-index: 1;
  width: 58px; height: 58px; flex-shrink: 0;
  border-radius: 50%; background: rgba(255,255,255,.22);
  border: 2px solid rgba(255,255,255,.5);
  display: grid; place-items: center;
  font-size: 23px; font-weight: 700; color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

/* Horizontal scroll rail (Continue cards) */
.hscroll {
  display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--outline) transparent;
}
.hscroll::-webkit-scrollbar { height: 6px; }
.hscroll::-webkit-scrollbar-thumb { background: var(--outline); border-radius: 99px; }
.hscroll::-webkit-scrollbar-track { background: transparent; }

.continue-card {
  flex: 0 0 240px; scroll-snap-align: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--elev-1); padding: 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.continue-card:hover { transform: translateY(-3px); box-shadow: var(--elev-3); border-color: var(--primary); }
.cc-top { display: flex; align-items: center; justify-content: space-between; }
.cc-ic { font-size: 22px; line-height: 1; }
.cc-resume {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--amber); background: rgba(178,106,0,.12); padding: 3px 8px; border-radius: var(--r-full);
}
.cc-title { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.cc-meta { font-size: 12px; color: var(--muted); }
.cc-bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.cc-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand-dark), var(--brand)); border-radius: 99px; transition: width .4s; }
.cc-cta { font-size: 13px; font-weight: 700; color: var(--primary); margin-top: 2px; }

/* Quick action row */
.home-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: var(--elev-1);
}
.home-act {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 8px 12px; color: var(--ink-soft);
  font-size: 11px; font-weight: 600; transition: background .15s, color .15s;
  text-align: center; border-right: 1px solid var(--line);
}
.home-act:last-child { border-right: none; }
.home-act:hover { background: var(--surface-1); color: var(--primary); text-decoration: none; }
.ha-ic { font-size: 20px; line-height: 1; }

/* Section title */
.home-section-title {
  font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 12px;
}

/* Category cards — M3 tonal style */
.cat-card-new {
  cursor: pointer; padding: 16px 14px; border-radius: var(--r-md);
  background: var(--card); box-shadow: var(--elev-1);
  transition: box-shadow .18s, transform .18s;
  display: flex; flex-direction: column; gap: 4px;
}
.cat-card-new:hover { transform: translateY(-2px); box-shadow: var(--elev-2); }
.ccn-ic { font-size: 26px; margin-bottom: 6px; }
.ccn-name { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.ccn-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Theme toggle button */
.theme-toggle { background: none; border: none; cursor: pointer; font-size: 20px; padding: 8px; border-radius: 50%; line-height: 1; color: var(--ink); }
.theme-toggle:hover { background: var(--surface-2); }

/* ── Practice hub — latest subtopics grid ───────────────────────────────── */
.practice-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.practice-recent-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 14px 14px 12px; border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line);
  cursor: pointer; transition: box-shadow .18s, border-color .18s, transform .18s;
}
.practice-recent-card:hover {
  border-color: var(--primary); box-shadow: var(--elev-2); transform: translateY(-1px);
}
.prc-ic { font-size: 20px; line-height: 1; }
.prc-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.prc-cta {
  font-size: 11px; font-weight: 600; color: var(--primary);
  margin-top: 2px;
}

/* ── Maintenance screen ──────────────────────────────────────────────────── */
.maintenance-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, var(--primary-container), var(--bg));
}
.maintenance-card {
  width: 100%; max-width: 460px; text-align: center;
  background: var(--card); border-radius: var(--r-lg);
  box-shadow: var(--elev-3); padding: 40px 30px;
}
.maintenance-ic { font-size: 56px; margin-bottom: 12px; }
.maintenance-card h1 { font-size: 26px; font-weight: 800; margin-bottom: 10px; color: var(--ink); }
.maintenance-card p { color: var(--ink-soft); font-size: 15px; line-height: 1.6; margin-bottom: 18px; }
.maintenance-app { font-weight: 700; color: var(--brand-dark); letter-spacing: .02em; margin-bottom: 22px; }
.maintenance-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Admin maintenance toggle switch (M3) ────────────────────────────────── */
.maint-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.maint-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.maint-track {
  position: relative; width: 52px; height: 30px; flex-shrink: 0;
  background: var(--outline); border-radius: var(--r-full); transition: background .2s;
}
.maint-thumb {
  position: absolute; top: 4px; left: 4px; width: 22px; height: 22px;
  background: var(--card); border-radius: 50%; transition: transform .2s; box-shadow: var(--elev-1);
}
.maint-toggle input:checked + .maint-track { background: var(--amber); }
.maint-toggle input:checked + .maint-track .maint-thumb { transform: translateX(22px); }

/* ── KaTeX math rendering ────────────────────────────────────────────────── */
/* Block (display-mode) math centres itself and scrolls horizontally on narrow screens */
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 6px 0; margin: 8px 0; }
/* Inline math respects surrounding line-height */
.katex { font-size: 1.05em; }
/* Inside option rows, keep inline math vertically aligned */
.opt .katex { vertical-align: middle; }

/* Report question dialog — radio option rows */
.report-opt {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 9px 12px; border-radius: 8px; border: 1.5px solid var(--line);
  font-size: 14px; color: var(--ink); transition: border-color .15s;
}
.report-opt:hover { border-color: var(--outline); }
.report-opt-sel   { border-color: var(--primary) !important; background: var(--brand-light); }
.report-opt input { accent-color: var(--primary); margin: 0; flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  footer.site .cols { grid-template-columns: 1fr; }
  .nav .links { display: none; }
  .nav-burger { display: block; }
  .hide-mobile { display: none; }
  .exam-body { grid-template-columns: 1fr; }
  .exam-side { display: none; }
  .home-hero { padding: 20px 16px 18px; }
  .home-greeting { font-size: 20px; }
  .home-sub { font-size: 13px; }
  .home-avatar-lg { width: 46px; height: 46px; font-size: 18px; }
  .home-actions { grid-template-columns: repeat(4, 1fr); }
  .home-act { font-size: 10px; padding: 12px 4px 10px; }
  .ha-ic { font-size: 18px; }
  .continue-card { flex-basis: 78vw; max-width: 280px; }
}
