/* PhysicsHub Lab — V5 "B 大气" surface for experiments (lab-core).
 * Builds only on ui-v5.css tokens; no colours of its own except apparatus
 * materials inside the stage. */

.lab-page { background: var(--ph-bg); color: var(--ph-ink); font-family: var(--ph-font-ui); margin: 0; -webkit-font-smoothing: antialiased; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }


/* ---------- experiment page ---------- */
.xp { max-width: 1320px; margin: 0 auto; padding: 22px var(--ph-layout-gutter) 72px; }
.xp-topline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-bottom: 10px; }
.xp-crumb { display: flex; gap: 8px; font-size: 13px; color: var(--ph-ink-tertiary); }
.xp-crumb a { color: var(--ph-chrome-accent); text-decoration: none; font-weight: 500; }
.xp-head { margin-bottom: 18px; }
.xp-eyebrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; font-size: 13px; color: var(--ph-ink-secondary); }
.xp-eyebrow > span:not(.xp-tag) + span::before { content: "·"; margin-right: 10px; color: var(--ph-ink-tertiary); }
.xp-tag { padding: 3px 10px; border-radius: 999px; background: var(--ph-chrome-accent-soft); color: var(--ph-chrome-accent); font-weight: 600; font-size: 12px; }
.xp-title { margin: 0; font-family: var(--ph-font-display); font-size: clamp(28px, 3vw, 40px); line-height: 1.08; letter-spacing: var(--ph-tracking-title); font-weight: 700; }
.xp-question { margin: 8px 0 0; font-size: 18px; color: var(--ph-ink-secondary); letter-spacing: -.01em; }
.xp-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.xp-progress .xp-phases { margin: 0; }
.xp-reset, .xp-open-bench { flex: none; }
.xp-progress-actions { display: flex; align-items: center; gap: 4px; }
.xp-reset.is-confirm { color: var(--ph-warning) !important; }

/* progress: six phases of a practical */
.xp-phases { display: flex; gap: 6px; margin: 0 0 18px; padding: 6px; background: var(--ph-surface); border-radius: 999px; box-shadow: var(--ph-shadow-card); width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.phase { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 7px 14px 7px 8px; border-radius: 999px; font: inherit; font-size: 14px; color: var(--ph-ink-tertiary); cursor: pointer; white-space: nowrap; transition: background-color var(--ph-motion-fast) var(--ph-ease-standard), color var(--ph-motion-fast); }
.phase:hover { background: var(--ph-fill); }
.phase-dot { position: relative; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ph-fill); font-size: 12px; transition: background-color var(--ph-motion-base) var(--ph-ease-spring), transform var(--ph-motion-slow) var(--ph-ease-press); }
.phase-dot b { font-weight: 600; }
.phase-dot svg { position: absolute; width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; transition: stroke-dashoffset var(--ph-motion-slow) var(--ph-ease-standard) 80ms; }
.phase.is-current { color: var(--ph-ink); font-weight: 600; background: var(--ph-fill); }
.phase.is-current .phase-dot { background: var(--ph-btn-primary); color: #fff; }
.phase.is-done { color: var(--ph-ink-secondary); }
.phase.is-done .phase-dot { background: var(--ph-positive); transform: scale(1.04); }
.phase.is-done .phase-dot b { opacity: 0; }
.phase.is-done .phase-dot svg { stroke-dashoffset: 0; }

.xp-grid { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(360px, 1fr); gap: 20px; align-items: start; }
.xp-stage-card { position: sticky; isolation: isolate; top: calc(var(--ph-shell-h) + 16px); background: var(--ph-surface); border-radius: var(--ph-radius-panel); box-shadow: var(--ph-shadow-card); overflow: hidden; }
.xp-stage { position: relative; aspect-ratio: var(--stage-ar, .9); height: auto; max-height: min(calc(100vh - 280px), 760px); min-height: 440px; width: 100%; background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #f6f6f8 60%, #eeeef1 100%); }
.xp-stage .lab-stage-svg { position: absolute; inset: 14px 14px 0; width: calc(100% - 28px); height: calc(100% - 14px); opacity: 0; transform: translateY(8px) scale(.985); transition: opacity 500ms var(--ph-ease-standard), transform 700ms var(--ph-ease-spring); }
.xp-stage.is-ready .lab-stage-svg { opacity: 1; transform: none; }
.xp-loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; justify-items: center; color: var(--ph-ink-secondary); font-size: 14px; }
.lab-load-error { display: grid; gap: 10px; justify-items: center; max-width: 360px; padding: 20px; text-align: center; }
.lab-load-error strong { font-size: 17px; font-weight: 600; color: var(--ph-ink); }
.lab-load-error p { margin: 0 0 4px; line-height: 1.5; color: var(--ph-ink-secondary); }
.xp-tray { position: absolute; right: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; z-index: 2; }
.xp-tray:empty { display: none; }
.xp-stage[data-tray="top"] .xp-tray { top: 20px; bottom: auto; }
.xp-capture-note { margin: 0; max-width: 340px; padding: 0 6px; font-size: 13px; line-height: 1.4; color: var(--ph-positive); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.xp-capture-note:empty { display: none; }
.xp-capture-note.is-new { animation: rise var(--ph-motion-slow) var(--ph-ease-spring); }
.xp-tray .tray-label { text-align: right; padding-right: 6px; }
.tray-slot { display: grid; gap: 6px; border-radius: 18px; padding: 2px; transition: box-shadow var(--ph-motion-base) var(--ph-ease-standard); }
.tray-label { font-size: 12px; color: var(--ph-ink-tertiary); padding-left: 4px; }
.tray-slot.is-focus { box-shadow: 0 0 0 3px var(--ph-focus-halo); animation: focus-breathe 2.4s var(--ph-ease-standard) infinite; }
@keyframes focus-breathe { 50% { box-shadow: 0 0 0 6px var(--ph-accent-halo); } }

/* SVG apparatus text and affordances */
.lab-stage-svg { font-family: var(--ph-font-ui); user-select: none; -webkit-user-select: none; }
.svg-scale { font-size: 21px; fill: #4b4026; font-variant-numeric: tabular-nums; }
.svg-chip { font-size: 27px; font-weight: 600; fill: var(--ph-ink); paint-order: stroke; stroke: rgba(255, 255, 255, .92); stroke-width: 9px; stroke-linejoin: round; font-variant-numeric: tabular-nums; }
.svg-chip-red { fill: #c40014; }
.svg-unknown { font-size: 30px; font-weight: 700; fill: #fff; }
.grab-target { outline: none; }
.grab-target:focus-visible > :first-child { stroke: var(--ph-chrome-accent); stroke-width: 3; }
.ap-pendulum.is-focus .grab-target circle:last-child, .ap-load .grab-target { transition: filter var(--ph-motion-base); }
.is-focus .grab-target:not(.length-grip) > circle:first-child { fill: var(--ph-accent-halo); animation: pulse-halo 2.2s var(--ph-ease-standard) infinite; }
@keyframes pulse-halo { 0%, 100% { fill-opacity: .5; } 50% { fill-opacity: 1; } }
.ap-beam.is-focus .ap-load > rect:first-child { fill: var(--ph-accent-halo); animation: pulse-halo 2.2s infinite; }
.inst-rule.is-focus .rule-cursor > rect { fill: var(--ph-accent-halo); animation: pulse-halo 2.2s infinite; }
.lab-loupe { transition: opacity 260ms var(--ph-ease-standard); pointer-events: none; }

/* stopwatch: a real-feeling device */
.inst-stopwatch .sw-case { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 22px; background: linear-gradient(180deg, #2c3136, #1d2125); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 8px 22px rgba(0,0,0,.14); }
.sw-lcd { min-width: 118px; display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; padding: 8px 12px; border-radius: 12px; background: linear-gradient(180deg, #c9d7c6, #b5c6b1); box-shadow: inset 0 2px 4px rgba(0,0,0,.25); color: #1d2a1c; }
.sw-digits { font: 600 30px/1 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.sw-unit { font-size: 13px; opacity: .7; }
.sw-buttons { display: flex; gap: 8px; }
.sw-btn { min-width: 66px; height: 44px; border: 0; border-radius: 999px; font: 600 15px var(--ph-font-ui); cursor: pointer; transition: transform var(--ph-motion-slow) var(--ph-ease-press), background-color var(--ph-motion-fast); -webkit-tap-highlight-color: transparent; }
.sw-btn:active { transform: scale(var(--ph-press-scale)); transition-duration: var(--ph-motion-press); }
.sw-start { background: #34c759; color: #fff; }
.sw-start.is-running { background: #ff453a; }
.sw-reset { background: rgba(255,255,255,.14); color: #fff; }
.inst-stopwatch.is-running .sw-lcd { box-shadow: inset 0 2px 4px rgba(0,0,0,.25), 0 0 0 2px rgba(52,199,89,.5); }

/* level and light-gate timer */
.inst-level { display: grid; gap: 8px; padding: 12px 16px; border-radius: 18px; background: var(--ph-surface-subtle); box-shadow: inset 0 0 0 1px var(--ph-line); min-width: 210px; }
.lv-track { position: relative; height: 26px; border-radius: 13px; background: linear-gradient(180deg, #eef6d8, #dbe9b8); box-shadow: inset 0 1px 3px rgba(0,0,0,.18); overflow: hidden; }
.lv-mark { position: absolute; left: 50%; top: 3px; bottom: 3px; width: 34px; margin-left: -17px; border-left: 1.5px solid rgba(0,0,0,.35); border-right: 1.5px solid rgba(0,0,0,.35); }
.lv-bubble { position: absolute; left: 50%; top: 4px; width: 28px; height: 18px; margin-left: -14px; border-radius: 9px; background: radial-gradient(circle at 35% 35%, #fff, rgba(255,255,255,.55)); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 180ms linear; }
.lv-text { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ph-ink-secondary); }
.inst-level.is-level { box-shadow: inset 0 0 0 2px var(--ph-positive); background: var(--ph-positive-soft); }
.inst-level.is-level .lv-text { color: var(--ph-positive); }
.inst-timer { display: grid; gap: 6px; }
.tm-lcd { display: flex; align-items: baseline; gap: 4px; padding: 10px 14px; border-radius: 14px; background: #10161b; color: #7cf0c6; min-width: 150px; justify-content: flex-end; }
.tm-digits { font: 600 26px/1 ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
.tm-label { font-size: 12px; color: var(--ph-ink-tertiary); }
.inst-contact-timer { padding: 10px 12px; border-radius: 22px; background: linear-gradient(180deg, #2c3136, #1d2125); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 8px 22px rgba(0,0,0,.14); }
.inst-contact-timer .tm-label { color: rgba(255,255,255,.62); padding: 0 4px; max-width: 280px; }
.ct-row { display: flex; align-items: center; gap: 10px; }
.ct-switch { min-width: 92px; background: #0a7a6f; color: #fff; }
.ct-switch.is-release { background: #ff453a; }
.svg-note { fill: var(--ph-ink-tertiary); font-size: 22px; }

/* step card */
.xp-side { display: grid; gap: 16px; }
.xp-step:empty { display: none; }
.xp-step { position: relative; background: var(--ph-surface); border-radius: var(--ph-radius-panel); box-shadow: var(--ph-shadow-card); padding: 24px 26px 22px; }
.step-top { display: flex; justify-content: space-between; align-items: center; }
.step-eyebrow { margin: 0; font-size: 13px; font-weight: 600; color: var(--ph-chrome-accent); letter-spacing: .01em; }
.step-count { margin: 0; font-size: 13px; color: var(--ph-ink-tertiary); font-variant-numeric: tabular-nums; }
.step-title { margin: 8px 0 8px; font-family: var(--ph-font-display); font-size: 25px; line-height: 1.18; letter-spacing: -.022em; font-weight: 700; animation: rise var(--ph-motion-slow) var(--ph-ease-spring); }
.step-body { margin: 0; font-size: 16px; line-height: 1.55; color: var(--ph-ink-secondary); animation: rise var(--ph-motion-slow) var(--ph-ease-spring) 40ms backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.step-actions { display: flex; gap: 8px; margin-top: 16px; }
.step-actions:empty { display: none; }
.step-hint { margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--ph-fill); font-size: 14.5px; line-height: 1.5; color: var(--ph-ink-secondary); }
.step-question { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.step-callouts { display: grid; gap: 8px; margin-top: 12px; }
.step-callouts:empty { display: none; }
.callout { margin: 0; padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; }
.callout.is-enter { animation: callout-in var(--ph-motion-slow) var(--ph-ease-press); }
@keyframes callout-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.callout-warning { background: var(--ph-warning-soft); color: #8a4700; }
.callout-positive { background: var(--ph-positive-soft); color: #1c6b30; }
.callout-info { background: var(--ph-info-soft); color: #0a4f9e; }

/* data cards */
.xp-card { background: var(--ph-surface); border-radius: var(--ph-radius-panel); box-shadow: var(--ph-shadow-card); padding: 18px 20px 20px; }
.xp-card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.xp-card-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.xp-card-meta { font-size: 13px; color: var(--ph-ink-tertiary); font-variant-numeric: tabular-nums; }
.xp-table-wrap { overflow-x: auto; margin: 0 -6px; }
.xp-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 15px; }
.xp-table th { text-align: right; padding: 8px 10px; font-weight: 600; font-size: 13.5px; color: var(--ph-ink); border-bottom: 1px solid var(--ph-line-strong); white-space: nowrap; }
.xp-table th .q { font-family: var(--ph-font-math); font-style: italic; font-size: 16px; }
.xp-table th .u { color: var(--ph-ink-secondary); font-weight: 500; }
.xp-table th.is-derived, .xp-table td.is-derived { color: var(--ph-ink-secondary); }
.xp-table td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--ph-line); }
.xp-table td.is-empty { color: var(--ph-ink-tertiary); }
.xp-table td.is-fresh { animation: cell-in 1.4s var(--ph-ease-standard); }
@keyframes cell-in { 0% { background: var(--ph-chrome-accent-soft); color: var(--ph-chrome-accent); transform: scale(1.08); } 30% { transform: none; } 100% { background: transparent; } }
.xp-col-act { width: 28px; padding: 0 !important; }
.xp-row-del { width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--ph-ink-tertiary); font-size: 17px; cursor: pointer; opacity: 0; transition: opacity var(--ph-motion-fast), background-color var(--ph-motion-fast); }
.xp-table tr:hover .xp-row-del, .xp-row-del:focus-visible { opacity: 1; }
.xp-row-del:hover { background: var(--ph-danger-soft); color: var(--ph-danger); }
.xp-empty-row td { text-align: left; color: var(--ph-ink-tertiary); font-size: 14px; padding: 14px 10px; }

.xp-graph svg { width: 100%; height: auto; display: block; }
.lab-graph { font-family: var(--ph-font-ui); }
.g-grid line { stroke: var(--ph-line); stroke-width: 1; }
.g-axis { stroke: var(--ph-ink-secondary); stroke-width: 1.3; }
.g-tick { font-size: 11.5px; fill: var(--ph-ink-tertiary); font-variant-numeric: tabular-nums; }
.g-label { font-size: 13px; fill: var(--ph-ink-secondary); font-style: italic; font-family: var(--ph-font-math); }
.g-empty { font-size: 13px; fill: var(--ph-ink-tertiary); }
.g-best { stroke: var(--ph-chrome-accent); stroke-width: 2; }
.g-worst { stroke: var(--ph-ink-tertiary); stroke-width: 1.4; stroke-dasharray: 6 5; }
.g-bar { stroke: var(--ph-ink-secondary); stroke-width: 1.2; }
.g-cross { stroke: var(--ph-ink); stroke-width: 1.8; stroke-linecap: round; }
.g-point.is-enter { animation: point-in 700ms var(--ph-ease-press) both; transform-box: fill-box; transform-origin: center; }
.g-point.is-new .g-cross { stroke: var(--ph-chrome-accent); }
@keyframes point-in { from { opacity: 0; transform: scale(.2); } }
.g-best, .g-worst { animation: line-in 600ms var(--ph-ease-standard); }
@keyframes line-in { from { opacity: 0; } }

.xp-result { margin-top: 14px; padding: 16px 18px; border-radius: 20px; background: linear-gradient(180deg, var(--ph-chrome-accent-soft), rgba(230,244,241,.4)); animation: rise var(--ph-motion-slow) var(--ph-ease-spring); }
.xp-result-main { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-family: var(--ph-font-display); }
.xp-result-label { font-size: 22px; font-style: italic; font-family: var(--ph-font-math); }
.xp-result-value { font-size: 38px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.xp-result-pm { font-size: 22px; color: var(--ph-ink-secondary); font-variant-numeric: tabular-nums; }
.xp-result-unit { font-size: 18px; color: var(--ph-ink-secondary); }
.xp-result-note { margin: 6px 0 0; font-size: 14px; line-height: 1.5; color: var(--ph-ink-secondary); }
.xp-result-note .ok { color: var(--ph-positive); font-weight: 600; }
.xp-result-note .off { color: var(--ph-warning); font-weight: 600; }
.xp-conclusion { margin-top: 12px; }

/* ---------- phone ---------- */
@media (max-width: 900px) {
  .xp-grid { grid-template-columns: 1fr; gap: 16px; }
  .xp-side { display: contents; }
  .xp-step { order: -1; }
  .xp-stage-card { position: relative; top: 0; }
  .xp-tray { position: static; flex-direction: row; flex-wrap: wrap; align-items: stretch; padding: 12px 14px 14px; border-top: 1px solid var(--ph-line); }
  .xp-tray .tray-label { text-align: left; padding-left: 4px; }
  /* the tray flows below the drawing here, so the drawing must take its own space (not overlay the tray) */
  .xp-stage { height: auto; aspect-ratio: auto; max-height: none; min-height: 0; display: flex; flex-direction: column; }
  .xp-stage .lab-stage-svg { position: relative; inset: auto; width: 100%; height: auto; aspect-ratio: var(--stage-ar, .9); max-height: 62vh; min-height: 240px; margin-top: 8px; }
  .xp-loading { position: relative; height: 54vh; }
  .xp-capture-note { flex-basis: 100%; max-width: none; text-align: left; }
}
@media (max-width: 720px) {
  .xp { padding: 14px 16px 56px; }
  .xp-head { margin-bottom: 12px; }
  .xp-title { font-size: 28px; }
  .xp-question { font-size: 16.5px; }
  .xp { position: relative; }
  .xp-progress { flex-direction: column; align-items: stretch; gap: 2px; margin-bottom: 12px; }
  .xp-progress-actions { justify-content: flex-end; }
  .xp-reset { position: absolute; top: 6px; right: 8px; }
  .xp-progress .xp-phases { width: auto; margin: 0 -16px; border-radius: 0; padding: 6px 12px; box-shadow: none; background: transparent; }
  .phase { padding: 6px 10px 6px 6px; font-size: 13px; background: var(--ph-surface); box-shadow: var(--ph-shadow-control); }
  .xp-tray { padding: 12px; gap: 10px; }
  .inst-stopwatch .sw-case { width: 100%; box-sizing: border-box; justify-content: space-between; }
  .sw-lcd { min-width: 112px; }
  .sw-digits { font-size: 26px; }
  .tray-slot { flex: 1 1 100%; }
  .xp-step { padding: 20px 18px; border-radius: 24px; }
  .step-title { font-size: 22px; }
  .xp-card { padding: 16px 14px; border-radius: 24px; }
  .xp-table { font-size: 14px; }
  .xp-table th, .xp-table td { padding: 8px 6px; }
  .xp-row-del { opacity: .6; }
}
@media (prefers-reduced-motion: reduce) {
  .lab-page *, .lab-page *::before { animation: none !important; transition-duration: 1ms !important; }
}

/* ---------- open bench (Workshop consumer) ---------- */
.bench-toolbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px var(--ph-layout-gutter); background: var(--ph-chrome); backdrop-filter: var(--ph-chrome-blur); -webkit-backdrop-filter: var(--ph-chrome-blur); border-bottom: 1px solid var(--ph-line); }
.bench-name { display: grid; line-height: 1.2; min-width: 0; }
.bench-name strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bench-kicker { font-size: 12px; color: var(--ph-ink-tertiary); }
.bench-tools { display: flex; gap: 8px; align-items: center; margin: 0 auto; }
.bench-tools .ph-button svg { width: 15px; height: 15px; }
.bench-sep { width: 1px; height: 22px; background: var(--ph-line-strong); margin: 0 4px; }
.bench-banner { display: flex; align-items: center; gap: 12px; max-width: 1400px; margin: 14px auto 0; padding: 12px 16px; border-radius: 18px; background: var(--ph-chrome-accent-soft); color: var(--ph-ink); font-size: 14.5px; line-height: 1.45; animation: rise var(--ph-motion-slow) var(--ph-ease-spring); box-sizing: border-box; width: calc(100% - 2 * var(--ph-layout-gutter)); }
.bench-banner > span:nth-child(2) { flex: 1; }
.bench-banner-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ph-chrome-accent); color: #fff; font-weight: 700; flex: none; }
.bench { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; max-width: 1400px; margin: 0 auto; padding: 16px var(--ph-layout-gutter) 48px; align-items: start; }
.bench-stage-card { position: sticky; top: 74px; background: var(--ph-surface); border-radius: var(--ph-radius-panel); box-shadow: var(--ph-shadow-card); overflow: hidden; isolation: isolate; }
.bench-stage { height: calc(100vh - 230px); max-height: none; aspect-ratio: auto; min-height: 480px; background-image: radial-gradient(circle, rgba(0,0,0,.07) 1px, transparent 1.2px), radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #f5f5f7 70%); background-size: 22px 22px, auto; }
.bench-notebook { display: grid; gap: 14px; }
.bench-props { display: grid; gap: 8px; }
.bench-prop { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bench-prop label { font-size: 14px; color: var(--ph-ink-secondary); }
.bench-prop .q { font-family: var(--ph-font-math); font-style: italic; font-size: 16px; color: var(--ph-ink); }
.bench-step { display: flex; align-items: center; gap: 6px; }
.bench-step .ph-input { width: 86px; text-align: center; min-height: 32px !important; font-variant-numeric: tabular-nums; }
.bench-step .u { width: 44px; font-size: 13px; color: var(--ph-ink-tertiary); }
.bench-step .ph-button-icon { width: 32px; min-height: 32px !important; padding: 0 !important; font-size: 17px !important; }
.bench-steps { margin: 6px 0 4px; padding-left: 22px; display: grid; gap: 8px; font-size: 15px; }
.bench-step-phase { display: inline-block; min-width: 46px; margin-right: 8px; padding: 1px 8px; border-radius: 999px; background: var(--ph-fill); font-size: 12px; color: var(--ph-ink-secondary); text-align: center; }
@media (max-width: 1000px) {
  .bench { grid-template-columns: 1fr; }
  .bench-stage-card { position: relative; top: 0; }
}
@media (max-width: 720px) {
  .bench-toolbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .bench-tools { margin: 0; flex-wrap: wrap; }
  .bench-end { width: 100%; }
  .bench-end .ph-button { width: 100%; }
  .bench { padding: 12px 12px 40px; }
  .bench-stage { height: auto; min-height: 0; }
  .bench-banner { width: calc(100% - 24px); flex-wrap: wrap; }
}

/* ---------- gallery ---------- */
.gal { max-width: 1240px; margin: 0 auto; padding: 0 var(--ph-layout-gutter) 96px; }
.gal-hero { text-align: center; padding: 64px 0 28px; }
.gal-kicker { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--ph-chrome-accent); }
.gal-title { margin: 0; font-family: var(--ph-font-display); font-size: clamp(40px, 6vw, 64px); line-height: 1.04; letter-spacing: -.035em; font-weight: 700; }
.gal-sub { margin: 14px auto 26px; max-width: 640px; font-size: 21px; line-height: 1.4; color: var(--ph-ink-secondary); letter-spacing: -.012em; }
.gal-search { max-width: 520px; margin: 0 auto; }
.gal-filters { position: sticky; top: var(--ph-shell-h); z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 16px; padding: 12px 0 14px; margin-bottom: 18px; background: linear-gradient(var(--ph-bg) 80%, rgba(245,245,247,0)); }
.gal-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.gal-h2 { margin: 0 0 18px; font-family: var(--ph-font-display); font-size: 28px; letter-spacing: -.022em; font-weight: 700; }
.gal-featured { margin-bottom: 56px; }
.gal-feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.gal-feature { position: relative; display: grid; grid-template-rows: auto 1fr; background: var(--ph-surface); border-radius: var(--ph-radius-panel); box-shadow: var(--ph-shadow-card); overflow: hidden; transition: transform var(--ph-motion-slow) var(--ph-ease-spring), box-shadow var(--ph-motion-base) var(--ph-ease-standard); }
.gal-feature:hover { transform: translateY(var(--ph-card-lift)); box-shadow: var(--ph-shadow-card-hover); }
.gal-feature-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.gal-feature-link:focus-visible { outline: 3px solid var(--ph-focus-ring); outline-offset: -3px; }
.gal-feature-preview { position: relative; aspect-ratio: 16 / 10; background: radial-gradient(110% 100% at 50% 0%, #ffffff, #f0f0f3 75%); }
.gal-feature-preview .card-preview-svg { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }
.gal-live { position: absolute; left: 16px; top: 14px; z-index: 1; display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px; border-radius: 999px; background: rgba(255,255,255,.86); backdrop-filter: blur(10px); font-size: 12.5px; font-weight: 600; color: var(--ph-ink-secondary); box-shadow: var(--ph-shadow-control); }
.gal-live i { width: 8px; height: 8px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 0 rgba(52,199,89,.5); animation: live 2s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(52,199,89,.45); } 70% { box-shadow: 0 0 0 7px rgba(52,199,89,0); } 100% { box-shadow: 0 0 0 0 rgba(52,199,89,0); } }
.gal-feature-body { padding: 22px 26px 24px; display: flex; flex-direction: column; }
.gal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; color: var(--ph-ink-secondary); }
.gal-feature-title { margin: 0; font-family: var(--ph-font-display); font-size: 26px; line-height: 1.15; letter-spacing: -.022em; font-weight: 700; }
.gal-feature-q { margin: 8px 0 14px; font-size: 17px; line-height: 1.45; color: var(--ph-ink-secondary); }
.gal-skills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.gal-skills li { padding: 4px 10px; border-radius: 999px; background: var(--ph-fill); font-size: 13px; color: var(--ph-ink-secondary); }
.gal-feature-actions { display: flex; gap: 8px; margin-top: auto; position: relative; z-index: 2; }
.gal-all-head { display: flex; align-items: baseline; justify-content: space-between; }
.gal-count { font-size: 14px; color: var(--ph-ink-tertiary); }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 18px; }
.gal-card { display: grid; grid-template-rows: auto 1fr; background: var(--ph-surface); border-radius: var(--ph-radius-card); box-shadow: var(--ph-shadow-card); overflow: hidden; color: inherit; text-decoration: none; transition: transform var(--ph-motion-slow) var(--ph-ease-spring), box-shadow var(--ph-motion-base) var(--ph-ease-standard); }
.gal-card:hover { transform: translateY(var(--ph-card-lift)); box-shadow: var(--ph-shadow-card-hover); }
.gal-card:active { transform: scale(.985); transition-duration: var(--ph-motion-press); }
.gal-card-media { aspect-ratio: 16 / 10; display: grid; place-items: center; background: radial-gradient(110% 100% at 50% 0%, #ffffff, #f1f1f4 80%); overflow: hidden; }
.gal-card-media img { width: 88%; height: 88%; object-fit: contain; mix-blend-mode: multiply; transition: transform var(--ph-motion-slow) var(--ph-ease-spring); }
.gal-card:hover .gal-card-media img { transform: scale(1.035); }
.gal-card-v5 { font-weight: 700; color: var(--ph-chrome-accent); }
.gal-card-media .card-preview-svg { width: 92%; height: 92%; }
.gal-card-body { padding: 14px 18px 18px; }
.gal-card-title { margin: 0 0 6px; font-size: 18px; line-height: 1.25; letter-spacing: -.015em; font-weight: 650; }
.gal-card-sum { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ph-ink-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gal-new { padding: 2px 8px; border-radius: 999px; background: var(--ph-btn-primary); color: #fff; font-size: 11.5px; font-weight: 700; }
.gal-empty { text-align: center; color: var(--ph-ink-tertiary); padding: 40px 0; }
@media (max-width: 900px) { .gal-feature-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .gal-hero { padding: 36px 0 18px; }
  .gal-sub { font-size: 17px; }
  .gal-filters { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; margin: 0 -16px 14px; padding: 10px 16px 12px; }
  .gal-chips { flex-wrap: nowrap; }
  .gal-chips .ph-chip { white-space: nowrap; }
  .gal-feature-body { padding: 18px 18px 20px; }
  .gal-feature-title { font-size: 23px; }
  .gal-feature-actions .ph-button { flex: 1; }
  .gal-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .gal-card-body { padding: 10px 12px 14px; }
  .gal-card-title { font-size: 15.5px; }
  .gal-card-sum { font-size: 13px; }
}

/* ---------- dark appearance (V5.1 全站主题; only with html[data-dark-ready]) ----------
 * Only the frame darkens. The experiment scene (stage, tray instruments, apparatus text) is a light
 * picture like a figure on paper: it keeps its own ground and gets the light tokens back, so nothing
 * inside it changes colour. */
:root[data-appearance="dark"] :is(.xp-stage, .bench-stage) {
  color-scheme: light;
  --ph-ink: #1d1d1f; --ph-ink-secondary: #5f5e58; --ph-ink-tertiary: #71706a;
  --ph-line: #d9d6cc; --ph-line-strong: #c9c5b8;
  --ph-surface: #ffffff; --ph-surface-subtle: #f3f1eb; --ph-surface-raised: #ffffff;
  --ph-fill: rgba(70, 60, 40, .06); --ph-fill-strong: rgba(70, 60, 40, .11);
  --ph-positive: #248a3d; --ph-positive-soft: rgba(36, 138, 61, .12); --ph-warning: #b25d00; --ph-danger: #d70015; --ph-info: #0a64c8;
  color: var(--ph-ink);
}
:root[data-appearance="dark"] .xp-stage .xp-loading { color: #5f5e58; }
/* Ethan 10-25: in dark the bench is a soft warm paper, not a white glare; the apparatus keeps its colours. */
:root[data-appearance="dark"] .xp-stage { background: radial-gradient(120% 90% at 50% 0%, #ebe8e1 0%, #e3e0d8 60%, #dbd7cd 100%); }
:root[data-appearance="dark"] .bench-stage { background-image: radial-gradient(circle, rgba(60,50,30,.10) 1px, transparent 1.2px), radial-gradient(120% 90% at 50% 0%, #ebe8e1 0%, #dfdcd3 70%); }
:root[data-appearance="dark"] .phase.is-current .phase-dot { color: var(--ph-btn-primary-ink); }
:root[data-appearance="dark"] .phase.is-current .phase-dot svg { stroke: var(--ph-btn-primary-ink); }
:root[data-appearance="dark"] .phase.is-done .phase-dot svg { stroke: #10241a; }
:root[data-appearance="dark"] .callout-warning { color: var(--ph-warning); }
:root[data-appearance="dark"] .callout-positive { color: var(--ph-positive); }
:root[data-appearance="dark"] .callout-info { color: var(--ph-info); }
:root[data-appearance="dark"] .xp-result { background: linear-gradient(180deg, var(--ph-chrome-accent-soft), transparent); }
:root[data-appearance="dark"] .bench-banner-icon { color: var(--ph-chrome-accent-ink); }
