:root {
  --carbon-foundation: #0D1117;
  --deep-carbon: #161B22;
  --hex-blue: #00A8E8;
  --junction-blue: #0077B6;
  --chrome-lattice: #8B949E;
  --steel: #C9D1D9;
  --white: #FFFFFF;
  --signal-red: #F85149;
  --success: #25D366;
  --warning: #EAB308;
  --accent-gradient: linear-gradient(90deg, var(--hex-blue) 0%, var(--junction-blue) 100%);
  --dark-bg-gradient: linear-gradient(135deg, var(--carbon-foundation) 0%, var(--deep-carbon) 100%);
  --light-bg-gradient: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f0f4f8 100%);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px;
  --space-xl: 32px; --space-2xl: 40px; --space-3xl: 60px;
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --shadow-sm: 0 2px 10px rgba(0,0,0,.1);
  --shadow-md: 0 10px 40px rgba(0,0,0,.1);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.15);
  /* theme-able surfaces (dark default) */
  --bg: var(--carbon-foundation);
  --bg-elev: var(--deep-carbon);
  --card: rgba(22,27,34,.72);
  --card-solid: #161B22;
  --text: #FFFFFF;
  --text-dim: var(--steel);
  --muted: var(--chrome-lattice);
  --border: rgba(255,255,255,.1);
  --input-bg: rgba(255,255,255,.04);
  --page-bg: var(--dark-bg-gradient);
}
html[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-elev: #f0f4f8;
  --card: #FFFFFF;
  --card-solid: #FFFFFF;
  --text: #0D1117;
  --text-dim: #3d4756;
  --muted: #5a6577;
  --border: #e2e8f0;
  --input-bg: #f8fafc;
  --page-bg: var(--light-bg-gradient);
}
*, *::before, *::after { box-sizing: border-box; }
/* Author display utilities (e.g. .btn inline-flex) otherwise beat the UA
 * [hidden] rule and show elements JS meant to keep hidden. */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font-family);
  background: var(--page-bg); background-attachment: fixed;
  color: var(--text); line-height: 1.6; font-size: 16px;
  min-height: 100dvh; display: flex; flex-direction: column;
}
/* hex lattice backdrop */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'%3E%3Cpath d='M15 2 28 9.5v15L15 32 2 24.5v-15zM45 28l13 7.5v15L45 58 32 50.5v-15z' fill='none' stroke='%2300A8E8' stroke-width='0.5'/%3E%3C/svg%3E");
  opacity: .06;
}
html[data-theme="light"] body::before, html[data-theme="light"]::before { opacity: .05; }
a { color: var(--hex-blue); }
:focus-visible { outline: 2px solid var(--hex-blue); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--hex-blue); color: #fff; padding: 10px 18px; border-radius: 0 0 8px 0; z-index: 200; font-weight: 600; }
.skip-link:focus { left: 0; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; position: relative; z-index: 1; }
main { flex: 1; position: relative; z-index: 1; }

/* ---------- header / nav (mirrors main site) ---------- */
.nav { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: rgba(13,17,23,.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); }
html[data-theme="light"] .nav { background: rgba(255,255,255,.88); }
.nav-logo img { height: 40px; width: auto; object-fit: contain; display: block; }
.nav-right-wrap { display: flex; align-items: center; gap: 14px; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { color: var(--text-dim); text-decoration: none; font-size: .9rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--hex-blue); }
.theme-toggle-btn { background: rgba(0,168,232,.08); border: 1px solid rgba(0,168,232,.3); border-radius: 8px;
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.theme-toggle-btn:hover { border-color: var(--hex-blue); }
.theme-toggle-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--hex-blue); stroke-width: 2; stroke-linecap: round; }
.theme-toggle-btn .sun-icon { display: block; } .theme-toggle-btn .moon-icon { display: none; }
html[data-theme="light"] .theme-toggle-btn .sun-icon { display: none; }
html[data-theme="light"] .theme-toggle-btn .moon-icon { display: block; }
.nav-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px; cursor: pointer; }
.nav-hamburger span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; }
html[data-theme="light"] .nav-hamburger span { background: var(--text); }
.mobile-menu { display: none; border-bottom: 1px solid var(--border); background: var(--bg-elev); padding: 8px 20px 18px; position: relative; z-index: 99; }
.mobile-menu.open { display: block; }
.mobile-menu nav { display: flex; flex-direction: column; }
.mobile-menu a { padding: 12px 4px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-weight: 500; }
.mobile-theme-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; color: var(--muted); font-size: .85rem; }

/* ---------- hero ---------- */
.hero { padding: 56px 0 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 8px 18px; border-radius: 9999px;
  border: 1px solid rgba(0,168,232,.3); background: rgba(0,168,232,.06); margin-bottom: 16px;
  color: var(--hex-blue); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(37,211,102,.6); }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 12px; }
.gradient-text { background: linear-gradient(90deg, #7dd8f7, var(--hex-blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-theme="light"] .gradient-text { background: linear-gradient(90deg, var(--hex-blue), var(--junction-blue)); -webkit-background-clip: text; background-clip: text; }
.hero-sub { max-width: 640px; color: var(--muted); margin: 0 0 24px; }
.accent-bar { height: 4px; background: var(--accent-gradient); border-radius: 4px; margin: 26px 0 0; }

/* ---------- cards / grids ---------- */
.section { padding: 32px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
.section-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.grid { display: grid; gap: 18px; }
.grid.catalog { grid-template-columns: repeat(3, 1fr); }
.grid.stats { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); }
html[data-theme="light"] .card { box-shadow: var(--shadow-md); }
.card:hover { border-color: rgba(0,168,232,.45); }
.exam-card { display: flex; flex-direction: column; gap: 12px; }
.exam-card .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.badge { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 12px; border-radius: 9999px; }
.badge.open { background: rgba(37,211,102,.12); color: var(--success); border: 1px solid rgba(37,211,102,.4); }
.badge.soon { background: rgba(234,179,8,.1); color: var(--warning); border: 1px solid rgba(234,179,8,.4); }
.exam-card h3 { margin: 0; font-size: 1.1rem; }
.exam-card p.desc { margin: 0; color: var(--muted); font-size: .9rem; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .82rem; }
.meta strong { color: var(--text); }
.stat-num { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.stat-num.accent { color: var(--hex-blue); }
.stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.progress-track { height: 8px; border-radius: 99px; background: rgba(139,148,158,.2); overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; background: var(--accent-gradient); border-radius: 99px; transition: width .5s ease; }

/* ---------- buttons / forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: var(--radius-md);
  font-family: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: all .2s ease; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--hex-blue); color: #fff; }
.btn-primary:hover { background: #0090cc; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline { background: transparent; border-color: var(--hex-blue); color: var(--hex-blue); }
.btn-outline:hover { background: rgba(0,168,232,.08); }
.btn-ghost { background: none; border: none; color: var(--muted); padding: 8px 10px; }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--signal-red); color: #fff; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 500; }
input[type="text"], input[type="email"], input[type="number"], select, textarea {
  font-family: inherit; font-size: .95rem; color: var(--text); background: var(--input-bg);
  border: 1px solid var(--border); border-radius: var(--radius-md); padding: 11px 14px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--hex-blue); outline: 2px solid rgba(0,168,232,.35); outline-offset: 0; }
.help { font-size: .8rem; color: var(--muted); font-weight: 400; }
.error-text { color: var(--signal-red); font-size: .82rem; min-height: 1.2em; }

/* ---------- exam runner ---------- */
.exam-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.timer-bar { position: sticky; top: 73px; z-index: 50; background: var(--card-solid); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 18px; display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem; }
.timer.low { color: var(--signal-red); }
.autosave { font-size: .78rem; color: var(--muted); }
.q-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.q-num { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.q-text { font-size: 1.05rem; font-weight: 600; margin: 0 0 6px; }
.q-topic { font-size: .75rem; color: var(--muted); margin-bottom: 14px; }
.opts { display: flex; flex-direction: column; gap: 10px; list-style: none; margin: 0; padding: 0; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; background: var(--input-bg);
  border: 1px solid var(--border); color: var(--text); padding: 13px 16px; border-radius: var(--radius-md);
  font-family: inherit; font-size: .93rem; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.opt:hover { border-color: var(--hex-blue); }
.opt.selected { border-color: var(--hex-blue); background: rgba(0,168,232,.1); }
.opt .key { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: var(--muted); }
.opt.selected .key { background: var(--hex-blue); border-color: var(--hex-blue); color: #fff; }
.flag-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 9999px;
  padding: 6px 14px; font-size: .78rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.flag-btn.flagged { border-color: var(--warning); color: var(--warning); background: rgba(234,179,8,.08); }
.palette { position: sticky; top: 160px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.palette h3 { margin: 0 0 12px; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pal-btn { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg);
  color: var(--text); font-family: inherit; font-weight: 600; font-size: .82rem; cursor: pointer; position: relative; }
.pal-btn.answered { background: rgba(0,168,232,.15); border-color: var(--hex-blue); }
.pal-btn.current { outline: 2px solid var(--hex-blue); outline-offset: 1px; }
.pal-btn.flagged::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .75rem; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; font-style: normal; }

/* ---------- result ---------- */
.score-hero { text-align: center; padding: 36px 22px; }
.score-ring { width: 150px; height: 150px; margin: 0 auto 14px; }
.verdict { font-size: 1.4rem; font-weight: 700; margin: 6px 0; }
.verdict.pass { color: var(--success); } .verdict.fail { color: var(--warning); }
.topic-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.review-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 12px; background: var(--card); }
.review-item.correct { border-left: 4px solid var(--success); }
.review-item.wrong { border-left: 4px solid var(--signal-red); }
.review-item .rationale { background: var(--input-bg); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .87rem; color: var(--text-dim); margin-top: 10px; }
.pill { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 10px; border-radius: 99px; }
.pill.correct { background: rgba(37,211,102,.12); color: var(--success); }
.pill.wrong { background: rgba(248,81,73,.12); color: var(--signal-red); }
.pill.skipped { background: rgba(139,148,158,.15); color: var(--muted); }

/* ---------- admin ---------- */
.dropzone { border: 2px dashed rgba(0,168,232,.5); border-radius: var(--radius-lg); padding: 40px 24px; text-align: center;
  background: rgba(0,168,232,.04); cursor: pointer; transition: all .2s ease; }
.dropzone:hover, .dropzone.drag { border-color: var(--hex-blue); background: rgba(0,168,232,.09); }
.dropzone input { display: none; }
.valid-ok { color: var(--success); font-weight: 600; }
.valid-bad { color: var(--signal-red); font-weight: 600; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
pre.code { background: #0a0e14; color: #c9d1d9; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; overflow: auto; font-size: .78rem; max-height: 420px; }
html[data-theme="light"] pre.code { background: #0D1117; }
table.val-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.val-table th, table.val-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.val-table th { color: var(--muted); text-transform: uppercase; font-size: .68rem; letter-spacing: .06em; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 300; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--card-solid); border: 1px solid var(--border); border-radius: var(--radius-xl);
  max-width: 480px; width: 100%; padding: 28px; box-shadow: var(--shadow-lg); }
.modal h2 { margin: 0 0 10px; font-size: 1.2rem; }
.modal p { color: var(--muted); font-size: .92rem; }

/* ---------- footer ---------- */
footer { margin-top: 48px; border-top: 1px solid var(--border); background: rgba(13,17,23,.6); position: relative; z-index: 1; }
html[data-theme="light"] footer { background: rgba(255,255,255,.7); }
.footer-accent { height: 4px; background: linear-gradient(90deg, var(--hex-blue), var(--junction-blue), var(--hex-blue)); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 28px 0; align-items: center; }
.footer-inner img { height: 44px; object-fit: contain; }
.footer-inner p { margin: 4px 0; color: var(--muted); font-size: .85rem; }
.footer-inner a { color: var(--hex-blue); text-decoration: none; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--card-solid);
  border: 1px solid var(--hex-blue); color: var(--text); padding: 11px 22px; border-radius: 99px; font-size: .85rem;
  font-weight: 500; opacity: 0; pointer-events: none; transition: all .3s ease; z-index: 400; box-shadow: var(--shadow-md); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- light theme: first-class premium + WCAG AA contrast ----------
   Brand: dark text #0D1117 on light surfaces, muted #5a6577 (AA-safe) for
   secondary only (chrome #8B949E reserved for decorative/borders), borders
   steel #C9D1D9, accent gradient #00A8E8 -> #0077B6 intact. */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] {
  color-scheme: light;
  --success: #15803d; /* AA-safe on white (badges, verdicts, pills, dots) */
  --warning: #b45309; /* AA-safe on white (flags, soon badges, fail verdict) */
  --signal-red: #b42318; /* AA-safe on white (errors, wrong answers, danger) */
  --border: #C9D1D9;  /* steel per brand */
  --shadow-sm: 0 1px 2px rgba(13,17,23,.06), 0 4px 16px rgba(13,17,23,.07);
  --shadow-md: 0 2px 6px rgba(13,17,23,.06), 0 14px 34px rgba(13,17,23,.10);
  --shadow-lg: 0 4px 12px rgba(13,17,23,.08), 0 24px 60px rgba(13,17,23,.14);
}
html[data-theme="light"] body::before { opacity: .045; }
html[data-theme="light"] ::selection { background: rgba(0,119,182,.18); }
html[data-theme="dark"] ::selection { background: rgba(0,168,232,.30); }
/* links + buttons: junction blue carries AA on white; hex blue stays for dark */
html[data-theme="light"] a { color: #0077B6; }
html[data-theme="light"] a:hover { color: #005e8c; }
html[data-theme="light"] .btn-primary { background: #0077B6; border-color: #0077B6; color: #fff; }
html[data-theme="light"] .btn-primary:hover { background: #005e8c; border-color: #005e8c; }
html[data-theme="light"] .btn-outline { border-color: #0077B6; color: #0077B6; }
html[data-theme="light"] .btn-outline:hover { background: rgba(0,119,182,.08); }
html[data-theme="light"] .btn-outline:disabled { border-color: #C9D1D9; color: #8B949E; }
html[data-theme="light"] .skip-link { background: #0077B6; }
/* nav / hero accents */
html[data-theme="light"] .nav-links a:hover, html[data-theme="light"] .nav-links a.active { color: #0077B6; }
html[data-theme="light"] .eyebrow { color: #0077B6; border-color: rgba(0,119,182,.35); background: rgba(0,119,182,.06); }
html[data-theme="light"] .stat-num.accent { color: #0077B6; }
html[data-theme="light"] .theme-toggle-btn { background: rgba(0,119,182,.06); border-color: rgba(0,119,182,.35); }
html[data-theme="light"] .theme-toggle-btn:hover { border-color: #0077B6; }
html[data-theme="light"] .theme-toggle-btn svg { stroke: #0077B6; }
/* focus rings: visible on white */
html[data-theme="light"] :focus-visible { outline-color: #0077B6; outline-width: 3px; }
html[data-theme="light"] input:focus, html[data-theme="light"] select:focus, html[data-theme="light"] textarea:focus {
  border-color: #0077B6; outline: 3px solid rgba(0,119,182,.28); outline-offset: 0; }
html[data-theme="light"] ::placeholder { color: #6b7280; opacity: 1; }
/* error red needs darkening on white for small text */
html[data-theme="light"] .error-text, html[data-theme="light"] .timer.low,
html[data-theme="light"] .pill.wrong, html[data-theme="light"] .valid-bad { color: #b42318; }
/* exam runner: AA borders + selected states */
html[data-theme="light"] .opt:hover { border-color: #0077B6; }
html[data-theme="light"] .opt.selected { border-color: #0077B6; background: rgba(0,119,182,.08); }
html[data-theme="light"] .opt.selected .key { background: #0077B6; border-color: #0077B6; }
html[data-theme="light"] .card:hover { border-color: rgba(0,119,182,.5); }
html[data-theme="light"] .pal-btn.answered { background: rgba(0,119,182,.12); border-color: #0077B6; }
html[data-theme="light"] .pal-btn.current { outline-color: #0077B6; }
html[data-theme="light"] .q-card, html[data-theme="light"] .timer-bar, html[data-theme="light"] .palette { box-shadow: var(--shadow-sm); }
/* dropzone */
html[data-theme="light"] .dropzone { border-color: rgba(0,119,182,.55); background: rgba(0,119,182,.04); }
html[data-theme="light"] .dropzone:hover, html[data-theme="light"] .dropzone.drag {
  border-color: #0077B6; background: rgba(0,119,182,.08); }
/* inline code + validation table in light */
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em;
  background: rgba(0,168,232,.12); padding: 2px 6px; border-radius: 4px; }
html[data-theme="light"] code { background: rgba(0,119,182,.09); color: #0D1117; }
html[data-theme="light"] table.val-table tbody tr:hover { background: rgba(0,119,182,.045); }
html[data-theme="light"] table.val-table td { color: #0D1117; }
/* result ring track keeps chrome at low opacity in both themes */
html[data-theme="light"] #ringSvg > circle:first-child { stroke: rgba(11,18,32,.14); }
/* admin CSV template block (themed via vars, works in both themes) */
.template-row { margin-top: 12px; }
.csv-status { min-height: 1.2em; margin: 8px 0 0; }
.format-guide { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--input-bg); padding: 12px 16px; font-size: .85rem; }
.format-guide summary { cursor: pointer; font-weight: 600; }
.format-guide summary:focus-visible { outline: 2px solid var(--hex-blue); outline-offset: 2px; }
html[data-theme="light"] .format-guide summary:focus-visible { outline-color: #0077B6; }
.format-guide ol, .format-guide ul { margin: 8px 0; padding-left: 20px; color: var(--text-dim); }
.format-guide li { margin: 4px 0; }
.format-guide .help { margin: 8px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
  .grid.catalog { grid-template-columns: repeat(2, 1fr); }
  .grid.stats { grid-template-columns: repeat(2, 1fr); }
  .exam-layout { grid-template-columns: 1fr; }
  .palette { position: static; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .nav-links, .nav-right-wrap > .theme-toggle-btn { display: none; }
  .nav-hamburger { display: flex; }
  .grid.catalog, .grid.stats { grid-template-columns: 1fr; }
  .hero { padding: 36px 0 4px; }
  .q-card { padding: 18px; }
  .timer-bar { top: 69px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
