/* Part 1-specific layout: visualisation stage and control panel. */

.viz-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .viz-layout { grid-template-columns: minmax(0, 1fr); } }

.viz-stage { padding: 12px; }
.viz-stage svg { width: 100%; height: auto; display: block; }
.viz-legend { justify-content: center; margin-top: 6px; }

#v-svg text { font-family: var(--sans); font-size: 10px; fill: var(--muted); }
#v-svg .tick { font-variant-numeric: tabular-nums; }
#v-svg .grid { stroke: var(--grid); stroke-width: 1; }
#v-svg .frame { fill: none; stroke: var(--axis); stroke-width: 1; }
#v-svg .pt { fill: var(--axis); stroke: var(--surface); stroke-width: 2; }
#v-svg .pt.sub { fill: var(--series-1); }
#v-svg .pt-label { fill: var(--ink-2); font-size: 9px; font-family: var(--mono); }
#v-svg .line-seg { stroke: var(--series-2); stroke-width: 2; stroke-linecap: round; opacity: 0.85; }
#v-svg .line-dot { fill: var(--series-2); opacity: 0.55; }
#v-svg .operand { fill: none; stroke: var(--series-2); stroke-width: 3; }
#v-svg .third { fill: var(--surface); stroke: var(--series-7); stroke-width: 2.5; stroke-dasharray: 3 3; }
#v-svg .reflect { stroke: var(--series-7); stroke-width: 2; stroke-dasharray: 4 4; marker-end: url(#arrow); }
#v-svg .result { fill: var(--series-7); stroke: var(--surface); stroke-width: 2; }
#v-svg .acc { fill: none; stroke: var(--series-7); stroke-width: 2; }
#v-svg .inf-label { fill: var(--series-7); font: 700 13px var(--mono); }
#v-svg .fade-in { animation: fadeIn .35s ease-out both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.viz-panel .controls { margin-bottom: 10px; }
.bits { display: flex; flex-wrap: wrap; gap: 4px; min-height: 34px; align-items: center; }
.bits .bit {
  width: 26px; height: 32px; display: grid; place-items: center; border-radius: 6px;
  font: 650 0.95rem/1 var(--mono); border: 1px solid var(--border-strong); color: var(--ink-2); background: var(--surface);
}
.bits .bit.done { background: var(--surface-2); color: var(--ink); }
.bits .bit.now { background: var(--ink); color: var(--page); border-color: var(--ink); }
.bits .bits-caption { font-size: 0.8rem; color: var(--ink-2); margin-left: 6px; }

.speed input { width: 110px; }
.viz-status {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  min-height: 92px; font-size: 0.92rem;
}
.viz-status .op { font: 650 1rem/1.4 var(--mono); color: var(--ink); }
.viz-status .detail { font: 0.84rem/1.5 var(--mono); color: var(--ink-2); margin-top: 4px; overflow-wrap: anywhere; white-space: pre-line; }
.viz-log {
  margin: 12px 0 0; padding: 0 0 0 2.2em;
  font-size: 0.8rem; color: var(--ink-2); line-height: 1.7;
}
.viz-log li + li { margin-top: 0; }
.viz-log li.current { color: var(--ink); font-weight: 650; }

/* show data tables in full: the page scrolls, not the table */
#stats details.data-table .table-wrap { max-height: none; }

/* point-addition formulas: one per row, label on the left */
.formulas { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; align-items: baseline; text-align: left; }
.formulas .f-label { font: 600 0.72rem/1.2 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.formulas .f-note { grid-column: 1 / -1; font-size: 0.85rem; color: var(--ink-2); font-style: italic; margin-top: 2px; }

/* experiment summary: 8 tiles in two even rows of 4 (2 per row on phones) */
#s-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { #s-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
