/* ---------------------------------------------------------------------------
   Zenith Students – standalone quiz template styles.
   Mobile-first, no framework, matches the main website's design language.
--------------------------------------------------------------------------- */

:root {
  --navy-950: #071530;
  --navy-900: #0c2148;
  --navy-800: #112c5b;
  --navy-700: #163872;
  --navy-600: #1d468c;
  --navy-500: #2b5aa8;
  --navy-100: #d9e4f5;
  --navy-50: #eef3fb;
  --gold: #e3a532;
  --gold-50: #fdf7ea;
  --ink: #0f172a;
  --ink-soft: #334155;
  --ink-muted: #5b6475;
  --line: #e2e8f0;
  --green: #10b981;
  --green-50: #ecfdf5;
  --red: #ef4444;
  --red-50: #fef2f2;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(12, 33, 72, 0.04), 0 4px 16px rgba(12, 33, 72, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: #f6f8fc;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { color: var(--navy-900); line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.pq-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ chrome */
.pq-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.pq-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.pq-brand span { display: flex; flex-direction: column; line-height: 1.1; }
.pq-brand strong { color: var(--navy-900); font-size: 1.05rem; }
.pq-brand small { color: var(--navy-500); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 3px; }
.pq-link { color: var(--navy-600); font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.pq-link:hover { text-decoration: underline; }

.pq-container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
.pq-footer {
  padding: 20px 16px 32px; text-align: center; color: var(--ink-muted);
  font-size: 0.8rem; border-top: 1px solid var(--line); background: #fff;
}
.pq-footer a { color: var(--navy-600); }

/* ------------------------------------------------------------------- cards */
.pq-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.pq-card + .pq-card, .pq-card + .pq-grid-2, .pq-grid-2 + .pq-card { margin-top: 16px; }
.pq-card-tight { padding: 14px; }
.pq-center { text-align: center; }
.pq-muted { color: var(--ink-muted); }
.pq-small { font-size: 0.8rem; }
.pq-mt { margin-top: 20px; }

.pq-eyebrow {
  color: var(--navy-600); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 8px;
}
.pq-eyebrow-light { color: var(--gold); }

/* ------------------------------------------------------------------ intro */
.pq-intro .pq-lead { color: var(--ink-muted); margin-top: 10px; }
.pq-facts {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0 0;
}
.pq-facts div { background: #f8fafc; border-radius: 12px; padding: 12px 14px; }
.pq-facts dt { color: var(--ink-muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.pq-facts dd { margin: 4px 0 0; font-size: 1.05rem; font-weight: 700; color: var(--navy-900); }
.pq-note {
  margin-top: 20px; background: var(--navy-50); border: 1px solid var(--navy-100);
  border-radius: 12px; padding: 14px 16px; font-size: 0.9rem; color: var(--navy-900);
}
.pq-note ul { margin: 8px 0 0; padding-left: 20px; }
.pq-note li { margin-bottom: 4px; }
.pq-kbd-hint { display: none; }

/* ------------------------------------------------------------------ layout */
/* minmax(0,…) stops a long, non-wrapping title from widening the whole grid. */
.pq-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }

/* ---------------------------------------------------------------- top bar */
.pq-bar {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 16px; position: sticky; top: 61px; z-index: 10;
}
.pq-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pq-bar-title {
  font-weight: 700; color: var(--navy-900); font-size: 0.9rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  /* min-width:0 lets the flex item shrink below its text width so a long
     quiz title truncates instead of widening the page. */
  flex: 1 1 auto; min-width: 0;
}
.pq-timer {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  background: var(--navy-50); color: var(--navy-700); border-radius: 999px;
  padding: 5px 12px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.9rem;
}
.pq-timer::before { content: "⏱"; }
.pq-timer-low { background: var(--red-50); color: #b91c1c; box-shadow: inset 0 0 0 1px #fecaca; }
.pq-progress { height: 8px; background: #eef2f7; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.pq-progress-fill { height: 100%; background: var(--navy-600); border-radius: 999px; transition: width 0.3s ease; }
.pq-bar-meta { margin-top: 6px; font-size: 0.72rem; font-weight: 600; color: var(--ink-muted); }

/* --------------------------------------------------------------- question */
.pq-qhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pq-qnum { color: var(--navy-600); font-size: 0.82rem; font-weight: 700; }
.pq-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pq-tag { background: #f1f5f9; color: var(--ink-soft); border-radius: 999px; padding: 3px 10px; font-size: 0.72rem; font-weight: 600; }
.pq-tag-pos { background: var(--green-50); color: #047857; }
.pq-tag-neg { background: var(--red-50); color: #b91c1c; }
.pq-qimg { display: block; max-width: 100%; max-height: 280px; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; }
.pq-question { margin-top: 14px; font-size: 1.08rem; font-weight: 700; line-height: 1.5; }

.pq-options { border: 0; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; }
.pq-option {
  display: flex; align-items: center; gap: 14px; min-height: 56px;
  padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.pq-option:hover { border-color: #82a3d9; background: #fafbfe; }
.pq-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pq-option:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.pq-option-key {
  flex-shrink: 0; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; background: #f1f5f9; color: #475569; font-weight: 700; font-size: 0.85rem;
}
.pq-option-text { color: var(--ink-soft); }
.pq-option.is-selected { border-color: var(--navy-600); background: var(--navy-50); }
.pq-option.is-selected .pq-option-key { background: var(--navy-700); color: #fff; }
.pq-option.is-selected .pq-option-text { color: var(--navy-900); font-weight: 600; }

/* ------------------------------------------------------------------ buttons */
.pq-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px;
  font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pq-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.pq-btn-primary { background: var(--navy-700); color: #fff; box-shadow: 0 6px 20px rgba(29, 70, 140, 0.25); }
.pq-btn-primary:hover:not([disabled]) { background: var(--navy-800); }
.pq-btn-outline { background: #fff; color: var(--navy-800); box-shadow: inset 0 0 0 1px var(--line); }
.pq-btn-outline:hover:not([disabled]) { background: #f8fafc; box-shadow: inset 0 0 0 1px #82a3d9; }
.pq-btn-ghost { background: transparent; color: var(--navy-700); }
.pq-btn-ghost:hover:not([disabled]) { background: var(--navy-50); }
.pq-btn-mark { background: #f1f5f9; color: var(--ink-soft); }
.pq-btn-mark.is-on { background: var(--gold-50); color: #7f5013; box-shadow: inset 0 0 0 1px #f4d58e; }
.pq-btn-block { width: 100%; margin-top: 24px; }

.pq-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid #eef2f7;
}

/* ------------------------------------------------------------------ palette */
.pq-side-title { font-size: 0.8rem; font-weight: 700; color: var(--navy-900); margin-bottom: 10px; }
.pq-palette { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 0; padding: 0; }
.pq-pal-btn {
  width: 100%; height: 40px; border: 0; border-radius: 10px; cursor: pointer;
  background: #f8fafc; color: #64748b; box-shadow: inset 0 0 0 1px #e2e8f0;
  font: inherit; font-weight: 700; font-size: 0.85rem;
}
.pq-pal-btn.is-answered { background: var(--navy-700); color: #fff; box-shadow: none; }
.pq-pal-btn.is-marked { background: var(--gold-50); color: #7f5013; box-shadow: inset 0 0 0 1px #f4d58e; }
.pq-pal-btn.is-skipped { background: #fff; color: #dc2626; box-shadow: inset 0 0 0 1px #fecaca; }
.pq-pal-btn.is-current { outline: 2px solid var(--navy-500); outline-offset: 2px; }

.pq-legend { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 14px 0 0; padding: 0; font-size: 0.72rem; color: var(--ink-muted); }
.pq-legend li { display: flex; align-items: center; gap: 6px; }
.pq-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-answered { background: var(--navy-700); }
.sw-marked { background: var(--gold-50); box-shadow: inset 0 0 0 1px #f4d58e; }
.sw-skipped { background: #fff; box-shadow: inset 0 0 0 1px #fecaca; }
.sw-unseen { background: #f8fafc; box-shadow: inset 0 0 0 1px #e2e8f0; }

/* -------------------------------------------------------------------- modal */
.pq-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(12, 33, 72, 0.5);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.pq-modal {
  background: #fff; border-radius: 20px 20px 0 0; padding: 24px;
  width: 100%; max-width: 420px;
}
.pq-modal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; text-align: center; }
.pq-modal-stats div { background: #f8fafc; border-radius: 12px; padding: 12px 6px; }
.pq-modal-stats strong { display: block; font-size: 1.4rem; color: var(--navy-800); }
.pq-modal-stats span { font-size: 0.72rem; color: var(--ink-muted); }
.pq-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

/* ------------------------------------------------------------------- result */
.pq-score { padding: 0; overflow: hidden; }
.pq-score-head {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff; padding: 24px 20px; display: grid; gap: 20px;
}
.pq-score-head h1 { color: #fff; }
.pq-grade { color: rgba(217, 228, 245, 0.9); margin-top: 6px; }
.pq-autosub {
  display: inline-block; margin-top: 12px; background: rgba(255, 255, 255, 0.12);
  border-radius: 999px; padding: 4px 12px; font-size: 0.82rem;
}
.pq-score-figures { display: flex; gap: 28px; }
.pq-score-figures span { display: block; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(217, 228, 245, 0.7); }
.pq-score-figures strong { font-size: 2.2rem; line-height: 1.1; }
.pq-accent { color: var(--gold); }

.pq-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; }
.pq-stats div { padding: 14px 8px; text-align: center; border-top: 1px solid #eef2f7; border-right: 1px solid #eef2f7; }
.pq-stats dt { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.pq-stats dd { margin: 4px 0 0; font-size: 1.05rem; font-weight: 700; color: var(--navy-900); font-variant-numeric: tabular-nums; }

.pq-grid-2 { display: grid; gap: 16px; }
.pq-bars { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.pq-bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; margin-bottom: 6px; }
.pq-bar-label span:first-child { font-weight: 600; color: var(--ink-soft); }
.pq-bar-label span:last-child { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pq-track { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.pq-fill { height: 100%; border-radius: 999px; }
.pq-fill.is-good { background: var(--green); }
.pq-fill.is-ok { background: var(--gold); }
.pq-fill.is-low { background: #f87171; }

.pq-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; }
.pq-chip { border-radius: 999px; padding: 6px 14px; font-size: 0.82rem; font-weight: 600; }
.pq-chip.is-good { background: var(--green-50); color: #047857; box-shadow: inset 0 0 0 1px #a7f3d0; }
.pq-chip.is-low { background: var(--red-50); color: #b91c1c; box-shadow: inset 0 0 0 1px #fecaca; }

.pq-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }

.pq-review { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: q; }
.pq-review-item { border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; padding: 14px; }
.pq-review-item.is-correct { border-left-color: var(--green); }
.pq-review-item.is-wrong { border-left-color: var(--red); }
.pq-review-item.is-skipped { border-left-color: #cbd5e1; }
.pq-review-q { font-weight: 700; color: var(--navy-900); margin-top: 4px; }
.pq-review-opts { list-style: none; margin: 12px 0 8px; padding: 0; display: grid; gap: 6px; font-size: 0.88rem; }
.pq-review-opts li { background: #f8fafc; color: var(--ink-soft); border-radius: 9px; padding: 8px 12px; }
.pq-review-opts li.is-answer { background: var(--green-50); color: #065f46; font-weight: 700; box-shadow: inset 0 0 0 1px #a7f3d0; }
.pq-review-opts li.is-chosen { background: var(--red-50); color: #b91c1c; box-shadow: inset 0 0 0 1px #fecaca; }
.pq-explain {
  margin-top: 10px; background: var(--navy-50); border-radius: 10px; padding: 10px 12px;
  font-size: 0.88rem; color: var(--navy-900);
}
.pq-explain::before { content: "💡 "; }

/* ------------------------------------------------------------- breakpoints */
@media (min-width: 560px) {
  h1 { font-size: 2rem; }
  .pq-card { padding: 26px; }
  .pq-facts { grid-template-columns: repeat(4, 1fr); }
  .pq-nav { display: flex; flex-wrap: wrap; align-items: center; }
  .pq-nav-end { margin-left: auto; }
  .pq-palette { grid-template-columns: repeat(8, 1fr); }
  .pq-stats { grid-template-columns: repeat(5, 1fr); }
  .pq-score-head { padding: 32px; }
  .pq-backdrop { align-items: center; padding: 16px; }
  .pq-modal { border-radius: 20px; }
  .pq-kbd-hint { display: list-item; }
}

@media (min-width: 900px) {
  .pq-container { padding: 28px 24px 64px; }
  .pq-layout { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .pq-side { position: sticky; top: 160px; }
  .pq-palette { grid-template-columns: repeat(5, 1fr); }
  .pq-grid-2 { grid-template-columns: 1fr 1fr; }
  .pq-stats { grid-template-columns: repeat(9, 1fr); }
  .pq-score-head { grid-template-columns: 1fr auto; align-items: center; }
  .pq-review-opts { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------- print */
@media print {
  .pq-topbar, .pq-footer, .pq-no-print, .pq-side, .pq-bar { display: none !important; }
  body { background: #fff; }
  .pq-card { box-shadow: none; break-inside: avoid; }
  .pq-score-head { background: #0c2148 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 14mm; }
}
