:root {
  color-scheme: light;
  --paper: #f4f5ef;
  --card: #fcfcf7;
  --ink: #172724;
  --muted: #50625a;
  --line: #cfd8cf;
  --field: #eff2eb;
  --accent: #d6f789;
  --dark: #172725;
  --stage: #142520;
  font: 16px/1.5 "Aptos", "Trebuchet MS", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #569843; outline-offset: 3px; }
a { color: inherit; }
.topbar { min-height: 67px; display: flex; align-items: center; gap: 20px; padding: 12px max(24px, calc((100% - 1372px)/2)); background: var(--dark); color: #f8f9ee; }
.brand { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 750; white-space: nowrap; }
.brand-mark { flex: none; --brand-outline: #53dbc9; --brand-center: var(--accent); }
.lab-name { color: #c4d4c9; font-size: .86rem; padding-left: 20px; border-left: 1px solid #52645b; }
.languages { margin-left: auto; display: flex; flex: none; padding: 2px; border: 1px solid #63776b; border-radius: 8px; }
.languages button, .views button, .camera-actions button { color: inherit; background: transparent; border: 0; border-radius: 6px; font-weight: 650; padding: 5px 10px; }
.languages button[aria-pressed=true] { background: var(--accent); color: var(--dark); }
.project-about { position: relative; font-size: .86rem; }
.project-about summary { cursor: pointer; }
.about-content { position: absolute; top: calc(100% + 12px); inset-inline-end: 0; z-index: 10; width: min(350px, calc(100vw - 26px)); padding: 16px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px #14242133; }
.about-content h2 { margin: 0; font-size: 1rem; }
.about-content p { margin: 8px 0; }
.about-content p:last-child { margin-bottom: 0; }
.about-note { color: var(--muted); }
main { max-width: 1420px; padding: 35px 24px 45px; margin: auto; }
.intro { margin: 0 0 20px; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.55rem); font-weight: 760; letter-spacing: -.06em; line-height: 1.06; }
.intro p { margin: 10px 0 0; color: var(--muted); }
.scenario { display: block; margin-top: 8px; color: var(--muted); font-weight: 650; font-size: .8rem; }
.scenario select { display: block; margin-top: 3px; }
.bench { display: grid; grid-template-columns: minmax(0, 1.95fr) minmax(330px, 1fr); gap: 16px; align-items: start; }
.controls { min-width: 0; display: grid; gap: 12px; }
#balance-controls { display: grid; gap: 12px; }
.scene-panel, .instrument, .panel { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; min-width: 0; }
.scene-panel { position: sticky; top: 14px; display: flex; flex-direction: column; background: var(--stage); color: #e4eee3; border-color: #354641; }
.view-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px; border-bottom: 1px solid #3b5046; }
.views, .camera-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.camera-actions { margin-left: auto; }
.camera-actions button { white-space: nowrap; }
.camera-actions button[data-label] { min-width: 38px; font-size: 1.02rem; box-shadow: inset 0 0 0 1px #52645b; }
.views button[aria-pressed=true] { background: #dff1c2; color: var(--dark); }
#rotate-view { color: #c5dcd0; }
#stage { position: relative; height: clamp(380px, 100dvh - 245px, 650px); background: #172823; }
#stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; touch-action: pan-y; }
#stage #scene { cursor: grab; }
#stage #scene:active { cursor: grabbing; }
#stage #scene.console-active { cursor: pointer; }
#stage:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#stage[data-walking=true] #scene { touch-action: none; }
.scene-panel:has(#scene[hidden]) :is(#face-pit-stairs, #walk-controls, #walk-hint) { display: none; }
.scene-panel:has(#stage[data-walking=true]) #viewport-hint { display: none; }
#walk-controls { position: absolute; bottom: 10px; left: 10px; z-index: 3; display: grid; grid-template-columns: repeat(3, 38px); gap: 4px; }
#walk-controls button { padding: 0; min-height: 38px; border: 1px solid #9caf9c; border-radius: 6px; background: #192e2bee; color: #f8ffe9; touch-action: none; }
#walk-controls button:active { background: #dff1c2; color: var(--dark); }
#walk-controls [data-walk-direction=forward] { grid-column: 2; }
#walk-controls [data-walk-direction=left] { grid-column: 1; }
.actuator-cue { position: absolute; z-index: 1; display: grid; place-items: center; width: 25px; height: 25px; transform: translate(-50%, -50%); border: 2px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 2px #182727b0; color: #f5ffcf; text-shadow: 0 1px 3px #14201c; font-weight: 800; pointer-events: none; }
.actuator-cue:is([data-control=fit], [data-control=lift-car], [data-control=lift-arms], [data-control=lift-lock]) { width: max-content; max-width: 220px; height: auto; min-height: 25px; padding: 2px 7px; border-radius: 6px; background: #192a27; font-size: .77rem; text-align: center; }
.scene-action:not(:focus-visible) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .actuator-cue { animation: actuator-cue 1s ease-in-out infinite alternate; }
  @keyframes actuator-cue { to { border-color: #f3ffc6; box-shadow: 0 0 0 5px #d6f78944; } }
}
.scene-footer { min-height: 48px; padding: 9px 15px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .82rem; color: #d2e0d6; border-top: 1px solid #3b5046; }
#next-action { color: var(--accent); }
#lift-controls label { display: flex; justify-content: space-between; gap: 10px; margin: 8px 0 2px; font-size: .84rem; }
#lift-controls input, #lift-inputs input { width: 100%; accent-color: #5f8430; }
#lift-controls #lift-vehicle-row { margin: 10px 0; }
.lift-jog { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.panel .lift-step { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 4px; color: var(--ink); }
#lift-step-count { flex: none; color: #426747; font: 700 .78rem ui-monospace, monospace; }
.panel #lift-step-hint { margin-top: 3px; }
.panel .lift-lock-status { display: inline-block; padding: 4px 9px; border-radius: 6px; background: #e7f2dd; color: #365c32; }
#lift-guide-options { margin-top: 12px; }
#lift-guide-options input[type=checkbox] { width: auto; margin: 0; }
#lift-guide-options label { display: inline-flex; align-items: center; justify-content: flex-start; }
.panel .lift-guide-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 10px; }
.lift-guide-legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border: 2px solid #5b8e38; border-radius: 50%; margin-right: 5px; }
.lift-guide-legend span + span::before { border-color: #a45042; border-radius: 2px; }
.panel #lift-training { margin: 13px 0 0; font-size: .78rem; }
.instrument { display: flex; flex-direction: column; padding: 18px; background: var(--dark); border-color: #354641; color: #f5faee; }
.instrument-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2 { font-size: 1.15rem; margin: 0; letter-spacing: -.02em; }
#rpm, .readout-meta { color: var(--accent); white-space: nowrap; font: 660 .88rem ui-monospace, monospace; }
.instrument-reading { display: grid; gap: 4px; margin-top: 12px; padding: 11px; border: 1px solid #4a6257; border-radius: 10px; background: #213731; }
.instrument-reading strong, .instrument-reading output { color: var(--accent); font: 700 1.26rem/1.3 ui-monospace, monospace; }
.instrument-reading p { color: #dcf0de; font-size: .87rem; margin: 2px 0; }
progress { display: block; width: 100%; height: 6px; margin: 12px 0 15px; appearance: none; border: 0; border-radius: 9px; background: #3b5046; accent-color: var(--accent); overflow: hidden; }
progress::-webkit-progress-bar { background: #3b5046; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.planes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plane { display: flex; flex-direction: column; background: #213731; border: 1px solid #4a6257; border-radius: 10px; padding: 11px; color: #dcf0de; font-size: .87rem; }
.plane[data-plane=inner] { --mark-color: var(--accent); }
.plane[data-plane=outer] { --mark-color: #ffca72; }
.plane-label { display: flex; align-items: center; gap: 7px; }
.plane-label::before { content: ''; flex: none; width: 8px; height: 8px; border: 2px solid var(--mark-color); border-radius: 50%; }
.plane[data-plane=outer] .plane-label::before { border-radius: 0; transform: rotate(45deg) scale(.8); }
.plane { --reading-color: #dce9e4; }
.plane[data-verdict=ok] { --reading-color: #b8f77f; }
.plane[data-verdict=correct] { --reading-color: #ff9389; }
.plane strong { font: 650 clamp(1.45rem, 3.2vw, 2.2rem)/1.2 ui-monospace, monospace; color: var(--reading-color); padding: 4px 0; }
.plane-verdict { color: var(--reading-color); font-size: .78rem; margin-bottom: 3px; }
#reading-note { margin: 0 0 9px; font-size: .78rem; color: #cfdfd2; }
button.next-control { outline: 2px solid #5b8d22; outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  button.next-control { animation: next-control 1s steps(1, end) infinite; }
  @keyframes next-control { 50% { background: var(--accent); color: var(--ink); } }
}
.plane button { color: #e4f0e7; border: 1px solid #6b8b7e; background: transparent; border-radius: 7px; padding: 5px 7px; margin-top: 8px; font-size: .8rem; }
#status { margin: 10px 0 0; color: var(--ink); }
#status.success { color: #3d6327; }
#stand-hint { margin: 7px 0 0; font-size: .78rem; }
.machine-actions, .setup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.machine-actions { margin-top: 8px; }
.machine-actions:empty { display: none; }
#mount-state { align-self: center; font-weight: 660; font-size: .87rem; }
.keyboard-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-block: 8px; }
.keyboard-actions button { color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; }
.machine-actions button { flex: 1 1 100px; }
.primary, .secondary { font-weight: 700; border: 1px solid #5d7468; border-radius: 8px; padding: 8px 13px; min-height: 39px; }
.primary { background: var(--accent); color: #17251a; border-color: #9bb95c; }
.secondary { background: transparent; color: inherit; }
.panel { padding: 17px 18px; background: var(--card); }
.panel p { font-size: .87rem; margin: 6px 0 12px; color: var(--muted); }
.dimensions, .placement { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.setup-actions { margin-top: 15px; }
.placement button { grid-column: 1 / -1; justify-self: start; }
.dimensions label, .placement label { font-weight: 650; font-size: .8rem; min-width: 0; }
.unit-input { display: flex; align-items: center; padding-right: 8px; gap: 3px; }
.unit-input, select { background: var(--field); border: 1px solid #aebeb1; border-radius: 7px; min-height: 38px; }
.unit-input > input { border: 0; background: transparent; padding: 7px; min-width: 0; width: 100%; color: inherit; font-variant-numeric: tabular-nums; }
.unit-input:focus-within { outline: 2px solid #569843; }
.unit-input > input:focus-visible { outline: 0; }
.unit-input > span { color: var(--muted); }
label select { color: var(--ink); width: 100%; padding: 6px; }
#weight-list { margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .83rem; }
#weight-list li { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 2px 0; }
#weight-list button { border: 0; background: transparent; text-decoration: underline; color: var(--ink); padding: 4px; }
.references { color: var(--muted); padding: 0 3px; margin-top: 19px; font-size: .88rem; }
.references summary { cursor: pointer; font-weight: 650; color: var(--ink); }
.institution-section details { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.institution-section summary img { display: inline-block; margin: 0 8px; vertical-align: middle; }
.institution-body { display: grid; justify-items: start; gap: 8px; padding: 8px 0 4px 22px; }
.institution-body a { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 900px) {
  .bench { grid-template-columns: minmax(0, 1fr) minmax(310px, .92fr); }
  main { padding-inline: 17px; }
}
@media (max-width: 690px) {
  .bench { grid-template-columns: 1fr; }
  .intro { margin-bottom: 16px; }
  .scene-panel { position: static; }
  main { padding-top: 24px; }
  .topbar { position: relative; padding: 10px 13px; gap: 8px; flex-wrap: wrap; }
  .project-about { position: static; }
  .about-content { top: calc(100% + 4px); inset-inline-end: 13px; }
  .lab-name { padding-left: 8px; font-size: .75rem; line-height: 1.15; }
  #stage { height: clamp(280px, 73vw, 380px); }
  .views { display: flex; flex-wrap: wrap; gap: 2px; }
  .views button, #rotate-view { padding-inline: 5px; font-size: .78rem; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) { #stage #scene { cursor: default; } }
