/* Loop Track: the track design bay. Scenes by art.js, colors from the --lt-* properties below (light and dark).
   Force arrows carry letters (W, N, f) and matching swatches, so colour is never the only cue. */
html {
  --lt-sky1: #bfe3f5; --lt-sky2: #eef8fc; --lt-hill: #a9cf9a; --lt-ground1: #8fbf73; --lt-ground2: #6c9f55; --lt-cloud: #ffffff;
  --lt-grass: #79b065; --lt-grass-hi: #9ccc84; --lt-curb: #d9dde0; --lt-asphalt: #4b5560; --lt-lane: #f7f3e8; --lt-cone: #f07a2a;
  --lt-concrete1: #d3d7da; --lt-concrete2: #a8b0b6; --lt-road: #3f4852;
  --lt-rail: #c3423f; --lt-rail-hi: #ef8a7f; --lt-rail-lo: #8a2421; --lt-support: #6d7a84;
  --lt-car: #1f6f8b; --lt-car-hi: #5fb7d4; --lt-glass: #dff3fb; --lt-trim: #ffd23f; --lt-wheel: #23292e;
  --lt-line: #2c3e48; --lt-ink: #142833; --lt-muted: #4a5f6b; --lt-grid: rgba(36, 94, 118, .10);
  --lt-panel1: #fbfdfe; --lt-panel2: #eaf3f6; --lt-tag: rgba(255, 255, 255, .88);
  --lt-w: #b8341f; --lt-n: #1c5fb8; --lt-f: #9a6400; --lt-acc: #5a3f8f; --lt-cue: #c4570f; --lt-ok: #1d7a3a; --lt-model: #1d7a3a;
  --lt-cue-bg: #fff1e3; --lt-ok-bg: #e3f4e8;
  --lt-card: #ffffff; --lt-chip: #ffffff; --lt-chip-on: #d7ecf2; --lt-chip-line: #8eaab5; --lt-accent: #245e76;
  --lt-build: #9a4a12; --lt-predict: #245e76; --lt-force: #5a3f8f; --lt-explain: #1d6b45;
}
html[data-theme="dark"] {
  --lt-sky1: #0d1b2e; --lt-sky2: #1d3048; --lt-hill: #22382e; --lt-ground1: #2b4630; --lt-ground2: #1d3122; --lt-cloud: #3a4c63;
  --lt-grass: #2a4a2c; --lt-grass-hi: #3b6440; --lt-curb: #5a646c; --lt-asphalt: #252b31; --lt-lane: #c9c3b0; --lt-cone: #ff9a52;
  --lt-concrete1: #4f585f; --lt-concrete2: #333b41; --lt-road: #1b2025;
  --lt-rail: #ff6b5e; --lt-rail-hi: #ffa79c; --lt-rail-lo: #a8352c; --lt-support: #8a99a4;
  --lt-car: #2f8fb0; --lt-car-hi: #8fd6ee; --lt-glass: #163846; --lt-trim: #ffd23f; --lt-wheel: #0c0f12;
  --lt-line: #a9bec9; --lt-ink: #e8f0f3; --lt-muted: #a9bcc6; --lt-grid: rgba(150, 210, 230, .08);
  --lt-panel1: #16242c; --lt-panel2: #1d2f3a; --lt-tag: rgba(14, 26, 34, .85);
  --lt-w: #ff8a73; --lt-n: #7fb6ff; --lt-f: #f2c14e; --lt-acc: #c8a8ff; --lt-cue: #ff9a52; --lt-ok: #6fd68f; --lt-model: #6fd68f;
  --lt-cue-bg: #3a2414; --lt-ok-bg: #183526;
  --lt-card: #1f333f; --lt-chip: #1f333f; --lt-chip-on: #24566a; --lt-chip-line: #4f7383; --lt-accent: #7fc4dc;
  --lt-build: #ffad70; --lt-predict: #7fc4dc; --lt-force: #c8a8ff; --lt-explain: #7fdca4;
}

.core { height: 100%; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, 1fr); gap: 16px; padding: 16px; overflow: auto; color: var(--lt-ink); font-size: 16px; box-sizing: border-box; }
.core * { box-sizing: border-box; }
.core-bench, .core-panel { min-width: 0; border-radius: 16px; overflow: auto; }
.core-bench { display: flex; flex-direction: column; gap: 10px; }
.core-panel { padding: 14px 16px; background: linear-gradient(180deg, var(--lt-panel1), var(--lt-panel2)); border: 1px solid var(--lt-chip-line); box-shadow: 0 2px 10px rgba(16, 43, 56, .12); }
.core-scene { flex: 0 0 auto; overflow: auto; border-radius: 14px; border: 2px solid var(--lt-line); background: var(--lt-panel2); box-shadow: 0 4px 14px rgba(16, 43, 56, .22); }
.core-scene:focus-visible { outline: 3px solid #dd9823; outline-offset: 3px; }
.core-scene svg { display: block; width: 100%; height: auto; }
.lt-fbd { touch-action: pan-x; cursor: crosshair; }
.core.locked .lt-fbd { cursor: default; }

/* scene text: every label ≥ 22 viewBox units */
.core-scene svg text, .ps svg text.lt-t { font-family: inherit; font-size: 22px; fill: var(--lt-ink); pointer-events: none; }
svg .lt-title { font-weight: 800; }
svg .lt-dim { font-weight: 700; fill: var(--lt-ink); }
svg .lt-muted { fill: var(--lt-muted); font-style: italic; }
svg .lt-tag { fill: var(--lt-tag); stroke: var(--lt-line); stroke-width: 1.2; }
svg .lt-flabel { font-weight: 800; }
svg .lt-acc-label { fill: var(--lt-acc); font-weight: 800; font-style: italic; }
svg .lt-model-label { fill: var(--lt-model); font-weight: 700; }
svg .lt-cloud ellipse { fill: var(--lt-cloud); opacity: .85; }
svg .lt-asphalt { fill: none; stroke: var(--lt-asphalt); stroke-width: 26; }
svg .lt-lane { fill: none; stroke: var(--lt-lane); stroke-width: 2.4; stroke-dasharray: 10 9; }
svg .lt-cone { fill: var(--lt-cone); stroke: var(--lt-line); stroke-width: 1; }
svg .lt-skid { fill: none; stroke: var(--lt-cue); stroke-width: 4; stroke-dasharray: 3 7; stroke-linecap: round; }
svg .lt-dimline { fill: none; stroke: var(--lt-line); stroke-width: 1.8; stroke-dasharray: 6 4; }
svg .lt-cue-badge rect { fill: var(--lt-cue-bg); stroke: var(--lt-cue); stroke-width: 2; }
svg .lt-cue-badge text { fill: var(--lt-cue); font-weight: 800; }
svg .lt-ok-badge rect { fill: var(--lt-ok-bg); stroke: var(--lt-ok); stroke-width: 2; }
svg .lt-ok-badge text { fill: var(--lt-ok); font-weight: 800; }
svg .lt-road { fill: none; stroke: var(--lt-road); stroke-width: 7; stroke-linecap: round; }
svg .lt-arc { fill: none; stroke: var(--lt-line); stroke-width: 2.2; }
svg .lt-cue { fill: var(--lt-cue); stroke: var(--lt-cue); stroke-width: 3.4; stroke-linejoin: round; }
svg .lt-support { fill: none; stroke: var(--lt-support); stroke-width: 5; stroke-linecap: round; }
svg .lt-rail-outer { fill: none; stroke: var(--lt-rail-lo); stroke-width: 4; }
svg .track { fill: none; stroke: url(#lt-steel); stroke-width: 9; stroke-linecap: round; }
svg .lt-ties { fill: none; stroke: var(--lt-support); stroke-width: 2.4; }
svg .lt-gauge { fill: var(--lt-panel1); stroke: var(--lt-line); stroke-width: 2; }
svg .lt-gauge-ok { fill: var(--lt-ok); }
svg .lt-gauge-over { fill: var(--lt-cue); }
svg .lt-capline { fill: none; stroke: var(--lt-line); stroke-width: 3; stroke-dasharray: 5 3; }
svg .lt-level { fill: none; stroke: var(--lt-acc); stroke-width: 2.4; stroke-dasharray: 9 6; }
svg .lt-platform { fill: var(--lt-support); stroke: var(--lt-line); stroke-width: 1.2; }
svg .station { fill: none; stroke: var(--lt-line); stroke-width: 3; stroke-dasharray: 5 4; }
svg .lt-event { stroke: var(--lt-cue); stroke-width: 4; stroke-dasharray: none; }
svg .cue { fill: none; stroke: var(--lt-cue); stroke-width: 3; stroke-dasharray: 7 5; }
svg .cart { fill: url(#lt-ball); stroke: var(--lt-line); stroke-width: 2; }
svg .lt-surface { fill: none; stroke: var(--lt-support); stroke-width: 6; stroke-linecap: round; opacity: .8; }
svg .body { fill: url(#lt-ball); stroke: var(--lt-line); stroke-width: 2; }
svg .force { stroke-width: 4.2; stroke-linecap: round; stroke-linejoin: round; }
svg .force.lt-w { stroke: var(--lt-w); fill: var(--lt-w); }
svg .force.lt-n { stroke: var(--lt-n); fill: var(--lt-n); }
svg .force.lt-f { stroke: var(--lt-f); fill: var(--lt-f); }
svg .force.lt-active { stroke-width: 6; }
svg .radial { fill: none; stroke: var(--lt-acc); stroke-width: 3; stroke-dasharray: 8 5; }
svg .radial-head { fill: var(--lt-panel1); stroke: var(--lt-acc); stroke-width: 2.4; stroke-linejoin: round; }
svg .lt-model { fill: none; stroke: var(--lt-model); stroke-width: 3; stroke-dasharray: 7 5; stroke-linejoin: round; }

/* the aim bar under the scene */
.lt-aim { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lt-aim-label { font-weight: 700; }
.core .lt-aim-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 16px; font-weight: 700; min-height: 44px; padding: 6px 14px 6px 8px; border-radius: 22px; border: 2px solid var(--lt-chip-line); background: var(--lt-chip); color: inherit; cursor: pointer; }
.core .lt-aim-btn.on { background: var(--lt-chip-on); border-color: var(--lt-accent); box-shadow: inset 0 0 0 1px var(--lt-accent); }
.lt-swatch { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 16px; flex: 0 0 auto; }
.lt-sw-w { background: var(--lt-w); } .lt-sw-n { background: var(--lt-n); } .lt-sw-f { background: var(--lt-f); }
html[data-theme="dark"] .lt-swatch { color: #0c1418; }
.core-observation { margin: 0; min-height: 3em; padding: 10px 14px; line-height: 1.45; font-weight: 600; border-left: 5px solid var(--lt-accent); background: var(--lt-panel1); border-radius: 0 10px 10px 0; }
.core .lt-replay { align-self: flex-start; font: inherit; font-size: 16px; font-weight: 700; min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 2px solid var(--lt-chip-line); background: var(--lt-chip); color: inherit; cursor: pointer; }
.lt-replay[hidden] { display: none; }

/* the panel */
.lt-case { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--lt-card); border: 1px dashed var(--lt-chip-line); }
.lt-case p { margin: 6px 0; line-height: 1.45; }
.lt-case .lt-case-kicker { margin-top: 0; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--lt-predict); }
.lt-table { border-collapse: collapse; margin: 6px 0; width: 100%; font-variant-numeric: tabular-nums; }
.lt-table th, .lt-table td { border: 1px solid var(--lt-chip-line); padding: 5px 8px; text-align: left; }
.lt-table tr:first-child th { background: var(--lt-panel2); }
.lt-step { margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--lt-chip-line); font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.lt-step-build { color: var(--lt-build); } .lt-step-predict { color: var(--lt-predict); } .lt-step-force { color: var(--lt-force); } .lt-step-explain { color: var(--lt-explain); }
.lt-step-note { margin: 0 0 8px; line-height: 1.4; color: var(--lt-muted); }
.lt-field { display: grid; gap: 6px; margin: 0 0 12px; }
.lt-label { display: flex; align-items: center; gap: 8px; font-weight: 700; line-height: 1.35; }
.lt-num { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lt-num input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 18px; font-weight: 700; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--lt-chip-line); background: var(--lt-chip); color: inherit; font-variant-numeric: tabular-nums; }
.lt-unit { flex: 0 0 auto; font-weight: 600; min-width: 3em; }
.lt-range { width: 100%; min-height: 44px; accent-color: #245e76; font-size: 16px; }
.lt-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lt-presets-label { font-weight: 600; color: var(--lt-muted); }
.core .lt-chip { font: inherit; font-size: 16px; font-weight: 700; min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 2px solid var(--lt-chip-line); background: var(--lt-chip); color: inherit; cursor: pointer; text-align: left; line-height: 1.3; }
.core .lt-choices .lt-chip { border-radius: 12px; width: 100%; }
.core .lt-chip.on { background: var(--lt-chip-on); border-color: var(--lt-accent); box-shadow: inset 0 0 0 1px var(--lt-accent); }
.core .lt-chip.on::before { content: "✓ "; }
.core .lt-chip:hover:not(:disabled), .core .lt-aim-btn:hover:not(:disabled) { border-color: var(--lt-accent); }
.lt-actions { display: flex; gap: 10px; margin-top: 8px; }
.core-run, .core-revise { font: inherit; font-size: 16px; font-weight: 800; min-height: 46px; border-radius: 12px; padding: 10px 16px; cursor: pointer; }
.core-run { flex: 1 1 auto; background: #245e76; color: #fff; border: 0; box-shadow: 0 3px 0 #163c4c; }
.core-revise { background: var(--lt-chip); color: inherit; border: 2px solid var(--lt-chip-line); }
.core button:disabled, .core input:disabled { opacity: .6; cursor: default; }
.core .lt-chip.on:disabled, .core .lt-aim-btn.on:disabled { opacity: .85; }
.core-run:disabled { box-shadow: none; }
.core :focus-visible { outline: 3px solid #dd9823; outline-offset: 2px; }
.core-status { margin: 8px 0 4px; line-height: 1.4; font-weight: 600; }
.lt-precision { margin: 0 0 6px; line-height: 1.4; }
.core-about summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.core-about p { line-height: 1.5; margin: 0 0 8px; }
.lt-example { margin: 8px 0; }
.lt-example svg { display: block; width: 100%; height: auto; }
.lt-example svg text { font-size: 22px; fill: var(--lt-ink); }

body .ps-kicker, body .ps-hint-note, body .ps-badge { font-size: 16px; }

@media (max-width: 900px) {
  .core { height: auto; grid-template-columns: 1fr; padding: 12px; }
  .core-bench, .core-panel { overflow: visible; }
  .core-bench .core-scene { overflow: auto; }
  .core-panel { padding-bottom: 30px; }
  .core-scene svg { min-width: 520px; }
}
@media (prefers-reduced-motion: reduce) { .core * { animation: none !important; transition: none !important; } }
.lt-example { border-radius: 14px; border: 2px solid var(--lt-line); overflow: hidden; }
