:root{color-scheme:dark;--bg:#101215;--panel:#171a1e;--line:#2b3035;--text:#eef0ef;--muted:#a1a9ad;--accent:#bce2d7;--mono:ui-monospace,"SF Mono",Consolas,monospace;font-family:Inter,"PingFang SC","Microsoft YaHei",system-ui,sans-serif}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text)}
button,input{font:inherit}
button{cursor:pointer}
button:focus-visible,input:focus-visible,a:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
button:disabled{cursor:default;opacity:.38}
[hidden]{display:none!important}
.quiet{border:1px solid #343a40;background:#1d2125;color:#e0e4e4;border-radius:8px;padding:8px 12px;font-size:14px;line-height:1.2;white-space:nowrap;text-decoration:none}
.quiet:hover:enabled,a.quiet:hover,.view-options button:hover{background:#2a3135}
#stage{position:relative;isolation:isolate;min-height:390px;height:100vh;height:100svh;overflow:hidden;background:radial-gradient(ellipse at 50% 42%,#373b3e 0%,#22272b 45%,#15191e 86%)}
#stage:fullscreen,#stage.expanded{width:100%;height:100%;min-height:0}
#stage.expanded{position:fixed;inset:0;z-index:10}
body.stage-expanded{overflow:hidden}
#stage:fullscreen #controls-link,#stage.expanded #controls-link{visibility:hidden}
#view{position:absolute;inset:0}
canvas{display:block;touch-action:none;outline:none;cursor:grab}
canvas.dragging{cursor:grabbing}
canvas.inspect{cursor:crosshair}
.stage-status{position:absolute;top:18px;right:18px;display:flex;align-items:center;gap:8px;border:1px solid #3a4447;background:#1b2225d9;border-radius:999px;padding:7px 10px;color:#d7dfde;font-size:13px;pointer-events:none;z-index:2}
.stage-status.status-idle{clip-path:inset(50%);overflow:hidden}
.stage-status span:first-child{width:7px;height:7px;background:#86918f;border-radius:50%}
.stage-status span.live{background:var(--accent)}
.stage-toolbar{position:absolute;left:clamp(10px,3vw,34px);right:clamp(10px,3vw,34px);bottom:max(14px,env(safe-area-inset-bottom));z-index:2;display:grid;grid-template-columns:1fr auto 1fr;gap:8px;align-items:center;pointer-events:none}
.stage-toolbar button,.stage-toolbar a{pointer-events:auto}
.stage-toolbar a{justify-self:start}
.stage-toolbar a,.stage-toolbar #fullscreen{display:flex;align-items:center;gap:5px}
.stage-actions{justify-self:end;display:flex;gap:6px}
.stage-toolbar .quiet{background:#171c20e8;border-color:#434a4f}
.stage-toolbar .quiet:hover:enabled,.stage-toolbar a.quiet:hover{background:#282e33}
.stage-toolbar svg{width:16px;height:16px}
.stage-toolbar a circle{fill:#171c20}
.view-options{display:flex;gap:3px;background:#171c20e8;border:1px solid #42494e;border-radius:9px;padding:4px}
.view-options button{background:transparent;border:none;color:var(--muted);border-radius:5px;padding:6px 10px;font-size:14px}
.view-options button.active{background:#34413f;color:var(--accent)}
svg{fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;width:19px;height:19px;flex:none}
.sidebar{display:grid;grid-template-columns:1.15fr 1fr 1fr;align-items:start;gap:14px;max-width:1240px;margin:auto;padding:23px clamp(14px,4vw,48px) 0;scroll-margin-top:12px}
.input-guide{margin:0 0 1px;color:var(--muted);font-size:14px;line-height:1.5}
.sidebar:focus{outline:none}
.panel{border:1px solid var(--line);border-radius:14px;background:var(--panel);padding:18px}
.panel h2{font-size:16px;margin:0 0 11px;display:flex;gap:9px;align-items:center;font-weight:650}
.panel h2 svg{color:var(--accent)}
.layer-list label{position:relative;min-height:37px;display:flex;align-items:center;gap:9px;border-bottom:1px solid #282d31;font-size:14px;cursor:pointer}
.layer-list label:last-child{border-bottom:0}
.swatch{width:9px;height:9px;border-radius:50%;background:#afafaf}
.swatch.skin{background:transparent;border:1px solid #b7bdbd}.swatch.bone{background:#ececec}.swatch.organ{background:#a9a9a9}.swatch.vessel{background:#878787}.swatch.nerve{background:#cbcbcb}.swatch.lymph{background:#777}.swatch.muscle{background:#999}
.layer-list input{position:absolute;right:0;opacity:0}
.layer-list i{margin-left:auto;width:30px;height:17px;border-radius:15px;position:relative;background:#343a3f;border:1px solid #4b5459}
.layer-list i::before{content:"";position:absolute;left:2px;top:2px;width:11px;height:11px;background:#a4adb0;border-radius:50%}
.layer-list input:checked+i{background:#3e6159;border-color:#547b72}
.layer-list input:checked+i::before{left:15px;background:#d5f2e9}
.layer-list input:focus-visible+i{outline:2px solid var(--accent);outline-offset:3px}
.range-label{display:flex;justify-content:space-between;margin-top:13px;color:var(--muted);font-size:14px}
.range-label output{color:var(--text);font:13px var(--mono)}
input[type=range]{width:100%;margin:9px 0 0;accent-color:var(--accent);cursor:pointer}
.physics-data{padding:9px 0 12px;display:flex;justify-content:space-between;gap:6px;align-items:baseline;border-bottom:1px solid var(--line);font-size:14px;color:var(--muted)}
.physics-data strong{font:23px var(--mono);color:var(--text);white-space:nowrap}
.physics-data small{font-size:12px;color:var(--muted)}
.hold{display:flex;align-items:center;gap:6px;font-size:14px;cursor:pointer}
.hold input{accent-color:var(--accent);width:15px;height:15px;margin:0 4px 0 0}
.physics p,.shape-panel p{margin:7px 0 14px;font-size:13px;line-height:1.6;color:var(--muted)}
.actions{display:flex;gap:7px;flex-wrap:wrap}
.actions button{flex:1;padding:8px 7px;min-width:85px}
#reset{border:1px solid #bce2d7;border-radius:8px;background:var(--accent);color:#142421;font-size:14px;font-weight:650}
#reset:hover{background:#d4eee7}
footer{display:flex;align-items:center;justify-content:space-between;gap:10px;max-width:1240px;margin:auto;padding:16px clamp(14px,4vw,48px) 20px;font-size:13px;color:#9aa3a8}
.loading{position:absolute;z-index:4;inset:0;display:grid;align-content:center;justify-items:center;pointer-events:none;color:var(--text);background:#1b202491}
.spinner{border:2px solid #61726e;border-top-color:var(--accent);width:27px;height:27px;border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.grab-label{position:absolute;pointer-events:none;z-index:3;background:#20312e;color:#dbf4ed;border:1px solid #6d8c83;padding:5px 8px;border-radius:6px;font-size:12px}
dialog{width:min(480px,calc(100% - 30px));background:#1b2125;border:1px solid #414a50;border-radius:12px;color:var(--text);padding:24px;line-height:1.65}
dialog::backdrop{background:#090b0dcc}
dialog h2{margin:0 0 14px;font-size:21px}
dialog a{color:var(--accent);margin-right:12px}
.close{float:right}
.shape-panel summary{display:flex;align-items:center;gap:9px;cursor:pointer;font-size:16px;font-weight:650;list-style:none}
.shape-panel summary::-webkit-details-marker{display:none}
.shape-panel summary svg{color:var(--accent)}
.shape-panel summary circle{fill:var(--panel)}
.shape-panel summary::after{content:"";width:7px;height:7px;margin-left:auto;margin-right:3px;border-bottom:1px solid var(--muted);border-right:1px solid var(--muted);transform:rotate(45deg)}
.shape-panel[open] summary::after{transform:rotate(225deg)}
.shape-panel summary:focus-visible{outline:2px solid var(--accent);outline-offset:4px;border-radius:4px}
.shape-panel p{margin:10px 0 6px}
.shape-panel button{margin-top:13px}
@media(max-width:760px){.sidebar{grid-template-columns:repeat(2,minmax(0,1fr))}.physics{grid-column:1/-1}}
@media(max-width:480px){.sidebar{grid-template-columns:1fr}.stage-toolbar{gap:4px}.stage-toolbar .quiet{font-size:12px;padding:7px 6px}.stage-toolbar a svg,.stage-toolbar #fullscreen svg{display:none}.stage-actions{gap:4px}.view-options{padding:3px}.view-options button{padding:5px 7px;font-size:13px}}
@media(prefers-reduced-motion:reduce){.spinner{animation:none}}

.control-intro{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
#pet-launch-help{flex-basis:100%;text-align:right}
.hang-controls{position:absolute;z-index:2;top:46%;left:calc(50% + clamp(112px,13.5vw,210px));display:grid;gap:8px;padding:9px 11px;border:1px solid #424a4d;border-radius:10px;background:#171c20e8}
.hang-controls .hold{white-space:nowrap}
.hang-controls button{width:100%;padding:6px 7px;font-size:13px}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
@media(max-width:640px){.hang-controls{top:auto;left:auto;right:clamp(10px,3vw,34px);bottom:calc(max(14px,env(safe-area-inset-bottom)) + 51px)}.hang-controls .hold{font-size:13px}}
