:root {
  color-scheme: light;
  --blue: #2458f5; --blue-dark: #1945c7; --pale: #edf2ff;
  --paper: #f6f8fd; --ink: #192b48; --muted: #68778f;
  --line: #dce3ef; --warm: #ffad66; --danger: #a74235;
  --shadow: 0 10px 34px #192b4824;
  --header-height: 56px; --view-height: 44px; --records-width: 350px; --update-height: 0px;
  font-family: DengXian, 'Microsoft YaHei', 'PingFang SC', sans-serif;
  color: var(--ink); background: var(--paper); font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { height: 100vh; height: 100dvh; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, select, summary, input[type=range] { cursor: pointer; }
button, summary, svg { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; border: 0; border-radius: 6px; padding: 8px 11px; font-weight: 600; transition: background .16s, color .16s; }
button:disabled { cursor: default; opacity: .4; }
button:hover:not(:disabled), button:active:not(:disabled) { background: var(--pale); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }
input, select { color: var(--ink); }
input[type=text], input[type=number], select { width: 100%; min-height: 44px; border: 1px solid var(--line); background: white; border-radius: 6px; padding: 8px; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input::placeholder { color: #8a97aa; font-size: 12px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }
input[type=range] { accent-color: var(--blue); margin: 0; min-width: 0; min-height: 44px; }
select:disabled { opacity: .55; cursor: default; }
h1, h2, h3, p { margin-top: 0; }
p { text-wrap: pretty; }
h2 { font-size: 16px; line-height: 1.5; margin-bottom: 12px; }
h3 { font-size: 14px; margin: 0; }
.icon { display: block; width: 20px; height: 20px; flex-shrink: 0; }
i[data-icon] { display: inline-flex; font-style: normal; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; padding: 10px; color: var(--muted); background: transparent; font-size: 21px; font-weight: 400; }
.quiet-button { background: transparent; color: var(--muted); }
.outline-button { background: white; border: 1px solid var(--line); color: var(--ink); }
.primary-button { background: var(--blue); color: white; }
.primary-button:hover:not(:disabled), .primary-button:active:not(:disabled) { background: var(--blue-dark); }
.text-button { background: none; color: var(--blue); padding: 0 4px; font-size: 11px; }
.full-width { width: 100%; }
.sr-only { position: absolute; clip: rect(0,0,0,0); width: 1px; height: 1px; overflow: hidden; }
.danger-text { color: var(--danger); }
/* An in-flow update notice gives the experiment its remaining viewport space. */
body.has-update-notice{--update-height:52px}
.update-notice{height:52px;min-height:52px;max-height:52px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 12px;background:#edf2ff;border-bottom:1px solid #cdd9ff;color:#192b48}
.update-notice>div{min-width:0;display:flex;align-items:center;gap:12px}
.update-notice strong{font-size:12px;font-weight:600;line-height:1.35}
.update-notice small{font-size:11px;color:#68778f;white-space:nowrap}
.update-notice button{min-height:44px;min-width:88px;flex-shrink:0;padding:6px 10px;font-size:12px}
body[data-updating=true] .update-notice{background:#e8efff}
@media(max-width:700px){.update-notice{padding-left:8px;padding-right:8px;gap:6px}.update-notice>div{display:block}.update-notice strong{display:block;font-size:11px}.update-notice small{display:block;font-size:10px}.update-notice button{min-width:80px}}

.app-header { height: var(--header-height); display: flex; align-items: center; gap: 20px; padding: 0 16px; background: white; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand h1 { font-size: 16px; line-height: 1.2; letter-spacing: .3px; margin: 0; font-weight: 650; }
.brand h1 span { font-size: 12px; font-weight: 400; margin-left: 5px; color: var(--muted); }
.experiment-tabs { display: flex; align-items: center; align-self: stretch; gap: 4px; }
.experiment-tabs button { background: none; color: var(--muted); padding: 8px 16px; font-size: 13px; }
.experiment-tabs button[aria-selected=true] { color: var(--blue); background: var(--pale); }
.header-actions { display: flex; margin-left: auto; gap: 3px; align-items: center; }
.header-actions button { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.header-actions .icon { width: 18px; height: 18px; }
.workspace-bar { display: flex; align-items: center; gap: 14px; height: var(--view-height); padding: 0 12px; background: white; border-bottom: 1px solid var(--line); }
.workspace-tabs, .focus-switch, .history-tools { display: flex; align-items: center; }
.workspace-tabs button { background: none; color: var(--muted); padding: 8px 14px; font-size: 13px; position: relative; }
.workspace-tabs button[aria-selected=true] { color: var(--blue); }
.workspace-tabs button[aria-selected=true]::after { content: ''; position: absolute; bottom: 0; height: 2px; left: 14px; right: 14px; background: var(--blue); }
.focus-switch { border-left: 1px solid var(--line); padding-left: 8px; }
.focus-switch button { min-width: 44px; padding: 7px 10px; font-size: 11px; color: var(--muted); background: none; }
.focus-switch button[aria-pressed=true] { color: var(--blue); }
.history-tools { margin-left: auto; }
.history-tools .icon { width: 18px; height: 18px; }
#workspace-hint { color: var(--muted); font-size: 11px; white-space: nowrap; }

.workspace { height: calc(100% - var(--header-height) - var(--view-height) - var(--update-height)); display: grid; grid-template-columns: minmax(0,1fr) var(--records-width); }
.bench-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fbfcfe; }
.workbench-toolbar { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 12px; background: white; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tool-cluster { display: flex; align-items: center; gap: 3px; padding-right: 8px; border-right: 1px solid var(--line); }
.tool-button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 68px; color: var(--muted); background: none; font-weight: 400; font-size: 12px; }
.tool-button[aria-pressed=true] { background: var(--pale); color: var(--blue); }
.view-controls { display: flex; align-items: center; }
.toolbar-view { margin-left: auto; }
.view-controls .quiet-button { font-size: 11px; font-weight: 400; padding: 4px 7px; }
.view-controls span { display: block; font: 10px Consolas,monospace; margin-top: 2px; }
.view-controls .icon-button { font-size: 21px; }
.canvas-well { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.experiment-stage, .graph-stage { width: 100%; height: 100%; min-height: 0; }
.bench-container { width: 100%; height: 100%; touch-action: none; outline-offset: -4px; overflow: hidden; }
.bench-svg { width: 100% !important; height: 100% !important; display: block; user-select: none; touch-action: none; }
.bench-container[data-tool=pan], .plot-container[data-tool=pan] { cursor: grab; }
.bench-container[data-tool=pen], .plot-container[data-tool=pen] { cursor: crosshair; }
.bench-container[data-tool=eraser], .plot-container[data-tool=eraser] { cursor: cell; }
.bench-container[data-tool=magnify] [data-component=A], .bench-container[data-tool=magnify] [data-component=V] { cursor: zoom-in; }
.bench-apparatus { cursor: move; }
.bench-terminal { cursor: crosshair; }
.wire-hit { cursor: move; pointer-events: stroke; }
.slider-handle { cursor: ew-resize; }
.selected-wire-action { position: absolute; bottom: 10px; right: 12px; background: white; border: 1px solid var(--line); color: var(--danger); font-size: 12px; }
.circuit-menu { position: relative; }
.circuit-menu summary { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 8px 12px; color: var(--muted); font-size: 12px; list-style: none; border-radius: 6px; }
.circuit-menu summary::-webkit-details-marker { display: none; }
.circuit-menu[open] summary { color: var(--blue); background: var(--pale); }
.menu-panel { position: absolute; bottom: calc(100% + 8px); right: 0; width: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: var(--shadow); z-index: 30; }
.menu-panel button { display: block; width: 100%; text-align: left; background: none; font-size: 12px; font-weight: 400; }
.circuit-menu .menu-panel { top: calc(100% + 8px); bottom: auto; }
.circuit-menu .menu-panel .tool-button { min-height: 44px; }
.circuit-menu .menu-panel .tool-button span { display: inline; }
.bench-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 26px; padding: 4px 14px; background: white; border-top: 1px solid #edf0f6; font-size: 11px; color: var(--muted); line-height: 1.6; flex-shrink: 0; }
#bench-hint { text-align: right; }
.ink-options { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 4px 12px; border-bottom: 1px solid var(--line); background: white; flex-shrink: 0; font-size: 12px; }
.pen-colors { display: flex; align-items: center; }
.pen-colors button { width: 44px; min-width: 44px; background: none; padding: 8px; }
.pen-colors button::after { content: ''; display: block; width: 18px; height: 18px; margin: auto; border-radius: 50%; background: var(--pen); }
.pen-colors button[aria-pressed=true]::after { outline: 2px solid var(--pen); outline-offset: 3px; }
.pen-width-label { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.pen-width-label select { width: 58px; border: 0; padding: 5px; font-size: 12px; }
.ink-options .quiet-button { font-size: 11px; padding: 5px 8px; }

.measurement-panels { height: 100%; width: 100%; padding: 8px 14px; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 5px; }
.reading-tabs { display: flex; align-items: center; justify-content: center; gap: 3px; }
.reading-tabs button { color: var(--muted); background: none; font-size: 12px; font-weight: 400; padding: 7px 12px; }
.reading-tabs button[aria-pressed=true] { color: var(--blue); background: var(--pale); }
.reading-meters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: center; gap: 18px; width: min(100%,650px); margin: 0 auto; flex: 1; min-height: 0; }
.reading-meters.is-single { grid-template-columns: 1fr; width: min(100%,310px); }
.reading-meter { width: 100%; height: 100%; min-height: 0; padding: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.reading-meter:hover:not(:disabled) { background: transparent; }
.reading-meter > span { font-size: 12px; color: var(--muted); padding: 3px; }
.reading-meter svg { width: 100%; max-height: calc(100% - 25px); height: auto; pointer-events: none; }
.reading-context { display: flex; justify-content: center; gap: 18px; align-items: center; color: var(--muted); font-size: 11px; min-height: 22px; }
.reading-context .lamp-indicator { width: 14px; height: 14px; border: 1px solid #9b9073; border-radius: 50%; background: #f2efdf; }

.graph-stage { display: flex; flex-direction: column; background: #fbfcfe; }
.plot-controls { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid #edf0f6; background: white; flex-wrap: wrap; }
.plot-controls > label:not(.check-control) { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.plot-controls select { width: 112px; font-size: 12px; }
.plot-controls input[type=number] { width: 66px; font: 12px Consolas,monospace; padding: 6px; }
.check-control { display: flex; align-items: center; gap: 5px; min-height: 44px; font-size: 11px; white-space: nowrap; }
.plot-container { flex: 1; min-height: 0; width: 100%; overflow: hidden; touch-action: none; }
.plot-container svg { width: 100%; height: 100%; display: block; user-select: none; touch-action: none; }
#plot-caption { flex-shrink: 0; margin: 0; padding: 5px 14px; color: var(--muted); font-size: 11px; line-height: 1.6; }
body[data-workspace=graph] #focus-switch, body[data-workspace=graph] [data-tool=connect], body[data-workspace=graph] [data-tool=magnify] { display: none; }
body[data-workspace=graph] #delete-wire { display: none !important; }
body[data-focus=reading][data-workspace=experiment] .workbench-toolbar, body[data-focus=reading][data-workspace=experiment] #delete-wire { display: none !important; }

.experiment-dock { min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: white; overflow: hidden; }
.record-pane { height: 100%; display: flex; flex-direction: column; padding: 10px 14px; min-height: 0; }
.data-heading { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-height: 44px; flex-shrink: 0; }
.data-heading h2 { margin: 0; font-size: 14px; font-weight: 600; }
#record-count { font: 11px Consolas,monospace; margin-left: 7px; color: var(--muted); }
.meter-shortcuts { display: flex; }
.meter-shortcuts button { font: 15px Georgia,serif; color: var(--muted); gap: 2px; padding: 6px; }
.meter-shortcuts .icon { width: 12px; height: 12px; }
.field-note { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 8px 0 12px; }
#data-intro { font-size: 11px; margin: 0 0 10px; flex-shrink: 0; }
.record-entry { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) 44px; align-items: end; gap: 4px; margin-bottom: 10px; flex-shrink: 0; }
.record-entry label { font-size: 11px; color: var(--muted); }
.record-entry input { margin-top: 4px; padding: 7px 6px; font-family: Consolas,monospace; font-size: 15px; }
.record-entry button { font-size: 24px; font-weight: 400; padding: 5px; }
.table-area { min-height: 0; overflow: auto; scrollbar-width: thin; overscroll-behavior: contain; flex: 0 1 auto; }
table { border-collapse: collapse; width: 100%; text-align: center; font-size: 12px; white-space: nowrap; }
th { height: 28px; padding: 5px; background: #f6f8fc; color: var(--muted); font-size: 10px; font-weight: 400; position: sticky; top: 0; z-index: 1; }
td { height: 44px; border-bottom: 1px solid #edf0f6; padding: 0 4px; font-family: Consolas,monospace; }
td:first-child { width: 24px; color: var(--muted); font-size: 11px; }
td input { width: 70px !important; min-width: 58px; min-height: 44px; text-align: center; font: 12px Consolas,monospace; padding: 5px !important; border-color: transparent !important; border-radius: 4px; }
td input:hover, td input:focus { border-color: var(--line) !important; background: #fafbfe; }
td button { width: 44px; min-width: 44px; min-height: 44px; padding: 5px; background: none; font-size: 17px; font-weight: 400; color: var(--muted); }
.computed-cell { color: var(--blue); font-size: 11px; }
.empty-table { white-space: normal; text-align: left; padding: 12px 3px; font: 12px/1.8 DengXian,'Microsoft YaHei',sans-serif; color: var(--muted); }
.data-secondary { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; flex-shrink: 0; }
.data-secondary button { font-size: 11px; font-weight: 400; padding: 5px; }
.statistics { padding: 9px 0; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.statistics strong { font: 600 16px Consolas,monospace; color: var(--ink); margin: 0 3px; }
.statistics small { display: block; font-size: 10px; line-height: 1.7; }
.numeric-helper { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 7px; padding: 0 6px; background: var(--pale); border-radius: 5px; flex-shrink: 0; }
.numeric-helper > span { font-size: 10px; color: var(--muted); }
.numeric-helper strong { font: 13px Consolas,monospace; white-space: nowrap; }
.numeric-helper small { font-size: 10px; }
.numeric-helper button { margin-left: auto; font-size: 11px; padding: 4px; }
#measurement-task { margin: 4px 0 8px; font-size: 11px; }
.section-details { border-top: 1px solid var(--line); margin-top: 14px; }
.section-details summary { display: flex; align-items: center; min-height: 44px; font-size: 12px; font-weight: 600; list-style: none; gap: 7px; }
.section-details summary::before { content: '›'; font-size: 18px; color: var(--muted); }
.section-details[open] summary::before { transform: rotate(90deg); }
#diagnostic-details { margin-top: 0; flex-shrink: 0; }
#diagnostics { max-height: 140px; overflow-y: auto; font-size: 12px; line-height: 1.8; color: var(--muted); }
#diagnostics p { margin: 0 0 8px; }
.learning-note { max-height: 120px; overflow-y: auto; border-top: 1px solid var(--line); margin-top: 6px; padding: 8px 0; font-size: 12px; line-height: 1.8; color: var(--muted); flex-shrink: 0; }

dialog { width: min(540px,calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); box-shadow: var(--shadow); padding: 22px; }
dialog::backdrop { background: #192b484f; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { margin: 0; font-size: 19px; }
.dialog-button-row { display: flex; gap: 8px; margin: 12px 0; }
.dialog-button-row button { flex: 1; font-size: 12px; }
.dialog-message { font-size: 12px; color: #477160; line-height: 1.8; margin: 12px 0 0; }
.dialog-message[data-error=true] { color: var(--danger); }
dialog hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.dock-tabs { display: flex; align-items: center; gap: 3px; }
.dock-tabs button { font-size: 13px; padding: 8px 13px; background: none; color: var(--muted); }
.dock-tabs button[aria-selected=true] { color: var(--blue); background: var(--pale); }
.dock-pane { padding: 18px 0 8px; }
.field-label { display: flex; justify-content: space-between; gap: 5px; font-size: 12px; font-weight: 600; margin: 16px 0 8px; }
.field-label span { color: var(--muted); font-size: 11px; font-weight: 400; }
.meter-range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; border-bottom: 1px solid #edf0f6; padding: 12px 0; cursor: pointer; }
.toggle-row strong { display: block; font-size: 13px; }
.toggle-row small { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.7; }
.teaching-section { margin-top: 24px; }
.teaching-section h3 { font-size: 13px; }
.dock-footer { border-top: 1px solid var(--line); padding-top: 10px; font-size: 11px; color: var(--muted); }
.offline-area { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.offline-area p { flex-basis: 100%; margin: 0; font-size: 11px; line-height: 1.7; }
.offline-area [data-ready=true] { color: #477160; }
.help-steps { padding-left: 22px; margin: 16px 0; font-size: 13px; line-height: 1.9; }
.help-steps li { margin-bottom: 12px; }
.model-description { border-top: 1px solid var(--line); padding: 10px 0; font-size: 12px; line-height: 1.8; color: var(--muted); }
.model-description summary { min-height: 44px; display: flex; align-items: center; color: var(--ink); font-weight: 600; }
.model-description p { margin: 8px 0 0; }
.meter-loupe { position: fixed; top: 126px; right: calc(var(--records-width) + 20px); width: 350px; background: white; border: 1px solid #bbc9dd; border-radius: 10px; box-shadow: 0 12px 48px #192b4833; z-index: 35; overflow: hidden; }
.loupe-header { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 14px; border-bottom: 1px solid var(--line); cursor: move; touch-action: none; user-select: none; }
.loupe-header h2 { font-size: 14px; margin: 0; white-space: nowrap; }
.loupe-header > span { font-size: 10px; color: var(--muted); }
.loupe-header .quiet-button { margin-left: auto; padding: 6px; font-size: 10px; font-weight: 400; }
#loupe-view { padding: 10px 10px 0; }
.meter-loupe svg { width: 100%; height: auto !important; display: block; }
.meter-loupe > p { margin: 4px 14px 12px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.loupe-drag-hint { display: block; color: #8b98aa; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); max-width: min(560px,calc(100% - 28px)); padding: 11px 18px; border-radius: 8px; background: #192b48ed; color: white; font-size: 12px; line-height: 1.7; box-shadow: var(--shadow); z-index: 100; pointer-events: none; }
.draft-stroke { pointer-events: none; }
body[data-workspace=graph] .numeric-helper { display: none; }

@media (max-width: 1250px) {
  :root { --records-width: 330px; }
  .tool-button { min-width: 44px; width: 44px; padding: 10px; }
  .tool-button > span { display: none; }
  .workbench-toolbar { gap: 5px; padding: 4px 8px; }
  .tool-cluster { gap: 1px; padding-right: 5px; }
  #workspace-hint, #bench-hint { display: none; }
  .plot-controls { gap: 7px; }
  .plot-controls > label:not(.check-control) { gap: 3px; }
  .plot-controls input[type=number] { width: 58px; }
}
@media (max-width: 850px) and (min-width: 601px) {
  :root { --records-width: 300px; }
  .record-pane { padding: 8px; }
  .app-header { gap: 9px; padding: 0 10px; }
  .experiment-tabs button { padding: 8px 10px; }
  .brand h1 { font-size: 14px; }
  .brand h1 span { display: none; }
  .plot-controls { padding: 4px 8px; }
  .plot-controls > label:not(.check-control) { flex-direction: column; align-items: flex-start; font-size: 10px; }
  .plot-controls select { width: 106px; }
}
@media (max-width: 600px) {
  :root { --header-height: 96px; --view-height: 44px; --record-height: clamp(260px,31dvh,300px); }
  .app-header { flex-wrap: wrap; align-content: center; gap: 0 8px; padding: 3px 10px; }
  .brand { gap: 6px; min-height: 44px; }
  .brand img { width: 23px; height: 23px; }
  .brand h1 { font-size: 14px; }
  .brand h1 span { font-size: 11px; margin-left: 3px; }
  .header-actions { height: 44px; gap: 0; }
  .header-actions button { padding: 6px 8px; font-size: 11px; }
  .header-actions .icon { width: 17px; height: 17px; }
  .experiment-tabs { order: 3; width: 100%; height: 44px; align-self: auto; gap: 2px; }
  .experiment-tabs button { flex: 1; font-size: 12px; padding: 8px; }
  .workspace-bar { padding: 0 6px; gap: 3px; }
  .workspace-tabs button { font-size: 12px; padding: 7px 10px; }
  .workspace-tabs button[aria-selected=true]::after { left: 10px; right: 10px; }
  .focus-switch { padding-left: 3px; }
  .focus-switch button { padding: 7px; font-size: 11px; }
  .history-tools .icon-button { padding: 10px; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) var(--record-height); }
  body[data-workspace=experiment][data-focus=circuit]:not([data-records-open=true]) .workspace { grid-template-rows: minmax(0,1fr) calc(48px + env(safe-area-inset-bottom,0px)); }
  body[data-workspace=experiment][data-focus=circuit]:not([data-records-open=true]) .record-pane > :not(.data-heading) { display: none !important; }
  body.has-values[data-workspace=experiment] { --record-height: clamp(304px,36dvh,344px); }
  body.has-calcs { --record-height: clamp(292px,35dvh,332px); }
  body.has-values.has-calcs[data-workspace=experiment] { --record-height: clamp(336px,40dvh,380px); }
  .experiment-dock { border-left: 0; border-top: 1px solid var(--line); }
  .record-pane { padding: 4px 10px; }
  .data-heading { min-height: 20px; }
  .data-heading h2 { font-size: 12px; }
  #record-count { font-size: 10px; }
  .meter-shortcuts, #data-intro, .data-secondary, #measurement-task { display: none !important; }
  .statistics { padding: 4px 0; font-size: 11px; }
  .statistics strong { font-size: 14px; }
  .statistics small { display: none; }
  .record-entry { margin: 3px 0 4px; gap: 4px; }
  .record-entry label { font-size: 10px; }
  .record-entry input { margin-top: 2px; font-size: 15px; }
  th { height: 26px; padding: 4px; }
  td { padding: 0 4px; }
  .empty-table { padding: 8px 2px; }
  .numeric-helper { min-height: 44px; margin: 0 0 3px; padding: 0 5px; gap: 7px; }
  .workbench-toolbar { padding: 4px 7px; gap: 5px; }
  .tool-cluster { padding-right: 4px; gap: 0; }
  .toolbar-view > .icon-button { display: none; }
  .toolbar-view .quiet-button { min-width: 44px; }
  .toolbar-view span { display: none; }
  .circuit-menu summary { padding: 8px; }
  .circuit-menu summary > span { display: none; }
  .bench-status { min-height: 23px; padding: 3px 10px; font-size: 10px; }
  .measurement-panels { padding: 3px 9px; gap: 2px; }
  .reading-tabs button { font-size: 11px; padding: 5px 10px; }
  .reading-meters { gap: 8px; }
  .reading-meters.is-single { width: min(100%,270px); }
  .reading-meter > span { font-size: 10px; }
  .reading-context { min-height: 18px; font-size: 10px; }
  .ink-options { justify-content: space-between; gap: 2px; padding: 3px 5px; }
  #ink-tool-label { display: none; }
  .pen-width-label { font-size: 0; gap: 0; }
  .pen-width-label select { width: 47px; padding: 4px; font-size: 11px; }
  .ink-options .quiet-button { max-width: 70px; font-size: 10px; padding: 4px; }
  .plot-controls { gap: 4px 7px; padding: 3px 8px; justify-content: flex-start; }
  .plot-controls > label:not(.check-control) { flex-direction: column; align-items: flex-start; gap: 0; font-size: 9px; }
  .plot-controls select { width: 102px; font-size: 11px; padding: 5px; }
  .plot-controls input[type=number] { width: 54px; padding: 5px; font-size: 11px; }
  .plot-controls .check-control { font-size: 10px; }
  #plot-caption { font-size: 10px; padding: 3px 9px; }
  dialog { padding: 16px; }
  .dock-tabs button { font-size: 12px; padding: 7px 10px; }
  .meter-loupe { display: none !important; }
}
@media (max-width: 370px) {
  .brand h1 span { display: none; }
  .header-actions button > span { display: none; }
  .workspace-tabs button { padding: 7px 7px; font-size: 11px; }
  .workspace-bar { padding: 0 3px; gap: 0; }
  .ink-options { flex-wrap: wrap; }
}
@media (max-height: 560px) and (min-width: 601px) {
  :root { --header-height: 48px; }
  .bench-status { display: none; }
  .record-pane { padding: 4px 8px; }
  .data-heading { min-height: 24px; }
  .meter-shortcuts, #data-intro, .data-secondary, #measurement-task, .record-pane #diagnostic-details, .record-pane #learning-note { display: none !important; }
  .data-heading h2 { font-size: 12px; }
  .record-entry { margin: 2px 0 4px; }
  .numeric-helper { min-height: 44px; margin-bottom: 2px; }
  .statistics { padding: 4px 0; font-size: 11px; }
  .statistics small { display: none; }
  .plot-controls > label:not(.check-control) { flex-direction: row; align-items: center; }
  .plot-controls { padding: 2px 8px; gap: 5px; }
  .plot-controls .check-control { font-size: 10px; }
  .meter-loupe { top: 98px; width: 310px; }
  .meter-loupe svg { max-height: 200px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.records-toggle { display:none; }

/* S03: task-sized work areas and on-demand pen controls. */
.bench-panel { position: relative; }
.compact-control-label { display: none; }
.pen-options-toggle { flex-shrink: 0; }
body:not([data-tool=pen]):not([data-tool=eraser]) #pen-options-toggle { display: none; }
.ink-options { position: absolute; top: 53px; left: 8px; right: 8px; z-index: 40; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.reading-meter svg { flex: 1; min-height: 0; height: 100% !important; max-height: calc(100% - 18px); }
body[data-workspace=graph] .record-entry, body[data-workspace=graph] #data-intro, body[data-workspace=graph] #measurement-task { display: none !important; }
body[data-workspace=graph] .bench-status { display: none; }

@media (max-width: 600px) {
  :root { --header-height: 48px; --record-height: 232px; }
  .workspace { grid-template-rows:minmax(0,1fr) calc(var(--record-height) + env(safe-area-inset-bottom,0px)); }
  body[data-workspace=experiment][data-focus=circuit][data-records-open=true] .workspace { grid-template-rows:minmax(0,1fr) calc(var(--record-height) + 24px + env(safe-area-inset-bottom,0px)); }
  body[data-workspace=experiment][data-focus=circuit] .data-heading { height:44px; min-height:44px; }
  body[data-workspace=experiment][data-focus=circuit] .records-toggle { display:inline-flex; align-items:center; justify-content:center; gap:5px; min-height:44px; padding:6px 8px; color:var(--blue); font-size:11px; }
  .app-header { flex-wrap: nowrap; gap: 4px; padding: 0 6px; }
  .brand { min-height: 44px; gap: 0; }
  .brand img { width: 24px; height: 24px; }
  .brand h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .experiment-tabs { order: 0; flex: 1; width: auto; height: 44px; min-width: 0; align-self: center; gap: 2px; }
  .experiment-tabs button { padding: 7px 6px; min-height: 44px; font-size: 12px; white-space: nowrap; }
  .header-actions { flex-shrink: 0; margin-left: 0; gap: 0; }
  .header-actions button { width: 44px; min-width: 44px; justify-content: center; padding: 10px; }
  .header-actions button > span { display: none; }
  body.has-values[data-workspace=experiment] { --record-height: 276px; }
  body.has-calcs { --record-height: 252px; }
  body.has-values.has-calcs[data-workspace=experiment] { --record-height: 296px; }
  body[data-workspace=graph] { --record-height: 188px; }
  body.has-calcs[data-workspace=graph] { --record-height: 208px; }
  .record-pane { padding: 2px 8px calc(2px + env(safe-area-inset-bottom,0px)); }
  .data-heading { min-height: 20px; height: 20px; }
  .record-entry { margin: 0; gap: 4px; min-height: 44px; }
  .record-entry label { display: flex; align-items: center; gap: 3px; font-size: 10px; white-space: nowrap; min-width: 0; }
  .record-entry input { flex: 1; width: 100%; min-width: 0; margin-top: 0; padding: 5px 4px; font-size: 14px; }
  .record-entry input::placeholder { font-size: 10px; }
  .record-entry button { min-height: 44px; }
  .table-area { flex: 1; min-height: 161px; }
  table { font-size: 12px; }
  th { height: 26px; }
  td { height: 44px; font-size: 12px; }
  td input { min-height: 44px; font-size: 12px; }
  .computed-cell { font-size: 11px; }
  .numeric-helper { height: 44px; min-height: 44px; max-height: 44px; margin: 0; }
  .statistics { height: 20px; min-height: 20px; max-height: 20px; padding: 0; font-size: 11px; line-height: 20px; overflow: hidden; }
  .statistics strong { font-size: 14px; }
  .statistics small { display: none; }
  .measurement-panels { position: relative; padding: 2px 4px; gap: 2px; }
  .reading-meters { gap: 4px; width: 100%; }
  .reading-meters.is-single { width: calc(100% - 48px); margin: 0 48px 0 0; }
  .reading-meter { min-height: 0; }
  .reading-meter > span { height: 16px; font-size: 11px; padding: 0; flex-shrink: 0; }
  .reading-meter svg { width: 100%; height: 100% !important; max-height: calc(100% - 16px); }
  .reading-context { min-height: 18px; height: 18px; font-size: 10px; }
  .reading-tabs { position: absolute; top: 4px; right: 4px; display: flex; flex-direction: column; gap: 0; width: 44px; min-height: 132px; height: auto; z-index: 2; }
  .reading-tabs button { width: 44px; min-width: 44px; min-height: 44px; padding: 4px; font-size: 11px; }
  .workbench-toolbar { min-height: 52px; gap: 3px; padding: 4px 6px; }
  .tool-cluster { gap: 0; padding-right: 3px; }
  .ink-options { top: 53px; left: 8px; right: 8px; padding: 5px 6px; gap: 4px; flex-wrap: wrap; justify-content: flex-start; }
  .pen-colors { flex: 0 0 176px; }
  .pen-width-label { flex: 0 0 48px; font-size: 0; gap: 0; }
  .pen-width-label select { width: 48px; min-height: 44px; padding: 4px; font-size: 11px; }
  .ink-options .quiet-button { flex: 0 0 48px; width: 48px; max-width: 48px; padding: 2px; font-size: 10px; line-height: 15px; }
  .plot-controls { flex-wrap: nowrap; height: 48px; min-height: 48px; max-height: 48px; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 4px; padding: 2px 6px; }
  .plot-controls > label:not(.check-control) { flex-direction: row; align-items: center; gap: 3px; font-size: 10px; min-width: 0; }
  .plot-control-label, .plot-check-label { display: none; }
  .compact-control-label { display: inline; }
  .plot-controls select { width: 92px; min-height: 44px; font-size: 11px; padding: 5px; }
  .plot-controls input[type=number] { width: 49px; min-height: 44px; font-size: 12px; padding: 5px; }
  .plot-controls .check-control { min-height: 44px; min-width: 44px; justify-content: center; gap: 3px; font-size: 10px; }
  .plot-controls .check-control input { margin: 0; }
  #plot-caption { height: 22px; max-height: 22px; padding: 3px 8px; font-size: 10px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 600px) and (max-height: 740px) {
  .bench-status { display: none; }
  .reading-context { display: none; }
}
@media (max-height: 560px) and (min-width: 601px) {
  .record-pane { padding: 2px 8px; }
  .data-heading { height: 20px; min-height: 20px; }
  .record-entry { min-height: 44px; margin: 0; }
  .record-entry label { display: flex; align-items: center; gap: 3px; font-size: 10px; white-space: nowrap; min-width: 0; }
  .record-entry input { min-width: 0; width: 100%; margin-top: 0; padding: 5px 4px; font-size: 13px; }
  .record-entry input::placeholder { font-size: 10px; }
  .table-area { flex: 1; min-height: 161px; }
  th { height: 26px; }
  td input { width: 58px !important; font-size: 12px; }
  .numeric-helper { height: 44px; min-height: 44px; max-height: 44px; margin: 0; }
  .statistics { height: 20px; min-height: 20px; max-height: 20px; padding: 0; font-size: 11px; line-height: 20px; overflow: hidden; }
  .statistics strong { font-size: 14px; }
  .plot-controls { flex-wrap: nowrap; height: 48px; min-height: 48px; max-height: 48px; padding: 2px 6px; gap: 5px; }
  .plot-control-label, .plot-check-label { display: none; }
  .compact-control-label { display: inline; }
  .plot-controls select { width: 92px; }
  .plot-controls input[type=number] { width: 52px; }
  .plot-controls .check-control { min-width: 44px; justify-content: center; }
  .reading-meters { width: 100%; gap: 4px; }
  .measurement-panels { padding: 2px 8px; gap: 0; }
  .reading-meter > span { height: 16px; min-height: 16px; padding: 0; }
  .reading-context { display: none; }
}
