:root {
  --brand: #1e3a8a;
  --brand-dark: #142a63;
  --gold: #f2b705;
  --gold-dark: #c99400;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2333;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --red: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Poppins', -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: 'Poppins', -apple-system, Segoe UI, Roboto, Arial, sans-serif; font-weight: 700; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.topbar { background: var(--card); border-bottom: 1px solid var(--border); z-index: 20; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 68px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--brand-dark); }
.brand img { height: 40px; width: auto; display: block; }
.brand .brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand .brand-txt small { font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: .02em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.nav a { color: var(--muted); font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--brand); }
.nav-greeting { color: var(--muted); font-size: 14px; }

/* Slim header used during a timed exam — no site nav, just a small brand mark + exit link,
   so the question/palette get as much vertical room as possible on short viewports. */
.topbar-minimal .container { height: 40px; }
.topbar-minimal .brand img { height: 24px; }
.exit-link { color: var(--muted); font-size: 13px; font-weight: 600; }
.exit-link:hover { color: var(--red); }

.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; background: var(--brand); color: #fff !important; border: none; cursor: pointer; font-size: 15px; font-weight: 600; font-family: inherit; transition: background .15s, transform .15s; }
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--brand) !important; border: 1px solid var(--brand); }
.btn.secondary:hover { background: #eef1fb; }
.btn.danger { background: var(--red); }
.btn.block { display: block; width: 100%; text-align: center; }
.btn.gold { background: var(--gold); color: var(--brand-dark) !important; }
.btn.gold:hover { background: var(--gold-dark); }

.page { padding: 32px 0 60px; }
.flash { max-width: 1100px; margin: 16px auto 0; padding: 12px 16px; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; }

/* ---- Animation keyframes ---- */
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes pulseGlow { 0%, 100% { opacity: .5; transform: scale(1); } 50% { opacity: .85; transform: scale(1.06); } }
@keyframes bounceDown { 0%, 100% { transform: translateY(0); opacity: .7; } 50% { transform: translateY(8px); opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ---- Hero ---- */
.hero { background: linear-gradient(120deg, var(--brand) 0%, var(--brand-dark) 45%, #2748a8 75%, var(--brand-dark) 100%); background-size: 260% 260%; animation: gradientShift 16s ease infinite; color: #fff; padding: 56px 0 64px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(242,183,5,.25), transparent 70%); animation: pulseGlow 6s ease-in-out infinite; }
.hero::before { content: ''; position: absolute; left: 10%; bottom: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%); }
.hero .eyebrow { display: inline-block; background: rgba(242,183,5,.18); color: var(--gold); border: 1px solid rgba(242,183,5,.4); padding: 5px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 16px; opacity: 0; animation: fadeInUp .7s ease .05s forwards; }
.hero h1 { font-size: 36px; margin: 0 0 12px; max-width: 560px; opacity: 0; animation: fadeInUp .7s ease .15s forwards; color: #fff; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 { background: linear-gradient(90deg, #fff 55%, var(--gold) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
}
.hero p { color: #dbe3ff; font-size: 16px; max-width: 500px; margin: 0 0 22px; opacity: 0; animation: fadeInUp .7s ease .25s forwards; }
.hero-badges { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 26px; opacity: 0; animation: fadeInUp .7s ease .45s forwards; }
.hero-badges .b { display: flex; align-items: center; gap: 10px; }
.hero-badges .b .n { font-size: 22px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.hero-badges .b .l { font-size: 13px; color: #cfd8f7; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; opacity: 0; animation: fadeInUp .7s ease .35s forwards; }
.hero-actions .btn { transition: transform .18s ease, box-shadow .18s ease; }
.hero-actions .btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 22px rgba(0,0,0,.25); }

.hero-grid { display: flex; align-items: center; gap: 32px; position: relative; z-index: 1; }
.hero-text { flex: 1 1 460px; min-width: 0; }
.hero-media { flex: 0 0 300px; position: relative; display: flex; align-items: center; justify-content: center; opacity: 0; animation: fadeInUp .8s ease .3s forwards; }
.hero-media-glow { position: absolute; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(242,183,5,.35), transparent 72%); filter: blur(4px); z-index: 0; animation: pulseGlow 4s ease-in-out infinite; }
.hero-photo { position: relative; z-index: 1; width: 280px; max-width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 30px rgba(0,0,0,.35)); animation: floatY 5s ease-in-out infinite; }
.hero-chip {
  position: absolute; z-index: 2; background: #fff; color: var(--brand-dark); font-size: 12px; font-weight: 700;
  padding: 8px 12px; border-radius: 999px; box-shadow: 0 8px 18px rgba(0,0,0,.25); white-space: nowrap;
  animation: floatY 3.6s ease-in-out infinite;
}
.hero-chip.chip-1 { top: 6%; left: -8%; animation-delay: 0s; }
.hero-chip.chip-2 { top: 46%; right: -10%; animation-delay: .7s; }
.hero-chip.chip-3 { bottom: 4%; left: -4%; animation-delay: 1.4s; }

.scroll-cue { position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 3; width: 26px; height: 26px; display: none; }
.scroll-cue span { display: block; width: 12px; height: 12px; border-right: 2px solid rgba(255,255,255,.7); border-bottom: 2px solid rgba(255,255,255,.7); transform: rotate(45deg); margin: 0 auto; animation: bounceDown 1.8s ease-in-out infinite; }
@media (min-width: 801px) { .scroll-cue { display: block; } }

/* Decorative animated abacus watermark behind the hero text */
.hero-abacus { position: absolute; z-index: 0; top: 50%; right: -60px; width: 480px; height: auto; max-width: none; opacity: .16; transform: translateY(-50%); pointer-events: none; }
.bead-row-a, .bead-row-b { transform-box: fill-box; transform-origin: center; }
.bead-row-a { animation: beadSlideA 6s ease-in-out infinite; }
.bead-row-b { animation: beadSlideB 7s ease-in-out infinite; }
@keyframes beadSlideA { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(46px); } }
@keyframes beadSlideB { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-46px); } }

/* Drifting math-symbol particles across the hero */
.hero-particles { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.float-sym { position: absolute; color: rgba(255,255,255,.22); font-weight: 800; font-size: 26px; font-family: 'Poppins', sans-serif; animation: floatDrift 7s ease-in-out infinite; }
.float-sym:nth-child(1) { animation-delay: 0s; }
.float-sym:nth-child(2) { animation-delay: .9s; color: rgba(242,183,5,.3); }
.float-sym:nth-child(3) { animation-delay: 1.8s; }
.float-sym:nth-child(4) { animation-delay: .5s; color: rgba(242,183,5,.3); }
.float-sym:nth-child(5) { animation-delay: 2.4s; }
.float-sym:nth-child(6) { animation-delay: 1.3s; color: rgba(242,183,5,.3); }
.float-sym:nth-child(7) { animation-delay: 2s; }
@keyframes floatDrift { 0%, 100% { transform: translateY(0) rotate(0deg); opacity: .18; } 50% { transform: translateY(-24px) rotate(10deg); opacity: .4; } }

/* Wave divider at the bottom of the hero, transitioning into the page background */
.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 2; line-height: 0; }
.hero-wave svg { width: 100%; height: 46px; display: block; }
.hero-wave path { fill: var(--bg); }

@media (max-width: 800px) {
  .hero-abacus { opacity: .1; right: -140px; width: 380px; }
}
@media (max-width: 480px) {
  .hero-abacus { display: none; }
  .float-sym { font-size: 20px; }
}

.section-wrap { padding-top: 48px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; margin-top: 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(20,42,99,.04); transition: transform .25s ease, box-shadow .25s ease, opacity .5s ease; }
.card:hover { transform: translateY(-6px); box-shadow: 0 16px 30px rgba(20,42,99,.15); }
.card.reveal { opacity: 0; transform: translateY(28px); transition: opacity .55s ease, transform .55s ease; }
.card.reveal.in-view { opacity: 1; transform: translateY(0); }
.card.reveal.in-view:hover { transform: translateY(-6px); }
.card .thumb { height: 168px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; font-weight: 700; text-align: center; padding: 10px; position: relative; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .thumb img { transform: scale(1.08); }
.card .body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p.desc { color: var(--muted); font-size: 14px; margin: 0 0 12px; flex: 1; }
.meta { display: flex; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.meta-pill { background: #eef1fb; color: var(--brand-dark); padding: 4px 10px; border-radius: 999px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .hero, .hero .eyebrow, .hero h1, .hero p, .hero-badges, .hero-actions, .hero-media, .hero-media-glow,
  .hero-photo, .hero-chip, .scroll-cue span, .card, .card.reveal, .bead-row-a, .bead-row-b, .float-sym {
    animation: none !important; opacity: 1 !important; transform: none !important; transition: none !important;
  }
  .hero-abacus, .float-sym { opacity: .16 !important; }
}

.form-card { max-width: 420px; margin: 40px auto; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: 0 1px 2px rgba(20,42,99,.04); }
.form-card h2 { margin-top: 0; }
label { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,58,138,.12); }
textarea { resize: vertical; }

.q-timer { position: sticky; top: 0; z-index: 15; background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; margin: 20px 0; display: flex; align-items: center; justify-content: space-between; }
.q-timer .time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-timer.warn { background: var(--red); }

.exam-h1 { font-size: 20px; margin: 0 0 12px; }
.q-timer.compact { margin: 0 0 14px; padding: 8px 16px; position: sticky; top: 8px; }

.exam-layout { display: flex; gap: 20px; align-items: flex-start; }
.exam-main { flex: 1; min-width: 0; scroll-margin-top: 16px; padding-bottom: 88px; }
.exam-sidebar { width: 270px; flex-shrink: 0; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.qnav-label { font-weight: 700; color: var(--muted); margin-bottom: 12px; background: none; border: none; padding: 0; text-align: left; cursor: default; font-family: inherit; display: block; width: auto; font-size: inherit; }
.qpalette-title { font-weight: 700; margin-bottom: 6px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; }

/* Prev / Next / Submit are pinned to the bottom of the viewport on every screen size, so a tall
   question (e.g. a 9-row stacked "flash" question) never pushes them out of reach — no scrolling
   needed to move between questions or submit, on desktop or phone. */
.exam-nav-btns {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
  background: #fff; border-top: 1px solid var(--border); padding: 12px 20px;
  display: flex; justify-content: center; align-items: center; gap: 14px;
  box-shadow: 0 -6px 16px rgba(15,23,42,.08);
}
.exam-nav-btns .btn { min-width: 130px; text-align: center; }
.nav-submit-mobile { display: inline-block; background: var(--gold); color: var(--brand-dark) !important; }

.qpalette-group + .qpalette-group { margin-top: 6px; }
.qpalette-group-title { font-size: 9px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.qpalette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.palbtn { width: 100%; height: 20px; border-radius: 4px; background: #fff; border: 1px solid var(--border); font-size: 9px; line-height: 1; cursor: pointer; font-family: inherit; padding: 0; }
.palbtn:hover { border-color: var(--brand); }
.palbtn.answered { background: #dcfce7; border-color: #86efac; }
.palbtn.current { outline: 2px solid var(--brand); border-color: var(--brand); font-weight: 700; }
.qpalette-legend { display: flex; gap: 12px; margin-top: 8px; font-size: 10px; color: var(--muted); flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }
.dot.answered { background: #86efac; }
.dot.current { background: var(--brand); }
.dot.unanswered { background: var(--red); }
.unanswered-flag { color: var(--red); font-weight: 700; }
.unanswered-flag strong { color: var(--red); }

@media (max-width: 800px) {
  .hero h1 { font-size: 28px; max-width: 100%; }
  .hero p { max-width: 100%; }
  .hero-grid { flex-direction: column; text-align: center; gap: 24px; }
  .hero-actions, .hero-badges { justify-content: center; }
  .hero-media { flex-basis: auto; margin-top: 8px; }
  .hero-photo { width: 220px; }
  .hero-media-glow { width: 220px; height: 220px; }
  .hero-chip { font-size: 11px; padding: 6px 10px; }
  .hero-chip.chip-1 { top: 2%; left: 0; }
  .hero-chip.chip-2 { top: 42%; right: 0; }
  .hero-chip.chip-3 { bottom: 2%; left: 4%; }

  /* Full site header: logo centered on top, menu wraps centered below it once it no longer
     fits in one row — shared by both the public-site header and the admin dashboard header
     (same .topbar markup on both). The slim exam .topbar-minimal stays a single row since it
     only ever holds the logo + one Exit link. */
  .topbar .container { flex-direction: column; justify-content: center; height: auto; padding: 10px 16px; gap: 8px; }
  .brand { justify-content: center; }
  .brand img { height: 30px; }
  .brand .brand-txt small { display: none; }
  .nav { width: 100%; justify-content: center; gap: 6px 14px; }
  .nav a, .nav-greeting { font-size: 13px; }

  .topbar-minimal .container { flex-direction: row; justify-content: space-between; height: 34px; padding: 0 16px; gap: 0; }
  .topbar-minimal .brand img { height: 20px; }
  .page { padding: 8px 0 40px; }
  .exam-h1 { font-size: 15px; margin: 0 0 6px; }
  .q-timer.compact { margin: 0 0 6px; padding: 6px 14px; }
  .q-timer .time { font-size: 17px; }

  .qnav-label { font-size: 12px; margin-bottom: 6px; }

  /* Palette stays visible as an always-on column in the right-side white space next to the
     question, instead of a hidden drawer. Question area and palette split the width evenly. */
  .exam-layout { gap: 8px; }
  .exam-sidebar {
    flex: 1 1 0; min-width: 0; width: auto; padding: 6px 5px; position: sticky; top: 8px; max-height: calc(100vh - 16px);
  }
  .qpalette-title { font-size: 11px; margin-bottom: 3px; }

  /* Flatten the 25-question groups into ONE continuous grid (group headers hidden) and shrink
     the buttons hard, so all ~150 question numbers fit in view with no internal scrolling. */
  .qpalette-group-title { display: none; }
  .qpalette-group { display: contents; }
  .qpalette { display: contents; }
  .qpalette-all { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
  .palbtn { height: 16px; font-size: 7px; border-radius: 3px; }
  .qpalette-legend { display: none; }
  .qpalette-summary { flex-direction: row; justify-content: space-around; gap: 2px; font-size: 8px; margin-top: 4px; padding-top: 4px; }
  .qpalette-summary strong { font-size: 9px; }
  .unanswered-flag { font-size: 8px; }
  .exam-sidebar .btn.block { display: none; }

  /* Prev / Submit: full-width tap targets on phones (still the same fixed bottom bar) */
  .exam-main { padding-bottom: 76px; }
  .exam-nav-btns { padding: 10px 12px; gap: 8px; }
  .exam-nav-btns .btn { flex: 1; min-width: 0; padding: 12px 8px; font-size: 14px; }
}

.question { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; scroll-margin-top: 120px; box-shadow: 0 1px 3px rgba(20,42,99,.05); }
.question .qnum { font-weight: 700; color: var(--brand-dark); margin-bottom: 10px; font-size: 19px; }
.q-stack { display: inline-block; vertical-align: top; font-family: 'Courier New', Consolas, monospace; text-align: right; line-height: 1.25; font-weight: 800; font-size: 19px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; margin-bottom: 8px; border: 1.5px solid var(--border); transition: background .12s, border-color .12s, transform .1s; cursor: pointer; font-size: 17px; }

.report-btn { display: inline-block; margin-top: 6px; background: none; border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; cursor: pointer; font-family: inherit; }
.report-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.report-btn:disabled { cursor: default; opacity: .7; }

.qpalette-summary { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.qpalette-summary strong { color: var(--text); font-size: 14px; }

.instructions-list { margin: 14px 0; padding-left: 20px; font-size: 14px; line-height: 1.7; color: var(--text); }
.instructions-list li { margin-bottom: 6px; }
.agree-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; font-size: 13px; color: var(--text); font-weight: 500; cursor: pointer; }
.agree-check input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; accent-color: var(--brand); }
.opt:hover { background: #f5f7ff; border-color: #c7d2fe; }
.opt input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); flex-shrink: 0; }
.opt.selected { background: #ecfdf5; border-color: var(--green); font-weight: 600; }
.opt.selected input[type=radio] { accent-color: var(--green); }
.opt.correct { background: #ecfdf5; border-color: var(--green); font-weight: 600; }
.opt.wrong { background: #fef2f2; border-color: var(--red); font-weight: 600; }
.opt input { width: auto; }

@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .exam-h1 { font-size: 14px; margin: 0 0 4px; }
  .q-timer.compact { flex-wrap: wrap; gap: 4px; }
  .hero { padding: 40px 0 52px; }
  .hero h1 { font-size: 24px; }
  .hero-badges { gap: 18px; }

  /* Compact question card so it fits the screen without scrolling */
  .question { padding: 10px 12px; margin-bottom: 8px; }
  .question .qnum { font-size: 16px; margin-bottom: 4px; }
  .q-stack { font-size: 15px; line-height: 1.15; }
  .opt { padding: 6px 8px; margin-bottom: 3px; font-size: 15px; gap: 8px; }
  .report-btn { font-size: 11px; padding: 4px 8px; }

  /* Question area and palette still split the width evenly on the narrowest phones. */
  .exam-layout { gap: 6px; }
  .exam-sidebar { padding: 5px 4px; }
  .qpalette-title { font-size: 10px; }
  .qpalette-all { grid-template-columns: repeat(6, 1fr); }
  .palbtn { height: 16px; font-size: 7px; }
  .qpalette-summary { font-size: 8px; }
  .qpalette-summary strong { font-size: 10px; }
}

/* Short-viewport tier (height, not width) — a small browser window or a phone in a squeezed
   view. Goal: question + all 4 options + Prev/Submit fit in view with no scrolling needed. */
@media (max-height: 620px) {
  .page { padding-top: 4px; }
  .exam-h1 { font-size: 12px; margin: 0 0 3px; }
  .q-timer.compact { margin: 0 0 4px; padding: 4px 12px; }
  .q-timer .time { font-size: 14px; }
  .qnav-label { font-size: 11px; margin-bottom: 3px; }
  .question { padding: 6px 10px; margin-bottom: 5px; }
  .question .qnum { font-size: 13px; margin-bottom: 2px; }
  .q-stack { font-size: 12px; line-height: 1.1; }
  .opt { padding: 4px 8px; margin-bottom: 2px; font-size: 13px; gap: 6px; }
  .opt input[type=radio] { width: 14px; height: 14px; }
  .report-btn { font-size: 9px; padding: 2px 6px; margin-top: 3px; }
  .exam-main { padding-bottom: 56px; }
  .exam-nav-btns { padding: 6px 10px; }
  .exam-nav-btns .btn { padding: 9px 8px; font-size: 13px; min-width: 0; }
}

.score-box { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); border-radius: 18px; padding: 32px 36px; margin-bottom: 28px; color: #fff; box-shadow: 0 12px 30px rgba(20,42,99,.25); position: relative; overflow: hidden; }
.score-box::after { content: ''; position: absolute; right: -50px; top: -50px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(242,183,5,.2), transparent 70%); }
.score-summary { display: flex; align-items: center; justify-content: space-between; gap: 32px; position: relative; z-index: 1; }
.score-summary-text { flex: 1; min-width: 0; }
.score-eyebrow { font-size: 13px; font-weight: 600; color: #cfd8f7; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.score-box .big { font-size: 44px; font-weight: 800; color: #fff; line-height: 1; }
.score-box .big .of { font-size: 22px; font-weight: 600; color: #cfd8f7; }
.score-pct-badge { display: inline-block; margin-top: 10px; background: rgba(242,183,5,.18); border: 1px solid rgba(242,183,5,.4); color: var(--gold); font-weight: 700; font-size: 13px; padding: 5px 14px; border-radius: 999px; }
.result-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; }
.rstat { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: #e8ecfb; }
.rstat .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rstat-correct .dot { background: var(--green); }
.rstat-wrong .dot { background: var(--red); }
.rstat-unanswered .dot { background: #94a3b8; }
.rstat .num { font-size: 17px; font-weight: 800; color: #fff; }

.donut-wrap { flex-shrink: 0; }
.donut { width: 150px; height: 150px; border-radius: 50%; position: relative; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.donut-hole { position: absolute; inset: 16px; background: var(--brand-dark); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-pct { font-size: 22px; font-weight: 800; color: #fff; }
.donut-label { font-size: 11px; color: #cfd8f7; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

@media (max-width: 600px) {
  .score-summary { flex-direction: column; text-align: center; }
  .result-stats { justify-content: center; }
  .donut { width: 130px; height: 130px; }
}

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 18px 0 30px; }
.stat-card { flex: 1; min-width: 150px; background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(20,42,99,.05); transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20,42,99,.1); }
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.stat-card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat-card.accent-brand { border-left-color: var(--brand); }
.stat-card.accent-gold { border-left-color: var(--gold); }
.stat-card.accent-green { border-left-color: var(--green); }
.stat-card.accent-red { border-left-color: var(--red); }

.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-gray { background: #e5e7eb; color: #4b5563; }

.pct-good { color: #15803d; font-weight: 700; }
.pct-ok { color: #b45309; font-weight: 700; }
.pct-poor { color: #b91c1c; font-weight: 700; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(20,42,99,.05); }
table.admin-table th, table.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; white-space: nowrap; }
table.admin-table th { background: var(--brand-dark); color: #fff; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.admin-table tbody tr, table.admin-table tr:not(:has(th)) { transition: background .12s; }
table.admin-table tr:hover td { background: #f5f7ff; }
table.admin-table tr:last-child td { border-bottom: none; }

.tabs { display: flex; gap: 8px; margin: 20px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a { padding: 10px 16px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--brand-dark); border-color: var(--brand); font-weight: 600; }

.errlist { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 12px 16px; margin: 14px 0; font-size: 13px; color: #991b1b; }
.hint { color: var(--muted); font-size: 13px; }
code.tpl { display: block; background: #111827; color: #d1fae5; padding: 12px 14px; border-radius: 8px; font-size: 13px; white-space: pre; overflow-x: auto; }

/* ---- Footer ---- */
.site-footer { background: var(--brand-dark); color: #cfd8f7; margin-top: 56px; padding: 40px 0 22px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 36px; justify-content: space-between; }
.site-footer .f-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.site-footer .f-brand img { height: 34px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.site-footer .f-brand span { font-weight: 700; color: #fff; font-size: 16px; }
.site-footer .f-col { min-width: 180px; }
.site-footer .f-col h4 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 12px; }
.site-footer .f-col p, .site-footer .f-col a { display: block; font-size: 14px; color: #cfd8f7; margin-bottom: 8px; }
.site-footer .f-col a:hover { color: var(--gold); }
.site-footer .f-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 18px; text-align: center; font-size: 13px; color: #9fb0e0; }
.site-footer .f-bottom a { color: var(--gold); }

@media (max-width: 600px) {
  .form-card { margin: 20px auto; padding: 20px; }
  .stat-card { min-width: 45%; }
  .site-footer { text-align: center; }
  .site-footer .container { justify-content: center; }
}

/* ---- Global banner hero (replaces the old text hero) ---- */
.hero-banner-wrap { width: 100%; line-height: 0; }
.hero-banner-wrap a { display: block; }
.hero-banner-img { width: 100%; height: auto; display: block; }

/* ---- Global participation flag slider (below hero) ---- */
.globe-band { background: #f4f6fd; padding: 44px 0 48px; }
.globe-head { text-align: center; max-width: 620px; margin: 0 auto 30px; padding: 0 20px; }
.globe-head .label { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dark); background: #fff4d6; padding: 5px 14px; border-radius: 999px; margin-bottom: 12px; }
.globe-head h2 { font-size: 26px; font-weight: 800; margin: 0; color: var(--brand-dark); }
.globe-head p { color: var(--muted); font-size: 14.5px; margin: 10px 0 0; }
.globe-viewport { overflow: hidden; width: 100%; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.globe-track { display: flex; align-items: flex-start; gap: 20px; width: max-content; animation: globeScroll 36s linear infinite; }
.globe-track:hover { animation-play-state: paused; }
.flag { flex: 0 0 auto; width: min(19vw, 148px); min-width: 118px; }
.flag-circle { position: relative; width: 100%; aspect-ratio: 1/1; border-radius: 50%; overflow: hidden; box-shadow: 0 10px 22px -10px rgba(20,42,99,.35); border: 4px solid #fff; background: #e6eaf7; }
.flag-circle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flag-label { position: absolute; left: 6%; right: 6%; bottom: 11%; background: rgba(255,255,255,.92); border-radius: 8px; padding: 4px 2px; font-size: 12px; font-weight: 700; color: var(--brand-dark); text-align: center; line-height: 1.2; }
@keyframes globeScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .globe-track { animation: none; } }
@media (max-width: 640px) {
  .flag { width: min(42vw, 148px); min-width: 118px; }
  .globe-track { gap: 14px; }
  .flag-label { font-size: 11px; bottom: 10%; }
}
