/* ============================================================
   Biology Olympiad Revision — visual system
   Direction: clean & scientific, light, warm-green, minimal.
   Type: IBM Plex Sans (UI/body) + IBM Plex Mono (metadata/labels).
   Ported from the design handoff; adapted for the live vanilla SPA.
   ============================================================ */

:root {
  /* surfaces */
  --bg:        #f3f6f2;
  --panel:     #ffffff;
  --panel-2:   #fafcf9;

  /* ink */
  --ink:       #15211b;
  --ink-2:     #43524b;
  --muted:     #717f78;
  --faint:     #97a39c;

  /* lines */
  --line:      #e4e9e3;
  --line-2:    #d6ddd5;

  /* green accent family */
  --accent:      #1f8a5b;
  --accent-700:  #167049;
  --accent-900:  #0d4730;
  --accent-tint: #e9f3ec;
  --accent-tint2:#dcecdf;

  /* semantic */
  --correct:      #1f8a5b;
  --correct-tint: #e9f3ec;
  --wrong:        #bf472e;
  --wrong-tint:   #f8ece7;
  --amber:        #a3730d;
  --amber-tint:   #f6efdf;

  /* shape */
  --r:    13px;
  --r-sm: 9px;
  --r-xs: 6px;

  --shadow-sm: 0 1px 2px rgba(18,40,28,.05);
  --shadow:    0 1px 2px rgba(18,40,28,.04), 0 10px 30px rgba(14,40,28,.06);

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* screen-reader-only (real inputs behind styled controls) */
.bo-vis-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- screen shell ---------- */
.bo-screen {
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}
.bo-screen *, .bo-screen *::before, .bo-screen *::after { box-sizing: border-box; }
.bo-col {
  width: 100%;
  max-width: 642px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- typography helpers ---------- */
.bo-eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-700);
}
.bo-h1 {
  font-size: 40px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
.bo-em { color: var(--accent-700); }
.bo-lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 16px 0 0;
  max-width: 52ch;
  text-wrap: pretty;
}

/* ---------- buttons ---------- */
.bo-btn {
  appearance: none;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 13px 20px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  letter-spacing: -.01em;
}
.bo-btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(13,71,48,.25), inset 0 1px 0 rgba(255,255,255,.12);
}
.bo-btn-primary:hover:not(:disabled) { background: var(--accent-700); }
.bo-btn-ghost {
  background: var(--panel);
  color: var(--ink-2);
  border-color: var(--line-2);
}
.bo-btn-ghost:hover:not(:disabled) { background: var(--panel-2); color: var(--ink); }
.bo-btn:disabled, .bo-btn.is-disabled { opacity: .45; cursor: not-allowed; }
.bo-block { width: 100%; display: block; }

/* ---------- chips / meta ---------- */
.bo-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--r-xs);
  white-space: nowrap;
}
.bo-chip-topic { background: var(--accent-tint); color: var(--accent-900); }
.bo-chip-muted { background: #eef1ed; color: var(--muted); }

.bo-metarow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.bo-partmeta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  flex-wrap: wrap;
}
.bo-partmeta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); }
.bo-partmeta .accent { color: var(--accent-700); }

/* ============================================================
   SPLASH
   ============================================================ */
.bo-splash { justify-content: center; }
.bo-splash .bo-col { padding-top: 40px; padding-bottom: 40px; }

.bo-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
.bo-mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--accent) 0 6px, transparent 7px),
              var(--accent-tint);
  border: 1.5px solid var(--accent);
  flex: 0 0 auto;
}
.bo-brand-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.bo-start {
  margin-top: 36px;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.bo-field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
}
.bo-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--panel);
}
.bo-step {
  width: 46px;
  border: none;
  background: var(--panel-2);
  color: var(--ink-2);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
}
.bo-step:hover { background: var(--accent-tint); color: var(--accent-700); }
.bo-num {
  width: 64px;
  border: none;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  background: var(--panel);
  appearance: textfield;
  -moz-appearance: textfield;
}
.bo-num::-webkit-outer-spin-button,
.bo-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bo-num:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.bo-hint {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--muted);
}
.bo-start .bo-btn-primary { margin-top: 22px; }

.bo-features {
  display: flex;
  gap: 28px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.bo-feature {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.bo-feat-k {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: .05em;
}

/* ---------- loading / error ---------- */
.bo-loading {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding: 120px 0;
}
.bo-error-screen .bo-col { padding-top: 40px; }

/* ============================================================
   QUIZ
   ============================================================ */
.bo-quiz { padding: 40px 0 36px; }

.bo-quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.bo-counter { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; color: var(--ink); text-transform: uppercase; }
.bo-counter b { color: var(--accent-700); font-weight: 600; }
.bo-app-name { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

.bo-track { height: 4px; background: #e6ebe5; border-radius: 999px; overflow: hidden; }
.bo-track .fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }

.bo-card {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 28px;
}
.bo-qtitle {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.25;
  margin: 16px 0 0;
  color: var(--ink);
  text-wrap: balance;
}
.bo-qstem {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 12px 0 0;
  text-wrap: pretty;
}

.bo-part { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.bo-pstem {
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink);
  margin: 12px 0 18px;
  text-wrap: pretty;
}

/* options */
.bo-opts { display: flex; flex-direction: column; gap: 9px; }
.bo-opt {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
  background: var(--panel);
}
.bo-opt:hover { border-color: var(--accent); background: var(--panel-2); }
.bo-ctrl {
  flex: 0 0 auto;
  width: 19px; height: 19px;
  border: 1.5px solid var(--line-2);
  border-radius: 50%;
  margin-top: 1px;
  position: relative;
  transition: border-color .12s ease;
}
.bo-ctrl.sq { border-radius: 6px; }
.bo-opt-text { font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.bo-opt-text b { color: var(--ink); font-weight: 600; margin-right: 3px; }

.bo-opt.is-selected {
  border-color: var(--accent);
  background: var(--accent-tint);
}
.bo-opt.is-selected .bo-ctrl { border-color: var(--accent); background: var(--accent); }
.bo-opt.is-selected .bo-ctrl::after {
  content: "";
  position: absolute; inset: 0;
  margin: auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
}
.bo-opt.is-selected.sq-sel .bo-ctrl::after {
  width: 6px; height: 9px;
  border-radius: 0;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
  background: transparent;
}
.bo-opt.is-selected .bo-opt-text { color: var(--ink); }

/* true / false + grouping rows */
.bo-stmts { display: flex; flex-direction: column; gap: 9px; }
.bo-stmt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 11px 14px;
}
.bo-stmt-text { font-size: 15px; line-height: 1.45; color: var(--ink-2); flex: 1 1 auto; min-width: 0; }
.bo-stmt-text b { color: var(--ink); margin-right: 3px; }
.bo-tf { display: flex; gap: 7px; flex: 0 0 auto; }
.bo-tf-btn {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
}
.bo-tf-btn:hover { border-color: var(--accent); }
.bo-tf-btn.sel-t { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-900); }
.bo-tf-btn.sel-f { background: var(--wrong-tint); border-color: var(--wrong); color: var(--wrong); }

/* grouping group picker */
.grp-select {
  flex: 0 0 auto;
  max-width: 52%;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  padding: 8px 11px;
  cursor: pointer;
}
.grp-select:hover { border-color: var(--accent); }
.grp-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.bo-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }

/* ============================================================
   RESULTS
   ============================================================ */
.bo-results { padding: 40px 0 44px; }

.bo-score {
  background: var(--accent-900);
  color: #eaf4ee;
  border-radius: var(--r);
  padding: 30px 30px 28px;
  position: relative;
  overflow: hidden;
}
.bo-score-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #7fc4a3;
}
.bo-score-big {
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1;
  margin: 14px 0 0;
  font-variant-numeric: tabular-nums;
}
.bo-score-big .of { color: #5fa384; font-weight: 500; }
.bo-score-sub { margin-top: 8px; font-size: 14.5px; color: #a9d3bf; }
.bo-score-track { margin-top: 20px; height: 6px; background: rgba(255,255,255,.13); border-radius: 999px; overflow: hidden; }
.bo-score-track .fill { height: 100%; background: #46c489; border-radius: 999px; transition: width .3s ease; }

.bo-note {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--amber-tint);
  border: 1px solid #ecdcb6;
  border-radius: var(--r-sm);
}
.bo-note-k {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--amber);
  flex: 0 0 auto;
  padding-top: 2px;
}
.bo-note-text { font-size: 13.5px; line-height: 1.5; color: #6f5413; }
.bo-note.is-error { background: var(--wrong-tint); border-color: #ecc6bb; }
.bo-note.is-error .bo-note-k { color: var(--wrong); }
.bo-note.is-error .bo-note-text { color: #7a3322; }

.bo-section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 30px 0 0;
}

.bo-fb {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}
.bo-fb.is-correct { border-left-color: var(--correct); }
.bo-fb.is-wrong   { border-left-color: var(--wrong); }
.bo-fb.is-partial { border-left-color: var(--amber); }

.bo-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--r-xs);
  white-space: nowrap;
}
.bo-tag.ok      { background: var(--correct-tint); color: var(--accent-900); }
.bo-tag.no      { background: var(--wrong-tint); color: var(--wrong); }
.bo-tag.partial { background: var(--amber-tint); color: var(--amber); }

.bo-fb-stem { font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--ink); margin: 14px 0 14px; text-wrap: pretty; }

/* option / item review */
.bo-rev { display: flex; flex-direction: column; gap: 7px; }
.bo-rev-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
.bo-rev-row b { color: var(--ink); margin-right: 3px; }
.bo-rev-mk { flex: 0 0 auto; width: 16px; font-weight: 700; font-size: 14px; text-align: center; line-height: 1.45; color: var(--faint); }
.bo-rev-row.r-correct { background: var(--correct-tint); border-color: #bfe0cc; }
.bo-rev-row.r-correct .bo-rev-mk { color: var(--correct); }
.bo-rev-row.r-wrong { background: var(--wrong-tint); border-color: #ecc6bb; }
.bo-rev-row.r-wrong .bo-rev-mk { color: var(--wrong); }
.bo-you {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: center;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: #fff;
  border: 1px solid var(--line-2);
  color: var(--muted);
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
/* true/false: short right-aligned you/ans */
.bo-rev-va {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.bo-rev-va b { color: var(--ink); }
/* grouping: longer group names wrap onto their own line */
.bo-rev-body { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; }
.bo-rev-ga { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.bo-rev-ga b { color: var(--ink); }

.bo-why {
  margin-top: 14px;
  padding: 13px 15px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}
.bo-why .k {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-700);
  margin-right: 6px;
}

/* peer distribution */
.bo-dist { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.bo-dist-h {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 11px;
}
.bo-dist-empty { font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; color: var(--faint); }
.bo-distrow { margin-bottom: 9px; }
.bo-distrow:last-child { margin-bottom: 0; }
.bo-dist-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.bo-dist-meta .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-dist-meta .val { font-family: var(--mono); font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.bo-bartrack { height: 9px; background: #eef1ed; border-radius: 999px; overflow: hidden; }
.bo-barfill { height: 100%; background: #cdd6cf; border-radius: 999px; transition: width .3s ease; }
.bo-distrow.is-correct .bo-barfill { background: var(--accent); }
.bo-distrow.is-correct .lab { color: var(--ink); font-weight: 500; }
.bo-distrow.is-yours .val { color: var(--accent-700); font-weight: 600; }

.bo-results-cta { margin-top: 26px; display: flex; justify-content: center; }
.bo-results-cta .bo-btn { padding-left: 28px; padding-right: 28px; }

/* ---------- narrow screens ---------- */
@media (max-width: 560px) {
  .bo-h1 { font-size: 30px; }
  .bo-card { padding: 22px 18px; }
  .bo-stmt { flex-wrap: wrap; }
  .grp-select { max-width: 100%; width: 100%; }
}
