/* 光学实验台：蓝图工程风——图纸蓝底、白色线框、方角面板、黄色高亮、等宽数字。左侧全幅三维台面，右侧控制栏（immersive-right-rail）。 */
:root {
  --bg: #0b2d57; --panel: rgba(12, 52, 98, .9); --panel2: rgba(18, 64, 116, .95); --line: rgba(214, 234, 255, .38);
  --text: #f2f8ff; --muted: #a9c6e6; --cyan: #7fdcff; --amber: #ffd43b; --red: #ff6b6b; --green: #6ee7a8; --blue: #8ab8ff;
  --ink: #eaf4ff; --grid: rgba(190, 220, 255, .09); --yellow: #ffd43b; --navy: #0b2d57;
  --paper: linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 20px 20px;
  --mono: Consolas, "JetBrains Mono", monospace;
  --rail: clamp(300px, 22vw, 380px);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
#lab { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); height: 100vh; background: var(--bg); }
/* 公共课堂工具条贴屏幕右缘；本页没有一键演示，隐藏演示步进按钮 */
#physics-classroom-toolbar [data-tool="previous"], #physics-classroom-toolbar [data-tool="play"], #physics-classroom-toolbar [data-tool="next"], #physics-subtitle-settings-toggle { display: none !important; }
body.collapsed #lab { grid-template-columns: 1fr 0; }
body.collapsed #rail > :not(.rail-head) , body.collapsed .rail-head > :not(#collapse) { display: none; }
body.collapsed #rail { border: 0; }
body.collapsed #collapse { position: fixed; right: 12px; top: 12px; z-index: 30; }

/* ── 台面 ── */
#stage { position: relative; overflow: hidden; min-width: 0; }
#canvas { position: absolute; inset: 0; }
#canvas canvas { display: block; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; display: flex; gap: 6px; align-items: baseline; padding: 3px 9px; border-radius: 2px; background: rgba(11, 45, 87, .88); border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 rgba(4, 20, 42, .45); font-size: 13px; white-space: nowrap; }
.tag b { color: #fff; font-weight: 700; }
.tag span { color: var(--yellow); font-family: var(--mono); }
.tag.sel { border-color: var(--yellow); background: rgba(60, 50, 0, .55); box-shadow: 3px 3px 0 rgba(255, 212, 59, .35); }
.tag.bad { border-color: var(--red); box-shadow: 3px 3px 0 rgba(255, 70, 70, .5); animation: pulse 0.8s infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 rgba(255, 70, 70, .2); } }
#tooltip { position: absolute; left: 0; top: 0; pointer-events: none; padding: 8px 12px; border-radius: 2px; background: rgba(11, 45, 87, .95); border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 rgba(4, 20, 42, .45); display: grid; gap: 2px; font-size: 13px; z-index: 6; }
#tooltip b { color: #fff; }
.endtag { position: absolute; left: 0; top: 0; pointer-events: none; padding: 3px 9px; border-radius: 2px; font-size: 13px; white-space: nowrap; color: #fff; background: rgba(11, 45, 87, .92); border: 1.5px solid var(--c); box-shadow: 3px 3px 0 rgba(4, 20, 42, .45); z-index: 5; }
.endtag::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 9px; height: 9px; margin-left: -5px; background: var(--c); border-radius: 50%; } #tooltip span { color: var(--yellow); font-family: var(--mono); } #tooltip small { color: var(--muted); }
#loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; color: var(--ink); background: var(--paper), var(--bg); z-index: 20; letter-spacing: .1em; }
#loading[hidden] { display: none; }

.hud { position: absolute; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
.top-left { left: 14px; top: 12px; max-width: calc(100% - 420px); }
.top-right { right: 14px; top: 12px; }
.bottom-left { left: 14px; bottom: 12px; align-items: center; }
.seg { display: flex; background: var(--panel); border: 1.5px solid var(--line); border-radius: 3px; padding: 3px; gap: 3px; box-shadow: 3px 3px 0 rgba(4, 20, 42, .4); }
.seg button, .top-right button { border: 0; background: transparent; padding: 7px 12px; border-radius: 2px; font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.seg button:hover:not(:disabled) { color: var(--text); background: rgba(214, 234, 255, .1); }
.seg button.on, .seg button.on:hover:not(:disabled) { color: var(--navy); background: var(--yellow); font-weight: 700; }
.top-right button { background: var(--panel); border: 1.5px solid var(--line); box-shadow: 3px 3px 0 rgba(4, 20, 42, .4); }
.top-right button.on { color: var(--navy); background: var(--yellow); border-color: var(--yellow); font-weight: 700; }
.wire-colors { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 5px 9px; }
.wire-colors span { color: var(--muted); font-size: 13px; margin-right: 2px; }
.wire-colors button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); background: var(--c); padding: 0; }
.wire-colors button[data-color="auto"] { width: auto; border-radius: 8px; padding: 0 8px; background: transparent; font-size: 13px; color: var(--muted); height: 24px; }
.wire-colors button.on { border-color: #fff; box-shadow: 0 0 10px var(--c, var(--cyan)); color: var(--cyan); }
.scene-note { position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; margin: 0; font-size: 12.5px; color: rgba(200, 225, 255, .7); pointer-events: none; white-space: nowrap; }
@media (max-width: 1500px) { .scene-note { display: none; } }

#toasts { position: absolute; top: 100px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 8; width: min(560px, 70%); pointer-events: none; }
.alert, .toast { pointer-events: auto; padding: 10px 14px; border-radius: 3px; font-size: 15px; display: flex; gap: 10px; align-items: center; box-shadow: 4px 4px 0 rgba(4, 20, 42, .45); }
.alert i { font-style: normal; font-weight: 800; }
.alert.danger { background: rgba(60, 8, 12, .86); border: 1px solid rgba(255, 80, 80, .8); color: #ffd6d6; box-shadow: 0 0 26px rgba(255, 50, 50, .45); animation: alarm 0.9s infinite alternate; cursor: pointer; }
.alert.warn { background: rgba(52, 34, 6, .86); border: 1px solid rgba(255, 180, 70, .75); color: #ffe7c2; box-shadow: 0 0 18px rgba(255, 170, 50, .3); cursor: pointer; }
@keyframes alarm { to { box-shadow: 0 0 8px rgba(255, 50, 50, .2); } }
.toast { background: rgba(11, 45, 87, .95); border: 1.5px solid var(--ink); color: #fff; transition: opacity .5s, transform .5s; }
.toast.danger { border-color: rgba(255, 90, 90, .7); color: #ffd6d6; }
.toast.out { opacity: 0; transform: translateY(-8px); }
#mode-hint { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); padding: 9px 16px; border-radius: 3px; background: rgba(11, 45, 87, .95); border: 1.5px solid var(--yellow); color: var(--yellow); box-shadow: 4px 4px 0 rgba(4, 20, 42, .45); font-size: 14px; z-index: 7; white-space: nowrap; }
#mode-hint[hidden] { display: none; }

/* ── 浮窗 ── */
.win { position: absolute; z-index: 9; display: flex; flex-direction: column; background: var(--paper), var(--panel); border: 1.5px solid var(--ink); border-radius: 3px; box-shadow: 6px 6px 0 rgba(4, 20, 42, .45); resize: both; overflow: hidden; min-width: 240px; min-height: 44px; max-height: calc(100% - 80px); }
.win[hidden] { display: none; }
.win header { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; cursor: move; border-bottom: 1.5px solid var(--line); user-select: none; flex: none; background: rgba(5, 28, 58, .5); }
.win header b { font-size: 15px; color: #fff; }
.win header small { color: var(--muted); font-size: 12px; flex: 1; }
.win header button { border: 0; background: transparent; color: var(--muted); width: 26px; height: 24px; border-radius: 6px; }
.win header .smode { display: flex; gap: 2px; background: rgba(0,0,0,.25); border-radius: 8px; padding: 2px; }
.win header .smode button { width: auto; padding: 0 8px; font-size: 12px; }
.win header .smode button.on { background: var(--yellow); color: var(--navy); }
.win header button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.win.min { height: auto !important; resize: none; }
.win.min .win-body { display: none; }
.win-body { flex: 1; min-height: 0; overflow: auto; }
#win-schematic .win-body { padding: 4px; }

#meter-list { padding: 6px; display: grid; gap: 6px; }
.meter-card canvas { max-height: 110px; object-fit: contain; }
#meter-list .empty { color: var(--muted); margin: 10px; font-size: 14px; }
.meter-card { background: radial-gradient(ellipse at 50% 100%, rgba(30, 70, 110, .55), rgba(8, 18, 30, .8)); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; }
.meter-card.bad { border-color: var(--red); box-shadow: 0 0 18px rgba(255, 60, 60, .45); }
.meter-card .mh { display: flex; justify-content: space-between; font-size: 13px; } .meter-card .mh span { color: var(--muted); }
.meter-card canvas { width: 100%; display: block; }
.meter-card .mr { text-align: center; margin-top: -6px; }
.meter-card output { font: 700 24px Consolas, monospace; color: #fff; text-shadow: 0 0 12px rgba(62, 224, 255, .8); }
.meter-card .mr small { color: var(--muted); margin-left: 4px; font-size: 15px; }

.data-body { padding: 10px; display: grid; gap: 8px; grid-template-rows: auto auto auto 1fr; }
.data-body .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.data-body button, .data-body select { background: var(--panel2); border: 1.5px solid var(--line); border-radius: 2px; padding: 6px 10px; color: var(--text); }
.data-body button.primary { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 700; }
.axes label { font-size: 13px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
#plot { width: 100%; background: var(--paper), rgba(5, 30, 62, .7); border: 1px solid var(--line); border-radius: 2px; }
#plot .ax { stroke: var(--ink); fill: none; } #plot .gr { stroke: rgba(190, 220, 255, .16); }
#plot .tk { fill: var(--muted); font-size: 11px; } #plot .al { fill: #fff; font-size: 12px; }
#plot .ln { fill: none; stroke: var(--cyan); stroke-width: 2; stroke-dasharray: 6 3; }
#plot .pt { fill: var(--yellow); stroke: var(--navy); stroke-width: 1; }
.table-wrap { overflow: auto; min-height: 60px; }
.data-body table { width: 100%; border-collapse: collapse; font: 13px var(--mono); }
.data-body th, .data-body td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.data-body th { color: var(--muted); font-family: inherit; position: sticky; top: 0; background: var(--panel2); }

/* ── 右侧控制栏 ── */
#rail { display: flex; flex-direction: column; min-height: 0; background: var(--paper), #0c3263; border-left: 2px solid var(--ink); box-shadow: -6px 0 0 rgba(4, 20, 42, .35); position: relative; z-index: 10; overflow: hidden; }
.rail-head { padding: 12px 16px 10px; margin: 12px 14px 10px; position: relative; border: 1.5px solid var(--ink); background: rgba(5, 28, 58, .55); }
.rail-head small { color: var(--muted); font-size: 12px; letter-spacing: .06em; }
.rail-head h1 { margin: 6px 0 6px; font-size: 27px; letter-spacing: .08em; color: #fff; }
.rail-head h1::after { content: 'OL-01'; margin-left: 10px; padding: 1px 6px; font: 700 12px var(--mono); letter-spacing: .05em; color: var(--navy); background: var(--yellow); vertical-align: 5px; }
.rail-head p { margin: 0; padding-top: 6px; border-top: 1px solid var(--line); color: #cfe3fa; font-size: 13.5px; }
#collapse { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; border-radius: 2px; border: 1.5px solid var(--line); background: var(--panel2); color: var(--yellow); font-size: 17px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 14px; padding: 0; border: 1.5px solid var(--ink); }
.tabs button { border: 0; border-right: 1.5px solid var(--ink); background: rgba(5, 28, 58, .45); padding: 9px 0; border-radius: 0; color: var(--muted); font-size: 15.5px; }
.tabs button:last-child { border-right: 0; }
.tabs button.on { background: var(--yellow); color: var(--navy); font-weight: 700; }
.rail-body { flex: 1; overflow: auto; padding: 12px 14px; min-height: 0; }
.rail-body::-webkit-scrollbar { width: 8px; } .rail-body::-webkit-scrollbar-thumb { background: rgba(214, 234, 255, .3); border-radius: 0; }
.tab h3 { margin: 14px 2px 8px; padding-bottom: 4px; font-size: 13px; color: var(--yellow); letter-spacing: .14em; font-weight: 700; border-bottom: 1px dashed var(--line); }
.tab .hint, .tab .empty { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 2px 2px 6px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { display: grid; grid-template-rows: 74px auto; gap: 4px; padding: 6px; border-radius: 2px; border: 1.5px solid var(--line); background: rgba(5, 28, 58, .5); text-align: center; font-size: 13.5px; transition: .15s; }
.card img { width: 100%; height: 74px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); background: radial-gradient(circle, rgba(230, 240, 250, .9), rgba(190, 210, 228, .75)); border-radius: 8px; }
.card .icon { display: grid; place-items: center; height: 74px; border-radius: 8px; background: radial-gradient(circle, rgba(230, 240, 250, .9), rgba(190, 210, 228, .75)); font-size: 30px; color: #2a4655; }
.card .icon svg { height: 64px; }
.card:hover { border-color: var(--yellow); box-shadow: 3px 3px 0 rgba(255, 212, 59, .3); transform: translate(-1px, -1px); }

.ph { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.ph img, .ph .icon { width: 72px; height: 56px; object-fit: contain; border-radius: 8px; background: radial-gradient(circle, rgba(230, 240, 250, .9), rgba(190, 210, 228, .75)); display: grid; place-items: center; }
.ph b { display: block; font-size: 17px; } .ph small { color: var(--yellow); font-family: var(--mono); }
.ph .sw { width: 40px; height: 10px; border-radius: 0; outline: 1.5px solid var(--ink); }
.live { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.live div { background: rgba(5, 28, 58, .6); border: 1.5px solid var(--line); border-radius: 2px; padding: 7px 10px; display: grid; }
.live span { color: var(--muted); font-size: 12px; }
.live b { font: 700 18px var(--mono); color: #fff; }
.field { display: grid; gap: 6px; margin: 12px 0; font-size: 14px; color: #cfe0f2; grid-template-columns: 1fr auto; align-items: center; }
.field .val { color: var(--yellow); font-family: var(--mono); font-weight: 700; }
.field input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--yellow); }
.field select { grid-column: 1 / -1; background: var(--panel2); color: var(--text); border: 1.5px solid var(--line); border-radius: 2px; padding: 7px; font: inherit; }
.field.toggle { cursor: pointer; }
.field.toggle input { display: none; }
.field.toggle i { width: 46px; height: 26px; border-radius: 2px; background: rgba(5, 28, 58, .8); border: 1.5px solid var(--line); position: relative; transition: .2s; }
.field.toggle i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 19px; height: 19px; border-radius: 1px; background: var(--muted); transition: .2s; }
.field.toggle input:checked + i { background: var(--yellow); border-color: var(--yellow); }
.field.toggle input:checked + i::after { left: 22px; background: var(--navy); }
.digits { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.digits label { display: grid; text-align: center; } .digits small { color: var(--muted); }
.digits input { width: 100%; text-align: center; font: 700 20px var(--mono); background: rgba(5, 28, 58, .8); color: var(--yellow); border: 1.5px solid var(--line); border-radius: 2px; padding: 4px; }
.note { color: #cfe3fa; font-size: 13.5px; line-height: 1.65; background: rgba(255, 212, 59, .07); border-left: 3px solid var(--yellow); padding: 8px 10px; border-radius: 0; }
.terms { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.terms span { font-size: 12px; padding: 2px 8px; border-radius: 2px; border: 1px solid var(--line); color: #dff0ff; }
.terms span.pos { border-color: rgba(255, 90, 90, .6); color: #ffb0a8; } .terms span.neg { border-color: rgba(130, 160, 255, .5); color: #b8c8ff; }
.actions { display: flex; gap: 6px; margin-top: 10px; }
.actions button, button.wide { flex: 1; padding: 8px; border-radius: 2px; border: 1.5px solid var(--line); background: var(--panel2); }
button.wide { width: 100%; margin: 6px 0; border-color: var(--green); color: var(--green); }
.actions button.danger { border-color: rgba(255, 90, 90, .5); color: #ff9a9a; }
.chips { display: flex; gap: 6px; grid-column: 1 / -1; }
.chips button { width: 28px; height: 28px; border-radius: 2px; background: var(--c); border: 2px solid rgba(255, 255, 255, .25); }
.chips button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--navy), 0 0 0 4px var(--yellow); }

.current { background: rgba(5, 28, 58, .55); border: 1.5px solid var(--green); border-radius: 2px; padding: 10px 12px; margin-bottom: 12px; }
.current small { color: var(--green); } .current b { display: block; font-size: 17px; margin: 2px 0 4px; }
.current ol { margin: 0; padding-left: 20px; color: #d4e6f5; font-size: 14px; line-height: 1.65; }
.task { border: 1.5px solid var(--line); border-radius: 2px; padding: 10px 12px; margin-bottom: 8px; background: rgba(5, 28, 58, .5); }
.task.on { border-color: var(--yellow); }
.task div { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.task b { font-size: 15.5px; } .task em { font-style: normal; font-size: 12px; color: var(--amber); white-space: nowrap; }
.task p { margin: 5px 0 8px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.task button { padding: 6px 12px; border-radius: 2px; border: 1.5px solid var(--yellow); background: transparent; color: var(--yellow); }

#rail footer { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px 14px; border-top: 1.5px solid var(--ink); background: rgba(5, 28, 58, .45); }
#rail footer button { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 2px; font-size: 16px; font-weight: 700; border: 2px solid; }
#rail footer svg { width: 20px; height: 20px; }
#principle { background: transparent; border-color: var(--ink) !important; color: #fff; }
#check { background: rgba(255, 179, 71, .1); border-color: rgba(255, 179, 71, .5) !important; color: var(--amber); }

/* ── 原理页 ── */
#learning { position: fixed; inset: 0; z-index: 40; overflow: auto; padding: 34px 56px; background: var(--paper), var(--bg); background-attachment: local; }
#learning[hidden] { display: none; }
#learning > small { color: var(--muted); font-size: 16px; display: block; margin-top: 18px; }
#learning h1 { font-size: 40px; margin: 6px 0 24px; }
#back { padding: 10px 18px; border-radius: 2px; border: 2px solid var(--yellow); background: transparent; color: var(--yellow); font-size: 18px; font-weight: 700; }
.lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lesson-grid article { border-radius: 2px; padding: 22px 26px; font-size: 22px; line-height: 1.65; border: 2px solid; background-color: rgba(5, 28, 58, .6) !important; box-shadow: 6px 6px 0 rgba(4, 20, 42, .4); }
.lesson-grid h2 { margin: 0 0 10px; padding-bottom: 8px; font-size: 26px; border-bottom: 1px dashed currentColor; }
.lesson-grid strong { display: block; font: 700 34px var(--mono); text-align: center; margin: 10px 0; padding: 6px 0; border: 1px solid var(--line); background: rgba(5, 28, 58, .5); text-shadow: none !important; }
.lesson-grid ul { padding-left: 22px; margin: 0; font-size: 19px; }
.lesson-grid .green { background: rgba(69, 240, 160, .08); border-color: rgba(69, 240, 160, .4); } .green h2, .green strong { color: var(--green); text-shadow: 0 0 16px rgba(69, 240, 160, .5); }
.lesson-grid .blue { background: rgba(90, 168, 255, .08); border-color: rgba(90, 168, 255, .4); } .blue h2 { color: var(--blue); }
.lesson-grid .amber { background: rgba(255, 179, 71, .08); border-color: rgba(255, 179, 71, .4); } .amber h2 { color: var(--amber); }
#live-example { color: var(--amber); }
@media (max-width: 1280px) { .lesson-grid { grid-template-columns: 1fr; } }

/* 暂停状态醒目提示 */
#t-run.paused { background: rgba(255, 179, 71, .22); border-color: #ffb347; color: #ffd28a; box-shadow: 0 0 12px rgba(255, 179, 71, .45); }
/* 音乐开启时按钮随节拍发光（--beat 由 updateGroove 每帧写入） */
#t-music.on { color: var(--navy); background: var(--yellow); border-color: var(--yellow); box-shadow: 0 0 0 calc(4px * var(--beat, 0)) rgba(255, 212, 59, .45); }
/* 页内确认框（替代原生 confirm，避免退出全屏） */
.ask-mask { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; background: rgba(4, 20, 42, .6); }
.ask { min-width: 340px; max-width: 460px; padding: 22px 22px 16px; border-radius: 2px; background: var(--paper), var(--panel2); border: 2px solid var(--ink); box-shadow: 8px 8px 0 rgba(4, 20, 42, .5); }
.ask p { margin: 0 0 18px; font-size: 18px; line-height: 1.6; color: var(--text); }
.ask-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ask-actions button { min-width: 88px; height: 40px; border-radius: 2px; font-size: 16px; border: 1.5px solid var(--line); background: transparent; color: var(--muted); }
.ask-actions .ask-ok { color: var(--navy); font-weight: 700; border: 0; background: var(--yellow); }
.ask-actions .ask-ok.danger { color: #fff; background: #e8413a; }
/* 控制栏收起后，展开按钮固定在右上角；右上浮动按钮组左移让位 */
body.collapsed .top-right { right: 58px; }
/* 控制栏固定按钮：位于收起按钮左侧；固定时高亮 */
#pin-rail { position: absolute; right: 48px; top: 8px; width: 34px; height: 34px; border-radius: 2px; border: 1.5px solid var(--line); background: var(--panel2); font-size: 15px; filter: grayscale(1); opacity: .55; }
#pin-rail.on { filter: none; opacity: 1; border-color: var(--yellow); background: rgba(255, 212, 59, .2); }
body.collapsed #pin-rail { display: none; }

/* ───────── 光学实验台专用 ───────── */
:root { --pink: #ff6fb5; --violet: #a77bff; }
.top-right button[hidden] { display: none; }
/* 标签：器材名 + 读数；角度标注 */
.tag i { font-style: normal; color: var(--yellow); font-family: var(--mono); }
.ang { position: absolute; left: 0; top: 0; pointer-events: none; padding: 2px 8px; border-radius: 2px; font: 700 14px var(--mono), "Microsoft YaHei"; white-space: nowrap; background: rgba(11, 45, 87, .9); border: 1.5px solid var(--c); color: #fff; z-index: 4; }
.ang small { color: var(--c); font-weight: 400; margin-right: 4px; }
/* 演示实验卡片 */
.preset { display: grid; grid-template-columns: 46px 1fr; gap: 4px 10px; align-items: center; padding: 10px 12px; margin-bottom: 8px; border-radius: 2px; border: 1.5px solid var(--line); background: rgba(5, 28, 58, .5); cursor: pointer; transition: .15s; text-align: left; width: 100%; color: inherit; }
.preset:hover { border-color: var(--ink); box-shadow: 4px 4px 0 rgba(4, 20, 42, .45); transform: translate(-1px, -1px); }
.preset.on { border-color: var(--yellow); background: rgba(255, 212, 59, .1); box-shadow: 4px 4px 0 rgba(255, 212, 59, .25); }
.preset .pi { grid-row: span 2; width: 46px; height: 46px; border-radius: 2px; display: grid; place-items: center; font-size: 26px; background: rgba(127, 220, 255, .16); border: 1.5px solid #7fdcff; }
.preset b { font-size: 16px; } .preset em { font-style: normal; font-size: 12px; color: var(--yellow); }
.preset:nth-child(4n+2) .pi { background: rgba(255, 138, 101, .18); border-color: #ff8a65; }
.preset:nth-child(4n+3) .pi { background: rgba(110, 231, 168, .16); border-color: #6ee7a8; }
.preset:nth-child(4n) .pi { background: rgba(255, 212, 59, .16); border-color: #ffd43b; }
.goal { background: rgba(5, 28, 58, .6); border: 1.5px solid var(--ink); border-radius: 2px; box-shadow: 4px 4px 0 rgba(4, 20, 42, .4); padding: 10px 12px; margin-bottom: 12px; }
.goal small { color: var(--yellow); letter-spacing: .08em; } .goal b { display: block; font-size: 18px; margin: 2px 0 6px; }
.goal p { margin: 0 0 8px; color: #e3f0ff; font-size: 14.5px; line-height: 1.65; }
.goal ol { margin: 6px 0 0; padding-left: 20px; color: #c3dbf3; font-size: 13.5px; line-height: 1.6; }
.goal ol li.on { color: var(--yellow); font-weight: 700; }
.goal .go { width: 100%; height: 46px; border-radius: 2px; border: 0; font-size: 17px; font-weight: 700; color: var(--navy); background: var(--yellow); box-shadow: 4px 4px 0 rgba(4, 20, 42, .5); }
.goal .go:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(4, 20, 42, .5); }
.back-list { background: none; border: 0; color: var(--yellow); padding: 4px 0; margin-bottom: 6px; font-size: 14px; }
/* 器材柜 */
.pal { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.pal button { display: grid; grid-template-columns: 12px 1fr; gap: 8px; align-items: center; text-align: left; padding: 9px 10px; border-radius: 2px; border: 1.5px solid var(--line); background: rgba(5, 28, 58, .5); font-size: 13.5px; line-height: 1.3; }
.pal button i { width: 12px; height: 12px; border-radius: 1px; background: var(--c); outline: 1.5px solid rgba(255, 255, 255, .5); }
.pal button:hover { border-color: var(--c); box-shadow: 3px 3px 0 rgba(4, 20, 42, .45); }
/* 粗滑块 + 微调按钮 + 直接输入 */
.num { display: grid; grid-template-columns: 40px 1fr 40px 86px; gap: 6px; align-items: center; grid-column: 1 / -1; }
.num button { height: 36px; border-radius: 2px; border: 1.5px solid var(--line); background: var(--panel2); font-size: 18px; color: var(--yellow); }
.num input[type=range] { -webkit-appearance: none; appearance: none; height: 12px; border-radius: 0; background: repeating-linear-gradient(90deg, rgba(234, 244, 255, .55) 0 1.5px, transparent 1.5px 10%), rgba(5, 28, 58, .9); border: 1.5px solid var(--ink); outline: none; }
.num input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 28px; border-radius: 2px; background: var(--yellow); border: 2px solid var(--navy); box-shadow: 2px 2px 0 rgba(4, 20, 42, .5); cursor: pointer; }
.num input[type=number] { width: 100%; height: 36px; text-align: center; font: 700 16px var(--mono); background: rgba(5, 28, 58, .8); color: var(--yellow); border: 1.5px solid var(--line); border-radius: 2px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; }
.opts button { padding: 7px 12px; border-radius: 2px; border: 1.5px solid var(--line); background: var(--panel2); font-size: 14px; color: #dbeafb; }
.opts button.on { color: var(--navy); background: var(--yellow); border-color: var(--yellow); font-weight: 700; }
.live b.ok { color: var(--green); } .live b.warn { color: var(--amber); }
.live .wide { grid-column: 1 / -1; }
.sharp { height: 12px; border-radius: 0; background: rgba(5, 28, 58, .8); border: 1px solid var(--line); overflow: hidden; margin-top: 4px; }
.sharp i { display: block; height: 100%; border-radius: 0; background: linear-gradient(90deg, #ff8a65, #ffd43b, #6ee7a8); transition: width .2s; }
/* 浮窗：光屏放大 / 视网膜 */
#zoom-cv, #retina-cv { width: 100%; display: block; background: #000; }
.zoom-read { padding: 6px 12px 10px; font-size: 14px; color: #d6e6f5; line-height: 1.6; }
.zoom-read b { color: var(--yellow); font-family: var(--mono); }
.fit { margin: 0; font-size: 14px; color: var(--green); }
/* 演示字幕卡：底部浮层，不挤压布局 */
#caption { position: absolute; left: 50%; bottom: 42px; transform: translateX(-50%); width: min(880px, calc(100% - 60px)); z-index: 12; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px 14px 18px; border-radius: 2px; background: var(--paper), rgba(11, 45, 87, .96); border: 2px solid var(--ink); box-shadow: 6px 6px 0 rgba(4, 20, 42, .5); animation: capIn .35s ease; }
@keyframes capIn { from { opacity: 0; transform: translate(-50%, 10px); } }
#caption[hidden] { display: none; }
.cap-step { font: 700 15px var(--mono); color: var(--navy); background: var(--yellow); border-radius: 0; padding: 6px 10px; white-space: nowrap; }
.cap-text { margin: 0; font-size: 21px; line-height: 1.5; color: #fff; }
.cap-ctl { display: flex; gap: 6px; }
#cap-voice { font-family: 'Segoe UI Symbol', sans-serif; font-size: 18px; }
#cap-voice.off { color: rgba(214, 234, 255, .55); }
.cap-ctl button { width: 40px; height: 40px; border-radius: 2px; border: 1.5px solid var(--line); background: var(--panel2); font-size: 16px; color: var(--yellow); }
#b-demo { background: var(--yellow); border-color: var(--yellow) !important; color: var(--navy); }
.lesson-grid .pink { background: rgba(255, 111, 181, .08); border-color: rgba(255, 111, 181, .4); } .pink h2 { color: var(--pink); }
.lesson-grid .violet { background: rgba(167, 123, 255, .08); border-color: rgba(167, 123, 255, .4); } .violet h2, .violet strong { color: var(--violet); }
.lesson-grid .slate { background: rgba(160, 180, 200, .06); border-color: rgba(160, 180, 200, .35); } .slate h2 { color: #cfe0f2; }
.blue strong { color: var(--blue); text-shadow: 0 0 16px rgba(90, 168, 255, .5); } .amber strong { color: var(--amber); text-shadow: 0 0 16px rgba(255, 179, 71, .5); }
#t-real.on { color: var(--navy); background: var(--yellow); border-color: var(--yellow); }
.num input[type=range] { grid-column: auto; width: 100%; }
