@charset "UTF-8";

:root {
  color-scheme: light;
  --paper: #f1f1eb;
  --panel: #fafaf6;
  --ink: #26343b;
  --muted: #7a8587;
  --line: #dedfd6;
  --accent: #c57c2e;
  --accent-bright: #e5a454;
  --accent-soft: #f3e7d6;
  --scene: #182530;
  --serif: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --mono: "Cascadia Code", "Consolas", monospace;
  --sans: "Bahnschrift", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 360px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; }
button, select, input[type="range"], input[type="checkbox"], summary { cursor: pointer; }
button { color: inherit; }
button, a, select, input, summary { -webkit-tap-highlight-color: transparent; }
button { border: 0; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, #viewport:focus-visible { outline: 3px solid #d79342; outline-offset: 3px; }
button { transition: background-color .18s, border-color .18s, color .18s, box-shadow .18s; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .45; }
button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; flex: 0 0 auto; margin: 0; }
sub { font-size: .7em; vertical-align: -.2em; }
i { font-family: var(--serif); font-weight: 500; }

.app-header { display: flex; align-items: center; gap: 36px; padding: 22px 28px 20px; background: #fafaf6; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 48px; background: #28373f; border-radius: 4px; }
.brand-mark svg { width: 34px; height: 34px; fill: none; stroke: #edb677; stroke-width: 1.3; stroke-linejoin: round; }
.brand-title { display: block; font-size: 23px; font-weight: 700; letter-spacing: -.7px; line-height: 1.3; }
.brand-dot { color: var(--accent); padding-left: 3px; }
.brand-kicker { display: block; margin-top: 5px; font: 9px var(--mono); letter-spacing: 1.4px; color: #647074; }
.header-subject { display: flex; flex-direction: column; gap: 7px; padding-left: 28px; border-left: 1px solid var(--line); font-size: 12px; color: #68777a; }
.eyebrow { display: block; font-size: 9px; font-family: var(--mono); letter-spacing: 1.3px; color: #818b8b; }
.subject-divider { color: #bcc2be; padding: 0 10px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.quiet-button, .primary-button, .secondary-button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 38px; padding: 0 12px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.quiet-button { background: transparent; color: #657276; }
.quiet-button > span { font-size: 20px; font-weight: 400; }
.quiet-button:hover { color: var(--ink); background: #eceee7; }
.primary-button { color: #fffaf1; background: #ad6e2c; padding: 0 15px; border: 1px solid #9c6128; }
.primary-button:hover { background: #986026; }
.secondary-button { border: 1px solid #d8d9cf; background: #f7f7f1; font-weight: 500; }
.secondary-button:hover { background: #eceee5; }
.full-width { width: 100%; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; max-width: 1920px; margin: 0 auto; padding: 22px 28px 0; align-items: start; }
.visual-workspace { min-width: 0; }
.scene-shell { background: var(--scene); border: 1px solid #27363f; border-radius: 8px; overflow: hidden; color: #cfdbdd; box-shadow: 0 8px 22px #202d3312; }
.scene-topbar { min-height: 57px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 17px; border-bottom: 1px solid #c8d7e112; background: #1c2a35; }
.scene-caption { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; font-weight: 600; }
.live-dot { height: 5px; width: 5px; background: #d5a365; border-radius: 50%; box-shadow: 0 0 0 3px #d5a36513; }
.scene-caption-en { font: 9px var(--mono); color: #7a8e9b; letter-spacing: 1.2px; margin-left: 5px; }
.view-switcher { display: flex; gap: 3px; background: #111d2766; padding: 3px; border-radius: 5px; }
.view-switcher button { padding: 6px 11px; border-radius: 3px; background: transparent; color: #aab9c0; font-size: 11px; white-space: nowrap; }
.view-switcher button i { font-size: 13px; margin-left: 3px; }
.view-switcher button:hover { background: #33424d; color: #fff; }
.view-switcher button.active { background: #e2a662; color: #302a22; box-shadow: 0 1px 4px #0003; }
#teaching-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
#teaching-exit { display: none; }
.panel-auto-reveal { display: flex; align-items: center; gap: 5px; color: #b7c8ce; font-size: 11px; white-space: nowrap; cursor: pointer; }
.panel-auto-reveal input { width: 12px; height: 12px; }
.panel-dock-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 5px; flex: 0 0 auto; min-height: 34px; padding: 5px 10px; border-bottom: 1px solid #d9dfd2; background: #f0f3eb; color: #647268; font-size: 11px; }
.panel-dock-header > span { margin-right: auto; font-weight: 600; }
.panel-dock-header button { padding: 4px 8px; border-radius: 3px; color: #647268; background: transparent; font-size: 11px; white-space: nowrap; }
.panel-dock-header button:hover { background: #e1e7d9; }
.panel-dock-header button[aria-pressed="true"] { color: #975f23; background: #f3e7d6; }
#scene-tools > .panel-dock-header { color: #b9cbd1; background: #20313c; border-bottom-color: #c8d7e112; }
#scene-tools > .panel-dock-header button { color: #c5d6dd; }
#scene-tools > .panel-dock-header button:hover { background: #3c5561; }
#scene-tools > .panel-dock-header button[aria-pressed="true"] { color: #ffe1b4; background: #795a32; }
#analysis-panels > .panel-dock-header { margin-top: 12px; border: 1px solid #d9dfd2; border-radius: 5px; }
#panel-edge-tabs button { position: fixed; z-index: 39; padding: 9px 7px; border: 1px solid #9eacaa77; background: #243b47ed; color: #d8e4e7; box-shadow: 0 2px 10px #0003; font-size: 11px; }
#panel-edge-tabs button:hover, #panel-edge-tabs button:focus-visible { background: #795a32; color: #fff3dc; }
#panel-edge-tabs [data-panel-reveal="controls"] { right: 0; top: 46%; border-radius: 5px 0 0 5px; }
#panel-edge-tabs [data-panel-reveal="diagrams"] { bottom: 0; left: 28px; border-radius: 5px 5px 0 0; padding: 6px 18px; }
#panel-edge-tabs [data-panel-reveal="tools"] { left: 0; top: 190px; border-radius: 0 5px 5px 0; }
.machining-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 17px; border-bottom: 1px solid #c8d7e112; background: #20313c; }
.machining-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.machining-buttons button { padding: 8px 12px; border: 1px solid #778e9655; border-radius: 4px; color: #e5ecee; background: #304650; font-size: 12px; }
.machining-buttons button:hover { background: #45606d; }
.machining-buttons button:disabled { opacity: .45; cursor: default; }
.machining-buttons #show-workpiece { color: #ffe1b4; border-color: #d6a26488; }
.machining-buttons #focus-tool[aria-pressed="true"] { background: #a67031; }
.machining-toolbar > span { color: #acbcc5; font-size: 11px; }
.reference-toolbar { padding: 12px 17px 10px; border-bottom: 1px solid #c8d7e120; background: #223541; }
.reference-selection-row, .reference-position-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reference-selection-row { justify-content: space-between; }
.reference-plane-picker { display: flex; gap: 5px; }
.reference-toolbar button { min-height: 30px; padding: 6px 10px; border: 1px solid #657d895e; border-radius: 4px; background: #304650; color: #d8e4e7; font-size: 12px; white-space: nowrap; }
.reference-toolbar button:hover { background: #3e5a68; }
.reference-plane-picker button { display: flex; align-items: center; gap: 5px; }
.reference-plane-picker button[aria-pressed="true"] { color: #fff3dc; background: #795a32; border-color: #e2b46e; box-shadow: inset 0 -2px #e2b46e; }
.reference-isolate { display: flex; align-items: center; gap: 6px; color: #c1ced3; font-size: 11px; cursor: pointer; }
.reference-position-row { margin-top: 9px; }
.reference-position-row > label { font-size: 12px; white-space: nowrap; }
.reference-position-row > input[type="range"] { flex: 1; width: auto; min-width: 90px; }
.reference-number-field { display: flex; align-items: center; gap: 5px; font: 11px var(--mono); color: #a9bdc6; }
.reference-number-field input { width: 66px; height: 30px; padding: 4px 5px; border: 1px solid #667f8b80; border-radius: 4px; background: #182a35; color: #ffe2b2; font: 12px var(--mono); }
.reference-drag-hint { margin: 8px 0 0; color: #98b0bd; font-size: 11px; line-height: 1.5; }
.scene-shell.reference-mode #viewport { min-height: 300px; height: clamp(300px, calc(100dvh - 650px), 500px); }
#viewport { position: relative; width: 100%; height: clamp(370px, calc(100dvh - 530px), 640px); min-height: 370px; overflow: hidden; outline-offset: -4px; touch-action: none; background: radial-gradient(ellipse at 48% 43%, #273843 0, #192732 60%, #14212b 100%); }
#viewport > canvas { display: block; width: 100%; height: 100%; }
#labels { position: absolute; z-index: 4; inset: 0; pointer-events: none; overflow: hidden; }
.label-leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.viewport-corner { position: absolute; z-index: 2; width: 16px; height: 16px; pointer-events: none; border-color: #73859340; border-style: solid; }
.corner-top-left { top: 20px; left: 20px; border-width: 1px 0 0 1px; }
.corner-bottom-right { bottom: 20px; right: 20px; border-width: 0 1px 1px 0; }
.label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-size: 14px; line-height: 1.4; color: #e7edf0; background: #16232be6; padding: 6px 9px; border: 1px solid #9cacb04d; border-radius: 4px; box-shadow: 0 2px 8px #0002; backdrop-filter: blur(4px); pointer-events: none; }
.label::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 6px 2px 0; border-radius: 50%; background: var(--label-color, #e9b574); }
.label.active { color: #ffdb9e; border-color: #e3ac61; }
.angle-label { color: #f8c681; font: 14px var(--serif); background: #15212ae8; border-color: #bb986248; }
.angle-label::before { display: none; }
.scene-message { position: absolute; z-index: 6; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 13px; background: #1a2832d9; text-align: center; padding: 28px; }
.scene-message strong { font-size: 15px; font-weight: 500; }
.scene-message > span:last-child { font-size: 12px; color: #8fa1ad; }
.loading-ring { width: 30px; height: 30px; border: 2px solid #60748255; border-top-color: #e0ac6c; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-message { color: #ffb99d; line-height: 1.8; }
.scene-bottom-bar { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 17px; border-top: 1px solid #c8d7e110; background: #1b2933; }
#status { font-size: 10px; color: #8599a5; line-height: 1.4; }
.scene-toggles { display: flex; gap: 14px; flex-shrink: 0; }
.scene-toggles label { display: flex; align-items: center; gap: 5px; font-size: 10px; cursor: pointer; }
.scene-toggles input { width: 11px; height: 11px; accent-color: #d6a264; }

.diagrams { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.diagram-card { overflow: hidden; min-width: 0; background: var(--panel); border: 1px solid #d9dcd3; border-radius: 6px; }
.diagram-heading { display: flex; align-items: center; justify-content: space-between; width: 100%; background: transparent; padding: 14px 14px 0; text-align: left; font-size: 12px; }
.diagram-heading > span:first-child { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.diagram-heading i { margin-left: 1px; font-size: 15px; }
.diagram-heading:hover { color: var(--accent); }
.diagram-heading.active { color: #ae6d29; }
.diagram-figure-no { font: 9px var(--mono); color: #9a9e96; display: flex; align-items: center; gap: 10px; }
.diagram-figure-no span { font: 15px var(--sans); color: #8b938e; }
.plane-swatch { display: inline-block; width: 7px; height: 7px; border-radius: 1px; flex-shrink: 0; }
.plane-swatch.pr { background: #69b4d2; }
.plane-swatch.po { background: #f5b969; }
.plane-swatch.ps { background: #b5a0de; }
.diagram-card svg { display: block; width: 100%; height: 164px; overflow: visible; }
.diagram-card svg text, .section-preview svg text { font-family: var(--sans); font-size: 14px; }
.diagram-readout { margin: 0 13px; padding: 10px 0 12px; border-top: 1px solid #e4e5dc; font-size: 12px; text-align: center; color: #6d7777; line-height: 1.5; min-height: 41px; overflow-wrap: anywhere; }
.section-result { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(240px, 1fr); margin-top: 16px; min-height: 246px; background: var(--panel); border: 1px solid #d9dcd3; border-radius: 6px; overflow: hidden; }
.section-result-visual { min-width: 0; padding: 14px 18px 10px; background: #f4f5ec; }
.section-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 8px; }
.section-result-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 0; }
.section-result-heading > span { font: 9px var(--mono); color: #8c9588; letter-spacing: 1px; }
.section-swatch { background: #edb877; }
.section-result-copy { align-self: center; padding: 24px; border-left: 1px solid #e0e3d7; }
.section-result-copy h2 { font-size: 19px; line-height: 1.5; margin: 9px 0 12px; font-weight: 600; letter-spacing: -.4px; }
.section-result-copy > p { font-size: 12px; line-height: 1.8; color: #818c7e; margin: 12px 0 0; }
.reference-section { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(180px, 1.1fr); margin-top: 12px; border: 1px solid #d4dccc; border-radius: 6px; overflow: hidden; background: var(--panel); }
.reference-section-visual { min-width: 0; padding: 12px 16px 0; background: #f0f3e9; }
.reference-section-visual .section-result-heading { padding-bottom: 0; }
.reference-section-visual .section-result-heading h2 { font-size: 12px; }
#reference-section-svg { display: block; width: 100%; height: 160px; }
#reference-section-svg text { font: 13px var(--sans); }
.reference-section-copy { align-self: center; min-width: 0; padding: 16px 20px; border-left: 1px solid #dfe5d6; }
.reference-section-copy .eyebrow { font-family: var(--sans); font-size: 11px; letter-spacing: .5px; color: #72836c; }
.reference-section-copy .section-info { margin-top: 8px; color: #405b40; font-size: 13px; }
.reference-section-copy > p { margin: 10px 0 0; color: #818d7b; font-size: 11px; line-height: 1.7; }

.control-panel { background: var(--panel); border: 1px solid #d7dad1; border-radius: 7px; overflow: hidden; display: flex; flex-direction: column; max-height: calc(100dvh - 182px); min-height: 693px; box-shadow: 0 3px 12px #29372f03; }
.panel-title { padding: 23px 22px 19px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-title .eyebrow { font-size: 8px; letter-spacing: 1.6px; }
.panel-title h1 { font-size: 20px; letter-spacing: -.5px; font-weight: 600; margin: 8px 0 0; }
.panel-number { font: 11px var(--mono); color: #acae9f; border: 1px solid #dedfd2; border-radius: 50%; width: 38px; height: 38px; display: grid; place-items: center; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 20px; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; color: #808983; padding: 12px 6px 13px; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: #9c622b; }
.tabs button.active { color: #9e672f; border-bottom-color: #b77a38; font-weight: 700; }
.panel-content { padding: 22px; overflow-y: auto; flex: 1 1 auto; scrollbar-width: thin; scrollbar-color: #c7ccbf transparent; }
.control-heading { margin-bottom: 20px; }
.control-heading h2 { font-size: 14px; margin: 0; font-weight: 600; }
.control-heading p { font-size: 13px; line-height: 1.6; color: #758176; margin: 8px 0 0; }
.field-label { display: block; font-size: 13px; color: #68746d; margin-bottom: 7px; }
select { width: 100%; min-height: 36px; padding: 7px 29px 7px 10px; border: 1px solid #d5d9cf; border-radius: 4px; color: #46534c; background: #f5f6ef; font-size: 13px; }
.preset-note { color: #8b9486; font-size: 11px; line-height: 1.6; margin: 7px 0 0; }
select:hover { border-color: #aeb7a9; }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 10px; font-size: 13px; font-weight: 600; color: #637169; }
.section-label > span:last-child { font: 8px var(--mono); letter-spacing: 1px; color: #9bA399; }
.feature-list { display: flex; flex-direction: column; gap: 7px; }
.feature-button { border: 1px solid #e0e2d9; border-radius: 5px; background: #f8f9f2; text-align: left; color: #4b5951; }
.feature-button:hover { background: #f0f1e8; border-color: #bfc8b9; }
.feature-button.active { border-color: #c99c62; background: #f4eadd; box-shadow: inset 2px 0 #bc8445; }
.feature-list .feature-button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 11px; min-height: 59px; }
.feature-rake { --feature: #eaaa52; }
.feature-flank { --feature: #65acb3; }
.feature-secondary { --feature: #9a91c2; }
.feature-main-edge { --feature: #ba842f; }
.feature-minor-edge { --feature: #4f9d90; }
.feature-tip { --feature: #da8269; }
.feature-icon { display: grid; place-items: center; position: relative; width: 31px; height: 31px; flex: 0 0 auto; color: #29373f; font: italic 16px var(--serif); border: 1px solid color-mix(in srgb, var(--feature), transparent 45%); background: color-mix(in srgb, var(--feature), transparent 75%); border-radius: 3px; }
.feature-icon sub { display: contents; }
.feature-button strong { display: block; font-size: 14px; font-weight: 600; }
.feature-button small { display: block; color: #788674; font-size: 12px; margin-top: 4px; }
.feature-arrow { margin-left: auto; color: #8b958c; font-size: 13px; }
.feature-compact { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.feature-compact .feature-button { display: flex; align-items: center; gap: 9px; min-height: 35px; padding: 9px 10px; }
.feature-compact .feature-button:last-child { grid-column: 1 / -1; }
.feature-compact strong { font-size: 13px; }
.feature-line { display: block; width: 17px; height: 3px; border-radius: 2px; background: var(--feature); }
.feature-point { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--feature); margin: 0 5px; }
.explanation-card { margin-top: 17px; padding: 12px 13px; background: #eeeee5; border-left: 2px solid #b4bda8; font-size: 13px; line-height: 1.8; color: #6b756c; border-radius: 0 4px 4px 0; }
.explanation-card h3 { font-size: 12px; color: #4c5a4f; margin: 0 0 5px; }
.explanation-card p { margin: 4px 0 0; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; font-size: 13px; }
.field-row select { width: 132px; min-height: 32px; font-size: 13px; }
.subtle-note { font-size: 12px; line-height: 1.8; color: #818d7d; margin: 12px 0 0; }
.slider-control { margin-bottom: 17px; }
.slider-control > label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 7px; }
.slider-control > label i { margin-left: 5px; font-size: 15px; color: #7b847c; }
.slider-control output { color: #a46d31; font: 14px var(--mono); min-width: 38px; text-align: right; }
input[type="range"] { width: 100%; margin: 4px 0; height: 16px; background: transparent; accent-color: #b68245; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: #d6dcd0; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #bc8647; border: 2px solid #fbfbf5; box-shadow: 0 0 0 1px #af7836; margin-top: -5px; }
input[type="range"] { -webkit-appearance: none; appearance: none; }
input[type="range"]::-moz-range-track { height: 3px; background: #d6dcd0; border-radius: 3px; }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 2px solid #fbfbf5; border-radius: 50%; background: #bc8647; box-shadow: 0 0 0 1px #af7836; }
.range-ends { display: flex; justify-content: space-between; font: 9px var(--mono); color: #a0a69b; margin-top: 1px; }
.plane-toggles { display: flex; justify-content: space-between; gap: 5px; margin: 14px 0 21px; }
.plane-toggles label { display: flex; align-items: center; gap: 3px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.plane-toggles input { width: 12px; height: 12px; }
.plane-toggles .plane-swatch { width: 5px; height: 5px; margin-left: 2px; }
.plane-adjust { border: 1px solid #dedfd3; border-radius: 4px; margin-top: 20px; }
.plane-adjust summary { display: flex; justify-content: space-between; list-style: none; padding: 12px; font-size: 12px; color: #6f796d; }
.plane-adjust[open] summary > span { transform: rotate(45deg); }
summary::-webkit-details-marker { display: none; }
.details-body { padding: 8px 12px 13px; }
.details-body .slider-control { margin-bottom: 14px; }
.details-body .slider-control label { font-size: 13px; }
.details-body .secondary-button { font-size: 10px; min-height: 31px; }
.spaced-label { margin-top: 19px; }
.material-description { font-size: 13px; line-height: 1.9; color: #637064; }
.material-description h3 { font-size: 18px; color: #3f5143; margin: 0 0 10px; }
.material-description p { margin: 8px 0; }
.material-properties { display: grid; gap: 10px; margin-top: 18px; font-size: 13px; line-height: 1.6; }
.material-properties > div { padding: 10px 12px; background: #f0f2e9; border: 1px solid #e2e5d9; border-radius: 4px; }
.material-properties strong { color: #4b5d4e; }
.material-properties meter, .material-properties progress { display: block; width: 100%; margin-top: 6px; accent-color: #a88851; }
.material-note { margin-top: 25px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; border: 1px solid #dce0d2; padding: 13px; border-radius: 5px; background: #f1f3e9; cursor: pointer; }
.switch-row strong { font-size: 14px; font-weight: 600; }
.switch-row small { display: block; font-size: 12px; color: #798572; margin-top: 5px; }
.switch-row input { appearance: none; width: 31px; height: 18px; border-radius: 10px; background: #cbd0c4; position: relative; transition: background .2s; }
.switch-row input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px #0002; }
.switch-row input:checked { background: #b78243; }
.switch-row input:checked::before { transform: translateX(13px); }
.spaced-control { margin-top: 22px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #798372; cursor: pointer; }
.section-preview { background-color: #f0f2e9; border: 1px solid #e0e4d7; border-radius: 5px; background-image: linear-gradient(#c4cebd20 1px, transparent 1px), linear-gradient(90deg, #c4cebd20 1px, transparent 1px); background-size: 16px 16px; }
.section-preview svg { display: block; width: 100%; height: 185px; }
.section-info { font-size: 13px; line-height: 1.8; color: #65765e; margin-top: 8px; }
.help-details { border-top: 1px solid var(--line); flex-shrink: 0; background: #f5f6ee; }
.help-details summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 15px 20px; font-size: 11px; color: #7a8678; }
.help-details summary > span:last-child { margin-left: auto; font-size: 15px; color: #9ba591; }
.help-icon { font: 9px var(--mono); border: 1px solid #a6b09e; width: 14px; height: 14px; border-radius: 50%; display: inline-grid; place-items: center; }
.help-body { padding: 0 20px 15px; font-size: 12px; line-height: 1.8; color: #7e8a7b; max-height: 240px; overflow-y: auto; }
.help-body a { color: #976628; text-underline-offset: 3px; }
.help-body p { margin: 0 0 8px; }
.help-body p:last-child { margin-bottom: 0; }
.app-footer { max-width: 1920px; margin: 0 auto; padding: 17px 29px 20px; display: flex; justify-content: space-between; color: #a1a99d; font-size: 9px; letter-spacing: .5px; }

@media (min-width: 1700px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 370px; }
  .control-panel { min-height: 752px; }
  .diagram-card svg { height: 194px; }
  .panel-content { padding: 25px; }
}
@media (max-width: 1200px) {
  .app-header { padding: 18px 20px; gap: 18px; }
  .header-subject { display: none; }
  .workspace { padding: 18px 20px 0; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; }
  .panel-title { padding: 22px 18px 17px; }
  .panel-title h1 { font-size: 19px; }
  .panel-content { padding: 20px 18px; }
  .scene-caption-en { display: none; }
  .scene-topbar { padding: 10px 13px; }
  .view-switcher button { padding: 6px 8px; }
  .scene-bottom-bar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .scene-toggles { align-self: flex-end; }
  .diagrams { gap: 10px; }
  .diagram-heading { padding: 13px 10px 0; font-size: 10px; }
  .diagram-figure-no { display: none; }
  .diagram-card svg { height: 144px; }
  .diagram-readout { min-height: 59px; margin: 0 8px; }
  .section-result { grid-template-columns: minmax(0, 1fr) minmax(200px, 1fr); }
  .section-result-copy { padding: 18px; }
  .control-panel { min-height: 690px; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .control-panel { max-height: none; min-height: 0; }
  .panel-content { overflow: visible; }
  .panel-title { padding: 20px 22px 16px; }
  .panel-title h1 { font-size: 21px; }
  .panel-content { padding: 22px; }
  #viewport { height: 480px; }
  .scene-bottom-bar { flex-direction: row; align-items: center; }
  .scene-toggles { align-self: auto; }
  .diagram-card svg { height: 175px; }
  .diagram-heading { font-size: 12px; padding: 14px 14px 0; }
  .diagram-figure-no { display: flex; }
  .diagram-readout { font-size: 12px; }
  .feature-list { display: grid; grid-template-columns: repeat(3, 1fr); }
  .feature-list .feature-button { padding: 12px; }
  .feature-arrow { display: none; }
  .feature-compact { grid-template-columns: repeat(3, 1fr); }
  .feature-compact .feature-button:last-child { grid-column: auto; }
  .plane-toggles { justify-content: flex-start; gap: 24px; }
}
@media (max-width: 600px) {
  .app-header { align-items: flex-start; flex-wrap: wrap; padding: 17px 15px 13px; gap: 15px; }
  .brand-mark { width: 38px; height: 42px; }
  .brand-title { font-size: 21px; }
  .brand-kicker { font-size: 8px; letter-spacing: 1px; }
  .header-actions { width: 100%; margin: 0; gap: 5px; justify-content: space-between; }
  .quiet-button, .primary-button { min-height: 34px; padding: 0 9px; font-size: 11px; }
  .workspace { padding: 13px 12px 0; gap: 14px; }
  .scene-topbar { align-items: flex-start; flex-direction: column; gap: 10px; padding: 12px; }
  .scene-caption-en { display: inline; }
  .view-switcher { width: 100%; }
  .view-switcher button { flex: 1; padding: 7px 4px; }
  #viewport { min-height: 350px; height: 420px; }
  .reference-toolbar { padding: 10px 12px; }
  .reference-selection-row { gap: 8px; }
  .reference-plane-picker { width: 100%; }
  .reference-plane-picker button { flex: 1; justify-content: center; padding: 6px 4px; }
  .reference-position-row { column-gap: 7px; row-gap: 8px; }
  .reference-position-row > label { width: 100%; }
  .reference-position-row > input[type="range"] { min-width: 145px; }
  .reference-position-row > button { flex: 1; }
  .reference-drag-hint { font-size: 10px; }
  .reference-section { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 10px; }
  .reference-section-visual { padding: 11px 10px 0; }
  .reference-section-visual .section-result-heading > span { display: none; }
  .reference-section-visual .section-result-heading h2 { font-size: 11px; }
  #reference-section-svg { height: 150px; }
  .reference-section-copy { padding: 12px 10px; }
  .reference-section-copy .section-info { font-size: 11px; }
  .reference-section-copy > p { font-size: 10px; }
  .scene-bottom-bar { flex-direction: column; align-items: flex-start; padding: 10px 12px; gap: 10px; }
  .scene-toggles { align-self: auto; }
  .diagrams { gap: 6px; margin-top: 10px; }
  .section-result { grid-template-columns: 1fr; margin-top: 10px; }
  .section-result-copy { border-left: 0; border-top: 1px solid #e0e3d7; padding: 18px; }
  .section-result-copy h2 { font-size: 17px; }
  .section-preview svg { height: 200px; }
  .diagram-card { border-radius: 4px; }
  .diagram-heading { padding: 10px 7px 0; font-size: 9px; }
  .diagram-heading > span:first-child { gap: 3px; }
  .diagram-heading i { font-size: 11px; }
  .diagram-heading .plane-swatch { width: 4px; height: 4px; }
  .diagram-figure-no { display: none; }
  .diagram-card svg { height: 108px; }
  .diagram-readout { min-height: 66px; font-size: 11px; margin: 0 5px; padding-top: 8px; }
  .feature-list { display: flex; }
  .feature-arrow { display: block; }
  .feature-compact { grid-template-columns: 1fr 1fr; }
  .feature-compact .feature-button:last-child { grid-column: 1 / -1; }
  .app-footer { padding: 16px 15px 20px; font-size: 8px; }
  .app-footer > span:last-child { display: none; }
  .label { font-size: 10px; padding: 4px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 540px) {
  .machining-toolbar { flex-direction: column; align-items: flex-start; }
  .diagrams { grid-template-columns: 1fr; }
  .diagram-card svg { height: 180px; }
  .diagram-heading { font-size: 13px; padding: 13px; }
  .diagram-readout { min-height: auto; padding: 10px; }
}

body.teaching-mode { --teaching-top: 48px; height: 100dvh; overflow: hidden; background: var(--scene); }
body.teaching-mode .app-header, body.teaching-mode .app-footer { display: none; }
body.teaching-mode .workspace { position: relative; display: block; width: 100%; max-width: none; height: 100dvh; padding: 0; margin: 0; overflow: hidden; }
body.teaching-mode .visual-workspace { height: 100%; }
body.teaching-mode .scene-shell { position: relative; display: flex; flex-direction: column; height: 100%; border: 0; border-radius: 0; }
body.teaching-mode .scene-topbar { position: relative; z-index: 40; flex: 0 0 var(--teaching-top); min-height: 0; padding: 5px 12px; gap: 12px; }
body.teaching-mode .scene-caption-en { display: none; }
body.teaching-mode .view-switcher { margin-left: auto; }
body.teaching-mode #teaching-actions { display: flex; align-items: center; gap: 5px; }
body.teaching-mode #teaching-exit { display: inline-block; }
#teaching-actions button { min-height: 32px; padding: 6px 10px; border: 1px solid #677f8c66; border-radius: 4px; color: #d9e5e7; background: #304650; font-size: 12px; white-space: nowrap; }
#teaching-actions button:hover { background: #45606d; }
#teaching-actions button[aria-expanded="true"] { color: #ffedcf; background: #795a32; border-color: #d8a361; }
#teaching-actions #teaching-exit { color: #ffe1b4; border-color: #d6a26488; }
body.teaching-mode #viewport { flex: 1 1 0; min-height: 0; height: auto; }
body.teaching-mode .scene-bottom-bar { flex: 0 0 34px; min-height: 34px; padding: 6px 12px; flex-direction: row; align-items: center; gap: 10px; }
body.teaching-mode .scene-toggles { align-self: auto; }
body.teaching-mode #status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.teaching-mode #scene-tools { display: none; position: absolute; z-index: 30; top: calc(var(--teaching-top) + 8px); left: 12px; width: 680px; max-width: calc(100% - 24px); max-height: calc(100% - var(--teaching-top) - 54px); overflow-y: auto; border: 1px solid #657d8977; border-radius: 6px; box-shadow: 0 8px 28px #0005; }
body.teaching-mode.teaching-tools-open #scene-tools { display: block; }
body.teaching-mode #scene-tools .machining-toolbar { flex-wrap: wrap; padding: 10px 12px; }
body.teaching-mode #scene-tools .reference-toolbar { padding: 10px 12px; }
body.teaching-mode .control-panel { display: none; position: absolute; z-index: 31; top: calc(var(--teaching-top) + 8px); right: 12px; bottom: 46px; width: 340px; max-width: calc(100% - 24px); min-height: 0; max-height: none; box-shadow: 0 8px 28px #0005; }
body.teaching-mode.teaching-controls-open .control-panel { display: flex; }
body.teaching-mode .control-panel .panel-title { padding: 14px 18px 12px; }
body.teaching-mode .control-panel .panel-title h1 { font-size: 18px; margin-top: 5px; }
body.teaching-mode .control-panel .panel-content { min-height: 0; overflow-y: auto; padding: 18px; }
body.teaching-mode .control-panel .feature-list { display: flex; }
body.teaching-mode .control-panel .feature-compact { grid-template-columns: 1fr 1fr; }
body.teaching-mode .control-panel .feature-compact .feature-button:last-child { grid-column: 1 / -1; }
body.teaching-mode .control-panel .plane-toggles { justify-content: space-between; gap: 5px; }
body.teaching-mode #analysis-panels { display: none; position: absolute; z-index: 29; bottom: 46px; left: 12px; width: 640px; max-width: calc(100% - 24px); max-height: 35dvh; overflow-y: auto; padding: 8px; border: 1px solid #cad2c1; border-radius: 6px; background: var(--panel); box-shadow: 0 8px 28px #0005; scrollbar-width: thin; }
body.teaching-mode.teaching-diagrams-open #analysis-panels { display: flex; flex-direction: column; gap: 8px; }
body.teaching-mode #analysis-panels > section { flex-shrink: 0; margin: 0; }
body.teaching-mode #analysis-panels > .panel-dock-header { margin: -8px -8px 0; border-radius: 0; }
body.teaching-mode #analysis-panels .diagrams { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
body.teaching-mode #analysis-panels .diagram-card svg { height: 140px; }
body.teaching-mode #analysis-panels .diagram-heading { padding: 10px 8px 0; font-size: 11px; }
body.teaching-mode #analysis-panels .diagram-readout { min-height: 0; padding: 8px 0; font-size: 11px; }
body.teaching-mode #analysis-panels .diagram-figure-no { display: none; }
body.teaching-mode #analysis-panels .reference-section, body.teaching-mode #analysis-panels .section-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; }
body.teaching-mode #analysis-panels .reference-section-copy, body.teaching-mode #analysis-panels .section-result-copy { padding: 12px; }
body.teaching-mode #analysis-panels .section-result-copy h2 { font-size: 15px; margin: 6px 0; }
body.teaching-mode #analysis-panels .section-result-copy > p, body.teaching-mode #analysis-panels .reference-section-copy > p { font-size: 11px; }
body.teaching-mode #reference-section-svg, body.teaching-mode #section-svg { height: 160px; }
@media (min-width: 901px) {
  body.teaching-mode.teaching-controls-open #scene-tools, body.teaching-mode.teaching-controls-open #analysis-panels { max-width: calc(100% - 376px); }
}
@media (max-width: 900px) {
  body.teaching-mode { --teaching-top: 84px; }
  body.teaching-mode .scene-topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 5px 8px; flex-basis: var(--teaching-top); }
  body.teaching-mode .scene-caption { display: none; }
  body.teaching-mode .view-switcher { margin-left: 0; width: 100%; }
  body.teaching-mode .view-switcher button { flex: 1; padding: 4px; }
  body.teaching-mode #teaching-actions { grid-column: 1 / -1; justify-content: flex-end; }
  body.teaching-mode #teaching-actions button { min-width: 70px; }
}
@media (max-width: 600px) {
  body.teaching-mode { --teaching-top: 84px; }
  body.teaching-mode .scene-topbar { flex-direction: column; align-items: stretch; gap: 4px; padding: 5px 8px; }
  body.teaching-mode .view-switcher { width: 100%; padding: 2px; }
  body.teaching-mode .view-switcher button { min-height: 30px; padding: 4px; }
  body.teaching-mode #teaching-actions { gap: 4px; }
  body.teaching-mode #teaching-actions button { flex: 1; min-height: 32px; padding: 5px 4px; font-size: 11px; }
  body.teaching-mode .scene-bottom-bar { justify-content: flex-end; padding: 6px 8px; }
  body.teaching-mode #status { display: none; }
  body.teaching-mode #analysis-panels .diagrams { grid-template-columns: 1fr; }
  body.teaching-mode #analysis-panels .diagram-card svg { height: 160px; }
  body.teaching-mode #analysis-panels .reference-section, body.teaching-mode #analysis-panels .section-result { grid-template-columns: 1fr; }
  body.teaching-mode #analysis-panels .reference-section-copy, body.teaching-mode #analysis-panels .section-result-copy { border-left: 0; border-top: 1px solid #dfe5d6; }
}

body:not(.teaching-mode).panel-controls-collapsed .workspace { grid-template-columns: minmax(0, 1fr); }
body:not(.teaching-mode).panel-controls-collapsed #teaching-control-panel,
body:not(.teaching-mode).panel-diagrams-collapsed #analysis-panels,
body:not(.teaching-mode).panel-tools-collapsed #scene-tools { display: none; }
body:not(.teaching-mode).panel-diagrams-collapsed #viewport { height: clamp(430px, calc(100dvh - 390px), 880px); }
body:not(.teaching-mode).panel-diagrams-collapsed.panel-tools-collapsed #viewport { height: clamp(430px, calc(100dvh - 250px), 980px); }
body:not(.teaching-mode).panel-controls-peek #teaching-control-panel { display: flex; position: fixed; z-index: 41; top: 80px; right: 12px; bottom: 24px; width: 340px; max-width: calc(100% - 24px); min-height: 0; max-height: none; box-shadow: 0 8px 28px #0005; }
body.panel-controls-peek .control-panel .panel-title { padding: 14px 18px 12px; }
body.panel-controls-peek .control-panel .panel-title h1 { font-size: 18px; margin-top: 5px; }
body.panel-controls-peek .control-panel .panel-content { min-height: 0; overflow-y: auto; padding: 18px; }
body.panel-controls-peek .control-panel .feature-list { display: flex; }
body.panel-controls-peek .control-panel .feature-compact { grid-template-columns: 1fr 1fr; }
body.panel-controls-peek .control-panel .feature-compact .feature-button:last-child { grid-column: 1 / -1; }
body.panel-controls-peek .control-panel .plane-toggles { justify-content: space-between; gap: 5px; }
body:not(.teaching-mode).panel-tools-peek #scene-tools { display: block; position: fixed; z-index: 40; top: 80px; left: 12px; width: 680px; max-width: calc(100% - 24px); max-height: calc(100dvh - 104px); overflow-y: auto; border: 1px solid #657d8977; border-radius: 6px; box-shadow: 0 8px 28px #0005; }
body.panel-tools-peek #scene-tools .machining-toolbar { flex-wrap: wrap; }
body:not(.teaching-mode).panel-diagrams-peek #analysis-panels { display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 40; bottom: 24px; left: 12px; width: 640px; max-width: calc(100% - 24px); max-height: 38dvh; overflow-y: auto; padding: 8px; border: 1px solid #cad2c1; border-radius: 6px; background: var(--panel); box-shadow: 0 8px 28px #0005; scrollbar-width: thin; }
body.panel-diagrams-peek #analysis-panels > .panel-dock-header { margin: -8px -8px 0; border-radius: 0; }
body.panel-diagrams-peek #analysis-panels > section { flex-shrink: 0; margin: 0; }
body.panel-diagrams-peek #analysis-panels .diagram-card svg { height: 140px; }
body.panel-diagrams-peek #analysis-panels .diagram-readout { min-height: 0; padding: 8px 0; font-size: 11px; }
body.panel-diagrams-peek #analysis-panels .diagram-figure-no { display: none; }
body.panel-diagrams-peek #analysis-panels .reference-section,
body.panel-diagrams-peek #analysis-panels .section-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; }
body.panel-diagrams-peek #analysis-panels .reference-section-copy,
body.panel-diagrams-peek #analysis-panels .section-result-copy { padding: 12px; }
body.teaching-mode #panel-edge-tabs [data-panel-reveal="tools"] { top: calc(var(--teaching-top) + 18px); }
body.teaching-mode #panel-edge-tabs [data-panel-reveal="diagrams"] { bottom: 34px; }
@media (max-width: 900px) {
  body:not(.teaching-mode) .scene-topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  body:not(.teaching-mode) .scene-caption { grid-column: 1 / -1; }
  body:not(.teaching-mode) .view-switcher { width: 100%; }
  body:not(.teaching-mode) .view-switcher button { flex: 1; padding: 6px 4px; }
  body:not(.teaching-mode) #teaching-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 600px) {
  body:not(.teaching-mode).panel-controls-peek #teaching-control-panel,
  body:not(.teaching-mode).panel-tools-peek #scene-tools { top: 150px; }
  body:not(.teaching-mode).panel-tools-peek #scene-tools { max-height: calc(100dvh - 174px); }
  body.panel-diagrams-peek #analysis-panels .reference-section,
  body.panel-diagrams-peek #analysis-panels .section-result { grid-template-columns: 1fr; }
  body.panel-diagrams-peek #analysis-panels .reference-section-copy,
  body.panel-diagrams-peek #analysis-panels .section-result-copy { border-top: 1px solid #dfe5d6; }
}
