*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.14);
  --text: #1a1a18;
  --muted: #6b6b66;
  --hint: #9e9e98;
  --accent-teal: #0f6e56;
  --accent-teal-bg: #e1f5ee;
  --accent-purple: #534ab7;
  --accent-purple-bg: #eeedfe;
  --accent-amber: #854f0b;
  --accent-amber-bg: #faeeda;
  --accent-coral: #993c1d;
  --accent-coral-bg: #faece7;
  --mono: 'DM Mono', monospace;
  --sans: 'DM Sans', sans-serif;
  --radius: 10px;
  --fbd-weight: #993c1d;
  --fbd-normal: #0f6e56;
  --fbd-friction: #854f0b;
  --fbd-tension: #534ab7;
  --fbd-applied: #2c5fa8;
  --fbd-custom: #555550;
  --fbd-net: #c0392b;
}

[data-theme="dark"] {
  --bg: #171717;
  --surface: #111111;
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.18);
  --text: #f1f0ea;
  --muted: #a3a39c;
  --hint: #6f6f69;
  --accent-teal: #36c9a0;
  --accent-teal-bg: rgba(54,201,160,0.14);
  --accent-purple: #a99cf5;
  --accent-purple-bg: rgba(169,156,245,0.14);
  --accent-amber: #e8b366;
  --accent-amber-bg: rgba(232,179,102,0.14);
  --accent-coral: #ec9572;
  --accent-coral-bg: rgba(236,149,114,0.14);
  --fbd-weight: #ec9572;
  --fbd-normal: #36c9a0;
  --fbd-friction: #e8b366;
  --fbd-tension: #a99cf5;
  --fbd-applied: #87aee6;
  --fbd-custom: #cdcbc4;
  --fbd-net: #ec9572;
}

body, body *,
body *::before,
body *::after {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo:hover { opacity: 0.6; }

.nav-links {
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: center;
}

.nav-link {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s;
}

.nav-link.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-link:hover { opacity: 0.6; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-divider {
  width: 1px;
  height: 16px;
  background: var(--border-strong);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.theme-toggle:hover { opacity: 0.6; }

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.page > header,
.page > .section {
  opacity: 0;
  transform: translateY(16px);
}

header {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

header .syllabus-back {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--hint);
  text-decoration: none;
  transition: color 0.2s;
}

header .syllabus-back:hover { color: var(--text); }

header > div:not(.study-toggle) {
  border-left: 3px solid var(--accent-purple);
  padding-left: 0.85rem;
  margin-top: 0.2rem;
}

header h1 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

header span {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--hint);
  font-style: italic;
}

.section-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hint);
  margin-bottom: 0.6rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
}

.section > .card,
.section > .grid {
  margin-bottom: 0.75rem;
}

.section > .card:last-child,
.section > .grid:last-child {
  margin-bottom: 0;
}

.card .card-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.row:last-child { border-bottom: none; padding-bottom: 0; }
.row:first-of-type { padding-top: 0; }

.row-desc {
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
  line-height: 1.4;
}

.row-val {
  font-size: 0.85rem;
  color: var(--text);
  text-align: right;
}

.badge {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-family: var(--mono);
  letter-spacing: 0.01em;
}

.teal   { background: var(--accent-teal-bg);   color: var(--accent-teal); }
.purple { background: var(--accent-purple-bg); color: var(--accent-purple); }
.amber  { background: var(--accent-amber-bg);  color: var(--accent-amber); }
.coral  { background: var(--accent-coral-bg);  color: var(--accent-coral); }

.footnote {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.fn-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.fn-key {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.fn-val { color: var(--muted); }

.section { margin-bottom: 2rem; }

.prose {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 0.75rem;
}
.prose strong { color: var(--text); font-weight: 500; }

.graph-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}
@media (max-width: 560px) { .graph-grid { grid-template-columns: 1fr; } }

.graph-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.graph-card-header {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.graph-card-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.graph-card-eq {
  font-size: 0.82rem;
  color: var(--accent-teal);
}

canvas { display: block; width: 100%; }

.graph-caption {
  padding: 0.45rem 1rem;
  font-size: 0.72rem;
  color: var(--hint);
  font-family: var(--mono);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.graph-caption > :first-child { flex: 1; }

.fbd-randomize {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--hint);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
}

.fbd-randomize:hover, .fbd-pause:hover {
  color: var(--accent-teal);
  border-color: var(--accent-teal);
}

.fbd-pause {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--hint);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
}

.step-list {
  list-style: none;
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.step-list li {
  counter-increment: steps;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}
.step-list li::before {
  content: counter(steps);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-teal);
  background: var(--accent-teal-bg);
  border-radius: 4px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.study-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.study-toggle-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--hint);
  transition: color 0.2s;
}

.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.study-mode .toggle-track {
  background: var(--accent-teal);
}

.study-mode .toggle-thumb {
  transform: translateX(14px);
}

.study-mode .study-toggle-label {
  color: var(--accent-teal);
}

.study-mode .row-val,
.study-mode .badge {
  background: var(--border-strong) !important;
  color: transparent !important;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 40px;
  display: inline-block;
}

.study-mode .formula {
  position: relative;
  color: transparent !important;
  cursor: pointer;
  transition: color 0.15s;
  filter: brightness(0.85);
}

.study-mode .formula::after {
  content: 'click to reveal';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hint);
}

.study-mode .formula.revealed { filter: none; }
.study-mode .formula.revealed::after { display: none; }

.study-mode .row-val.revealed,
.study-mode .badge.revealed {
  background: revert !important;
  color: revert !important;
}

.study-mode .formula.revealed {
  color: revert !important;
}

.study-mode .badge.teal.revealed   { background: var(--accent-teal-bg) !important; color: var(--accent-teal) !important; }
.study-mode .badge.purple.revealed { background: var(--accent-purple-bg) !important; color: var(--accent-purple) !important; }
.study-mode .badge.amber.revealed  { background: var(--accent-amber-bg) !important; color: var(--accent-amber) !important; }
.study-mode .badge.coral.revealed  { background: var(--accent-coral-bg) !important; color: var(--accent-coral) !important; }
.study-mode .row-val.revealed      { background: transparent !important; color: var(--text) !important; }

/* Variable color coding — K teal, U coral, E_mech amber, p purple, J teal */
.var-k     { color: var(--accent-teal)   !important; }
.var-u     { color: var(--accent-coral)  !important; }
.var-emech { color: var(--accent-amber)  !important; }
.var-p     { color: var(--accent-purple) !important; }
.var-j     { color: var(--accent-teal)   !important; }
.var-omega { color: var(--accent-teal)   !important; }
.var-alpha { color: var(--accent-coral)  !important; }
.var-theta { color: var(--accent-purple) !important; }
.var-tau     { color: var(--accent-amber)  !important; }
.var-inertia { color: var(--accent-teal)   !important; }

.study-mode .formula:not(.revealed)  .var-k,
.study-mode .formula:not(.revealed)  .var-u,
.study-mode .formula:not(.revealed)  .var-emech,
.study-mode .formula:not(.revealed)  .var-p,
.study-mode .formula:not(.revealed)  .var-j,
.study-mode .formula:not(.revealed)  .var-omega,
.study-mode .formula:not(.revealed)  .var-alpha,
.study-mode .formula:not(.revealed)  .var-theta,
.study-mode .formula:not(.revealed)  .var-tau,
.study-mode .formula:not(.revealed)  .var-inertia,
.study-mode .row-val:not(.revealed)  .var-k,
.study-mode .row-val:not(.revealed)  .var-u,
.study-mode .row-val:not(.revealed)  .var-emech,
.study-mode .row-val:not(.revealed)  .var-p,
.study-mode .row-val:not(.revealed)  .var-j,
.study-mode .row-val:not(.revealed)  .var-omega,
.study-mode .row-val:not(.revealed)  .var-alpha,
.study-mode .row-val:not(.revealed)  .var-theta,
.study-mode .row-val:not(.revealed)  .var-tau,
.study-mode .row-val:not(.revealed)  .var-inertia,
.study-mode .badge:not(.revealed)    .var-k,
.study-mode .badge:not(.revealed)    .var-u,
.study-mode .badge:not(.revealed)    .var-emech,
.study-mode .badge:not(.revealed)    .var-p,
.study-mode .badge:not(.revealed)    .var-j,
.study-mode .badge:not(.revealed)    .var-omega,
.study-mode .badge:not(.revealed)    .var-alpha,
.study-mode .badge:not(.revealed)    .var-theta,
.study-mode .badge:not(.revealed)    .var-tau,
.study-mode .badge:not(.revealed)    .var-inertia { color: transparent !important; }

.study-mode .graph-caption span {
  color: transparent;
  background: var(--border-strong);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.study-mode .graph-caption.revealed span {
  color: inherit;
  background: transparent;
}

/* ── Table of contents ── */
.page-wrapper {
  display: flex;
  flex-direction: column;
}

.toc {
  display: none;
}

.toc-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc-link {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hint);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0 0.35rem 0.75rem;
  border-left: 1.5px solid var(--border);
  transition: color 0.2s, border-color 0.2s;
}

.toc-link:hover { color: var(--muted); }

.toc-link.active {
  color: var(--accent-teal);
  border-left-color: var(--accent-teal);
}

/* ── FBD controls ── */
.fbd-controls {
  padding: 0.5rem 0.75rem 0.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fbd-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.fbd-control-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--hint);
  letter-spacing: 0.05em;
  min-width: 65px;
  flex-shrink: 0;
}

.fbd-control input[type="range"] {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-strong);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.fbd-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-teal);
  cursor: pointer;
}

.fbd-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-teal);
  border: none;
  cursor: pointer;
}

.fbd-control-val {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text);
  min-width: 50px;
  text-align: right;
  flex-shrink: 0;
}

@keyframes tocIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (min-width: 1160px) {
  .page-wrapper {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 2.5rem;
    padding: 0 2rem;
  }

  .page-wrapper .page {
    flex: 0 1 780px;
    margin: 0;
  }

  .toc.visible {
    display: block;
    position: sticky;
    top: 100px;
    width: 240px;
    flex-shrink: 0;
    order: 1;
    border: none;
    animation: tocIn 0.5s ease;
  }

}

/* ── Unified meta bar (prev/next + flashcards + practice + study toggle) ── */
.note-metabar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.note-metabar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
}

.note-metabar-sep {
  color: var(--border-strong);
  font-family: var(--mono);
  font-size: 0.75rem;
  flex-shrink: 0;
  line-height: 1;
}

.note-metabar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

/* ── Prev / next nav links (used in metabar + bottom nav) ── */
.note-nav {
  display: flex;
  align-items: center;
  padding: 0.6rem 0;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.note-nav-link {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--hint);
  text-decoration: none;
  transition: color 0.2s;
}

.note-nav-link:hover { color: var(--accent-teal); }

.note-nav-prev::before { content: '\2190\00a0'; }
.note-nav-next::after  { content: '\00a0\2192'; }
.note-nav-next         { margin-left: auto; }

.note-metabar .note-nav-next { margin-left: 0; }

/* ── Resource links (flashcards, practice) ── */
.note-resource-link {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--hint);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.18s;
  white-space: nowrap;
}
.note-resource-link:hover { color: var(--accent-teal); }

@media (max-width: 600px) {
  .note-metabar {
    flex-wrap: wrap;
    gap: 0.5rem 0;
  }
  .note-metabar-left {
    flex: 1 1 100%;
    width: 100%;
  }
  .note-metabar-right {
    flex: 1 1 100%;
    width: 100%;
    flex-shrink: 1;
    gap: 0.85rem;
    padding-top: 0.3rem;
    border-top: 1px solid var(--border);
  }
  .note-nav-link {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 42vw;
  }
  .note-metabar-sep {
    flex-shrink: 0;
  }
  .note-metabar-right .study-toggle {
    margin-left: auto;
  }
}

/* ── Quiz ── */
.quiz-q {
  margin-bottom: 2rem;
}

.quiz-q-num {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hint);
  margin-bottom: 0.4rem;
}

.quiz-q-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}

.quiz-opt:hover:not(.quiz-locked) {
  border-color: var(--accent-teal);
}

.quiz-opt-letter {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 1px;
}

.quiz-opt-text {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.5;
}

.quiz-opt.quiz-correct {
  border-color: var(--accent-teal);
  background: var(--accent-teal-bg);
}

.quiz-opt.quiz-correct .quiz-opt-letter {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  color: white;
}

.quiz-opt.quiz-wrong {
  border-color: var(--accent-coral);
  background: var(--accent-coral-bg);
}

.quiz-opt.quiz-wrong .quiz-opt-letter {
  background: var(--accent-coral);
  border-color: var(--accent-coral);
  color: white;
}

.quiz-opt.quiz-locked {
  cursor: default;
  opacity: 0.5;
}

.quiz-opt.quiz-correct.quiz-locked,
.quiz-opt.quiz-wrong.quiz-locked {
  opacity: 1;
}

.quiz-explain {
  margin-top: 0.6rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
  border-left: 2px solid var(--accent-teal);
  display: none;
}

.quiz-explain.show { display: block; }

.quiz-step {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.quiz-step-num {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent-teal);
  min-width: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.quiz-score {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--hint);
  text-align: right;
}

.quiz-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.quiz-regen {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--hint);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.quiz-regen:hover {
  color: var(--accent-teal);
  border-color: var(--accent-teal);
}

.quiz-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.quiz-input {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  width: 120px;
}

.quiz-input:focus { outline: none; border-color: var(--accent-teal); }

.quiz-submit {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.quiz-submit:hover { border-color: var(--accent-teal); }

.quiz-eqs {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.quiz-eqs.show { display: block; }

@media (min-width: 1160px) {
  .quiz-eqs {
    display: block;
    position: sticky;
    top: 100px;
    width: 240px;
    flex-shrink: 0;
    order: 1;
    margin: 0;
    margin-top: 5rem;
    align-self: flex-start;
    border: none;
  }

  .quiz-eqs .quiz-eqs-list { display: flex; }
    .quiz-eqs.sidebar-collapsed .quiz-eqs-list { display: none; }
  .quiz-eqs.sidebar-collapsed .quiz-eqs-title { margin-bottom: 0; }

  .quiz-eqs .quiz-eqs-title {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
  }

  .quiz-eqs .quiz-eqs-title:hover { color: var(--muted); }

  .quiz-eqs .quiz-eqs-title::after {
    content: ' ▴';
    font-size: 0.5rem;
  }

  .quiz-eqs.sidebar-collapsed .quiz-eqs-title::after {
    content: ' ▾';
  }

  .quiz-eqs .quiz-eq-row { padding: 0.3rem 0; }
  .quiz-eqs .quiz-eq-label { font-size: 0.6rem; }
  .quiz-eqs .quiz-eq-val { font-size: 0.78rem; }

  #eqBtn { display: none; }
}

.quiz-sidebar-toggle { display: none; }

.quiz-eqs-title {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hint);
  margin-bottom: 0.5rem;
}

.quiz-eqs-list {
  display: flex;
  flex-direction: column;
}

.quiz-eq-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.quiz-eq-row:last-child { border-bottom: none; }

.quiz-eq-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  flex-shrink: 0;
}

.quiz-eq-val {
  font-size: 0.85rem;
  color: var(--text);
  text-align: right;
}
