:root { color-scheme: light; --ink:#173139; --muted:#4c656b; --teal:#086a62; --line:#cddfdd; font:15px/1.45 Arial,sans-serif; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; background:#edf5f4; color:var(--ink); }
h1,h2,p,dl { margin:0; }
h1 { font-size:clamp(23px,4vw,36px); line-height:1.12; }
h2 { font-size:17px; }
.lab { max-width:1260px; margin:auto; padding:clamp(12px,3vw,28px); }
.brand { color:var(--teal); font-size:10px; text-transform:uppercase; letter-spacing:.14em; font-weight:bold; margin-bottom:5px; }
.intro { color:var(--muted); margin-top:7px; }
.presets,.race-controls,footer { display:flex; flex-wrap:wrap; gap:7px; }
.presets { margin:14px 0 12px; }
button,select,input { font:inherit; color:inherit; border:1px solid var(--line); border-radius:8px; background:#fff; min-height:42px; padding:6px 8px; }
button { cursor:pointer; font-size:13px; }
button:hover { background:#e6f4f2; }
button:disabled { opacity:.52; cursor:default; }
:focus-visible { outline:3px solid #ad580f; outline-offset:2px; }
.primary { color:#fff; background:#087266; border-color:#087266; }
.primary:hover { background:#095e55; }
.workspace { display:grid; grid-template-columns:minmax(0, 1.65fr) minmax(245px, 1fr); align-items:start; gap:10px; }
.setups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.setup,.comparison { min-width:0; border-radius:12px; padding:13px; }
.setup { background:#fff; border:1px solid var(--line); }
.setup h2 { display:flex; align-items:center; gap:7px; margin-bottom:9px; }
.setup h2::before { content:""; width:10px; height:10px; border-radius:50%; background:#128677; }
.setup[data-setup=B] h2::before { background:#af5916; }
.fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.fields label { min-width:0; display:flex; flex-direction:column; justify-content:space-between; gap:4px; font-size:12px; font-weight:700; }
.fields input,.fields select { width:100%; font-size:15px; font-weight:400; }
.wide,.speed { grid-column:1 / -1; }
.error { color:#a02332; font-size:12px; margin-top:7px; }
.estimates { background:#e6f4f1; padding:9px; border-radius:8px; margin-top:11px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px 9px; }
.estimates dt { font-size:11px; color:var(--muted); }
.estimates dd { margin:1px 0 0; font-weight:700; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.estimates div:last-child { grid-column:1 / -1; }
.speed dd:first-of-type { font-size:22px; color:#095951; }
.speed .secondary { font-size:12px; color:var(--muted); font-weight:400; }
.comparison { background:#132b33; color:#effaf9; }
#reset-race { color:var(--ink); }
#comparison-result { font-size:14px; margin-top:5px; min-height:2.8em; }
.tracks { background:#1a363e; border:1px solid #46636b; border-radius:9px; margin:10px 0; padding:10px; }
.track + .track { margin-top:13px; }
.lane-caption,.scale { display:flex; justify-content:space-between; gap:7px; color:#d6e9e9; font-size:12px; }
.lane-caption b { color:var(--lane); }
.rail { position:relative; height:34px; margin:3px 0 0; padding-inline:12px; overflow:hidden; border-radius:5px; background:repeating-linear-gradient(90deg,#25454e 0,#25454e calc(20% - 1px),#5e7479 calc(20% - 1px),#5e7479 20%); }
.runway { height:100%; width:100%; position:relative; }
.progress { height:4px; width:0; top:16px; left:0; position:absolute; background:var(--lane); opacity:.6; }
.finish { width:5px; position:absolute; height:100%; top:0; right:9px; background:repeating-linear-gradient(#e0f0ef 0 4px,#17343b 4px 8px); }
.wheel { width:23px; height:23px; border:3px solid var(--lane); border-radius:50%; position:absolute; top:5px; left:0; background:#1a363e; transform:translateX(-50%) rotate(var(--spin,0deg)); z-index:1; }
.wheel::before { content:""; width:13px; height:3px; border-radius:2px; position:absolute; top:7px; left:2px; background:var(--lane); }
.scale { margin-top:7px; }
#race-status { min-height:1.45em; margin:7px 0 3px; color:#fff; font-weight:700; font-size:13px; }
.race-note { color:#bfd7d9; font-size:12px; }
details { border:1px solid var(--line); border-radius:8px; background:#fff; margin-top:10px; padding:8px 10px; font-size:13px; }
summary { cursor:pointer; font-weight:700; }
details ul { margin:6px 0; padding-left:20px; }
details li + li { margin-top:5px; }
footer { margin-top:10px; font-size:13px; gap:8px 15px; }
a { color:var(--teal); text-underline-offset:3px; }
@media (max-width:830px) { .workspace { grid-template-columns:1fr; } }
@media (max-width:480px) {
  .setups { grid-template-columns:1fr; }
  .setup,.comparison { padding:10px; }
  .presets button { min-height:44px; }
}

/* Interactive classroom layout, v1.1. */
:root { --selected:#6941c6; --selected-dark:#52329e; font-family:Arial,sans-serif; }
body { background:#f3f7f7; }
.lab { max-width:1500px; padding:24px; }
header { border-bottom:1px solid #d8e5e5; padding-bottom:18px; }
.brand { font-size:11px; letter-spacing:.2em; margin-bottom:8px; }
h1 { font-size:clamp(24px,3vw,34px); letter-spacing:-.035em; }
.intro { font-size:15px; }
button { font-size:13px; min-height:44px; padding:8px 13px; font-weight:600; transition:background .15s,color .15s,box-shadow .15s; }
button[aria-pressed="true"],button[aria-pressed="true"]:hover { background:var(--selected); border-color:var(--selected); color:#fff; box-shadow:0 0 0 2px #e6ddfb; }
.presets { gap:10px; margin:18px 0; }
.presets button { border-radius:24px; }
.eyebrow { color:#55737b; font-size:10px; letter-spacing:.14em; font-weight:700; margin-bottom:5px; }
.explorer { border:1px solid var(--line); background:#fff; border-radius:16px; overflow:hidden; }
.explorer-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px; border-bottom:1px solid var(--line); }
.explorer h2 { font-size:20px; }
.view-controls { display:flex; flex-wrap:wrap; gap:7px; }
.explorer-body { display:grid; grid-template-columns:minmax(0,1fr) 280px; }
.mechanism { min-width:0; padding:8px 12px 12px; background:#eff6f6; }
#mechanism-svg { display:block; width:100%; height:auto; max-height:310px; }
#mechanism-svg text { fill:#34525b; font:700 12px Arial,sans-serif; }
.visual-note { max-width:740px; margin:0 auto; text-align:center; color:#59747b; font-size:11px; }
.insight { background:#faf8ff; border-left:1px solid #e4ddf2; padding:20px; display:flex; flex-direction:column; justify-content:center; gap:8px; }
.setup-badge { font-size:10px; letter-spacing:.14em; color:var(--selected); font-weight:700; }
#visual-ratio { font-size:38px; line-height:1.1; color:#50328b; }
.insight h3 { font-size:15px; margin:0; }
.insight p { font-size:12px; color:#4e596d; }
.shaft-readout { display:grid; grid-template-columns:1fr 1fr; gap:12px; border-top:1px solid #ded7ec; padding-top:10px; font-size:11px; color:#657083; }
.shaft-readout b { display:block; color:#253744; font-size:15px; margin-top:2px; overflow-wrap:anywhere; }
.section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:24px 0 12px; }
.section-heading h2 { font-size:21px; }
.section-heading>span { font-size:12px; color:#59747b; }
.workspace { grid-template-columns:minmax(0,1.7fr) minmax(290px,1fr); gap:16px; }
.setups { gap:14px; }
.setup,.comparison { padding:18px; border-radius:14px; }
.setup { border-top:4px solid #0b8f84; }
.setup[data-setup=B] { border-top-color:#ae5c17; }
.setup h2 { margin-bottom:14px; font-size:18px; }
.fields { gap:10px; }
.fields label { font-size:12px; }
.fields input,.fields select { border-radius:8px; min-height:42px; }
.fields input[type=range] { padding:0; border:0; min-height:24px; height:24px; accent-color:var(--selected); cursor:pointer; }
.quick-ratios { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.quick-ratios button { flex:1; white-space:nowrap; font-size:11px; padding:6px 7px; }
.estimates { background:#f0f7f6; gap:9px; padding:12px; }
.speed dd:first-of-type { font-size:26px; }
.comparison { background:#18333d; }
.comparison .eyebrow { color:#b5d7dc; }
.comparison h2 { font-size:22px; }
.predict-label { margin:12px 0 8px; font-size:13px; color:#d6e5e9; }
.predictions { display:flex; gap:7px; flex-wrap:wrap; }
.predictions button { color:#233e47; flex:1; padding:6px 8px; white-space:nowrap; }
#prediction-status { font-size:12px; color:#e0d7ff; min-height:36px; margin-top:8px; }
#comparison-result { margin:8px 0; font-size:13px; }
.tracks { margin:12px 0; padding:15px 12px; }
.rail { height:44px; margin-top:7px; }
.wheel { top:10px; }
.progress { top:21px; }
.race-controls button { flex:1; }
#race { background:#22b8a6; color:#102e34; border-color:#22b8a6; }
#race:hover { background:#50cfbf; }
details { margin-top:18px; padding:13px 16px; }
footer { padding:15px 0 5px; }
footer a { background:#fff; border:1px solid var(--line); border-radius:8px; padding:10px 14px; font-weight:600; text-decoration:none; }
@media (max-width:1050px) { .workspace { grid-template-columns:1fr; } .comparison { display:block; } .explorer-body { grid-template-columns:minmax(0,1fr) 230px; } }
@media (max-width:680px) {
 .lab { padding:14px; }
 .explorer-bar { align-items:flex-start; flex-direction:column; padding:14px; }
 .explorer-body { grid-template-columns:1fr; }
 .insight { border-left:0; border-top:1px solid #e4ddf2; padding:14px; display:grid; grid-template-columns:1fr 1fr; gap:7px 14px; }
 .setup-badge,.insight h3,#visual-explanation { grid-column:1 / -1; }
 #visual-ratio { grid-column:1; font-size:30px; }
 .shaft-readout { grid-column:2; grid-row:2 / 4; align-self:center; border:0; padding:0; }
 #visual-diameter { grid-column:1 / -1; }
 .section-heading>span { display:none; }
 .section-heading h2 { font-size:19px; }
 .view-controls button { padding:7px 11px; }
}
@media (max-width:540px) { .setups { grid-template-columns:1fr; } .setup,.comparison { padding:14px; } }
@media (prefers-reduced-motion:reduce) { button { transition:none; } }

/* Window controls and a viewport-sized classroom workspace. */
.lab>header { display:flex; justify-content:space-between; align-items:center; gap:18px; }
.header-copy { min-width:0; }
.window-actions { display:flex; flex-wrap:wrap; gap:8px; flex-shrink:0; }
.panel-tabs,.setup-switch { display:none; }
#window-status:empty { display:none; }
#window-status { color:#923c14; padding:8px; background:#fff2dc; }
body.expanded { overflow:hidden; }
body.expanded .lab { height:100vh; height:100dvh; max-width:none; padding:12px; display:grid; gap:10px;
 grid-template-columns:290px minmax(0,1fr) 320px;
 grid-template-rows:auto auto minmax(0,1fr) 44px;
 grid-template-areas:'header header header' 'presets presets presets' 'setups explorer comparison' 'help footer footer'; }
.expanded .lab>header { grid-area:header; padding:0 0 8px; }
.expanded h1 { font-size:clamp(19px,1.8vw,28px); }
.expanded .brand { font-size:10px; margin-bottom:4px; }
.expanded .intro,.expanded .section-heading { display:none; }
.expanded .presets { grid-area:presets; margin:0; align-items:center; }
.expanded .presets button { min-height:38px; padding:7px 12px; }
.expanded .workspace { display:contents; }
.expanded .setups { grid-area:setups; display:flex; flex-direction:column; gap:8px; min-height:0; overflow:auto; overscroll-behavior:contain; }
.expanded .setup-switch { display:flex; gap:8px; position:sticky; top:0; z-index:2; background:#f3f7f7; padding:2px; }
.expanded .setup-switch button { flex:1; }
.expanded .setup { display:none; padding:12px; }
.expanded .setup.is-active { display:block; }
.expanded .setup h2 { margin-bottom:9px; }
.expanded .setup h2 { display:none; }
.expanded .fields { gap:8px; }
.expanded .fields input,.expanded .fields select { min-height:36px; }
.expanded .fields input[type=range] { min-height:20px; height:20px; }
.expanded .quick-ratios button { min-height:38px; }
.expanded .quick-ratios { margin-top:10px; }
.expanded .estimates { padding:9px; gap:6px; }
.expanded .speed dd:first-of-type { font-size:24px; }
.expanded .explorer { grid-area:explorer; min-height:0; display:flex; flex-direction:column; }
.expanded .explorer-bar { flex-wrap:wrap; gap:8px; padding:12px; flex-shrink:0; }
.expanded .explorer-bar h2 { font-size:18px; }
.expanded .view-controls { gap:6px; }
.expanded .view-controls button { padding:6px 10px; min-height:40px; }
.expanded .explorer-body { display:flex; flex-direction:column; flex:1; min-height:0; overflow:auto; }
.expanded .mechanism { flex:1; min-height:170px; display:flex; flex-direction:column; }
.expanded #mechanism-svg { flex:1; min-height:110px; width:100%; height:0; max-height:none; }
.expanded .visual-note { flex-shrink:0; font-size:11px; }
.expanded .insight { display:grid; grid-template-columns:1fr 1fr; gap:7px 14px; flex-shrink:0; border-left:0; border-top:1px solid #e4ddf2; padding:14px; }
.expanded .setup-badge,.expanded .insight h3,.expanded #visual-explanation { grid-column:1/-1; }
.expanded #visual-ratio { grid-column:1; font-size:32px; }
.expanded .shaft-readout { grid-column:2; grid-row:2/4; border:0; padding:0; }
.expanded #visual-diameter { grid-column:1/-1; }
.expanded .comparison { grid-area:comparison; overflow:auto; min-height:0; padding:16px; overscroll-behavior:contain; }
.expanded .comparison h2 { font-size:21px; }
.expanded .predictions button { padding:7px 8px; font-size:12px; }
.expanded #prediction-status { min-height:36px; }
.expanded .tracks { padding:12px; }
.expanded .race-controls button { padding:7px; }
.expanded #race-status:empty { display:none; }
.expanded .race-note { font-size:11px; margin-top:8px; }
.expanded .lab>details { grid-area:help; margin:0; align-self:stretch; padding:10px; font-size:12px; }
.expanded .lab>details[open] ul { position:fixed; bottom:60px; left:12px; z-index:10; background:white; border:1px solid var(--line); border-radius:10px; width:min(540px,calc(100vw - 24px)); max-height:65dvh; overflow:auto; padding:20px 20px 20px 35px; box-shadow:0 5px 35px #18333d33; }
.expanded footer { grid-area:footer; margin:0; padding:0; align-items:center; justify-content:flex-end; font-size:12px; }
.expanded footer a { padding:8px 12px; }
.expanded #window-status:not(:empty) { position:fixed; top:80px; right:12px; max-width:360px; z-index:20; border:1px solid #d6a351; border-radius:8px; }
@media (max-width:1100px) and (min-width:981px) {
 .expanded .lab { grid-template-columns:265px minmax(0,1fr) 285px; gap:8px; padding:8px; }
 .expanded .comparison { padding:12px; }
}
@media (max-width:980px) {
 .lab>header { align-items:flex-start; flex-direction:column; }
 body.expanded .lab { grid-template-columns:minmax(0,1fr); grid-template-rows:auto 44px auto minmax(0,1fr) 42px 40px;
  grid-template-areas:'header' 'tabs' 'presets' 'main' 'help' 'footer'; padding:8px; gap:8px; }
 .expanded .lab>header { flex-direction:row; align-items:center; gap:8px; }
 .expanded h1 { font-size:18px; }
 .expanded .brand { font-size:9px; }
 .expanded .window-actions { flex-shrink:1; }
 .expanded .window-actions button { min-height:38px; font-size:12px; padding:6px 8px; }
 .expanded .panel-tabs { grid-area:tabs; display:flex; gap:8px; }
 .expanded .panel-tabs button { flex:1; }
 .expanded .presets { overflow-x:auto; flex-wrap:nowrap; gap:6px; padding:2px; }
 .expanded .presets button { flex-shrink:0; min-height:36px; font-size:12px; }
 .expanded .setups,.expanded .explorer,.expanded .comparison { grid-area:main; display:none; }
 .expanded[data-panel=setups] .setups { display:flex; }
 .expanded[data-panel=explorer] .explorer { display:flex; }
 .expanded[data-panel=comparison] .comparison { display:block; }
 .expanded footer { justify-content:center; flex-wrap:nowrap; gap:8px; }
 .expanded footer a { padding:8px; font-size:11px; }
 .expanded .lab>details[open] ul { bottom:100px; }
 .expanded .setup { flex:1; }
}
@media (max-height:700px) and (min-width:981px) {
 .expanded .lab { gap:7px; padding:8px; }
 .expanded .explorer-bar { padding:8px; }
 .expanded .insight { padding:10px; gap:5px; }
 .expanded #visual-ratio { font-size:26px; }
 .expanded .comparison { padding:12px; }
 .expanded .predict-label { margin:8px 0; }
 .expanded .tracks { margin:8px 0; }
}
