:root {
  --bg:#111110; --panel:#1d1b17; --panel-2:#26231e; --ink:#ede7da; --ink-2:#aaa292; --ink-3:#7d7669;
  --rule:#343028; --accent:#e77f64; --accent-soft:#e77f6422; --on-accent:#1b1410; --good:#6cc47b; --bad:#ef6a58;
  --shade:#000000a6; --float:#201e19ee;
  --sans:"Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  --serif:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,"Times New Roman",serif;
  --r-bone:#c9b98a; --r-origin:#e0702e; --r-insertion:#a56bcb; --r-muscle:#c8604e; --r-nerve:#e3b122;
  --r-artery:#d8382a; --r-vein:#4a80cf; --r-organ:#b07a58; --r-near:#7fa89a;
  color-scheme:dark;
}
:root[data-theme="paper"] {
  --bg:#e8e1d3; --panel:#f7f2e7; --panel-2:#ece5d6; --ink:#2a2620; --ink-2:#6b6355; --ink-3:#8e8574;
  --rule:#d9d0bd; --accent:#8f2d22; --accent-soft:#8f2d2218; --on-accent:#fbf6ec; --good:#3f6b3a; --bad:#a8321f;
  --shade:#3a331f55; --float:#f7f2e7f2;
  --r-bone:#6d7a2c; --r-origin:#cc5a22; --r-insertion:#7a3f98; --r-muscle:#b9604f; --r-nerve:#b98500;
  --r-artery:#c22c1e; --r-vein:#2d62ad; --r-organ:#8a5a3c; --r-near:#4c7a6c;
  color-scheme:light;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html,body { height:100%; margin:0; }
body { background:var(--bg); color:var(--ink); font:15.5px/1.45 var(--sans); display:flex; flex-direction:column; height:100dvh; overflow:hidden; }
button,input,select { font:inherit; color:inherit; }
button { cursor:pointer; }
:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
p { margin:0; }

/* top bar */
.top { display:flex; align-items:center; gap:14px; padding:8px 14px; border-bottom:1px solid var(--rule); background:var(--panel); min-height:54px; flex:none; }
.brand { display:flex; flex-direction:column; line-height:1.1; flex:none; }
.brand b { font:600 21px/1 var(--serif); letter-spacing:.01em; }
.brand span { color:var(--ink-3); font-size:11px; margin-top:3px; white-space:nowrap; }
.modes { display:flex; gap:2px; flex:0 1 auto; min-width:0; overflow-x:auto; scrollbar-width:none; }
.modes button { border:0; background:none; padding:7px 11px; border-radius:6px; color:var(--ink-2); white-space:nowrap; }
.modes button:hover { background:var(--panel-2); color:var(--ink); }
.modes button[aria-pressed="true"] { background:var(--accent); color:var(--on-accent); font-weight:600; }
.search { position:relative; flex:1 1 180px; min-width:120px; max-width:380px; margin-left:auto; }
.search input { width:100%; height:34px; padding:0 11px; border:1px solid var(--rule); border-radius:7px; background:var(--bg); }
.pop { position:absolute; z-index:30; top:calc(100% + 5px); left:0; right:0; background:var(--panel); border:1px solid var(--rule); border-radius:8px; box-shadow:0 12px 30px var(--shade); max-height:60vh; overflow:auto; padding:4px; }
.pop button { display:block; width:100%; text-align:left; border:0; background:none; padding:6px 9px; border-radius:5px; }
.pop button:hover,.pop button.cur { background:var(--panel-2); }
.pop small { display:block; color:var(--ink-3); font-size:12px; }
.pop p { padding:8px 9px; color:var(--ink-3); }
.seg { display:inline-flex; border:1px solid var(--rule); border-radius:7px; overflow:hidden; flex:none; }
.seg button { border:0; background:none; padding:6px 10px; color:var(--ink-2); }
.seg button+button { border-left:1px solid var(--rule); }
.seg button:hover { color:var(--ink); background:var(--panel-2); }
.seg button[aria-pressed="true"] { background:var(--panel-2); color:var(--accent); font-weight:600; }
.btn { border:1px solid var(--accent); background:var(--accent); color:var(--on-accent); border-radius:7px; padding:6px 12px; white-space:nowrap; }
.btn.ghost { background:none; border-color:var(--rule); color:var(--ink); }
.btn.ghost:hover:not(:disabled) { border-color:var(--ink-3); }
.btn:disabled { opacity:.38; cursor:default; }
.undo-top span[aria-hidden] { font-size:1.1em; line-height:1; }

/* layout */
.stage { flex:1; min-height:0; display:grid; grid-template-columns:286px minmax(0,1fr) 370px; }
.stage.no-right { grid-template-columns:286px minmax(0,1fr) 0; }
.stage.no-right .right { visibility:hidden; }
.stage.no-left { grid-template-columns:0 minmax(0,1fr) 370px; }
.stage.no-left .left { visibility:hidden; }
.stage.no-left.no-right { grid-template-columns:0 minmax(0,1fr) 0; }
.left,.right { background:var(--panel); min-height:0; display:flex; flex-direction:column; }
.left { border-right:1px solid var(--rule); } .right { border-left:1px solid var(--rule); }
.scroll { overflow:auto; flex:1; min-height:0; padding:14px; }
.tabs { display:flex; border-bottom:1px solid var(--rule); flex:none; }
.tabs button { flex:1; border:0; background:none; padding:10px; color:var(--ink-2); border-bottom:2px solid transparent; margin-bottom:-1px; }
.tabs button[aria-selected="true"] { color:var(--ink); border-bottom-color:var(--accent); font-weight:600; }
h3 { font-size:12px; color:var(--ink-3); font-weight:600; margin:0 0 8px; }

/* layers */
.presets { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:18px; }
.presets button { border:1px solid var(--rule); background:none; border-radius:15px; padding:4px 11px; color:var(--ink-2); }
.presets button:hover { color:var(--ink); border-color:var(--ink-3); }
.lyr { padding:7px 0 9px; border-top:1px solid var(--rule); }
.lyr-t { display:flex; align-items:center; gap:9px; width:100%; border:0; background:none; padding:0; text-align:left; }
.lyr-t .sw { width:13px; height:13px; border-radius:4px; background:var(--c); flex:none; box-shadow:inset 0 0 0 1px #0003; }
.lyr-t .nm { flex:1; }
.lyr-t .tg { width:30px; height:17px; border-radius:9px; background:var(--rule); position:relative; flex:none; transition:background .15s; }
.lyr-t .tg::after { content:""; position:absolute; top:2px; left:2px; width:13px; height:13px; border-radius:50%; background:var(--ink-2); transition:transform .15s,background .15s; }
.lyr-t[aria-pressed="true"] .tg { background:var(--accent); }
.lyr-t[aria-pressed="true"] .tg::after { transform:translateX(13px); background:var(--on-accent); }
.lyr-t[aria-pressed="false"] .nm { color:var(--ink-3); }
.lyr input[type=range] { width:100%; display:block; margin:7px 0 0; accent-color:var(--accent); height:14px; }
.lyr.wait .nm::after { content:" …"; color:var(--ink-3); }
.lyr[data-on="0"] input { opacity:.35; }
.attr { color:var(--ink-3); font-size:12px; margin-top:16px; }
.groups { display:grid; gap:6px; margin-bottom:16px; }
.grp { display:flex; align-items:center; gap:12px; width:100%; padding:13px 12px; background:var(--panel-2); border:1px solid var(--rule); border-radius:10px; text-align:left; font-size:16.5px; font-weight:600; }
.grp .sw { width:16px; height:16px; border-radius:5px; background:var(--c); flex:none; box-shadow:inset 0 0 0 1px #0003; }
.grp span { flex:1; }
.grp .tg { width:36px; height:21px; border-radius:11px; background:var(--rule); position:relative; flex:none; transition:background .15s; }
.grp .tg::after { content:""; position:absolute; top:3px; left:3px; width:15px; height:15px; border-radius:50%; background:var(--ink-2); transition:transform .15s,background .15s; }
.grp[aria-pressed="true"] .tg { background:var(--accent); }
.grp[aria-pressed="true"] .tg::after { transform:translateX(15px); background:var(--on-accent); }
.grp[aria-pressed="false"] { background:none; color:var(--ink-3); }
.grp[aria-pressed="false"] .sw { opacity:.45; }
.seg.detail { display:flex; margin-bottom:16px; }
.seg.detail button { flex:1; padding:8px 2px; font-size:13.5px; }
.ltabs { display:flex; flex-wrap:wrap; margin-bottom:12px; }
.ltabs button { flex:1 1 auto; font-size:12.5px; padding:6px 8px; }
.mvlist { display:grid; gap:3px; margin-bottom:14px; }
.it.mv,.it.lesson { display:block; width:100%; margin:0; text-align:left; border:1px solid var(--rule); background:none; border-radius:8px; padding:9px 11px; }
.it.mv:hover,.it.lesson:hover { background:var(--panel-2); }
.it.mv.on,.it.lesson.on { border-color:var(--accent); background:var(--accent-soft); color:var(--accent); font-weight:600; }
.it.lesson { display:grid; grid-template-columns:1fr auto; gap:0 8px; }
.it.lesson em { font-style:normal; color:var(--ink-3); font-size:13px; }
.it.lesson i { grid-column:1 / -1; height:3px; margin-top:6px; background:linear-gradient(90deg,var(--accent) var(--p),var(--rule) var(--p)); }
.lessonbar { top:auto; bottom:calc(100% - 58px); top:10px; bottom:auto; }
#selBar:not([hidden]) ~ #lessonBar { top:58px; }
.lessonbar .lcount { padding:0 8px; color:var(--ink-2); }
.plan { border-top:1px solid var(--rule); margin-top:16px; padding-top:12px; }
.field input[type=date],.field input[type=range] { width:100%; height:32px; border:1px solid var(--rule); background:var(--panel-2); border-radius:6px; padding:0 6px; accent-color:var(--accent); }
.field input[type=range] { border:0; background:none; padding:0; }
.skinlayers { display:flex; flex-direction:column; border-radius:8px; overflow:hidden; border:1px solid var(--rule); }
.skinlayers div { padding:8px 10px; color:#2a1d17; min-height:34px; }
.skinlayers b { display:block; font-size:13px; }
.skinlayers small { display:block; font-size:12px; opacity:.85; line-height:1.35; }
#noteBox { width:100%; resize:vertical; border:1px solid var(--rule); background:var(--panel-2); border-radius:7px; padding:7px 9px; font:inherit; }
.more { border-top:1px solid var(--rule); padding-top:8px; }
.more > summary { cursor:pointer; color:var(--ink-2); font-size:14.5px; padding:4px 0 8px; }
.more .presets { margin-top:6px; }
.ico { width:18px; height:18px; vertical-align:-4px; margin-right:5px; }

/* tree */
.tree details { border-top:1px solid var(--rule); }
.tree summary { padding:7px 0; cursor:pointer; font-weight:600; }
.tree details details { border:0; margin-left:10px; }
.tree details details summary { font-weight:400; color:var(--ink-2); padding:4px 0; }
.tree .it { display:block; width:100%; text-align:left; border:0; background:none; padding:3px 7px; margin-left:12px; width:calc(100% - 12px); border-radius:4px; }
.tree .it:hover { background:var(--panel-2); }
.tree .it.on { background:var(--accent-soft); color:var(--accent); }

/* viewport */
.view { position:relative; min-width:0; min-height:0; overflow:hidden; background:var(--bg); }
.gl-host,.gl-host canvas { position:absolute; inset:0; width:100%; height:100%; display:block; touch-action:none; }
.view::after { content:""; position:absolute; inset:0; pointer-events:none; background:radial-gradient(ellipse at 50% 42%,transparent 55%,#00000030 100%); }
.lab-lines,.labs { position:absolute; inset:0; z-index:2; pointer-events:none; width:100%; height:100%; transition:opacity .12s; }
.moving .lab-lines,.moving .labs { opacity:.12; }
.selrect { position:absolute; z-index:2; border:1.5px dashed var(--accent); background:color-mix(in srgb, var(--accent) 12%, transparent); border-radius:2px; pointer-events:none; }
.selbar .selcount { color:var(--ink-2, var(--ink)); font-size:13px; padding:0 8px 0 6px; white-space:nowrap; }
.lab-lines line { stroke:var(--ink); stroke-opacity:.55; stroke-width:1; }
.lab-lines circle { fill:var(--accent); stroke:var(--panel); stroke-width:1; }
.lab { position:absolute; pointer-events:auto; max-width:250px; border:1px solid var(--rule); background:var(--float); padding:3px 10px; border-radius:6px; font-size:15px; line-height:1.3; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lab:hover { border-color:var(--accent); }
.progress { position:absolute; top:0; left:0; right:0; height:2px; z-index:4; }
.progress i { display:block; height:100%; background:var(--accent); width:0; }
.hint { position:absolute; left:14px; top:58px; max-width:min(210px,32%); color:var(--ink-2); font-size:12.5px; z-index:2; pointer-events:none; text-shadow:0 1px 2px var(--bg); }
.is-labels .hint,.is-quiz .hint { display:none; }
.tip { position:absolute; z-index:6; pointer-events:none; background:var(--float); border:1px solid var(--rule); border-radius:6px; padding:5px 9px; max-width:300px; box-shadow:0 6px 18px var(--shade); }
.tip b { font:600 18px/1.25 var(--serif); display:block; }
.tip small { color:var(--ink-2); display:block; font-size:14px; }
.dock-wrap { position:absolute; left:50%; bottom:12px; transform:translateX(-50%); z-index:5; display:flex; flex-direction:column; align-items:center; gap:6px; width:max-content; max-width:calc(100% - 20px); }
.dock { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:4px 6px; max-width:100%; background:var(--float); border:1px solid var(--rule); border-radius:10px; padding:5px; }
.dock .seg { border:0; }
.dock .seg button { padding:8px 12px; white-space:nowrap; }
.dock .seg button+button { border:0; }
.dock select { height:30px; border:1px solid var(--rule); background:var(--panel-2); border-radius:6px; padding:0 5px; max-width:140px; }
.tool { border:1px solid transparent; background:none; border-radius:7px; padding:8px 12px; color:var(--ink-2); white-space:nowrap; }
.tool:hover { color:var(--ink); background:var(--panel-2); }
.tool[aria-pressed="true"] { color:var(--accent); border-color:var(--accent); }
.tool.warn { color:var(--on-accent); background:var(--accent); }
.dock .sep { display:none; }
.drawer-btn,.drawer-close { display:none; }
.tool.strong { color:var(--ink); border-color:var(--rule); background:var(--panel-2); }
.pane-tog { position:absolute; left:10px; top:10px; z-index:5; }
.pane-tog .tool { background:var(--float); border-color:var(--rule); color:var(--ink); }
.selbar { position:absolute; top:10px; left:50%; transform:translateX(-50%); z-index:6; display:flex; align-items:center; flex-wrap:wrap; justify-content:center; gap:4px 4px; background:var(--float); border:1px solid var(--rule); border-radius:10px; padding:4px; width:max-content; max-width:calc(100% - 20px); box-shadow:0 8px 24px var(--shade); }
.selbar .tool { color:var(--ink); padding:7px 9px; }
.selbar .fade { display:flex; align-items:center; gap:6px; padding:0 8px; color:var(--ink); font-size:13px; }
.selbar .fade input { width:92px; accent-color:var(--accent); }
.selbar .fade output { min-width:3ch; color:var(--ink-3); font-size:12px; font-variant-numeric:tabular-nums; }
.selbar .keep { flex-basis:100%; display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:4px; border-top:1px solid var(--rule); padding-top:4px; }
.selbar .keep span { color:var(--ink-3); font-size:12px; padding:0 4px; }
.selbar .keep button { display:flex; align-items:center; gap:5px; border:1px solid var(--rule); border-radius:999px; background:none; color:var(--ink-2, var(--ink)); padding:4px 9px; font-size:12px; }
.selbar .keep button i { width:8px; height:8px; border-radius:50%; background:var(--c); opacity:.45; }
.selbar .keep button[aria-pressed="true"] { border-color:var(--ink-3); color:var(--ink); }
.selbar .keep button[aria-pressed="true"] i { opacity:1; }
.is-sel .pane-tog { top:58px; }
.is-sel .hint { display:none; }
.selbar .seg { border-color:var(--rule); }
.selbar .seg button { padding:7px 8px; }
.sep2 { width:1px; align-self:stretch; background:var(--rule); margin:4px 3px; }
.area-pop { background:var(--float); border:1px solid var(--rule); border-radius:12px; padding:12px; width:min(460px,100%); box-shadow:0 10px 30px var(--shade); }
.area-pop h4 { margin:12px 0 6px; font-size:13px; color:var(--ink-3); font-weight:600; }
.area-pop .agrid { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin-top:6px; }
.area-pop button:not(.seg button) { border:1px solid var(--rule); background:var(--panel-2); border-radius:8px; padding:11px 6px; color:var(--ink); }
.area-pop .wide { width:100%; }
.area-pop .arow { display:flex; gap:6px; }
.area-pop .arow .wide { flex:1; width:auto; }
.area-pop .amany { flex:0 0 auto; padding:11px 12px !important; white-space:nowrap; }
.area-pop .amany::before { content:"+ "; font-weight:700; }
.area-pop button[aria-pressed="true"]:not(.seg button) { background:var(--accent); color:var(--on-accent); border-color:var(--accent); font-weight:600; }
.area-pop .seg button { padding:8px 16px; }
.lab.on { border-color:var(--accent); font-weight:600; }
.legend { display:grid; gap:5px; }
.legend div { display:flex; align-items:center; gap:9px; }
.legend i { width:16px; height:16px; border-radius:4px; flex:none; box-shadow:inset 0 0 0 1px #0004; }
.smallnote { font-size:12.5px; margin-top:7px; }
.chip.on { border-color:var(--accent); background:var(--accent-soft); font-weight:600; }
.zonecard .ztitle { font:600 20px/1.2 var(--serif); margin:0 0 8px; color:var(--ink); }
.sec h4 i[style] { width:12px; height:12px; }
.cut-box { background:var(--float); border:1px solid var(--rule); border-radius:10px; padding:5px 8px; display:flex; align-items:center; gap:8px; max-width:100%; flex-wrap:wrap; justify-content:center; }
.cut-box input { width:110px; max-width:60vw; accent-color:var(--accent); }
.cut-box .seg { border:0; }
.cut-box .seg button { padding:7px 7px; }
.cut-box .tool { padding:7px 7px; }
.loader { position:absolute; inset:0; z-index:8; display:grid; place-items:center; background:var(--bg); text-align:center; padding:20px; }
.loader p { margin-bottom:10px; color:var(--ink-2); max-width:44ch; }
.loader .bar { width:240px; height:3px; background:var(--rule); margin:auto; }
.loader .bar i { display:block; height:100%; width:0; background:var(--accent); }

/* landmarks on bones */
.pins { position:absolute; inset:0; z-index:3; pointer-events:none; overflow:hidden; }
.pin { position:absolute; left:-5px; top:-5px; width:10px; height:10px; opacity:.9; padding:0; border-radius:50%; border:1.5px solid var(--panel); background:var(--accent); pointer-events:auto; }
.pin:hover,.pin.on { background:#ffcf6b; transform-origin:center; box-shadow:0 0 0 3px #ffcf6b55; opacity:1; }
/* settings "points through the bone": a point on the far side shows paler, as a ring */
.pin.far { opacity:.5; background:transparent; border:2px solid var(--accent); }
.pin.far.on, .pin.far:hover { opacity:.8; background:transparent; border-color:#ffcf6b; }
/* the point asked about in "Name it": larger, with a slow pulse so it is found at once */
.pin.q, .pin.q:hover { left:-9px; top:-9px; width:18px; height:18px; border:3px solid #fff; background:#ff4524; opacity:1; box-shadow:0 0 0 0 #ff4524aa; animation:pinPulse 1.6s ease-out infinite; }
@keyframes pinPulse { 0% { box-shadow:0 0 0 0 #ff4524cc; } 70% { box-shadow:0 0 0 14px #ff452400; } 100% { box-shadow:0 0 0 0 #ff452400; } }
@media (prefers-reduced-motion: reduce) { .pin.q { animation:none; box-shadow:0 0 0 4px #ff452466; } }
.pin-lab { position:absolute; left:0; top:0; white-space:nowrap; background:var(--float); border:1px solid var(--accent); border-radius:5px; padding:1px 7px; font-size:13px; }

/* quiz (victorina) */
.vgrid { display:grid; gap:1px; }
.vt { display:flex; align-items:center; gap:7px; padding:3px 0; cursor:pointer; }
.vt span { flex:1; } .vt em { font-style:normal; font-size:12px; color:var(--ink-3); }
.vrow { display:flex; gap:14px; margin:10px 0 14px; font-size:13px; }
.vhead { display:flex; justify-content:space-between; font-size:13px; color:var(--ink-3); }
.vhead b { color:var(--ink); }
.vprog { height:3px; background:var(--rule); margin:6px 0 14px; } .vprog i { display:block; height:100%; background:var(--accent); }
.vq { font:600 20px/1.3 var(--serif); margin:0 0 14px; }
.vopts { display:grid; gap:6px; margin-bottom:10px; }
.vres { font-weight:600; margin:8px 0; } .good { color:var(--good); } .bad { color:var(--bad); }
.vbar { display:grid; grid-template-columns:1fr 90px 42px; align-items:center; gap:8px; font-size:13px; margin:4px 0; }
.vbar i { height:6px; background:linear-gradient(90deg,var(--accent) var(--p),var(--rule) var(--p)); } .vbar em { font-style:normal; color:var(--ink-3); text-align:right; }
.vmiss { padding:7px 0; border-top:1px solid var(--rule); font-size:13.5px; } .vmiss p { margin:2px 0; }
.def { font-size:13.5px; white-space:pre-line; } .def-src { font-size:12px; margin-top:5px; } .def-src a { color:var(--accent); }
.tree details details { margin-left:12px; }
.tree summary em { font-style:normal; font-size:12px; color:var(--ink-3); margin-left:3px; }
.tree .show { border:0; background:none; color:var(--ink-3); padding:0 4px; }
.tree .show:hover { color:var(--accent); }

/* quiz bar */
.qbar { position:absolute; top:12px; left:50%; transform:translateX(-50%); z-index:5; background:var(--float); border:1px solid var(--rule); border-radius:10px; padding:10px 14px; width:min(560px,calc(100% - 24px)); box-shadow:0 10px 30px var(--shade); }
.q-ask { color:var(--ink-2); font-size:13px; }
.q-row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.q-name { font:600 22px/1.25 var(--serif); margin-right:auto; }
.q-res.ok { color:var(--good); font-weight:600; } .q-res.bad { color:var(--bad); font-weight:600; }
.opts { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:7px; }
.opt { text-align:left; border:1px solid var(--rule); background:none; border-radius:7px; padding:6px 9px; }
.opt:hover:not(:disabled) { border-color:var(--ink-3); }
.opt kbd { color:var(--ink-3); font:12px var(--sans); margin-right:7px; }
.opt.ok { border-color:var(--good); color:var(--good); } .opt.bad { border-color:var(--bad); color:var(--bad); }
.card-names { display:grid; grid-template-columns:1fr 1fr; gap:3px 16px; margin-bottom:9px; }
.card-names em { color:var(--ink-3); font-style:normal; font-size:12px; margin-right:7px; }
.field { display:block; margin-bottom:10px; }
.field span { display:block; font-size:12.5px; color:var(--ink-2); margin-bottom:3px; }
.field select { width:100%; height:32px; border:1px solid var(--rule); background:var(--panel-2); border-radius:6px; padding:0 6px; }
.stats { display:flex; gap:22px; margin-top:6px; }
.stat b { font:600 24px/1 var(--serif); display:block; }
.stat span { font-size:12px; color:var(--ink-3); }
.link-btn { border:0; background:none; padding:0; color:var(--accent); text-decoration:underline; text-underline-offset:2px; }
.boxes { display:grid; grid-template-columns:repeat(5,1fr); gap:5px; height:60px; align-items:end; }
.boxes div { background:var(--accent); border-radius:2px 2px 0 0; }
.box-labels { display:grid; grid-template-columns:repeat(5,1fr); gap:5px; text-align:center; font-size:12px; color:var(--ink-3); margin-top:4px; }
.box-labels b { display:block; color:var(--ink); }
.weak { list-style:none; margin:0; padding:0; font-size:13px; }
.weak li { display:flex; justify-content:space-between; gap:8px; padding:4px 0; border-bottom:1px solid var(--line, rgba(127,127,127,.2)); }
.weak em { font-style:normal; color:var(--ink-3); white-space:nowrap; }
.muted { color:var(--ink-3); }

/* info card */
.eyebrow { color:var(--ink-3); font-size:12.5px; margin-bottom:3px; }
.eyebrow::first-letter { text-transform:uppercase; }
.title { font:600 25px/1.18 var(--serif); margin:0 0 11px; overflow-wrap:anywhere; }
.title .star { border:0; background:none; color:var(--ink-3); font-size:21px; line-height:1; padding:2px 4px; margin-left:6px; vertical-align:2px; cursor:pointer; }
.title .star[aria-pressed="true"] { color:#f1b84a; }
.title .star:hover { color:#f1b84a; }
.favs { padding:4px 2px 10px; margin-bottom:8px; border-bottom:1px solid var(--rule); }
.favs h4 { font-size:12px; font-weight:600; color:var(--ink-3); margin:6px 0 5px; text-transform:uppercase; letter-spacing:.04em; }
.names { margin:0 0 12px; display:grid; grid-template-columns:auto 1fr; gap:3px 12px; }
.names dt { color:var(--ink-3); font-size:12px; line-height:1.65; }
.names dd { margin:0; overflow-wrap:anywhere; }
.names .pri { font-weight:600; }
.acts { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 12px; }
.acts .btn { padding:4px 10px; font-size:13px; }
.note { font-size:13px; color:var(--ink-2); border-left:2px solid var(--accent); padding:1px 0 1px 9px; margin:0 0 12px; }
.sec { border-top:1px solid var(--rule); padding:10px 0; }
.sec h4 { margin:0 0 6px; font-size:12.5px; font-weight:600; color:var(--ink-2); display:flex; align-items:center; gap:7px; }
.sec.closed > :not(h4) { display:none; }
.sec.closed { padding:7px 0; }
.sec > h4 { cursor:pointer; user-select:none; }
.sec > h4::after { content:"⌃"; margin-left:auto; color:var(--ink-3); }
.sec.closed > h4::after { content:"⌄"; }
.sec h4 i,.chip i { width:8px; height:8px; border-radius:50%; background:var(--c,var(--ink-3)); flex:none; display:inline-block; }
.chips { display:flex; flex-wrap:wrap; gap:5px; }
.chip { border:1px solid var(--rule); background:none; border-radius:6px; padding:3px 8px; text-align:left; }
/* a reference the model has no part for: plain text, not a button */
.chip.plain { border-style:dashed; color:var(--ink-2, var(--ink)); cursor:default; }
.chip:hover { border-color:var(--accent); }
.sub { font-size:12.5px; color:var(--ink-3); margin:7px 0 4px; }
.sec ul { margin:0; padding-left:17px; }
.sec li { margin:2px 0; }
.sec li small { color:var(--ink-3); }
.near { margin-bottom:6px; } .near p { font-size:13px; color:var(--ink-2); margin-top:2px; }
.empty h2 { font:600 21px/1.2 var(--serif); margin:0 0 8px; }
.empty p { color:var(--ink-2); }

/* settings */
dialog { border:1px solid var(--rule); background:var(--panel); color:var(--ink); border-radius:12px; padding:20px; width:min(440px,calc(100vw - 24px)); }
dialog::backdrop { background:var(--shade); }
.keys-dlg { width:min(520px,calc(100vw - 24px)); }
.keys { width:100%; border-collapse:collapse; font-size:14px; margin-bottom:10px; }
.keys td { padding:6px 4px; border-bottom:1px solid var(--rule); vertical-align:middle; }
.keys td:first-child { white-space:nowrap; padding-right:14px; width:1%; }
kbd { display:inline-block; min-width:1.6em; text-align:center; font:600 12px/1.6 ui-monospace,Consolas,monospace; padding:0 6px; border:1px solid var(--rule); border-bottom-width:2px; border-radius:5px; background:var(--bg); color:var(--ink); }
dialog h2 { font:600 21px/1.2 var(--serif); margin:0 0 14px; }
.set { margin-bottom:14px; } .set>span { display:block; font-size:12.5px; color:var(--ink-2); margin-bottom:5px; }
.checks { display:flex; flex-wrap:wrap; gap:14px; } .checks label { display:flex; align-items:center; gap:5px; }
.foot { display:flex; justify-content:flex-end; margin-top:8px; }
.credit { font-size:13px; color:var(--ink-2); }
.credit a { color:var(--accent); }
.set .acts { margin:0; }
.set a { color:var(--accent); }
.news { margin-top:6px; font-size:13px; } .news summary { cursor:pointer; color:var(--ink-2); } .news ul { margin:6px 0 0; padding-left:18px; } .news li { margin:2px 0; }
.disclaimer { color:var(--ink-2); border-left:3px solid var(--accent); padding-left:9px; }
.foot { gap:8px; }

/* report a mistake */
.report { margin-top:16px; padding-top:10px; border-top:1px solid var(--rule); font-size:13px; }
.report .link-btn { color:var(--ink-2); }
.report .link-btn::before { content:"⚑ "; text-decoration:none; display:inline-block; margin-right:2px; }
.report-dlg .rep-about { margin:-6px 0 12px; }
.rep-kinds { border:0; padding:0; margin:0 0 12px; display:grid; gap:2px; }
.rep-kinds label { display:flex; align-items:center; gap:9px; padding:6px 8px; border-radius:7px; cursor:pointer; }
.rep-kinds label:hover { background:var(--panel-2); }
.rep-kinds input { accent-color:var(--accent); width:17px; height:17px; margin:0; flex:none; }
.report-dlg textarea { width:100%; resize:vertical; border:1px solid var(--rule); border-radius:8px; background:var(--bg); color:var(--ink); padding:8px 10px; font:inherit; }
.rep-msg { min-height:1.4em; margin-top:8px; font-weight:600; }
.rep-msg:empty { min-height:0; margin:0; }

/* bottom message */
.toast { position:fixed; z-index:60; left:50%; bottom:calc(18px + env(safe-area-inset-bottom)); transform:translateX(-50%); width:min(520px,calc(100vw - 24px)); display:flex; align-items:center; gap:10px; padding:10px 8px 10px 14px; background:var(--panel); border:1px solid var(--rule); border-radius:10px; box-shadow:0 12px 34px var(--shade); }
.toast p { flex:1; font-size:14px; }
.sharebox { flex:1; min-width:0; display:grid; gap:6px; }
.sharebox .row { display:flex; gap:6px; min-width:0; }
.sharebox input { flex:1; min-width:0; font:inherit; font-size:13px; padding:6px 8px; border-radius:6px; border:1px solid var(--rule); background:var(--bg); color:var(--ink); }
.toast-x { border:0; background:none; color:var(--ink-2); font-size:22px; line-height:1; padding:4px 8px; min-width:36px; min-height:36px; }

/* first launch tour */
.tour { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:16px; background:var(--shade); }
.tour-card { position:relative; width:min(400px,100%); background:var(--panel); border:1px solid var(--rule); border-radius:14px; padding:26px 22px 18px; text-align:center; box-shadow:0 20px 50px var(--shade); }
.tour-card svg { width:76px; height:76px; fill:none; stroke:var(--accent); stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; margin:6px auto 10px; display:block; }
.tour-card h2 { font:600 22px/1.2 var(--serif); margin:0 0 8px; }
.tour-card p { color:var(--ink-2); }
.tour-card .foot { justify-content:center; margin-top:18px; }
.tour-card .btn { padding:9px 18px; }
.tour-lang { position:absolute; top:10px; right:10px; font-size:12px; }
.tour-lang button { padding:3px 7px; }
.tour-dots { display:flex; justify-content:center; gap:6px; margin-top:16px; }
.tour-dots i { width:7px; height:7px; border-radius:50%; background:var(--rule); }
.tour-dots i.on { background:var(--accent); }

/* search: names one or two typos away */
.sr-head { font-size:12px; color:var(--ink-3); padding:8px 9px 3px; border-top:1px solid var(--rule); margin-top:3px; }
.pop > .sr-head:first-child { border-top:0; margin-top:0; }

/* text size: panels and dialogs grow, the 3D view keeps its scale */
:root[data-fs="l"] :is(.left, .right, .qbar, .selbar, .pop, dialog, .tour-card, .toast) { zoom:1.13; }
:root[data-fs="xl"] :is(.left, .right, .qbar, .selbar, .pop, dialog, .tour-card, .toast) { zoom:1.27; }

/* fingers: every control at least about 44 px tall */
@media (pointer:coarse) {
  .btn, .tool, .link-btn, .opt, .modes button, .seg button, .presets button, .pop button, .lyr-t, aside .drawer-close { min-height:44px; }
  .chip { min-height:38px; padding:6px 10px; }
  .tree summary { min-height:40px; display:flex; align-items:center; gap:4px; }
  .report .link-btn { min-height:40px; }
  .rep-kinds label { min-height:44px; }
}

@media (max-width:1180px) {
  .stage { grid-template-columns:250px minmax(0,1fr) 300px; }
  .brand span { display:none; }
  .dock .lb { display:none; }
  .dock .tool .ico { margin-right:0; }
  /* the selection tool keeps its word: an icon alone does not say what it does */
  .dock :is(#selT, #manyT) .lb { display:inline; }
  .dock :is(#selT, #manyT) .ico { margin-right:5px; }
  .modes button { padding:6px 8px; }
}
@media (max-width:900px) {
  .top { flex-wrap:wrap; gap:8px; padding:7px 10px; }
  .modes { order:5; width:100%; overflow-x:auto; scrollbar-width:none; }
  .search { order:2; min-width:0; }
  .brand { order:1; } .langs { order:3; } #undoTop, #redoTop { order:4; } #openSettings { order:4; }
  /* undo / redo: the arrows alone on a phone, so the header keeps to two rows */
  .undo-top [data-i18n] { display:none; }
  .undo-top { padding:6px 10px; }
  /* the selection bar stays small over the model */
  .selbar { gap:2px; padding:3px; }
  .selbar .tool { padding:6px 7px; font-size:13px; }
  .selbar .fade span { display:none; }
  .selbar .fade::before { content:"◐"; font-size:15px; color:var(--ink-2, var(--ink)); }
  .selbar .fade input { width:76px; }
  .selbar .keep { gap:3px; }
  .selbar .keep span { display:none; }
  .selbar .keep button { padding:3px 7px; font-size:11.5px; }
  .langs button { padding:6px 7px; }
  #openSettings { padding:6px 8px; }
  .stage, .stage.no-right, .stage.no-left, .stage.no-left.no-right { grid-template-columns:minmax(0,1fr); position:relative; }
  .left,.right { position:absolute; z-index:10; left:0; right:0; bottom:0; max-height:58%; height:58%; border:0; border-top:1px solid var(--rule); box-shadow:0 -10px 30px var(--shade); transform:translateY(102%); transition:transform .22s ease; visibility:hidden; }
  .left.open,.right.open { transform:none; visibility:visible; }
  .drawer-btn { display:inline-block; }
  .drawer-close { display:block; flex:none; align-self:flex-end; border:0; background:none; color:var(--accent); padding:9px 14px 3px; min-height:36px; }
  .hint { display:none; }
  .opts { grid-template-columns:1fr; }
  .dock-wrap { left:10px; right:10px; width:auto; transform:none; max-width:none; align-items:stretch; }
  .dock { flex-wrap:nowrap; overflow-x:auto; justify-content:flex-start; scrollbar-width:none; }
  .q-name { font-size:19px; }
  /* the dock already has a Layers button that opens the drawer; the floating one only got in the way of the bars at the top */
  .pane-tog { display:none; }
  .toast { bottom:calc(72px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion:reduce) { * { transition:none !important; } }
