/* style.css — chemistry tutor frontend.
 * Visual language adapted from the enviPath@MU landing page (gradient nav
 * header, hero, rounded soft-shadow cards, gradient stat/action buttons),
 * with the purple accent swapped for teaching blue (#103cff). */

:root {
  --fg: #333;
  --heading: #2c3e50;
  --muted: #6c757d;
  --bg: #f8f9fa;
  --card: #fff;
  --border: #e9ecef;

  /* Teaching blue accent (matches nitrogen / curved-arrow colour). */
  --accent: #103cff;
  --accent-strong: #0c2fcc;
  --accent-grad: linear-gradient(135deg, #3a5cff 0%, #103cff 100%);
  --accent-shadow: rgba(16, 60, 255, 0.35);

  /* Manchester brand header + gold hover (unchanged from the reference). */
  --header-grad: linear-gradient(90deg, #000000 0%, #eeb412 100%);
  --gold: #eeb412;

  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lift: 0 8px 20px rgba(0, 0, 0, 0.12);

  --success-bg: #e6f6ea;
  --success-fg: #1f7a3b;
  --critical-bg: #fdecea;
  --critical-fg: #c52f24;
  --major-bg: #fff4dc;
  --major-fg: #a06b00;
  --minor-bg: #eef1ff;
  --minor-fg: #0000cc;
  --note-bg: #f0f0f0;
  --note-fg: #555;
}

/* Textbook chem notation: Sₙ1 / H₂O / H₃O⁺ — sub/sup size matches chem texts. */
.chem-notation sub.chem-sub,
sub.chem-sub {
  font-size: 0.68em;
  font-weight: 600;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  bottom: -0.18em;
  letter-spacing: 0.01em;
}
.chem-notation sup.chem-sup,
sup.chem-sup {
  font-size: 0.68em;
  font-weight: 600;
  line-height: 0;
  vertical-align: baseline;
  position: relative;
  top: -0.45em;
  letter-spacing: 0.01em;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

/* Gradient nav header (Manchester black → gold). */
header {
  background: var(--header-grad);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.site-nav {
  max-width: 1200px; margin: 0 auto; padding: 0.9rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand-logo-link { display: block; line-height: 0; }
.brand-logo {
  height: 46px; width: auto; display: block;
  background: #fff; border-radius: 8px; padding: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
/* Site title: no underline; hover shifts to gold (matches the lab's other
   apps, e.g. the ADA Document Remediator). */
.brand-name {
  font-size: 1.4rem; font-weight: 700; color: #fff; text-decoration: none;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); transition: color 0.2s;
}
.brand-name:hover { color: var(--gold); }

/* Auth bar sits in the nav (right side), styled as translucent nav buttons. */
.auth-bar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.auth-status {
  color: rgba(255, 255, 255, 0.92); font-size: 0.9rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
}
.auth-bar button {
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff; padding: 0.4rem 0.85rem; border-radius: 8px; cursor: pointer;
  font-size: 0.9rem; font-weight: 500; transition: all 0.2s;
}
.auth-bar button:hover {
  background: rgba(255, 255, 255, 0.22); border-color: #fff; color: var(--gold);
}
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-link {
  color: #fff; text-decoration: none; font-weight: 600; font-size: 0.95rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); transition: color 0.2s;
}
.nav-link:hover { color: var(--gold); }

/* Hero (title + tagline), matching the ADA Remediator: plain and centered
   below the nav — no card, no shadow. */
.hero { text-align: center; padding: 2.25rem 1rem 0.5rem; margin-bottom: 1.5rem; }
.hero[hidden] { display: none; }
.hero h1 { font-size: 2rem; margin: 0 0 0.5rem; color: var(--heading); }
.hero p { font-size: 1.08rem; color: var(--muted); max-width: 720px; margin: 0 auto; }
.hero p a { color: var(--accent); text-decoration: underline; }
.hero p a:hover { color: var(--gold); }

.auth-panel {
  max-width: 920px; margin: 1rem auto -0.5rem; padding: 1.25rem 1.5rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
}
.auth-tabs { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; }
.auth-tabs button {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 0.35rem 0.5rem; cursor: pointer; color: var(--muted); font-size: 0.95rem;
}
.auth-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.auth-panel .field { display: block; margin-bottom: 0.7rem; }
/* `.field { display:block }` outranks the UA [hidden] rule, so the register-only
   display-name row leaked into login mode; restore hidden behaviour. */
.auth-panel .field[hidden] { display: none; }
.auth-panel .field > span { display: block; font-size: 0.9rem; margin-bottom: 0.2rem; }
.auth-panel input {
  width: 100%; max-width: 360px; padding: 0.45rem 0.55rem;
  border: 1px solid var(--border); border-radius: 4px; font-size: 0.95rem;
}
.auth-panel .row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.4rem; }
.auth-panel button {
  padding: 0.45rem 0.9rem; border-radius: 4px; cursor: pointer; font-size: 0.95rem;
  border: 1px solid var(--border); background: var(--card); color: var(--fg);
}
.auth-panel button.primary {
  background: var(--accent-grad); color: #fff; border: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.auth-panel button.primary:hover {
  transform: translateY(-2px); box-shadow: 0 4px 12px var(--accent-shadow);
}
.auth-panel input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--minor-bg);
}
.auth-panel button:disabled { opacity: 0.6; cursor: wait; transform: none; box-shadow: none; }
.auth-panel .status { color: var(--critical-fg); font-size: 0.9rem; }
.auth-panel .help { color: var(--muted); font-size: 0.88rem; margin: 0.6rem 0 0; }

.my-attempts-panel { max-width: 56rem; }
.my-attempts-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.35rem;
}
.my-attempts-head h2 { margin: 0; font-size: 1.15rem; }
.my-attempts-filters {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1rem;
  align-items: flex-end; margin: 0.75rem 0 0.5rem;
}
.my-attempts-filters .field { margin: 0; min-width: 10rem; flex: 1 1 12rem; }
.my-attempts-filters select { width: 100%; }
.my-attempts-table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.5rem;
}
.my-attempts-table th, .my-attempts-table td {
  text-align: left; padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border); vertical-align: top;
}
.my-attempts-table th { color: var(--muted); font-weight: 600; }
.my-attempts-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82em; }
.my-attempts-table .prompt-snip {
  display: block; color: var(--muted); font-size: 0.82em;
  max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.my-attempts-table .sub-snip {
  max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

main.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}

/* About page: numbered sections (matches Osborne Lab ADA / timetable About). */
.about-page h1 {
  text-align: left;
  font-size: 1.75rem;
  margin: 0 0 1.25rem;
  color: var(--heading);
}
.about-page .step {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.about-page .step h3 {
  color: var(--accent);
  margin: 0 0 1rem;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
}
.about-page .step-number {
  background: var(--accent);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.about-page .step p { margin: 0 0 0.65rem; }
.about-page .step p:last-child { margin-bottom: 0; }
.about-page .step a { color: var(--accent); }
.about-page .step a:hover { color: var(--accent-strong); }

section {
  background: var(--card); padding: 1.75rem 2rem; border: none;
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 2rem;
}

h1, h2, h3 { color: var(--heading); }
h2 { margin-top: 0; }
h3 { margin: 1rem 0 0.5rem; }

.list-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.list-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.list-controls button {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--accent); cursor: pointer; font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
}
.list-controls button:hover { border-color: var(--accent); background: var(--minor-bg); }
.list-search { flex: 1 1 14rem; min-width: 12rem; max-width: 22rem; }
.list-search input {
  width: 100%; box-sizing: border-box;
  font-size: 0.85rem; padding: 0.25rem 0.55rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--fg);
}
.list-search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-shadow);
}
.list-type-filter select {
  font-size: 0.85rem; padding: 0.25rem 0.5rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--fg);
}
.list-search-empty {
  margin: 0.75rem 0 0; padding: 0.85rem 1rem;
  color: var(--muted); font-size: 0.95rem;
  background: var(--note-bg); border-radius: 6px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.category-body { padding-bottom: 0.25rem; }
.category-subtype {
  margin: 0.75rem 0.75rem 0.2rem;
  padding: 0.35rem 0.65rem 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 6px;
  border-left: 3px solid currentColor;
}
.category-subtype--mechanism,
.category-subtype--structure {
  color: var(--success-fg);
  background: var(--success-bg);
}
.category-subtype--other {
  color: var(--muted);
  background: var(--note-bg);
}
.related-problems {
  margin: 1.75rem 0 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--success-bg);
  border: 1px solid #c5e6cf;
  border-radius: 8px;
}
.related-problems-title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: var(--success-fg);
}
.related-problems-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.related-problems-list li {
  padding: 0;
  border-bottom: 1px solid rgba(31, 122, 59, 0.15);
}
.related-problems-list li:last-child { border-bottom: none; }
.related-problems-card {
  display: block;
  padding: 0.45rem 0.35rem;
  margin: 0 -0.35rem;
  border-radius: 6px;
  color: var(--success-fg);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.related-problems-card:hover,
.related-problems-card:focus-visible {
  background: rgba(31, 122, 59, 0.08);
  outline: none;
}
.related-problems-card:hover .related-problems-prompt {
  text-decoration: underline;
}
.related-problems-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem;
}
.related-problems-item .problem-list-scheme {
  margin-top: 0.35rem;
  pointer-events: none; /* clicks go to the card link */
}

/* Collapsible reaction-family categories, styled like enviPath feature cards
 * (native <details>/<summary>; hover lifts, blue accents). */
#problem-groups details.category {
  border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 1rem; background: var(--card); overflow: hidden;
  box-shadow: var(--shadow); transition: box-shadow 0.2s, transform 0.2s;
}
#problem-groups details.category:hover { box-shadow: var(--shadow-lift); }
#problem-groups details.category[open] { box-shadow: var(--shadow-lift); }
.category-summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 1rem 1.2rem; font-weight: 600;
}
.category-summary::-webkit-details-marker { display: none; }
.category-summary:hover { background: var(--minor-bg); }
.category-name { color: var(--accent); font-size: 1.15rem; }
.category-blurb { color: var(--muted); font-size: 0.85em; font-weight: 400; }
.category-count {
  margin-left: auto; background: var(--accent-grad); color: #fff;
  border-radius: 999px; padding: 0.1rem 0.7rem; font-size: 0.8rem;
  font-weight: 700; min-width: 1.8em; text-align: center;
}

/* Nested topic subcategories inside a reaction family (collapsed by default). */
#problem-groups details.subcategory {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0.55rem 0.85rem;
  background: rgba(0, 0, 0, 0.015);
  overflow: hidden;
}
#problem-groups details.subcategory[open] {
  background: var(--card);
}
.subcategory-summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.65rem 0.9rem; font-weight: 600;
}
.subcategory-summary::-webkit-details-marker { display: none; }
.subcategory-summary:hover { background: var(--minor-bg); }
.cell-model-links {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  margin: 0.75rem 0.85rem 0.2rem;
}
.subcategory-body .cell-model-links { margin: 0.55rem 0.75rem 0.15rem; }
.cell-model-link em { font-style: italic; }
.cell-model-links-label {
  color: var(--muted); font-size: 0.85rem; font-weight: 600; margin-right: 0.15rem;
}
.cell-model-link {
  display: inline-block; color: var(--accent); font-weight: 600;
  text-decoration: none; border: 1px solid var(--border); border-radius: 999px;
  padding: 0.28rem 0.75rem; background: #fff;
}
.cell-model-link:hover { border-color: var(--accent); background: var(--minor-bg); }
.subcategory-name { color: var(--fg); font-size: 0.98rem; }
.subcategory-count {
  margin-left: auto;
  background: var(--note-bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.08rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 1.6em;
  text-align: center;
}
.subcategory-body { padding-bottom: 0.15rem; }
.subcategory-body .problem-list { padding-left: 0.65rem; padding-right: 0.65rem; }
.subcategory-body .category-subtype { margin-left: 0.5rem; margin-right: 0.5rem; }

.problem-list { list-style: none; padding: 0 0.9rem 0.4rem; margin: 0; }
.problem-list li { padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.problem-list li:last-child { border-bottom: none; }
.problem-list-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
  margin: -0.25rem -0.35rem;
  padding: 0.25rem 0.35rem;
  cursor: pointer;
}
.problem-list-link:hover .problem-list-prompt,
.problem-list-link:focus-visible .problem-list-prompt {
  text-decoration: underline;
}
.problem-list-link:hover,
.problem-list-link:focus-visible {
  background: rgba(0, 0, 0, 0.03);
  outline: none;
}
.problem-list-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.35rem; }
.problem-list-prompt {
  color: var(--accent);
  line-height: 1.45;
  padding: 0.05em 0 0.15em;
}
.meta { color: var(--muted); font-size: 0.85em; margin-left: 0.25em; }

/* Compact reaction scheme under each structure problem in the catalog list */
.problem-list-scheme {
  margin: 0.45rem 0 0.15rem;
}
.problem-list-preview .list-preview-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.35rem;
}
.problem-list-preview .list-preview-axis {
  font-size: 0.78em; color: var(--muted); margin-bottom: 0.25rem;
}
.problem-list-preview .list-preview-spectrum {
  margin: 0.35rem 0 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.72em;
  line-height: 1.35;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
  white-space: pre-wrap;
  max-width: 36rem;
}
.reaction-scheme-compact {
  gap: 0.35rem;
  margin: 0.45rem 0 0.1rem;
}
.reaction-scheme-compact .structure-fig-sm {
  padding: 0.2rem 0.3rem 0.3rem;
  border-radius: 6px;
}
.reaction-scheme-compact .structure-img-sm {
  /* Intrinsic SVG size from fixed-bond depictions (not a shared box). */
  width: auto; height: auto; max-width: none;
}
.reaction-scheme-compact .struct-label {
  font-size: 0.9em; font-weight: 600; color: #000;
}
.reaction-scheme-compact .structure-fig figcaption code {
  font-size: 0.9em; color: #000;
}
.reaction-scheme-compact .rxn-plus { font-size: 1.05rem; }
.reaction-scheme-compact .rxn-arrow {
  min-width: 88px; padding: 0 0.2rem;
}
.reaction-scheme-compact .rxn-arrow-reagent {
  font-size: 0.9em; max-width: 160px; color: #000; line-height: 1.25;
}
.reaction-scheme-compact .rxn-arrow-conditions {
  font-size: 0.85em; max-width: 160px; color: #000; font-style: italic;
  line-height: 1.2;
}
.reaction-scheme-compact .rxn-arrow-bar {
  min-width: 64px; margin: 0.15rem 0;
}
.reaction-scheme-compact .rxn-placeholder {
  font-size: 0.78em; color: var(--muted); font-style: italic;
}
.reaction-scheme-compact .rxn-arrow-bar::after {
  top: -5px; border-left-width: 8px;
  border-top-width: 4px; border-bottom-width: 4px;
}
.reaction-scheme-compact .rxn-product {
  min-width: 56px; min-height: 72px; padding: 0.15rem;
}
.reaction-scheme-compact .rxn-product-mark {
  font-size: 1.5rem; padding: 0.45rem 0.6rem;
}

/* Mechanism problem detail: keep the scheme on one horizontal line. */
.reaction-scheme-detail-compact {
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.15rem;
}
.reaction-scheme-detail-compact .rxn-reactants,
.reaction-scheme-detail-compact .rxn-products {
  flex-wrap: nowrap;
  flex: 0 0 auto;
}
.reaction-scheme-detail-compact .structure-fig-sm {
  flex: 0 0 auto;
}
.reaction-scheme-detail-compact .rxn-arrow {
  flex: 0 0 auto;
}

#back-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 0.95rem; padding: 0; margin-bottom: 0.5rem;
}
#back-btn:hover { text-decoration: underline; }

#problem-meta div { margin: 0.15rem 0; color: var(--muted); }
#problem-meta code { background: #f1f1f1; padding: 1px 4px; border-radius: 3px; font-size: 0.9em; }

/* Starting-compound / ranking-item line structures */
.structure-gallery {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  margin: 0.5rem 0 0.9rem;
}
.structure-gallery[hidden] { display: none; }
.structure-fig {
  margin: 0; padding: 0.4rem 0.5rem 0.5rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; text-align: center;
}
.structure-img {
  /* Natural SVG pixel size — bond length is fixed server-side, so small and
     large molecules stay on the same scale instead of each filling a box. */
  display: block; width: auto; height: auto; margin: 0 auto;
}
.structure-fig figcaption { margin-top: 0.3rem; font-size: 1em; }
.structure-fig .struct-label {
  display: block; font-weight: 600; color: #000; font-size: 1.1em;
  margin-bottom: 0.15rem;
}
.structure-fig figcaption code {
  background: #f1f1f1; padding: 2px 6px; border-radius: 3px;
  font-size: 1em; color: #000;
}

/* Reaction scheme: reactants ── reagent/conditions ──► product placeholder */
.reaction-scheme {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  margin: 0.6rem 0 1rem;
}
.reaction-scheme[hidden] { display: none; }
.rxn-reactants,
.rxn-products {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
}
.rxn-plus { font-size: 1.4rem; font-weight: 600; color: var(--muted); }
/* Mechanism schemes show real products (not the dashed "?" placeholder). */
.rxn-products .rxn-product {
  border-style: solid;
  min-width: 0;
  min-height: 0;
}
.rxn-arrow {
  display: flex; flex-direction: column; align-items: center;
  flex: 0 1 auto; min-width: 150px; padding: 0 0.35rem;
}
.rxn-arrow-reagent {
  font-size: 1.1em; color: #000; text-align: center;
  max-width: 280px; line-height: 1.3;
}
.rxn-arrow-conditions {
  font-size: 1em; color: #000; font-style: italic;
  text-align: center; max-width: 280px; line-height: 1.25;
}
.rxn-arrow-bar {
  position: relative; width: 100%; min-width: 120px; height: 0;
  border-top: 2px solid var(--fg); margin: 0.3rem 0;
}
.rxn-arrow-bar::after {
  content: ''; position: absolute; right: -1px; top: -6px;
  border-left: 10px solid var(--fg);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.rxn-product {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-width: 130px; min-height: 165px;
  border-style: dashed;
}
.rxn-product-mark {
  font-size: 2.6rem; color: var(--muted); line-height: 1;
  padding: 1rem 1.3rem;
}
.rxn-placeholder {
  color: var(--muted); font-style: italic; padding: 1rem 1.2rem;
  border: 1px dashed var(--border); border-radius: 8px;
}
@media (max-width: 640px) {
  .rxn-arrow { min-width: 110px; }
  .rxn-arrow-bar { min-width: 80px; }
}

#editor-frame-wrap {
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; overflow: hidden;
  margin-bottom: 0.75rem;
}
#ketcher-frame {
  width: 100%; height: 520px; border: none; display: block;
}
.ketcher-tip {
  margin: -0.35rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

#smiles-fallback { margin-bottom: 0.75rem; }
#smiles-fallback .help { color: var(--muted); font-size: 0.9em; margin: 0.25rem 0 0.5rem; }
#smiles-input {
  width: 100%; padding: 0.5rem 0.75rem; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.95rem; border: 1px solid var(--border); border-radius: 4px;
}

#submit-row { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; }
#submit-btn, #rank-submit-btn {
  background: var(--accent-grad); color: #fff; border: none;
  padding: 0.65rem 1.4rem; border-radius: 8px; cursor: pointer;
  font-size: 0.95rem; font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}
#submit-btn:hover, #rank-submit-btn:hover {
  transform: translateY(-2px); box-shadow: 0 4px 12px var(--accent-shadow);
}
#submit-btn:disabled, #rank-submit-btn:disabled {
  opacity: 0.6; cursor: wait; transform: none; box-shadow: none;
}
#submit-status { color: var(--muted); font-size: 0.9rem; }

#answer-result-host > section {
  margin: 0.75rem 0 1rem;
}
#answer-result-host > section > h3 {
  margin-top: 0;
}

.banner {
  padding: 0.6rem 0.9rem; border-radius: 4px; font-weight: 500;
  margin-bottom: 0.75rem;
}
.banner.success { background: var(--success-bg); color: var(--success-fg); }
.banner.critical { background: var(--critical-bg); color: var(--critical-fg); }
.banner.major { background: var(--major-bg); color: var(--major-fg); }
.banner.minor { background: var(--minor-bg); color: var(--minor-fg); }

#hits-list { list-style: none; padding-left: 0; }
.hit {
  padding: 0.6rem 0.85rem; margin: 0.5rem 0; border-radius: 4px;
  border-left: 4px solid transparent;
}
.hit.critical { background: var(--critical-bg); border-left-color: var(--critical-fg); }
.hit.major    { background: var(--major-bg);    border-left-color: var(--major-fg); }
.hit.minor    { background: var(--minor-bg);    border-left-color: var(--minor-fg); }
.hit.note     { background: var(--note-bg);     border-left-color: var(--note-fg); }

.severity {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; padding: 1px 6px; border-radius: 3px;
  margin-right: 0.5rem; vertical-align: middle;
}
.severity.critical { background: var(--critical-fg); color: #fff; }
.severity.major    { background: var(--major-fg);    color: #fff; }
.severity.minor    { background: var(--minor-fg);    color: #fff; }
.severity.note     { background: var(--note-fg);     color: #fff; }

.hit-name { font-weight: 600; }
.feedback { margin-top: 0.3rem; }
.concept { margin-top: 0.3rem; color: var(--muted); font-size: 0.9em; }
.suppresses { margin-top: 0.2rem; color: var(--muted); font-size: 0.8em; }

.reaction-summary {
  margin-top: 0.75rem; padding: 0.6rem 0.85rem;
  background: #f7f9fc; border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 4px;
}
.reaction-header { margin-bottom: 0.35rem; }
.reaction-label { color: var(--muted); font-size: 0.85em; }
.reaction-name { font-weight: 600; }
.reaction-category { color: var(--muted); font-size: 0.85em; }
.reaction-summary-text { color: var(--fg); font-size: 0.92em; margin: 0.25rem 0 0.5rem; }
.reaction-link {
  color: var(--accent); font-size: 0.88em; text-decoration: none;
}
.reaction-link:hover { text-decoration: underline; }

/* Graduated reveal of the reaction reference */
.reveal-control { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.reaction-reveal-btn {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); padding: 0.25rem 0.7rem;
  border-radius: 4px; cursor: pointer; font-size: 0.85rem;
}
.reaction-reveal-btn:hover { background: var(--accent); color: #fff; }
.reveal-note { color: var(--muted); font-size: 0.82em; }
.reveal-note-body { font-size: 0.92em; margin-bottom: 0.25rem; }
.reveal-rationale { font-size: 0.92em; margin: 0.25rem 0; }
.reaction-reveal-content:not(:empty) { margin-top: 0.5rem; }
.reaction-reveal-content .reaction-header { margin-bottom: 0.25rem; }

/* Inline full reference (revealed in place, no popup) */
.reaction-full-ref { margin-top: 0.4rem; }
.ref-loading { color: var(--muted); font-size: 0.85em; }
.reaction-extras .ref-block { margin: 0.4rem 0; }
.mechanism-image-fig {
  margin: 0.75rem 0 1rem;
  padding: 0;
}
.mechanism-image-fig img.mechanism-image {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
}
.mechanism-image-fig figcaption {
  margin-top: 0.35rem;
  font-size: 0.9em;
  color: var(--muted);
}
.mechanism-image-credit {
  margin-top: 0.25rem;
  font-size: 0.75em;
  color: var(--muted);
}
.ref-heading { font-weight: 600; font-size: 0.85em; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.15rem; }
.ref-list { margin: 0.1rem 0 0; padding-left: 1.2rem; font-size: 0.9em; }
.ref-list li { margin: 0.1rem 0; }
.ref-text { font-size: 0.9em; }

/* On-demand hint */
#hint-row { margin: 0.5rem 0 1rem; }
#hint-btn {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); padding: 0.35rem 0.8rem;
  border-radius: 4px; cursor: pointer; font-size: 0.9rem;
}
#hint-btn:hover { background: var(--accent); color: #fff; }
#hint-btn:disabled { opacity: 0.7; cursor: default; background: transparent; color: var(--muted); border-color: var(--border); }
.hint-note { color: var(--muted); font-size: 0.85em; margin-left: 0.6rem; }
#hint-content:not(:empty) { margin-top: 0.6rem; }
.hint-mechanism { font-size: 0.95em; margin-bottom: 0.25rem; }
.hint-extra { font-size: 0.9em; color: var(--fg); }
.hint-error { color: var(--major-fg); font-size: 0.88em; }

/* "Use in editor" affordance on reactant/answer figures */
.use-in-editor-btn {
  display: inline-block; margin-top: 0.25rem;
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); padding: 0.15rem 0.5rem;
  border-radius: 4px; cursor: pointer; font-size: 0.75rem;
}
.use-in-editor-btn:hover { background: var(--accent); color: #fff; }
.use-in-editor-btn:disabled { opacity: 0.7; cursor: default; }
.rxn-use-all { margin-top: 0.35rem; }
.use-all-in-editor-btn { font-weight: 600; }

/* Reveal-answer (self-paced study) */
#solution-row { margin: 0.5rem 0 1rem; }
#solution-btn {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); padding: 0.35rem 0.8rem;
  border-radius: 4px; cursor: pointer; font-size: 0.9rem;
}
#solution-btn:hover { background: var(--accent); color: #fff; }
#solution-btn:disabled { opacity: 0.7; cursor: default; background: transparent; color: var(--muted); border-color: var(--border); }
#solution-content:not(:empty) { margin-top: 0.6rem; }
.solution-caption { font-size: 0.9em; margin-bottom: 0.35rem; }

/* Mechanism detail: Show answer lives under Arrows in the right column. */
.mech-solution-host:empty { display: none; }
.mech-side .solution-row-mech {
  margin: 1rem 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #c8d0d8;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.mech-side .solution-row-mech .hint-note {
  display: block;
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--muted);
}
.mech-side .solution-row-mech #solution-content:not(:empty) {
  margin-top: 0.35rem;
  width: 100%;
}

.solution-ranking { margin: 0.4rem 0; padding-left: 1.3rem; }
.solution-ranking li { margin-bottom: 0.5rem; }
.solution-rank-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.solution-rationale { font-size: 0.86em; color: var(--muted); margin-top: 0.15rem; }

/* Ranking problems */
#ranking-section { margin-top: 0.5rem; }
#ranking-list { list-style: none; padding: 0; margin: 0.75rem 0; }
.rank-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border);
}
.rank-slot { font-weight: 600; min-width: 2rem; color: var(--muted); }
.rank-select { flex: 1; padding: 0.35rem 0.5rem; font-size: 0.95rem; }
#rank-submit-row { margin-top: 0.75rem; }

/* Metabolic flux simulation */
#simulation-section { margin-top: 0.5rem; }
.sim-goal {
  background: #f6f4ef; border: 1px solid var(--border); border-radius: 8px;
  padding: 0.65rem 0.85rem; margin: 0.6rem 0; font-size: 0.92rem;
}
.sim-workspace {
  display: grid;
  grid-template-columns: minmax(12.5rem, 1fr) minmax(0, 2.2fr);
  gap: 0.75rem 1.25rem;
  align-items: start;
  margin: 0.75rem 0 0.15rem;
}
@media (max-width: 860px) {
  .sim-workspace { grid-template-columns: 1fr; }
}
.sim-controls { min-width: 0; }
.sim-presets { margin: 0 0 0.65rem; }
.sim-presets-group {
  margin: 0 0 0.45rem;
}
.sim-presets-label {
  display: block;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); margin-bottom: 0.25rem;
}
.sim-presets-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.sim-preset {
  background: #fff; color: var(--heading);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.22rem 0.65rem; font-size: 0.8rem; cursor: pointer;
  line-height: 1.3;
}
.sim-preset:hover { border-color: var(--accent); color: var(--accent); }
.sim-preset.active {
  background: var(--accent-grad); color: #fff; border-color: transparent;
}
.sim-preset:disabled { opacity: 0.45; cursor: not-allowed; }
.sim-presets-note { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--muted); }
.sim-sliders { display: flex; flex-direction: column; gap: 0.85rem; margin: 0.35rem 0 0; }
.sim-map {
  padding: 0.7rem 0.8rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.sim-map-toggle {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; cursor: pointer;
}
.sim-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(11rem, 14rem);
  gap: 0.75rem 1.1rem;
  align-items: start;
  margin-top: 0.45rem;
}
@media (max-width: 640px) {
  .sim-map-layout { grid-template-columns: 1fr; }
}
.sim-map-svg { width: 100%; max-width: 42rem; margin: 0 auto; }
.sim-map-svg svg { width: 100%; height: auto; display: block; }
.sim-map-body { fill: #f3e4d4; stroke: #c4a990; stroke-width: 1.6; }
.sim-map-edge {
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  cursor: pointer;
  pointer-events: none;
}
.sim-map-edge-hit {
  fill: none; stroke: transparent; stroke-width: 16;
  pointer-events: stroke; cursor: pointer;
}
.sim-map-edge-tag {
  font-size: 9px; font-weight: 700;
  paint-order: stroke; stroke: #f7f3ec; stroke-width: 3px;
  pointer-events: none; text-anchor: middle;
}
.sim-map-svg.sim-map-focus .sim-map-edge-g.is-dim,
.sim-map-svg.sim-map-focus .sim-map-node.is-dim {
  opacity: 0.18;
}
.sim-map-edge-g.is-hot .sim-map-edge {
  opacity: 1 !important;
}
.sim-map-edge-g.is-hot .sim-map-edge-tag { opacity: 1 !important; }
.sim-map-edge.flowing {
  animation: sim-map-flow 1.15s linear infinite;
}
@keyframes sim-map-flow {
  to { stroke-dashoffset: calc(-1 * var(--flow-cycle, 18px)); }
}
.sim-map-node { cursor: pointer; }
.sim-map-node-label {
  font-size: 11px; font-weight: 700; fill: #4a4038;
  pointer-events: none; text-anchor: middle;
}
.sim-map-node-label.small { font-size: 9px; }
.sim-map-badge {
  font-size: 12px; font-weight: 700;
}
.sim-map-legend {
  display: flex; flex-direction: column; gap: 0.28rem;
  font-size: 0.78rem; line-height: 1.25;
}
.sim-map-legend-row {
  display: grid;
  grid-template-columns: 0.7rem 1fr 2.4rem;
  gap: 0.35rem; align-items: center;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.12rem 0.2rem;
}
.sim-map-legend-row.is-hot { background: #f3efe6; }
.sim-map-legend-swatch {
  width: 0.7rem; height: 0.7rem; border-radius: 2px;
}
.sim-map-legend-bar {
  height: 0.35rem; background: #e8e4dc; border-radius: 99px; overflow: hidden;
  grid-column: 2 / 4;
}
.sim-map-legend-bar > span { display: block; height: 100%; width: 0; border-radius: inherit; }
.sim-map-caption {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.88rem; color: var(--heading);
  background: #f7f3ec;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 3.4rem;
}
.sim-map-cap-head {
  display: flex; justify-content: space-between; gap: 0.75rem;
  align-items: baseline;
}
.sim-map-cap-head strong { font-size: 0.92rem; }
#sim-map-cap-val { font-variant-numeric: tabular-nums; color: var(--muted); }
#sim-map-cap-hint { margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--muted); }
.sim-slider-row { display: grid; grid-template-columns: 7.4rem 1fr 2.8rem; gap: 0.5rem; align-items: center; }
.sim-slider-row input[type="range"] { width: 100%; }
.sim-slider-row.sim-locked { opacity: 0.72; }
.sim-slider-row.sim-locked label { font-style: italic; }
.sim-meters { display: flex; flex-direction: column; gap: 0.65rem; margin: 1rem 0 0.5rem; }
.sim-meter { display: grid; grid-template-columns: 9.2rem 1fr 4.2rem; gap: 0.75rem; align-items: center; }
.sim-meter-track {
  height: 0.7rem; background: #e8e4dc; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.sim-meter-fill { height: 100%; width: 0; background: #4a7c59; border-radius: inherit; }
.sim-meter-fill.warn { background: #b45309; }
.sim-meter-fill.ok { background: #2f6f4e; }
#sim-submit-row { margin-top: 0.75rem; }
.sim-trace {
  margin: 1rem 0 0.25rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}
.sim-trace-toggle {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; cursor: pointer;
}
.sim-trace-legend {
  display: flex; flex-wrap: wrap; gap: 0.35rem 0.85rem;
  margin: 0.65rem 0 0.35rem;
}
.sim-trace-legend-group {
  flex: 1 1 100%;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); margin-top: 0.35rem;
}
.sim-trace-swatch {
  display: inline-block; width: 0.7rem; height: 0.7rem;
  border-radius: 2px; margin-right: 0.35rem; vertical-align: -0.05rem;
}
.sim-trace-legend label {
  display: inline-flex; align-items: center; gap: 0.2rem;
  font-size: 0.88rem; cursor: pointer; user-select: none;
}
.sim-trace-chart { width: 100%; overflow: hidden; }
.sim-trace-chart svg { width: 100%; height: auto; display: block; }
.sim-trace-axis { fill: var(--muted); font-size: 10px; }
.sim-trace-title { fill: #4a4038; font-size: 12px; font-weight: 700; }
.sim-trace-end { font-size: 10px; font-weight: 700; }
#simulation-trace-caption { margin: 0.35rem 0 0.15rem; }
.sim-trace-readout {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Multiple-choice (naming / spectroscopy) */
#choice-section { margin-top: 0.5rem; }
.choice-stimulus {
  white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem; background: #f6f4ef; border: 1px solid var(--border);
  padding: 0.75rem 1rem; margin: 0.75rem 0; overflow-x: auto;
}
.choice-passage {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  background: #f6f4ef;
  border: 1px solid var(--border);
  border-left: 3px solid #6b5d4d;
  padding: 0.85rem 1.05rem;
  margin: 0.75rem 0;
  max-width: 48rem;
}
#problem-passage {
  margin-top: 0.35rem;
  margin-bottom: 0.85rem;
}
.choice-letter {
  font-weight: 700;
  min-width: 1.35rem;
  color: var(--muted);
  flex: 0 0 auto;
}
.choice-list {
  border: none; padding: 0; margin: 0.75rem 0;
  display: flex; flex-direction: column; gap: 0.35rem;
}
.choice-option {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.5rem 0.35rem; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.choice-option:last-child { border-bottom: none; }
.choice-option input { margin-top: 0.25rem; }
.choice-option-label { flex: 1; line-height: 1.35; }
.choice-option-img {
  max-width: 200px; max-height: 180px; width: auto; height: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
.pedagogy-figure-wrap { margin: 0.75rem 0; }
.pedagogy-figure {
  margin: 0; display: inline-flex; flex-direction: column; align-items: center;
  gap: 0.35rem;
}
.pedagogy-img {
  max-width: 280px; max-height: 240px; width: auto; height: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
.structure-gallery .pedagogy-figure { margin: 0.25rem 0.5rem 0.25rem 0; }
#choice-submit-row { margin-top: 0.75rem; }

/* Attempt history (client-side, per problem) — collapsed header until clicked */
#attempt-history-section.attempt-history {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}
.history-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  margin: 0;
  padding: 0.65rem 0.9rem;
  font-weight: 600;
  font-size: 1.05rem;
}
.history-summary::-webkit-details-marker { display: none; }
.history-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--muted);
  transition: transform 0.15s;
}
#attempt-history-section[open] > .history-summary::before {
  transform: rotate(90deg);
}
.history-summary:hover { background: var(--minor-bg); }
.history-body { padding: 0 0.9rem 0.75rem; }
.history-body-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.history-privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 42rem;
}
#clear-history-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 0.85rem; padding: 0;
  flex-shrink: 0;
}
#clear-history-btn:hover { text-decoration: underline; }
#attempt-history-list { list-style: decimal; padding-left: 1.6rem; margin: 0.6rem 0 0; }
.history-entry { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.history-entry:last-child { border-bottom: none; }
.history-entry-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.history-submission {
  background: #f1f1f1; padding: 1px 5px; border-radius: 3px;
  font-size: 0.85em; color: var(--fg);
  overflow-wrap: anywhere; max-width: 100%;
}
.history-time { margin-left: auto; }
.history-codes { margin-top: 0.25rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.history-code {
  font-size: 0.68rem; font-weight: 600; padding: 1px 5px; border-radius: 3px;
  background: var(--note-bg); color: var(--note-fg);
}
.history-code.critical { background: var(--critical-bg); color: var(--critical-fg); }
.history-code.major    { background: var(--major-bg);    color: var(--major-fg); }
.history-code.minor    { background: var(--minor-bg);    color: var(--minor-fg); }

footer {
  text-align: center; padding: 2rem; color: var(--muted);
  margin-top: 3rem; background: var(--card); border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer .version { margin: 0.5rem 0 0; font-size: 0.82rem; opacity: 0.75; }

/* Learning objectives page */
.objectives-page { max-width: 52rem; padding-bottom: 3rem; }
.objectives-intro h1 { margin-bottom: 0.4rem; }
.objectives-intro p { color: var(--muted); margin-top: 0; }
.objectives-course-tabs {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin: 1.25rem 0 1rem; border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.objectives-course-tab {
  border: 1px solid var(--border); background: var(--card);
  padding: 0.4rem 0.85rem; border-radius: 4px; cursor: pointer;
  font-weight: 600;
  text-decoration: none; color: inherit; display: inline-block;
}
.objectives-course-tab.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.objectives-course-meta { color: var(--muted); margin: 0 0 1.25rem; }
.objective-group { margin-bottom: 1.75rem; }
.objective-group-title { font-size: 1.15rem; margin: 0 0 0.75rem; }
.objective-list { display: flex; flex-direction: column; gap: 0.5rem; }
.objective-related { margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px dashed var(--border); }
.objective-related-title { font-size: 1rem; margin: 0 0 0.35rem; }
.objective-related-help { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.6rem; }
.objective-related-topics { display: flex; flex-direction: column; gap: 0.5rem; }
.objective-related-topic-name { font-weight: 600; color: var(--fg); }
.objective-card {
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--card); padding: 0.35rem 0.75rem 0.5rem;
}
.objective-summary {
  list-style: none; cursor: pointer;
  display: flex; gap: 0.75rem; align-items: flex-start;
  justify-content: space-between; flex-wrap: wrap;
}
.objective-summary::-webkit-details-marker { display: none; }
.objective-head { display: flex; gap: 0.65rem; flex: 1; min-width: 12rem; }
.objective-code {
  font-weight: 700; color: var(--accent); white-space: nowrap;
  text-decoration: none;
}
.objective-code:hover { text-decoration: underline; }

/* Focused single-CLO page (deep link / open in new tab) */
body.clo-focus-view main.container {
  max-width: none;
  width: 100%;
  margin: 1.25rem 0 2.5rem;
  padding: 0 1.5rem;
}
body.clo-focus-view .objectives-page {
  max-width: none;
  width: 100%;
  padding-bottom: 2rem;
}
.clo-focus {
  max-width: none;
  width: 100%;
}
.clo-focus-back {
  display: inline-block; margin: 0 0 1rem;
  color: var(--accent); text-decoration: none; font-size: 0.95rem;
}
.clo-focus-back:hover { text-decoration: underline; }
.clo-focus-header {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  background: #f0f0f0;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.clo-focus-course {
  margin: 0 0 0.25rem; color: #000; font-size: 0.9rem;
}
.clo-focus-group {
  margin: 0 0 0.75rem; color: #000; font-size: 0.9rem;
}
.clo-focus-title {
  margin: 0 0 0.5rem; color: var(--accent); font-size: 1.5rem;
}
.clo-focus-text {
  margin: 0; color: #000; font-size: 1.05rem; line-height: 1.45;
}
.clo-focus-body h2 {
  font-size: 1.1rem; margin: 0 0 0.75rem;
}
.clo-focus-problems {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.clo-focus-problem { margin: 0; padding: 0; }
.clo-focus-problem-link {
  display: block;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.clo-focus-problem-link:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.clo-focus-problem-prompt {
  display: block;
  color: var(--accent);
  font-weight: 500;
  line-height: 1.4;
}
.clo-focus-problem-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.objective-text { flex: 1; }
.objective-count {
  font-size: 0.8rem; white-space: nowrap; color: var(--muted);
  padding: 0.15rem 0.45rem; border-radius: 3px; background: #f1f1f1;
}
.objective-count.has-problems {
  background: var(--note-bg); color: var(--note-fg); font-weight: 600;
}
.objective-problem-list {
  margin: 0.5rem 0 0.25rem; padding-left: 1.25rem;
}
.objective-problem { margin: 0.35rem 0; }
.objective-problem-link { color: var(--accent); text-decoration: none; }
.objective-problem-link:hover { text-decoration: underline; }
.objective-problem-meta {
  display: block; font-size: 0.8rem; color: var(--muted); margin-top: 0.1rem;
}
.objective-empty { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0 0.2rem; }
.objectives-error { color: var(--critical-fg); }

.clo-picker {
  max-height: 220px; overflow: auto;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.5rem 0.75rem; background: #fff;
  margin: 0.35rem 0 0.5rem;
}
.clo-picker-course { margin: 0.6rem 0 0.25rem; font-size: 0.95rem; color: var(--heading); }
.clo-picker-course:first-child { margin-top: 0; }
.clo-picker-item {
  display: flex; gap: 0.5rem; align-items: flex-start;
  font-size: 0.88rem; margin: 0.2rem 0; cursor: pointer;
}
.clo-picker-item input { margin-top: 0.2rem; }

.coach-badge {
  display: inline-block; margin-left: 0.4rem;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
  text-transform: uppercase; color: #7c3aed;
  background: #f3e8ff; border-radius: 999px; padding: 0.1rem 0.5rem;
  vertical-align: middle;
}
.coach-thread { display: flex; flex-direction: column; gap: 0.55rem; margin: 0.6rem 0; }
.coach-line p { margin: 0.2rem 0 0; }
.coach-who { font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.coach-line.coach-coach p { color: var(--heading); }
.coach-compose { display: flex; gap: 0.5rem; align-items: flex-end; }
.coach-compose textarea {
  flex: 1; resize: vertical; min-height: 2.6rem;
  font: inherit; padding: 0.4rem 0.55rem;
  border: 1px solid var(--border); border-radius: 6px;
}

