/* 电磁感应实验台：明亮的蓝紫底色 + 高饱和强调色（电流黄、磁感线紫、感应磁场橙、速度绿、受力粉）。
   面向课堂投影：字号偏大、按钮粗、读数卡一眼能读。三维画面铺满，所有面板都是浮层。 */
:root {
  --bg: #1a1f5c; --panel: rgba(22, 27, 84, .88); --panel-solid: #1c2270; --line: rgba(170, 190, 255, .28);
  --ink: #f2f5ff; --dim: #b9c4f2; --yellow: #ffe14d; --violet: #b98cff; --orange: #ffa53d; --green: #46e68a; --pink: #ff5fd0; --cyan: #5fe0f5; --red: #ff4d5e; --blue: #3a8dff;
  --rail: 372px; --r: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 16px/1.5 "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

#lab { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); height: 100vh; }
#lab.rail-off { grid-template-columns: minmax(0, 1fr) 0; }
#lab.rail-off #rail { display: none; }
#stage { position: relative; overflow: hidden; min-width: 0; }
#canvas { position: absolute; inset: 0; }
#canvas canvas { display: block; touch-action: none; }
#loading { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); padding: 14px 26px; border-radius: 999px; background: var(--panel-solid); border: 2px solid var(--cyan); font-weight: 700; z-index: 30; }

/* ── 顶部浮层 ── */
.hud { position: absolute; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 6; }
.hud.top-left { left: 14px; top: 12px; max-width: calc(100% - 330px); }
.hud.top-right { right: 14px; top: 12px; }
.title-pill { display: flex; align-items: center; gap: 10px; padding: 5px 16px 5px 6px; border-radius: 999px; background: linear-gradient(100deg, #ff5fd0, #8a5cff); font-weight: 800; font-size: 18px; box-shadow: 0 6px 18px rgba(138, 92, 255, .45); }
.title-pill b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; color: #7a3cff; font-size: 18px; }
.seg { display: inline-flex; border-radius: 12px; background: var(--panel); border: 1.5px solid var(--line); padding: 3px; gap: 2px; }
.seg button { padding: 6px 13px; border-radius: 9px; font-weight: 700; color: var(--dim); white-space: nowrap; }
.seg button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.seg button.on { background: var(--yellow); color: #251a00; }
.seg.wrap { display: flex; flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 auto; padding: 9px 10px; }
.chip { padding: 8px 15px; border-radius: 12px; background: var(--panel); border: 1.5px solid var(--line); font-weight: 700; }
.chip:hover { border-color: var(--cyan); }
.chip.on { background: var(--cyan); color: #04222a; border-color: var(--cyan); }
.scene-note { position: absolute; left: 16px; top: 56px; margin: 0; font-size: 13px; color: var(--dim); opacity: .85; pointer-events: none; z-index: 5; text-shadow: 0 1px 3px #0b0e3a; }

/* ── 底部：证据条 + 操作条 ── */
#bottom { position: absolute; left: 14px; right: 14px; bottom: 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; z-index: 6; }
#bottom > * { pointer-events: auto; }
#actionbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#actionbar button { padding: 11px 20px; border-radius: 14px; background: var(--panel-solid); border: 2px solid var(--line); font-weight: 800; font-size: 17px; box-shadow: 0 5px 0 rgba(8, 10, 50, .55); transition: transform .08s, box-shadow .08s; }
#actionbar button:hover { border-color: var(--yellow); }
#actionbar button:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(8, 10, 50, .55); }
#actionbar button.go { background: linear-gradient(180deg, #ffe96b, #ffc928); color: #2a1c00; border-color: #fff3a8; }
#evidence { display: flex; gap: 12px; align-items: stretch; width: 100%; max-width: 1180px; padding: 10px 12px; border-radius: 18px; background: var(--panel); border: 1.5px solid var(--line); backdrop-filter: blur(8px); }
#dial { flex: 0 0 214px; border-radius: 12px; background: #fbf6e2; color: #20232e; padding: 4px 6px 2px; position: relative; }
#dial svg { display: block; width: 100%; }
#dial.over { box-shadow: 0 0 0 3px var(--red), 0 0 22px rgba(255, 77, 94, .7); }
.dl-arc { fill: none; stroke: #20232e; stroke-width: 1.6; }
.dl-tick { stroke: #20232e; stroke-width: 1.3; } .dl-tick.big { stroke-width: 2.4; }
.dl-num { font: 700 11px sans-serif; fill: #20232e; } .dl-g { font: 800 17px serif; fill: #20232e; } .dl-side { font: 700 9px "Microsoft YaHei", sans-serif; fill: #6a6f80; }
.dl-needle line { stroke: #c8302c; stroke-width: 2.6; stroke-linecap: round; } .dl-hub { fill: #20232e; }
.dl-range { text-align: center; font-size: 13px; font-weight: 700; color: #4a4f66; margin-top: -4px; }
#dial.over .dl-range { color: #c8302c; }
#readouts { flex: 0 0 300px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#readouts > div { border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); padding: 5px 11px; min-width: 0; }
#readouts small { display: block; font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#readouts b { font: 800 23px/1.15 "Cambria Math", "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
#readouts em { font-style: normal; font-size: 13px; color: var(--dim); margin-left: 5px; }
#explain { flex: 1 1 0; min-width: 0; border-radius: 12px; padding: 8px 14px; background: rgba(255, 255, 255, .07); border-left: 6px solid var(--cyan); }
#explain b { display: block; font-size: 18px; color: var(--cyan); }
#explain p { margin: 3px 0 0; font-size: 15px; line-height: 1.55; color: #e4e9ff; }
#explain[data-tone="live"] { border-left-color: var(--yellow); background: rgba(255, 225, 77, .1); } #explain[data-tone="live"] b { color: var(--yellow); }
#explain[data-tone="warn"] { border-left-color: var(--pink); background: rgba(255, 95, 208, .1); } #explain[data-tone="warn"] b { color: #ff9ae2; }

#pin { position: absolute; transform: translate(-50%, -130%); padding: 6px 13px; border-radius: 999px; background: var(--yellow); color: #2a1c00; font-weight: 800; font-size: 15px; white-space: nowrap; pointer-events: none; z-index: 5; box-shadow: 0 5px 14px rgba(0, 0, 0, .35); animation: pin 1.2s ease-in-out infinite; }
#pin::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--yellow); border-bottom: 0; }
@keyframes pin { 50% { transform: translate(-50%, -150%); } }
#tooltip { position: absolute; padding: 5px 10px; border-radius: 8px; background: #0d1140; border: 1px solid var(--line); font-size: 13px; pointer-events: none; z-index: 20; white-space: nowrap; }
#toasts { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 25; pointer-events: none; }
.toast { padding: 9px 18px; border-radius: 999px; background: #fff; color: #1a1f5c; font-weight: 700; box-shadow: 0 8px 22px rgba(0, 0, 0, .35); transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(-10px); }

/* ── 浮窗 ── */
.win { position: absolute; z-index: 8; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--line); backdrop-filter: blur(8px); box-shadow: 0 14px 34px rgba(5, 8, 45, .5); display: flex; flex-direction: column; }
#win-chart { right: 14px; top: 58px; width: 372px; }
#win-record { left: 14px; top: 92px; width: 480px; max-height: calc(100% - 350px); }
.win header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px 7px 14px; cursor: move; border-bottom: 1px solid var(--line); user-select: none; }
.win header b { font-size: 15px; }
.win header span { display: flex; gap: 4px; }
.win header button { min-width: 30px; height: 28px; padding: 0 8px; border-radius: 8px; background: rgba(255, 255, 255, .1); font-size: 13px; font-weight: 700; }
.win header button:hover { background: rgba(255, 255, 255, .22); }
.win-body { padding: 8px 10px 10px; overflow: auto; min-height: 0; }
#chart { display: block; width: 100%; }
#scope-slot canvas { display: block; width: 100%; border-radius: 10px; margin-top: 6px; border: 2px solid #35507a; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.row button { padding: 7px 14px; border-radius: 10px; background: rgba(255, 255, 255, .1); border: 1.5px solid var(--line); font-weight: 700; }
.row button.primary { background: var(--pink); border-color: #ffb3ea; color: #2a0020; }
.rec-note { margin: 0 0 8px; font-size: 13.5px; color: var(--dim); }
.table-wrap { max-height: 168px; overflow: auto; border-radius: 10px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 5px 8px; text-align: center; border-bottom: 1px solid rgba(170, 190, 255, .16); white-space: nowrap; }
th { position: sticky; top: 0; background: #262d8c; font-weight: 700; color: var(--yellow); }
td.empty { color: var(--dim); padding: 14px; white-space: normal; }
#plot { display: block; width: 100%; margin-top: 8px; }
.pl-bg { fill: rgba(255, 255, 255, .05); stroke: var(--line); } .pl-grid { stroke: rgba(170, 190, 255, .16); }
.pl-t { font-size: 11px; fill: var(--dim); } .pl-l { font-size: 12px; font-weight: 700; fill: var(--ink); }
.pl-fit { stroke: var(--yellow); stroke-width: 2; stroke-dasharray: 6 4; } .pl-pt { fill: var(--pink); stroke: #fff; stroke-width: 1.5; }
.fit { margin: 4px 0 0; font-size: 13.5px; color: var(--yellow); }

/* ── 右侧控制栏 ── */
#rail { display: flex; flex-direction: column; min-height: 0; background: linear-gradient(180deg, #232a8a, #171b5e); border-left: 2px solid rgba(170, 190, 255, .3); z-index: 9; }
.rail-head { position: relative; padding: 14px 16px 10px; }
.rail-head small { color: var(--dim); font-size: 12.5px; letter-spacing: .04em; }
.rail-head h1 { margin: 2px 0 0; font-size: 25px; line-height: 1.2; background: linear-gradient(90deg, #ffe14d, #ff8fd8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rail-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--dim); }
#collapse { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .1); font-size: 17px; }
.tabs { display: flex; gap: 6px; padding: 0 12px; }
.tabs button { flex: 1; padding: 9px 0; border-radius: 12px 12px 0 0; font-weight: 800; color: var(--dim); background: rgba(255, 255, 255, .06); }
.tabs button.on { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 0 3px 0 var(--yellow); }
.rail-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; background: rgba(255, 255, 255, .06); border-top: 1px solid var(--line); }
.card { display: flex; gap: 11px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 11px; margin-bottom: 9px; border-radius: var(--r); background: rgba(255, 255, 255, .07); border: 2px solid transparent; }
.card:hover { border-color: var(--line); background: rgba(255, 255, 255, .12); }
.card.on { border-color: var(--yellow); background: rgba(255, 225, 77, .12); }
.card i { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font: 800 20px sans-serif; color: #fff; background: #8a5cff; }
.card:nth-child(7n+1) i { background: #ff4d8a; } .card:nth-child(7n+2) i { background: #ff8a3d; } .card:nth-child(7n+3) i { background: #e0b400; }
.card:nth-child(7n+4) i { background: #2fc46e; } .card:nth-child(7n+5) i { background: #1fb5d8; } .card:nth-child(7n+6) i { background: #4d7dff; } .card:nth-child(7n) i { background: #a45cff; }
.card b { font-size: 16.5px; } .card small { margin-left: 8px; font-size: 12px; color: var(--cyan); }
.card p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--dim); }
.ctl { margin-bottom: 13px; }
.ctl label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 700; color: var(--dim); }
.ctl.note { font-size: 13px; color: var(--dim); padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; height: 30px; accent-color: var(--yellow); }
.range output { flex: 0 0 82px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #5fe0f5, #b98cff); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -8px; border-radius: 50%; background: var(--yellow); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.switch { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1.5px solid var(--line); font-weight: 700; text-align: left; }
.switch i { flex: 0 0 50px; height: 28px; border-radius: 14px; background: #4a5196; position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on i { background: var(--green); } .switch.on i::after { left: 25px; }
#guide { margin-top: 4px; border-radius: 12px; background: rgba(95, 224, 245, .1); border: 1.5px solid rgba(95, 224, 245, .4); padding: 8px 12px; }
#guide summary { font-weight: 800; color: var(--cyan); cursor: pointer; }
#tasks { margin: 6px 0 2px; padding-left: 22px; font-size: 14.5px; }
#tasks li { margin-bottom: 4px; }
#rail footer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
#rail footer button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px; border-radius: 12px; background: rgba(255, 255, 255, .1); border: 1.5px solid var(--line); font-weight: 700; font-size: 14.5px; }
#rail footer button:hover { border-color: var(--yellow); }
#rail footer svg { width: 20px; height: 20px; }

/* ── 原理页 ── */
#learning { position: fixed; inset: 0; z-index: 60; overflow-y: auto; padding: 26px clamp(18px, 5vw, 80px) 50px; background: linear-gradient(160deg, #1b2070, #2a1a6a 60%, #151848); }
#learning > small { display: block; margin-top: 14px; color: var(--dim); }
#learning h1 { margin: 2px 0 18px; font-size: 34px; }
#back { padding: 9px 18px; border-radius: 12px; background: var(--yellow); color: #2a1c00; font-weight: 800; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.lesson-grid article { border-radius: 18px; padding: 16px 20px; background: rgba(255, 255, 255, .07); border-top: 6px solid var(--c); }
.lesson-grid h2 { margin: 0 0 6px; font-size: 20px; color: var(--c); }
.lesson-grid p { margin: 6px 0; font-size: 15.5px; }
.lesson-grid strong { display: block; margin: 8px 0; padding: 8px 14px; border-radius: 10px; background: rgba(0, 0, 0, .25); font: 700 21px "Cambria Math", "Times New Roman", serif; color: #fff; }
.lesson-grid ul { margin: 6px 0; padding-left: 20px; font-size: 14.5px; } .lesson-grid li { margin-bottom: 5px; }
.violet { --c: #c9a4ff; } .amber { --c: #ffc24d; } .green { --c: #5cf09a; } .blue { --c: #6fc4ff; } .pink { --c: #ff8fd8; } .slate { --c: #c3cdf5; grid-column: 1 / -1; }

/* ── 封面 ── */
html.cover-on #lab { visibility: hidden; }
#cover { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: minmax(360px, 1fr) minmax(0, 1.25fr); align-items: center; gap: 3vw; padding: 0 6vw; overflow: hidden; background: radial-gradient(circle at 78% 30%, #4a2fb8 0, transparent 55%), radial-gradient(circle at 12% 85%, #d0368f 0, transparent 45%), linear-gradient(140deg, #171b6b, #2b1a78); transition: opacity .7s, transform .7s; }
#cover.leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.cv-copy small { letter-spacing: .12em; color: #cfd6ff; }
.cv-copy h1 { margin: 8px 0 10px; font-size: clamp(46px, 6.2vw, 96px); line-height: 1.05; }
.cv-copy h1 span { display: block; } .cv-t1 { color: var(--yellow); } .cv-t2 { color: #fff; }
.cv-copy p { margin: 0 0 16px; font-size: 20px; color: #dfe4ff; }
.cv-chips { display: flex; flex-wrap: wrap; gap: 9px; padding: 0; margin: 0 0 26px; list-style: none; }
.cv-chips li { padding: 6px 14px; border-radius: 999px; font-weight: 700; background: rgba(255, 255, 255, .13); border: 1.5px solid rgba(255, 255, 255, .35); }
.cv-enter { padding: 15px 34px; border-radius: 18px; background: linear-gradient(180deg, #ffe96b, #ffc928); color: #2a1c00; font-size: 23px; font-weight: 800; box-shadow: 0 7px 0 #b98200, 0 16px 34px rgba(0, 0, 0, .35); }
.cv-enter span { margin-left: 10px; } .cv-enter:active { transform: translateY(5px); box-shadow: 0 2px 0 #b98200; }
.cv-copy em { display: block; margin-top: 16px; font-style: normal; font-size: 14px; color: #b9c4f2; }
.cv-art { width: 100%; max-height: 82vh; }
.cv-card { fill: rgba(255, 255, 255, .07); stroke: rgba(255, 255, 255, .28); stroke-width: 2; }
.cv-mag { animation: cv-slide 3.2s ease-in-out infinite alternate; }
@keyframes cv-slide { from { transform: translateX(150px); } to { transform: translateX(-70px); } }
.cv-needle { transform-origin: 590px 400px; animation: cv-needle 3.2s ease-in-out infinite alternate; }
@keyframes cv-needle { 0% { transform: rotate(0); } 50% { transform: rotate(-38deg); } 100% { transform: rotate(0); } }
.cv-dots circle { fill: var(--yellow); animation: cv-dot 3.2s ease-in-out infinite alternate; }
@keyframes cv-dot { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.cv-line { fill: none; stroke: #c9a4ff; stroke-width: 2.5; opacity: .8; }
@media (max-width: 900px) { #cover { grid-template-columns: 1fr; } .cv-art { display: none; } }
@media (max-height: 760px) { #readouts b { font-size: 20px; } #explain p { font-size: 14px; } #dial { flex-basis: 180px; } }
@media (max-width: 1500px) { .scene-note { display: none; } }
@media (max-width: 1280px) { #readouts { flex-basis: 250px; } #dial { flex-basis: 180px; } .hud.top-left { max-width: calc(100% - 250px); } }
