/* NAVLE practice exam simulator.
   Deliberately flat and institutional: no gradients, no rounded cards, no shadows.
   Matches the ICVA / starttest.com self-assessment interface. */

:root {
  --navy: #23386b;
  --navy-dark: #1f3864;
  --accent: #4e7ec1;
  --hdr-dim: #a9bce0;
  --btn: #5b6e9e;
  --btn-hover: #7386b6;
  --rule: #c8ccd4;
  --ink: #111111;
  --green: #167a3c;
  --green-bg: #e7f4ec;
  --red: #b3261e;
  --red-bg: #fbeceb;
  --amber: #b5730a;
  --amber-bg: #fdf4e3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: Helvetica, Arial, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

a { color: #1a4f9c; }

/* ------------------------------------------------------------------ header */

.exam-header {
  background: var(--navy);
  color: #ffffff;
  display: flex;
  align-items: flex-start;
  padding: 9px 14px 8px;
  min-height: 56px;
}
.hdr-left { flex: 0 0 26%; font-size: 13px; line-height: 1.35; }
.hdr-center { flex: 1 1 auto; text-align: center; font-size: 14px; line-height: 1.45; }
.hdr-right { flex: 0 0 26%; text-align: right; font-size: 13px; line-height: 1.35; }

.hdr-left .item-label,
.hdr-right .time-label { color: var(--hdr-dim); font-weight: bold; }
.hdr-center div { font-weight: bold; }
.hdr-right .time-value { font-weight: bold; font-size: 14px; }
.hdr-right .time-value.low { color: #ffd0cc; }

.mark-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  cursor: pointer;
  user-select: none;
  font-weight: bold;
  font-size: 13px;
}
.mark-wrap input { width: 14px; height: 14px; margin: 0; cursor: pointer; }

.accent-strip { height: 5px; background: var(--accent); }

/* -------------------------------------------------------------------- body */

.exam-body {
  padding: 26px 34px 96px;
  max-width: 1500px;
}

.q-image-wrap { text-align: center; margin: 4px 0 26px; }
.q-image-wrap img {
  /* Cap HEIGHT as well as width. A tall or square figure constrained only by width
     pushes the stem and all five options below the fold, which the real exam never
     does: there the graphic, stem and options are visible together. */
  max-width: min(700px, 100%);
  max-height: 46vh;
  width: auto;
  height: auto;
  border: 1px solid #ddd;
}
.q-image-missing {
  display: inline-block;
  width: 700px;
  max-width: 100%;
  padding: 40px 12px;
  border: 1px dashed #bbb;
  color: #777;
  font-size: 13px;
}

.q-row { display: flex; align-items: flex-start; gap: 10px; }
.q-num { flex: 0 0 34px; text-align: right; font-size: 16px; line-height: 1.55; padding-top: 1px; }
.q-stem { flex: 1 1 auto; font-size: 16px; line-height: 1.55; }

.options { margin: 22px 0 0 44px; padding: 0; list-style: none; }
.options li { margin: 0; }
.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 8px 7px 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.5;
}
.opt:hover { background: #f2f5fa; }
.opt input { margin: 3px 0 0; width: 16px; height: 16px; flex: 0 0 auto; cursor: pointer; }
.opt .letter { flex: 0 0 30px; }
.opt.selected { background: #eaf0fa; }

/* ------------------------------------------------------------------ footer */

.exam-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--navy);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  min-height: 64px;
  z-index: 40;
}
.foot-group { display: flex; gap: 26px; }
.foot-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
}
.foot-btn:disabled { opacity: 0.35; cursor: default; }
.foot-btn .glyph {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--btn);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}
.foot-btn:not(:disabled):hover .glyph { background: var(--btn-hover); }
.foot-brand { font-size: 11px; color: var(--hdr-dim); letter-spacing: 0.5px; text-align: center; }

/* ------------------------------------------------------------------- modal */

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 48, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: #ffffff;
  border: 1px solid #7c8aa8;
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal.narrow { max-width: 420px; }
.modal-head {
  background: var(--navy);
  color: #ffffff;
  font-weight: bold;
  font-size: 14px;
  padding: 10px 14px;
}
.modal-body { padding: 18px; overflow: auto; font-size: 14px; line-height: 1.55; }
.modal-foot {
  border-top: 1px solid var(--rule);
  padding: 12px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  padding: 8px 16px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #ffffff;
  cursor: pointer;
}
.btn:hover { background: #2d4682; }
.btn.secondary { background: #ffffff; color: var(--navy); }
.btn.secondary:hover { background: #eef2f9; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #8f1e17; }

/* -------------------------------------------------------------- review grid */

.review-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 18px; height: 18px; border: 1px solid #8a93a6; display: inline-block; }
.legend-swatch.answered { background: var(--navy); border-color: var(--navy); }
.legend-swatch.unanswered { background: #ffffff; }
.legend-swatch.marked { background: #ffffff; border-color: var(--amber); border-width: 3px; }

.review-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
@media (max-width: 640px) { .review-grid { grid-template-columns: repeat(6, 1fr); } }
.rv {
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  padding: 9px 0;
  border: 1px solid #8a93a6;
  background: #ffffff;
  color: var(--navy);
  cursor: pointer;
  position: relative;
}
.rv.answered { background: var(--navy); color: #ffffff; border-color: var(--navy); }
.rv.marked { border: 3px solid var(--amber); }
.rv.current { outline: 3px solid var(--accent); outline-offset: -1px; }
.rv:hover { filter: brightness(1.12); }

/* -------------------------------------------------------------- calculator */

.calc { width: 250px; margin: 0 auto; }
.calc-display {
  border: 1px solid #8a93a6;
  background: #f7f8fa;
  padding: 12px 10px;
  font-size: 22px;
  text-align: right;
  font-family: "Courier New", Courier, monospace;
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 8px;
}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.calc-grid button {
  font-family: inherit;
  font-size: 15px;
  padding: 12px 0;
  border: 1px solid #8a93a6;
  background: #ffffff;
  cursor: pointer;
}
.calc-grid button:hover { background: #eef2f9; }
.calc-grid button.op { background: #e5eaf3; }
.calc-grid button.eq { background: var(--navy); color: #ffffff; border-color: var(--navy); }
.calc-grid button.wide { grid-column: span 2; }

/* --------------------------------------------------------------- start page */

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
.page-header {
  background: var(--navy);
  color: #ffffff;
  padding: 20px 24px;
  margin-bottom: 0;
}
.page-header h1 { margin: 0; font-size: 22px; }
.page-header .sub { color: var(--hdr-dim); font-size: 13px; margin-top: 4px; }
.page-inner { max-width: 900px; margin: 0 auto; }

h2 { font-size: 17px; margin: 30px 0 10px; }
h3 { font-size: 15px; margin: 22px 0 8px; }
p, li { font-size: 15px; line-height: 1.6; }

.panel { border: 1px solid var(--rule); padding: 16px 18px; margin: 16px 0; }
.panel.note { background: #f6f8fc; }
.panel.warn { background: var(--amber-bg); border-color: #e0c48a; }

.kv { display: flex; flex-wrap: wrap; gap: 26px; margin: 10px 0; }
.kv div { font-size: 14px; }
.kv .k { color: #555; display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.kv .v { font-weight: bold; font-size: 17px; }

/* ------------------------------------------------------------------ results */

.score-head {
  border: 1px solid var(--rule);
  border-top: 6px solid var(--navy);
  padding: 20px 22px;
  margin: 20px 0;
}
.score-big { font-size: 46px; font-weight: bold; line-height: 1; }
.score-sub { font-size: 15px; margin-top: 6px; color: #333; }
.band-tag {
  display: inline-block;
  border: 1px solid var(--navy);
  color: var(--navy);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 10px;
}

table.bd { width: 100%; border-collapse: collapse; margin: 8px 0 4px; }
table.bd th, table.bd td {
  border-bottom: 1px solid var(--rule);
  padding: 7px 8px;
  font-size: 14px;
  text-align: left;
  vertical-align: middle;
}
table.bd th { background: #eef1f7; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
table.bd td.num, table.bd th.num { text-align: right; white-space: nowrap; }
.bar { background: #e6e9ef; height: 12px; width: 100%; min-width: 90px; display: block; }
.bar > span { display: block; height: 100%; background: var(--navy); }
.bar.weak > span { background: var(--red); }
.bar.mid > span { background: var(--amber); }
.bar.good > span { background: var(--green); }

.qcard { border: 1px solid var(--rule); border-left: 5px solid var(--red); padding: 16px 18px; margin: 16px 0; }
.qcard.right { border-left-color: var(--green); }
.qcard.blank { border-left-color: var(--amber); }
.qcard .meta { font-size: 12px; color: #555; margin-bottom: 8px; }
.qcard .meta span { margin-right: 14px; }
.qcard .stem { font-size: 15px; line-height: 1.6; margin: 8px 0 12px; }
.qcard img { max-width: min(620px, 100%); max-height: 40vh; width: auto; height: auto; border: 1px solid #ddd; margin-bottom: 12px; }
.qcard ol { list-style: none; margin: 0; padding: 0; }
.qcard ol li { padding: 6px 10px; font-size: 15px; border: 1px solid transparent; }
.qcard ol li.correct { background: var(--green-bg); border-color: #a8d5bb; }
.qcard ol li.chosen { background: var(--red-bg); border-color: #eab6b2; }
.qcard ol li .tag { font-size: 11px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 10px; }
.qcard ol li.correct .tag { color: var(--green); }
.qcard ol li.chosen .tag { color: var(--red); }
.why {
  background: var(--red-bg);
  border-left: 4px solid var(--red);
  padding: 10px 12px;
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.6;
}
.why b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--red); margin-bottom: 4px; }
.expl { background: #f6f8fc; border-left: 4px solid var(--navy); padding: 10px 12px; margin: 12px 0 0; font-size: 15px; line-height: 1.6; }
.expl b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--navy); margin-bottom: 4px; }
.srcline { font-size: 13px; margin-top: 10px; }

details.fold { border: 1px solid var(--rule); margin: 16px 0; }
details.fold > summary {
  cursor: pointer;
  padding: 12px 16px;
  background: #eef1f7;
  font-weight: bold;
  font-size: 15px;
}
details.fold > div { padding: 4px 16px 12px; }

.muted { color: #666; font-size: 13px; }
.loading { padding: 40px 0; color: #666; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }

/* -------------------------------------------------------------------- print */

@media print {
  .noprint, .exam-footer, .toolbar { display: none !important; }
  body { font-size: 11pt; }
  .page { max-width: none; padding: 0; }
  .page-header { background: none; color: #000; border-bottom: 2px solid #000; padding: 0 0 8px; }
  .page-header .sub { color: #333; }
  .qcard { break-inside: avoid; page-break-inside: avoid; border-left-width: 3px; }
  details.fold > div { display: block !important; }
  details.fold { break-inside: auto; }
  .bar > span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.bd th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a[href]:after { content: ""; }
}
