
:root {
  --ink:#242331; --muted:#625f70; --line:#dedde6; --teal:#594691; --accent:#594691;
  --light:#eeebf7; --paper:#fff; --lab-line:var(--line);
  font-family:Arial,"Microsoft YaHei",sans-serif; font-synthesis:none; color:var(--ink);
}
*,*::before,*::after { box-sizing:border-box }
body { margin:0; color:var(--ink); background:linear-gradient(135deg,#f5f3fa 0%,#faf9fc 36%,#fcfbfd 75%) fixed; min-height:100vh }
[hidden] { display:none!important }
main,.site-header-inner { width:min(calc(100% - 80px),1440px); margin-inline:auto }
main { padding:0 0 30px }
.site-header { border-bottom:1px solid var(--line); background:#fbfafdf5 }
.site-header-inner,.site-header b,.site-header nav,.site-header a { display:flex; align-items:center }
.site-header-inner { justify-content:space-between; gap:12px; min-height:58px }
.site-header b { gap:10px; font-size:15px; font-weight:650; white-space:nowrap }
.brand-mark { width:28px; height:21px; color:var(--accent) }
.site-header nav { gap:clamp(15px,3vw,32px); align-self:stretch }
.site-header a { color:var(--muted); font-size:14px; text-decoration:none; border-bottom:2px solid transparent }
.site-header a:hover,.site-header a[aria-current] { color:var(--accent) }
.site-header a[aria-current] { border-color:currentColor; font-weight:650 }
.intro { display:flex; justify-content:space-between; align-items:baseline; flex-wrap:wrap; gap:6px 12px; margin:clamp(22px,2.7vw,40px) 0 clamp(18px,1.8vw,27px) }
h1 { margin:0; font-size:clamp(26px,2.6vw,40px); line-height:1.18; font-weight:700; letter-spacing:-.045em }
h2,h3,p { margin:0 }
h2 { font-size:clamp(17px,1.35vw,21px); line-height:1.4; letter-spacing:-.025em }
h3 { font-size:14px; line-height:1.5 }
.small,.unit,.visit,.experiment-name { color:var(--muted); font-size:12px; line-height:1.6 }
button,input,select { font:inherit; font-variant-numeric:tabular-nums }
button,.template-link { cursor:pointer; font-weight:600; font-size:13px; line-height:1.35; min-height:36px; padding:7px 11px; border:1px solid var(--line); border-radius:6px; background:white; color:var(--ink) }
button:hover,.template-link:hover { background:var(--light); color:var(--accent) }
button:disabled { opacity:.45; cursor:default }
input:not([type=range],[type=file],[type=radio],[type=checkbox]),select { font-size:14px; min-width:0; color:var(--ink); border:1px solid #c9c7d2; border-radius:5px; padding:7px 9px; background:white }
input[type=range],input[type=checkbox] { accent-color:var(--accent) }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px }
summary { cursor:pointer; color:var(--ink); font-size:14px; font-weight:600; padding:6px 0 }
summary::marker { font-size:.78em; color:var(--accent) }
.footer { margin:18px 0 0; color:var(--muted); font-size:12px }
@media(max-width:850px) {
  main,.site-header-inner { width:calc(100% - 36px) }
  .site-header-inner { min-height:52px }
}
@media(max-width:430px) {
  main,.site-header-inner { width:calc(100% - 24px) }
  .site-header nav { gap:12px }
  .site-header b { gap:5px; font-size:13px }
  .brand-mark { width:21px }
  .site-header a { font-size:13px }
}
@media print { body { background:white } main { width:100%; padding:0 } .site-header,.no-print,.footer { display:none!important } }

.lab-layout { display:grid; gap:16px }
.lab-workbench { display:grid; grid-template-columns:minmax(0,1fr) clamp(324px,29%,400px); grid-template-areas:"scene controls" "rods controls"; grid-template-rows:auto 1fr; background:var(--paper); border:1px solid var(--line); border-radius:12px; overflow:hidden }
.scene { grid-area:scene; min-width:0; padding:clamp(16px,1.7vw,26px) }
.scenehead,.stage-caption,.rod-top { display:flex; align-items:center; justify-content:space-between; gap:8px 18px; flex-wrap:wrap }
.scenehead>div { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px 16px }
.scene-result { padding:18px 22px 0; margin-top:15px; background:#f0edf7; border-radius:8px 8px 0 0; display:flex; align-items:flex-end; justify-content:space-between; gap:6px 15px; flex-wrap:wrap }
.scene-result span,.metric { display:block }
.scene-result span { font-size:12px; color:var(--muted); margin-bottom:3px }
.metric { font-size:clamp(30px,3vw,48px); line-height:1.1; letter-spacing:-.045em; font-variant-numeric:tabular-nums; color:#43365e }
#detail { font-size:13px; color:#51485d; line-height:1.6 }
.scene-wrap { position:relative; overflow:hidden; border-radius:0 0 8px 8px; background:#f0edf7 }
#scene { height:clamp(280px,26vw,402px); width:100%; overflow:hidden; touch-action:none }
#scene canvas { width:100%; height:100%; display:block }
.stage-caption { margin-top:10px }
.model-note,.legend,.scene-guide { font-size:12px; line-height:1.6; color:var(--muted) }
.model-note.invalid { color:#a23638; font-weight:650 }
.legend { display:flex; align-items:center; gap:4px 12px; flex-wrap:wrap }
.legend span { white-space:nowrap }
.dot { display:inline-block; vertical-align:1px; width:7px; height:7px; border-radius:50%; margin-right:4px }
.control-console { grid-area:controls; min-width:0; padding:clamp(16px,1.7vw,26px); border-left:1px solid var(--line); background:#fcfbfd }
.console-group { margin-top:18px }
.console-group h3,.control label { display:block; margin:0 0 7px; font-size:13px; font-weight:650; color:#48434f }
.inputrow { display:grid; align-items:center; grid-template-columns:minmax(0,1fr) 75px 22px; gap:7px }
.inputrow input { width:100%; margin:0 }
#loadValue { margin-top:5px }
#loadState { margin:4px 0 9px; font-size:13px; font-weight:600; color:#574775 }
.load-steps,.load-shortcuts,.console-footer { display:grid; gap:6px }
.load-steps { grid-template-columns:repeat(3,1fr) }
.load-shortcuts,.console-footer { grid-template-columns:1fr 1fr }
.load-shortcuts { margin-top:6px }
#atCritical { background:var(--accent); color:white; border-color:var(--accent) }
#atCritical:hover { background:#493778 }
.plate-card { transition:background-color .12s }
.presets { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; margin-bottom:12px }
.preset { min-width:0; min-height:44px; display:flex; flex-direction:column; justify-content:center; align-items:flex-start; gap:2px; padding:6px; text-align:left; font-weight:400 }
.preset[aria-pressed=true] { background:var(--light); border-color:#9280b4 }
.preset-title { font-size:12px; font-weight:650 }
.preset-length { font-size:11px; color:var(--muted) }
.console-settings { border-top:1px solid var(--line); margin-top:16px; padding-top:4px }
.advanced { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:10px 0 }
.advanced .control:first-child { grid-column:1/-1 }
.advanced .inputrow { grid-template-columns:minmax(0,1fr) auto }
.advanced .small { margin:0 0 5px }
.console-footer { margin-top:8px }
.rod-panel { grid-area:rods; align-self:start; min-width:0; padding:0 clamp(16px,1.7vw,26px) 16px }
.rod-inspector { border-top:1px solid var(--line); padding-top:15px }
.rod-buttons { display:flex; flex-wrap:wrap; gap:4px }
.rod-buttons button { min-width:31px; min-height:31px; padding:3px 7px }
.rod-buttons button[aria-pressed=true] { background:var(--accent); color:white; border-color:var(--accent) }
.rod-info { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 17px; margin:11px 0; font-size:13px; font-variant-numeric:tabular-nums }
#selectedTitle { font-weight:700 }
.profile svg { width:min(100%,320px); height:auto; display:block }
.profile summary { font-size:13px }
#sceneStatus { margin-top:3px }
.calculation { border-top:1px solid var(--line); padding:8px 0 }
.calculation details { padding:6px 0 6px 12px }
.chart { display:block; width:100%; height:auto }
.scroll { max-width:100%; overflow-x:auto }
table { border-collapse:collapse; width:100%; font-variant-numeric:tabular-nums; font-size:13px }
td,th { white-space:nowrap; padding:8px; border-bottom:1px solid var(--line); text-align:left }
.calc-steps p { font-size:13px; line-height:1.6; margin:7px 0 }
@media(max-width:850px) {
  .lab-workbench { grid-template-columns:minmax(0,1fr); grid-template-areas:"scene" "controls" "rods" }
  .control-console { border-left:0; border-top:1px solid var(--line) }
  .rod-panel { padding-top:14px }
  #scene { height:clamp(180px,46vw,320px) }
  .scene-result { padding:12px 14px 0 }
  .scene { padding:14px }
  .scenehead>div { justify-content:space-between; width:100% }
  .stage-caption { gap:3px 10px }
  .console-group { margin-top:14px }
}
@media(max-width:450px) {
  .scene-result { align-items:flex-start }
  .scene-result #detail { font-size:12px; align-self:flex-end }
  .rod-buttons { gap:3px }
  .rod-buttons button { min-width:29px; min-height:34px }
  .rod-info { gap:4px 10px }
}
@media print { .lab-workbench { display:block; border:0 } .control-console,button { display:none } }

.plate-choices { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
.plate-choice { position: relative; display: block; min-width: 0; cursor: pointer; }
.plate-choice input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.plate-card { display: grid; place-items: center; height: 49px; border: 1px solid var(--lab-line); border-radius: 8px; background: #fcfbff; color: #625676; }
.plate-card svg { width: min(96%,67px); height: 36px; }
.plate-icon-rods, .plate-icon-support { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.plate-icon-rods { stroke-width: 2; }
.plate-icon-support { opacity: .72; stroke-width: 1.35; }
.plate-icon-hinge { fill: #fcfbff; stroke: currentColor; stroke-width: 1.6; }
.plate-icon-fixture { fill: #534377; stroke: #fcfbff; stroke-width: 1.1; stroke-linejoin: round; }
.plate-icon-pin { fill: none; stroke: #f6f0ff; stroke-width: 2; stroke-linecap: round; }
.plate-choice:hover .plate-card { border-color: #8e75c2; }
.plate-choice input:checked + .plate-card { color: #432e82; background: #eee7fb; border-color: #987bcf; box-shadow: inset 0 0 0 1px #987bcf; }
.plate-choice input:checked + .plate-card .plate-icon-fixture { fill: #463178; stroke: #eee7fb; }
.plate-choice input:focus-visible + .plate-card { outline: 2px solid #593c9b; outline-offset: 2px; }

.burst{position:absolute;left:50%;top:50%;width:1px;height:1px;pointer-events:none;opacity:0;z-index:2}.burst.play{animation:burst-life 1.1s ease-out both}.burst::before,.burst::after{content:'';position:absolute;left:0;top:0;transform:translate(-50%,-50%) scale(.1);border-radius:50%}.burst::before{width:80px;height:80px;background:radial-gradient(circle,#fff 0,#ffe99b 18%,#f5a335aa 38%,transparent 70%);filter:blur(1px)}.burst::after{width:110px;height:110px;border:3px solid #efab43}.burst.play::before{animation:burst-flash .8s ease-out both}.burst.play::after{animation:burst-ring .9s ease-out both}.burst i{position:absolute;left:0;top:0;width:8px;height:8px;border-radius:50%;background:#f0a23a;transform:rotate(calc(var(--i)*30deg)) translateX(0);opacity:0}.burst.play i{animation:burst-spark .8s ease-out both;animation-delay:calc((var(--i) * 9ms))}@keyframes burst-life{0%{opacity:1}85%{opacity:1}100%{opacity:0}}@keyframes burst-flash{0%{transform:translate(-50%,-50%) scale(.1);opacity:0}18%{opacity:1}100%{transform:translate(-50%,-50%) scale(2.1);opacity:0}}@keyframes burst-ring{0%{transform:translate(-50%,-50%) scale(.1);opacity:1}100%{transform:translate(-50%,-50%) scale(1.8);opacity:0}}@keyframes burst-spark{0%{opacity:1;transform:rotate(calc(var(--i)*30deg)) translateX(0) scale(1)}100%{opacity:0;transform:rotate(calc(var(--i)*30deg)) translateX(105px) scale(.2)}}
#bursts{position:absolute;inset:0;pointer-events:none;z-index:2}
@media(prefers-reduced-motion:reduce){.burst{display:none}}
.intro { justify-content:flex-start; align-items:center; gap:7px 18px; }
.intro .page-visits { color:#49357e; background:#eee7fb; border:1px solid #dbcef5; border-radius:999px; padding:4px 11px; font-size:14px; font-weight:700; white-space:nowrap; }
@media(max-width:520px) { .intro { align-items:flex-start; flex-direction:column; } }

.scene-result .result-condition { text-align:right; font-size:12px; color:#46377a; }
.scene-result .result-condition p { margin:2px 0 0; }
.scene-result .result-condition strong { display:block; }

.scenehead{display:flex;align-items:center;justify-content:space-between;gap:8px}.apparatus-view{display:flex;align-items:center;gap:.45rem;font-size:.85rem}.apparatus-view select{font:inherit;color:inherit;border:1px solid #b8b4c4;border-radius:.45rem;padding:.3rem .45rem;background:white}.force-diagram .legend{margin:.65rem 0}

/* Model-first scene: results remain available in calculation details. */
.scene-wrap{margin-top:15px;border-radius:8px}
.calculation-result{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:14px 0}
.calculation-result .metric{font-size:24px;letter-spacing:normal}
.calculation-result .result-condition{font-size:14px}
.calculation-result p{margin:3px 0}
