@font-face{font-family:"Smiley Sans";src:url("./fonts/SmileySans-Oblique.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap}
:root{
  --bg:#e9e4da;
  --surface:#f6f2ea;
  --surface-2:#efe9dd;
  --surface-3:#e7e1d5;
  --text:#33302b;
  --muted:#6f6a62;
  --muted-2:#8a847a;
  --line:#d6cec1;
  --line-strong:#bcb2a3;
  --blue:#94665a;
  --blue-dark:#7a5147;
  --blue-soft:#e6d8cf;
  --gold:#b09a72;
  --gold-soft:#f0e6d2;
  --green:#75806a;
  --radius:10px;
  --shadow:0 1px 2px rgba(51,48,43,.14), 0 2px 6px rgba(51,48,43,.07);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  overflow:hidden;
  color:var(--text);
  background:var(--bg);
  font-family:"Smiley Sans","Microsoft YaHei","PingFang SC",system-ui,sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

button,input{font:inherit}
button{
  color:inherit;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
button:focus-visible,input:focus-visible{
  outline:2px solid var(--blue);
  outline-offset:2px;
}

.app{
  height:100dvh; max-width:1920px; margin:0 auto;
  padding:10px;
  display:flex; flex-direction:column; gap:8px;
}

/* ---------- toolbar ---------- */
.topbar{
  flex:none; min-height:52px;
  display:grid; grid-template-columns:minmax(250px,1fr) auto minmax(180px,1fr);
  align-items:center; gap:12px;
  padding:6px 12px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.brand{display:flex; align-items:center; gap:10px; min-width:0}
.logo-mark{
  width:34px; height:34px; border-radius:8px; position:relative; flex:none;
  background:linear-gradient(135deg,#94665a,#7a5147);
  display:grid; place-items:center;
  box-shadow:inset 0 -2px 0 rgba(0,0,0,.12);
}
.logo-mark::before{content:none}
.logo-mark span{
  font-family:"Cambria Math","Times New Roman",serif; font-style:italic;
  font-size:20px; font-weight:700; line-height:1; color:#fff;
}
.brand h1{margin:0; font-size:16px; font-weight:600; letter-spacing:.01em; color:var(--text)}
.brand p{margin:3px 0 0; font-size:9px; letter-spacing:.2em; color:var(--muted-2); font-weight:600}

.top-center{
  display:flex; align-items:center; gap:14px;
}
.mode-switch{display:flex; gap:3px; padding:3px; border-radius:8px; background:var(--surface-3)}
.mode-btn{
  border:0; background:transparent; border-radius:6px; cursor:pointer;
  min-height:32px; padding:5px 14px; font-size:13px; font-weight:500; color:var(--muted);
  transition:background .15s,color .15s,box-shadow .15s;
}
.mode-btn:hover{background:rgba(255,255,255,.7); color:var(--text)}
.mode-btn.active{
  color:var(--blue-dark);
  background:var(--surface);
  box-shadow:0 1px 2px rgba(51,48,43,.22),0 1px 3px rgba(51,48,43,.1);
  font-weight:600;
}
.count-control{display:flex; align-items:center; gap:9px}
.count-control>span{font-size:12px; color:var(--muted); white-space:nowrap}
.count-group{display:flex; gap:2px; padding:2px; border-radius:7px; background:var(--surface-3)}
.count-btn{
  width:30px; height:30px; padding:0; border:0; border-radius:5px; cursor:pointer;
  background:transparent; color:var(--muted); font-size:13px; font-weight:600;
  transition:.15s;
}
.count-btn:hover{background:rgba(255,255,255,.8); color:var(--text)}
.count-btn.active{background:var(--blue-soft); color:var(--blue-dark); box-shadow:inset 0 0 0 1px #d8c2b8}

.topbar .back-to-lab{margin-top:4px;font-size:11px}
.top-result{
  justify-self:end; display:flex; align-items:baseline; gap:8px;
  padding:5px 11px; border:1px solid var(--line); border-radius:8px;
  background:var(--surface-2);
  white-space:nowrap;
}
.top-result>span{font-size:12px; color:var(--muted)}
.top-result strong{
  display:inline-block; min-width:60px; text-align:right;
  font-family:"Bahnschrift","Segoe UI",sans-serif;
  font-size:21px; line-height:1; font-weight:600; letter-spacing:-.02em;
  font-variant-numeric:tabular-nums; color:var(--gold);
}
.top-result em{font-style:normal; font-size:12px; color:var(--muted)}

/* ---------- workspace ---------- */
.workspace{
  flex:1; min-height:0;
  display:grid; grid-template-columns:286px minmax(0,1fr) 358px; gap:10px;
}
.panel,.stage{
  min-height:0; border:1px solid var(--line); border-radius:var(--radius);
  background:var(--surface);
  box-shadow:var(--shadow);
}
.panel{display:flex; flex-direction:column; overflow:hidden}

/* ---------- left panel ---------- */
.left-panel{padding:14px 12px 12px}
.panel-head{display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0 2px 12px}
.kicker{display:block; font-size:9px; letter-spacing:.14em; color:var(--muted-2); font-weight:700; margin-bottom:3px}
.panel-head h2{margin:0; font-size:17px; font-weight:600}
.add-btn{
  min-height:38px; padding:7px 13px;
  border:1px solid #d8c2b8; background:var(--blue-soft);
  color:var(--blue-dark); border-radius:7px; font-size:13px; font-weight:500; cursor:pointer;
  transition:.15s; white-space:nowrap;
}
.add-btn:hover{background:#e6d8cf; border-color:#d8c2b8}
.add-btn:disabled{opacity:.45; cursor:default}

.force-list{
  flex:1; min-height:80px; overflow-y:auto; overflow-x:hidden;
  display:flex; flex-direction:column; gap:6px; padding:1px 3px 2px 1px;
  scrollbar-width:thin; scrollbar-color:#bcb2a3 transparent;
}
.force-list::-webkit-scrollbar{width:7px}
.force-list::-webkit-scrollbar-thumb{background:#c8bfb0; border-radius:99px}
.force-list::-webkit-scrollbar-thumb:hover{background:#b3a99a}

.force-card{
  --c:#a85a4f; --c-soft:rgba(168,90,79,.08);
  position:relative; flex:none;
  padding:7px 9px 6px 12px; border-radius:8px;
  background:var(--surface-2);
  border:1px solid #dcd4c6;
  cursor:pointer; overflow:hidden;
  transition:border-color .15s, background .15s, box-shadow .15s;
}
.force-card::before{
  content:""; position:absolute; left:0; top:0; bottom:0; width:4px;
  background:var(--c); opacity:.9;
}
.force-card:hover{background:#fff; border-color:#c8bfb0}
.force-card.selected{
  border-color:#d8c2b8; background:var(--c-soft);
  box-shadow:inset 0 0 0 1px rgba(148,102,90,.08);
}
.force-card.selected::before{opacity:1}

.fc-head{display:flex; align-items:center; gap:8px; min-height:28px}
.fc-dot{width:10px; height:10px; border-radius:50%; background:var(--c); flex:none}
.fc-name{font-size:14px; font-weight:700; letter-spacing:.01em; color:var(--text)}
.fc-mag{margin-left:auto; display:flex; align-items:center; gap:5px}
.fc-mag input{
  width:62px; height:30px;
  border:1px solid var(--line-strong); border-radius:6px;
  background:#fff; color:var(--text); padding:3px 7px;
  font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:14px; font-weight:600;
  text-align:right; font-variant-numeric:tabular-nums;
  -moz-appearance:textfield;
}
.fc-mag input:focus{border-color:var(--blue); outline:2px solid var(--blue-soft)}
.fc-mag input::-webkit-outer-spin-button,.fc-mag input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.fc-mag span{font-size:11px; color:var(--muted)}
.fc-del{
  width:32px; height:32px; padding:0; border:0; border-radius:6px; cursor:pointer;
  background:transparent; color:var(--muted); font-size:20px; line-height:1;
  transition:.15s;
}
.fc-del:hover{background:#e2c9c2; color:#87483f}
.fc-del:disabled{opacity:.25; cursor:default}

.fc-locks{display:flex; gap:6px; margin-top:5px}
.lock-btn{
  flex:1; padding:3px 8px; border:1px solid var(--line-strong); border-radius:6px;
  background:#faf8f4; color:var(--muted); font-size:11px; cursor:pointer; transition:.15s;
  white-space:nowrap; line-height:1.5;
}
.lock-btn:hover{border-color:var(--c,#94665a); color:var(--text)}
.lock-btn.active{
  background:var(--c-soft,#f0e6e2); border-color:var(--c,#94665a); color:var(--c,#94665a);
  font-weight:600;
}

.range-row{
  display:grid; grid-template-columns:30px minmax(0,1fr) 80px;
  align-items:center; gap:7px; margin-top:2px;
  min-height:26px;
}
.range-row label{font-size:12px; color:var(--muted); white-space:nowrap}
.range-row .val{
  font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:12px; color:var(--text);
  text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap;
}
.range-row.phi-row{transition:opacity .2s}
.mode-2d .phi-row{display:none}

/* 5–6 forces: drop the duplicate |F| slider; the number field still edits it. */
.force-list.dense{gap:5px}
.force-list.dense .force-card{padding:7px 9px 6px 12px}
.force-list.dense .mag-row{display:none}
.force-list.dense .range-row{margin-top:2px; min-height:28px}
.force-list.dense .fc-head{min-height:28px}

input[type="range"]{
  -webkit-appearance:none; appearance:none; width:100%; height:28px;
  margin:0; background:transparent; cursor:pointer; display:block;
}
input[type="range"]::-webkit-slider-runnable-track{
  height:5px; border-radius:99px;
  background:linear-gradient(90deg,var(--c) 0 var(--fill,50%),#e2dbd0 var(--fill,50%) 100%);
}
input[type="range"]::-moz-range-track{height:5px; border-radius:99px;background:#e2dbd0}
input[type="range"]::-moz-range-progress{height:5px;border-radius:99px;background:var(--c)}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none; width:18px; height:18px; margin-top:-6.5px;
  border-radius:50%; background:#fff; border:3px solid var(--c);
  box-shadow:0 1px 3px rgba(51,48,43,.35);
  transition:transform .12s;
}
input[type="range"]:active::-webkit-slider-thumb{transform:scale(1.12)}
input[type="range"]::-moz-range-thumb{
  width:14px;height:14px;border-radius:50%;background:#fff;border:3px solid var(--c);
  box-shadow:0 1px 3px rgba(51,48,43,.35);
}

.preset-area{flex:none; margin-top:10px; padding-top:11px; border-top:1px solid var(--line)}
.section-label{font-size:11px; letter-spacing:.04em; color:var(--muted); font-weight:600; margin-bottom:7px}
.preset-grid{display:grid; grid-template-columns:1fr 1fr; gap:6px}
.preset-grid button{
  min-height:42px; padding:7px 8px;
  border:1px solid var(--line); border-radius:7px;
  background:#fff; color:var(--text);
  font-size:12px; line-height:1.25; cursor:pointer; transition:.15s;
}
.preset-grid button:hover{background:var(--surface-3); border-color:var(--line-strong)}
.preset-grid button:active{background:#e2dbd0}
.preset-grid button.primary{color:var(--blue-dark); border-color:#d8c2b8; background:var(--blue-soft)}
.preset-grid button.primary:hover{background:#e6d8cf; border-color:#d8c2b8}
.hint{
  margin:9px 0 0; font-size:11px; line-height:1.6; color:var(--muted);
  padding-left:18px; position:relative;
}
.hint::before{
  content:"i"; position:absolute; left:1px; top:1px; width:14px; height:14px;
  border:1px solid var(--line-strong); border-radius:50%;
  font-size:9px; line-height:12px; text-align:center; color:var(--muted);
  font-family:Georgia,serif; font-style:italic;
}

.selected-card{
  flex:none; margin-top:9px; padding:9px 10px 8px; border-radius:8px;
  border:1px solid var(--line); background:var(--surface-2);
}
.selected-head{display:flex; align-items:center; gap:6px; margin-bottom:6px}
.selected-head .kicker{margin:0}
.selected-head .sel-name{
  margin-left:auto; font-size:12px; font-weight:600; color:var(--text);
  display:flex; align-items:center; gap:6px;
}
.selected-head .sel-name i{
  width:8px;height:8px;border-radius:50%;background:var(--sel-color,#a85a4f);
}
.selected-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:5px}
.selected-grid div{padding:5px 6px; border-radius:5px; background:#fff; border:1px solid #dcd4c6}
.selected-grid span{display:block; font-size:9px; color:var(--muted); margin-bottom:1px}
.selected-grid b{
  display:block; text-align:right; font-family:"Bahnschrift","Segoe UI",sans-serif;
  font-size:11px; font-weight:600; color:var(--text); font-variant-numeric:tabular-nums;
}
.selected-card .sel-dir{
  margin:7px 0 0; font-size:10px; color:var(--muted); display:flex; justify-content:space-between; gap:6px;
}
.selected-card .sel-dir b{color:var(--text); font-weight:600; font-family:"Bahnschrift","Segoe UI",sans-serif}
.selected-mag{
  display:grid; grid-template-columns:24px minmax(0,1fr) 56px; align-items:center; gap:8px;
  margin-top:5px; padding-top:5px; border-top:1px solid #e4ddd0;
}
.selected-mag > span{font-size:11px; color:var(--muted); white-space:nowrap}
.selected-mag > b{
  font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:11px; font-weight:600;
  text-align:right; color:var(--text); font-variant-numeric:tabular-nums; white-space:nowrap;
}
.selected-mag input{height:26px}
.mode-2d .selected-grid{grid-template-columns:repeat(2,1fr)}
.mode-2d .sel-fz{display:none}

/* Magnitude is edited by the big slider in the selected-vector card; cards keep the number field. */
.force-list .mag-row{display:none}

/* ---------- stage ---------- */
.stage{
  position:relative; overflow:hidden;
  background:#fff;
  isolation:isolate;
}
.stage::after{content:none}
#scene{position:absolute; inset:0; width:100%; height:100%; cursor:grab; touch-action:none; z-index:1}
#scene.dragging{cursor:grabbing}
#scene.handle{cursor:pointer}

.stage-top{
  position:absolute; z-index:3; top:12px; left:12px; right:12px;
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  pointer-events:none;
}
.scene-badge{
  display:flex; align-items:center; gap:8px; padding:8px 11px; min-height:38px;
  border:1px solid var(--line); border-radius:7px;
  background:rgba(255,255,255,.94);
  box-shadow:0 1px 2px rgba(51,48,43,.12);
  font-size:11.5px; color:var(--muted);
}
.scene-badge .live-dot{width:8px; height:8px; border-radius:50%; background:var(--green); flex:none}
.scene-badge b{color:var(--text); font-weight:600}
.scene-badge .sep{color:#b3a99a}
.plane-lock{color:var(--gold); display:none}
.mode-2d .plane-lock{display:inline}

.legend{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:flex-end;
  padding:8px 11px; min-height:38px;
  border:1px solid var(--line); border-radius:7px;
  background:rgba(255,255,255,.94);
  box-shadow:0 1px 2px rgba(51,48,43,.12);
  font-size:10.5px; color:var(--muted);
  pointer-events:auto; /* .stage-top 设了 pointer-events:none，这里要恢复，否则复选框点不到 */
}
.legend span{display:inline-flex; align-items:center; gap:5px; white-space:nowrap}
.legend i{width:16px; height:3px; border-radius:2px; display:inline-block}
.legend .dot{width:8px; height:8px; border-radius:50%}

.camera-tools{
  position:absolute; z-index:3; right:12px; bottom:68px;
  display:flex; flex-direction:column; gap:7px;
}
.aux-toggle{
  position:absolute; z-index:3; left:12px; bottom:12px;
  height:30px; padding:0 11px; border-radius:15px; cursor:pointer;
  border:1px solid var(--line); background:rgba(255,255,255,.94);
  color:var(--muted); font-size:11.5px; font-family:inherit;
  box-shadow:0 1px 2px rgba(51,48,43,.12);
}
.aux-toggle[aria-pressed="true"]{color:var(--text); border-color:#b3a99a}
.legend-toggle{display:inline-flex; align-items:center; gap:5px; cursor:pointer; white-space:nowrap}
.legend-toggle input{margin:0; accent-color:#94665a; width:13px; height:13px}
.tool-btn{
  width:44px; height:44px; padding:0; border-radius:8px; cursor:pointer;
  border:1px solid var(--line); background:#fff;
  color:var(--text); font-size:21px; line-height:1;
  box-shadow:0 1px 3px rgba(51,48,43,.18);
  display:grid; place-items:center; transition:.12s;
}
.tool-btn:hover{background:var(--surface-3); border-color:var(--line-strong)}
.tool-btn:active{background:#e2dbd0}
.tool-btn.small{font-size:22px}

.stage-footer{
  position:absolute; z-index:3; left:12px; right:12px; bottom:12px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  pointer-events:none; font-size:10.5px; color:var(--muted);
}
.stage-footer .keys{display:flex; align-items:center; gap:9px; flex-wrap:wrap}
.stage-footer kbd{
  font:inherit; padding:3px 6px; border:1px solid var(--line);
  border-radius:4px; background:#fff; color:var(--muted);
}
.grid-unit{white-space:nowrap; padding:5px 8px; border-radius:5px; background:#fff; border:1px solid var(--line)}

/* ---------- right panel ---------- */
.right-panel{
  padding:12px; gap:10px; overflow-y:auto;
  background:var(--surface-2);
  scrollbar-width:thin; scrollbar-color:#bcb2a3 transparent;
}
.right-panel::-webkit-scrollbar{width:7px}
.right-panel::-webkit-scrollbar-thumb{background:#c8bfb0; border-radius:99px}

.result-card{
  position:relative; flex:none; overflow:hidden;
  padding:15px 15px 13px; border-radius:8px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow);
}
.result-card::before{content:none}
.result-top{display:flex; align-items:flex-start; justify-content:space-between; gap:10px}
.result-value{display:flex; align-items:baseline; gap:6px; margin-top:2px}
.result-value strong{
  font-family:"Bahnschrift","Segoe UI",sans-serif;
  font-size:46px; line-height:.95; font-weight:600; letter-spacing:-.03em;
  font-variant-numeric:tabular-nums; color:var(--gold);
}
.result-value span{font-size:14px; color:var(--muted); font-weight:600}
.range-state{
  flex:none; padding:5px 9px; border-radius:99px; font-size:10.5px;
  color:var(--green); border:1px solid #cdd6c8; background:#dbe3d6;
}
.range-state.edge{color:var(--gold); border-color:#e0d2b0; background:var(--gold-soft)}

.result-comps{display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-top:13px}
.mode-2d .result-comps{grid-template-columns:repeat(2,1fr)}
.mode-2d .comp-z{display:none}
.comp{padding:8px 8px 7px; border-radius:6px; border:1px solid #dcd4c6; background:var(--surface-2)}
.comp span{display:block; font-size:9px; color:var(--muted); margin-bottom:2px}
.comp b{
  display:block; font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:13px;
  font-weight:600; color:var(--text); font-variant-numeric:tabular-nums; text-align:right;
}

.range-block{margin-top:13px}
.range-labels{display:flex; justify-content:space-between; gap:8px; font-size:10px; color:var(--muted); margin-bottom:7px}
.range-labels b{font-family:"Bahnschrift","Segoe UI",sans-serif; color:var(--text); font-weight:600; font-size:11.5px}
.range-track{position:relative; height:8px; border-radius:99px; background:#e2dbd0}
.range-fill{
  position:absolute; top:0; bottom:0; border-radius:99px;
  background:linear-gradient(90deg,#cdd6c8,#ece0c4 62%,#e2c9c2);
  transition:left .15s,width .15s;
}
.range-marker{
  position:absolute; top:50%; width:14px; height:14px; border-radius:50%;
  transform:translate(-50%,-50%); background:#fff; border:3px solid var(--gold);
  box-shadow:0 1px 3px rgba(51,48,43,.28);
  transition:left .15s; z-index:2;
}
.range-scale{display:flex; justify-content:space-between; margin-top:6px; font-size:9.5px; color:var(--muted)}
.range-scale b{font-weight:500; color:var(--muted)}

.angle-row{
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
  padding-top:10px; margin-top:10px; border-top:1px solid var(--line);
  font-size:10px; color:var(--muted);
}
.angle-row b{
  font-family:"Bahnschrift","Segoe UI",sans-serif; color:var(--text); font-weight:600;
  font-size:11.5px; font-variant-numeric:tabular-nums;
}
.angle-row .angle-sep{width:1px; height:11px; background:var(--line); margin:0 2px}

.proof-card{
  flex:none; border-radius:8px; overflow:hidden;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow);
}
.proof-tabs{display:flex; padding:5px; gap:5px; background:var(--surface-2); border-bottom:1px solid var(--line)}
.proof-tab{
  flex:1; border:0; border-radius:6px; min-height:40px; padding:7px 8px; cursor:pointer;
  background:transparent; color:var(--muted); font-size:12px; font-weight:500;
  transition:.15s; position:relative;
}
.proof-tab:hover{color:var(--text); background:var(--surface-3)}
.proof-tab.active{background:#fff; color:var(--blue-dark); box-shadow:0 1px 2px rgba(51,48,43,.22); font-weight:600}
.proof-tab.active::after{content:none}

.proof-panel{padding:12px 13px 13px; animation:fade .2s ease}
.proof-panel[hidden]{display:none}
@keyframes fade{from{opacity:0;transform:translateY(2px)}to{opacity:1;transform:none}}

.proof-range{
  display:flex; align-items:baseline; justify-content:space-between; gap:8px;
  padding:9px 10px; border-radius:6px; margin-bottom:10px;
  border:1px solid #e0d2b0; background:var(--gold-soft);
}
.proof-range .label{font-size:9px; letter-spacing:.08em; color:#7a6536; font-weight:700}
.proof-range .value{
  font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:12.5px; color:#7a6536;
  font-variant-numeric:tabular-nums; text-align:right; line-height:1.3;
}
.proof-range .value small{font-size:9.5px; color:#7a6536; font-weight:400}

.formula{
  font-family:"Cambria Math","Times New Roman",Georgia,serif;
  font-size:15px; line-height:1.7; color:var(--text);
  padding:9px 11px; border-radius:6px; background:var(--surface-2);
  border-left:3px solid #d8c2b8;
  margin-bottom:9px; overflow-x:auto; white-space:nowrap;
  scrollbar-width:none;
}
.formula::-webkit-scrollbar{display:none}
.formula em{font-style:italic; color:var(--text)}
.formula .hl{color:var(--gold)}
.formula .dim{color:var(--muted)}
.formula .op{color:var(--muted); padding:0 2px}
sub{font-size:.65em}

.steps{margin:0 0 10px; padding:0; list-style:none; display:flex; flex-direction:column; gap:6px}
.steps li{position:relative; padding-left:18px; font-size:11.5px; line-height:1.7; color:#33302b}
.steps li::before{
  content:""; position:absolute; left:2px; top:8px; width:5px; height:5px; border-radius:50%;
  background:#d8c2b8;
}
.steps li b{color:var(--text); font-weight:600}
.steps li .hl{color:var(--gold); font-weight:600}
.steps li .eq{font-family:"Cambria Math","Times New Roman",serif; color:var(--text)}

.chart-wrap{margin:8px 0 10px; padding:5px 3px 1px; border-radius:6px; border:1px solid #dcd4c6; background:#f3eee5}
#curve2{display:block; width:100%; height:122px}

.proof-actions{display:grid; grid-template-columns:1fr 1fr; gap:7px}
.proof-actions button{
  border:1px solid var(--line); border-radius:6px; min-height:42px; padding:7px 6px;
  background:#fff; color:var(--text); font-size:11.5px;
  cursor:pointer; transition:.15s; line-height:1.3;
}
.proof-actions button:hover{background:var(--surface-3); border-color:var(--line-strong)}
.proof-actions button.gold{border-color:#e0d2b0; background:var(--gold-soft); color:#7a6536}
.proof-actions button.gold:hover{background:#ece0c4}

.note{
  margin:9px 0 0; font-size:10.5px; line-height:1.6; color:var(--muted);
  padding-top:8px; border-top:1px solid var(--line);
}
.note b{color:var(--text); font-weight:600}
.source-tag{
  display:inline-block; padding:2px 6px; border-radius:4px; margin-left:4px;
  background:var(--surface-3); color:var(--muted); font-size:9px; letter-spacing:.02em;
}
.source-tag.live{background:#dbe3d6; color:var(--green)}

.term-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-bottom:9px}
.term{padding:7px 8px; border-radius:5px; background:var(--surface-2); border:1px solid #dcd4c6}
.term span{display:block; font-size:9px; color:var(--muted); margin-bottom:2px}
.term b{font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:12px; color:var(--text); font-weight:600; font-variant-numeric:tabular-nums}
.term.hot b{color:var(--gold)}
.term.good b{color:var(--green)}

.general-note{
  flex:none; padding:10px 12px; border-radius:7px;
  border:1px dashed var(--line-strong); background:var(--surface-2);
  font-size:10.5px; line-height:1.65; color:var(--muted);
}
.general-note b{color:var(--text); font-weight:600}
.general-note .formula-inline{font-family:"Cambria Math","Times New Roman",serif;color:var(--gold)}

.toast{
  position:fixed; z-index:20; left:50%; bottom:22px; transform:translate(-50%,14px);
  padding:10px 18px; border-radius:8px; font-size:12.5px; color:#fff;
  background:#33302b;
  box-shadow:0 4px 14px rgba(51,48,43,.35);
  opacity:0; pointer-events:none; transition:.22s;
  max-width:calc(100vw - 32px);
}
.toast.show{opacity:1; transform:translate(-50%,0)}

/* ---------- trigonometry card ---------- */
.trig-card{
  flex:none; padding:12px 13px 11px; border-radius:8px;
  border:1px solid var(--line); background:#fff; box-shadow:var(--shadow);
}
.trig-head{display:flex; align-items:flex-start; justify-content:space-between; gap:8px; margin-bottom:9px}
.trig-head h3{margin:0; font-size:14px; font-weight:600}
.trig-chip{
  flex:none; padding:3px 8px; border-radius:99px; font-size:9px;
  color:var(--muted); background:var(--surface-3); white-space:nowrap;
}
.trig-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:6px}
.trig-cell{padding:7px 8px 6px; border-radius:6px; border:1px solid #dcd4c6; background:var(--surface-2)}
.trig-cell span{display:block; font-size:9px; color:var(--muted); margin-bottom:2px}
.trig-cell b{
  display:block; font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:12.5px;
  font-weight:600; color:var(--text); font-variant-numeric:tabular-nums; text-align:right;
}
.trig-cell.hot b{color:var(--gold)}
.trig-bars{margin-top:9px; display:flex; flex-direction:column; gap:5px}
.trig-bar{display:grid; grid-template-columns:58px minmax(0,1fr) 58px; align-items:center; gap:8px; font-size:9.5px; color:var(--muted)}
.trig-bar>span{white-space:nowrap; font-family:"Cambria Math","Times New Roman",serif; font-size:11px}
.trig-track{position:relative; height:7px; border-radius:99px; background:#e2dbd0; overflow:hidden}
.trig-fill{position:absolute; top:0; bottom:0; left:0; border-radius:99px; background:#94665a; transition:width .18s}
.trig-bar.neg .trig-fill{background:#a85a4f}
.trig-bar b{
  text-align:right; font-family:"Bahnschrift","Segoe UI",sans-serif; font-size:11px;
  font-weight:600; color:var(--text); font-variant-numeric:tabular-nums;
}
.trig-formula{
  margin-top:10px; padding:8px 10px; border-radius:6px; background:var(--surface-2);
  border-left:3px solid #b09a72; font-family:"Cambria Math","Times New Roman",serif;
  font-size:12.5px; line-height:1.65; color:var(--text); overflow-wrap:anywhere; white-space:normal;
  scrollbar-width:none;
}
.trig-formula::-webkit-scrollbar{display:none}
.trig-formula b{color:var(--gold); font-weight:600; font-family:"Bahnschrift","Segoe UI",sans-serif}
.trig-note{margin:7px 0 0; font-size:10px; line-height:1.6; color:var(--muted)}
.trig-note b{color:var(--text); font-weight:600}

/* ---------- responsive ---------- */
@media (max-width:1340px){
  .workspace{grid-template-columns:280px minmax(0,1fr) 348px}
  .left-panel{padding-left:10px;padding-right:10px}
  .right-panel{padding:10px}
  .result-value strong{font-size:42px}
}
@media (max-width:1120px){
  body{overflow:auto}
  .app{height:auto; min-height:100dvh}
  .topbar{grid-template-columns:1fr auto; row-gap:8px; padding:10px 12px}
  .top-center{grid-column:1/-1; grid-row:2; justify-self:center; order:3}
  .top-result{grid-column:2;grid-row:1}
  .workspace{grid-template-columns:280px minmax(0,1fr); grid-template-rows:minmax(580px,calc(100dvh - 200px)) auto}
  .right-panel{grid-column:1/-1; display:grid; grid-template-columns:1fr 1fr; align-items:start; overflow:visible}
  .result-card{grid-column:1/-1}
  .trig-card{grid-column:1/-1}
  .general-note{grid-column:1/-1}
}
@media (max-width:760px){
  .app{padding:8px; gap:8px}
  .topbar{grid-template-columns:1fr auto; gap:8px; padding:9px 10px}
  .brand{gap:9px}
  .brand .logo-mark{width:38px;height:38px}
  .brand h1{font-size:16px}
  .brand p{display:none}
  .top-result{padding:6px 9px}
  .top-result>span{font-size:10px}
  .top-result strong{font-size:21px; min-width:54px}
  .top-center{gap:8px; flex-wrap:wrap; justify-content:center}
  .mode-btn{min-height:42px; padding:8px 14px; font-size:13px}
  .count-btn{width:38px;height:38px;font-size:13px}
  .workspace{grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(500px,66dvh) auto auto}
  .panel,.stage{min-width:0}
  .left-panel{grid-row:2}
  .right-panel{grid-row:3; grid-template-columns:minmax(0,1fr); min-width:0}
  .result-card,.general-note,.proof-card,.result-top,.result-comps,.comp{min-width:0}
  .result-card,.general-note{grid-column:1}
  .stage{min-height:500px}
  .legend{display:none}
  .stage-footer .keys{display:none}
  .force-list{max-height:none; overflow:visible}
  .fc-mag input{width:70px;height:36px}
  .fc-del{width:38px;height:38px}
  .range-row{min-height:34px}
  input[type="range"]{height:34px}
  input[type="range"]::-webkit-slider-thumb{width:22px;height:22px;margin-top:-8.5px}
  .preset-grid button{min-height:46px;font-size:12.5px}
  .proof-actions button{min-height:46px}
}
@media (max-height:820px) and (min-width:761px){
  .force-list{gap:5px}
  .force-card{padding:6px 9px 5px 12px}
  .range-row{min-height:25px; margin-top:1px}
  input[type="range"]{height:25px}
  .selected-card{padding:7px 9px 6px}
  .selected-grid div{padding:4px 6px}
  .selected-mag{margin-top:3px; padding-top:3px}
  .preset-area{margin-top:7px; padding-top:8px}
  .preset-grid button{min-height:36px}
  .left-panel .hint{display:none}
}
@media (max-width:480px){
  .top-center{flex-wrap:nowrap; gap:6px}
  .count-control>span{display:none}
  .mode-btn{min-height:40px; padding:8px 10px; font-size:12px}
  .count-btn{width:34px; height:34px}
  .top-result strong{min-width:48px}
}
@media (pointer:coarse){
  .add-btn,.preset-grid button,.proof-actions button,.tool-btn{min-height:46px}
  .tool-btn{width:46px;height:46px}
  .count-btn{width:38px;height:38px}
  .fc-del{width:38px;height:38px}
  .fc-mag input{height:36px}
}
@media (max-width:480px){
  .mode-btn{white-space:nowrap; padding:8px 8px}
  .count-btn{width:36px; height:36px}
}
/* ≤420：顶栏控件允许换行，杜绝横向溢出；隐藏数量标签节省空间 */
@media (max-width:420px){
  .top-center{flex-wrap:wrap; justify-content:center; gap:6px}
  .count-control>span{display:none}
  .app{overflow-x:hidden}
}

/* site integration */
.brand{ color: inherit; text-decoration: none; }
.brand:hover .logo-mark{ transform: translateY(-1px); }
.logo-mark{ transition: transform .18s ease; }


/* editable angle fields in the force cards */
.range-row .val-group{display:inline-flex;align-items:center;justify-content:flex-end;gap:1px;min-width:0}
.range-row .val-input{width:100%;min-width:0;border:0;border-bottom:1px solid transparent;background:transparent;color:var(--text);font:inherit;text-align:right;font-variant-numeric:tabular-nums;padding:1px 0}
.range-row .val-input:focus{outline:none;border-bottom-color:var(--c,#94665a)}
.range-row .val-suffix{color:var(--muted)}
.val-input::-webkit-outer-spin-button,.val-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.val-input{-moz-appearance:textfield}

/* 全站宋体（首页与顶栏除外） */
body.serif,
body.serif *:not(svg):not(path) {
  font-family: var(--song) !important;
}
body.serif .site-header,
body.serif .site-header *,
body.serif .admin-header,
body.serif .admin-header * {
  font-family: var(--display) !important;
}
