/* Shared styles. Layout: plain government-exam look, white with deep blue. */
:root {
  --navy: #0B1A33;        /* hero band / brand dark */
  --blue: #1F5AA6;        /* primary actions */
  --blue-dk: #163F78;     /* exam header band */
  --blue-lt: #E8F0FB;     /* tinted panels */
  --ink: #1B2433;
  --muted: #5B6678;
  --line: #CBD5E3;
  --bg: #FFFFFF;
  --bg2: #F4F7FB;
  --green: #2E9E4F; --red: #D23B3B; --beige: #EFE3C8; --beige-ink: #6B5A33; --star: #F2B705;
  --ok-bg: #DDF3E3; --ok-ink: #1D6B35; --bad-bg: #FBE1E1; --bad-ink: #9B2323; --warn-bg: #FFF8E1;
  --font: "Noto Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "Noto Sans Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; }
a { color: var(--blue); }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #7FB0EE; outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }

.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.container { max-width: 1080px; margin: 0 auto; }
.narrow { max-width: 720px; margin: 0 auto; }

/* brand */
.brand { display: inline-flex; flex-direction: column; text-decoration: none; color: inherit; line-height: 1.1; }
.brand .wm { font-weight: 700; font-size: 20px; letter-spacing: .1px; }
.brand .wm span { color: #3B7DD8; }
.brand small { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; opacity: .75; margin-top: 2px; }

/* top bar */
.topbar { background: var(--navy); color: #fff; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; flex-wrap: wrap; }
.topbar nav { display: flex; gap: 6px 18px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: #D6E2F5; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: #fff; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--blue); background: var(--blue); color: #fff;
  padding: 9px 18px; border-radius: 4px; font-weight: 600; text-decoration: none; font-size: 14px; line-height: 1.3; }
.btn:hover { background: var(--blue-dk); border-color: var(--blue-dk); }
.btn.ghost { background: #fff; color: var(--blue); }
.btn.ghost:hover { background: var(--blue-lt); }
.btn.light { background: #fff; color: var(--navy); border-color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* cards & forms */
.card { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.card-h { background: var(--blue); color: #fff; padding: 10px 16px; font-weight: 600; border-radius: 6px 6px 0 0; }
.card-b { padding: 18px 16px; }
label.f { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
input.f, select.f, textarea.f { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
textarea.f { resize: vertical; min-height: 70px; line-height: 1.45; }
.field { margin-bottom: 14px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.note { border-left: 4px solid var(--star); background: var(--warn-bg); padding: 10px 12px; margin: 12px 0; border-radius: 0 4px 4px 0; }
.note.blue { border-color: var(--blue); background: var(--blue-lt); }
.alert { padding: 10px 12px; border-radius: 4px; background: var(--bad-bg); color: var(--bad-ink); margin: 10px 0; }
.alert.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-weight: 700; font-size: 12px; }
.pill.pyq { background: var(--blue-lt); color: var(--blue-dk); }
.pill.model { background: #E2F4E8; color: #1D6B35; }
.pill.pass { background: var(--ok-bg); color: var(--ok-ink); }
.pill.fail { background: var(--bad-bg); color: var(--bad-ink); }
.pill.grey { background: #ECEFF4; color: var(--muted); }

/* modal */
.scrim { position: fixed; inset: 0; background: rgba(15, 25, 45, .55); display: grid; place-items: center; z-index: 80; padding: 16px; }
.modal { background: #fff; border-radius: 6px; max-width: 480px; width: 100%; overflow: hidden; max-height: 90vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 800px; }
.modal .card-b { overflow: auto; }
.modal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.modal td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.modal td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.modal .foot { border-top: 1px solid var(--line); background: var(--bg2); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; }

footer.site { background: var(--navy); color: #AFC0DA; font-size: 13px; }
footer.site .wrap { padding-block: 22px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
footer.site a { color: #D6E2F5; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--blue-lt); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* question rendering (shared by exam, review, admin preview) */
.qtext { font-size: 16px; font-weight: 500; margin-bottom: 16px; max-width: 75ch; white-space: normal; overflow-wrap: anywhere; }
.qtext img.qimg { display: block; margin: 12px 0; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: zoom-in; }
