/* Chapter 9: circuit drawings, equation text, the step calculator, unit drill, battery race, answer chain and bulb lab. */

.wire { fill: none; stroke: #e8eefc; stroke-width: 4; stroke-linejoin: round; }
.cur-line {
  fill: none;
  stroke: #8fd3ff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 1 21;
  animation: cur-flow 1s linear infinite;
}
@keyframes cur-flow { to { stroke-dashoffset: -44; } }
.lamp-glow, .lamp-core { transition: opacity .9s ease; }
.cir-label { font: 700 22px system-ui, sans-serif; fill: #cfd9ef; }
.cir-letter { font: 800 24px system-ui, sans-serif; fill: #ffd166; }

.eq-big { font: 800 120px system-ui, sans-serif; fill: #fff; }
.eq-big.small { font-size: 96px; }
.eq-mid { font: 800 52px system-ui, sans-serif; fill: #fff; }
.eq-mid.gold-fill, .eq-line.gold-fill { fill: #ffd166; }
.eq-line { font: 600 36px system-ui, sans-serif; fill: #e8eefc; }
.eq-note { font: 600 26px system-ui, sans-serif; fill: #9fb4dd; }
.eq-note.small-note { font-size: 22px; }
.eq-note.core-note { fill: #e8eefc; }
.eq-tag { font: 800 30px system-ui, sans-serif; }
.eq-tag.gold { fill: #ffd166; }

.heat-title { font: 700 26px system-ui, sans-serif; fill: #e8eefc; }
.heat-res { font: 800 26px system-ui, sans-serif; fill: #8fd3ff; }
.heat-res.hot { fill: #ff9f68; }
.ion-plus { font: 800 22px system-ui, sans-serif; fill: #3b2030; }
.bat-text { font: 700 24px system-ui, sans-serif; fill: #fff; }

.tbl-box { fill: rgba(8, 14, 30, .78); stroke: rgba(255, 255, 255, .25); stroke-width: 2; }
.tbl-head { font: 800 28px system-ui, sans-serif; fill: #ffd166; }
.tbl-row { font: 600 24px system-ui, sans-serif; fill: #e8eefc; }
.tbl-row.gold-row { fill: #ffd166; font-weight: 800; }

/* Step calculator and unit drill */
.calc-question { margin: 0; font-size: 1.1em; line-height: 1.45; text-align: center; }
.calc-question b { color: var(--gold); }
.calc-body { display: flex; flex-direction: column; gap: max(8px, 1.2cqw); width: 100%; align-items: center; }
.calc-step { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.calc-values { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; }
.calc-field { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #cfd9ef; }
.calc-input {
  width: 7.5em;
  font: 700 1em ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: .45em .6em;
  border-radius: .6em;
  border: 2px solid #3a4f7d;
  background: #0f1a33;
  color: #fff;
}
.calc-input:focus { outline: none; border-color: var(--gold); }
.calc-input:disabled { opacity: .85; }
.calc-input.wrong { border-color: var(--bad); }
.calc-input.correct { border-color: var(--ok); background: #143a28; }
.calc-unit { font-weight: 700; color: #cfd9ef; }
.drill-q { font-size: 1.3em; font-weight: 700; }
.drill-dots { display: flex; gap: 6px; justify-content: center; }
.drill-dots span { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.drill-dots span.now { background: var(--gold); }
.drill-dots span.done { background: var(--ok); }
.lab-note { margin: 0; font-size: .82em; color: #9fb4dd; text-align: center; }

/* Battery race */
.race-clock { margin: 0; text-align: center; font-weight: 700; color: #cfd9ef; }
.race-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: max(8px, 1.2cqw); width: 100%; }
.race-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.race-card.hint { box-shadow: 0 0 0 3px var(--gold); }
.race-bar { display: block; width: 100%; height: 22px; border-radius: 6px; border: 2px solid #e8eefc; overflow: hidden; }
.race-fill { display: block; width: 100%; height: 100%; background: #5cc96b; }
.race-time { font-size: .9em; color: #cfd9ef; }
.race-time.flat { color: #ffd0d0; font-weight: 700; }
.options .chip-btn.hint { box-shadow: 0 0 0 3px var(--gold); }

/* Answer chain */
.chain-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: max(10px, 1.6cqw); width: 100%; align-items: start; }
.chain-list { margin: 0; padding-left: 1.6em; display: flex; flex-direction: column; gap: 6px; min-height: 3em; }
.chain-link { padding: .4em .7em; border-radius: .6em; border: 2px solid var(--ok); font-weight: 600; line-height: 1.3; }
.chain-pool { display: flex; flex-direction: column; gap: 6px; }
.chain-tile { font-size: .95em; }
.chain-tile.hint { box-shadow: 0 0 0 3px var(--gold); }

/* Bulb brightness lab */
.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: max(10px, 1.6cqw);
  width: 100%;
  align-items: start;
}
.lab-left { display: flex; flex-direction: column; gap: 6px; }
.lab-picture { width: 100%; border-radius: .8em; overflow: hidden; background: #0d1730; }
.lab-readout-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.lab-readout-grid span { display: flex; flex-direction: column; align-items: center; padding: .3em; border-radius: .6em; background: rgba(255, 255, 255, .08); font-weight: 800; }
.lab-readout-grid small { font-size: .72em; font-weight: 600; color: #9fb4dd; }
.lab-controls { display: flex; flex-direction: column; gap: 6px; }
.lab-task-list { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-task { font-size: .85em; padding: .35em .7em; }
.lab-task.on { border-color: var(--gold); background: #2c3d66; }
.predict-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.predict-label { flex: 0 0 9.5em; font-weight: 700; font-size: .88em; }
.predict-opts { display: flex; flex-wrap: wrap; gap: 4px; }
.predict-btn { font-size: .82em; padding: .3em .6em; text-align: center; }
.predict-btn.on { border-color: var(--gold); background: #2c3d66; }
.predict-btn:disabled:not(.on) { opacity: .45; }
.lab-results { width: 100%; }
.lab-table { width: 100%; border-collapse: collapse; font-size: .85em; }
.lab-table th, .lab-table td { padding: .35em .5em; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.lab-table thead th { color: #9fb4dd; font-size: .9em; }
.lab-table td small { display: block; color: #cfd9ef; font-weight: 600; }
.lab-table tr.hit td:nth-child(2) { color: #c9f7d4; }
.lab-table tr.miss td:nth-child(2) { color: #ffd0d0; }
.lab-table td.reason, .lab-table th.reason { color: #cfd9ef; font-size: .92em; }
.lab-chain { margin: .5em 0 0; font-weight: 700; color: #ffe7a8; text-align: center; }

@container (max-width: 620px) {
  .lab-grid, .chain-grid { grid-template-columns: 1fr; }
  .race-row { grid-template-columns: 1fr; }
  .calc-input { width: 6.5em; }
  .predict-label { flex-basis: 100%; }
}
