:root {
  color-scheme:light;
  --lavender:#c8c4d7;
  --button-surface:#fbfaf7;
  --button-ink:#4d4757;
  --button-active:#4d475e;
  --tool-size:clamp(28px,3.35vw,44px);
  --toolbar-gap:clamp(4px,.48vw,7px);
  --inset:clamp(7px,1vw,15px);
}
*{box-sizing:border-box}
html,body{width:100%;height:100%;margin:0}
body{min-height:100dvh;background:var(--lavender);color:var(--button-ink);font:400 15px/1.38 system-ui,sans-serif}
[hidden]{display:none!important}
button{font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
button:focus-visible{outline:2px solid #29223e;outline-offset:2px}
svg{display:block}
.symbols{position:absolute;width:0;height:0;overflow:hidden}
.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.stage{position:relative;isolation:isolate;width:100%;height:100vh;height:100dvh;overflow:hidden;min-height:220px}
.stage-bg{position:absolute;inset:0;background:var(--lavender)}
.cat-canvas,.portrait-effects,.crown-effects{position:absolute;display:block;pointer-events:none}
.cat-canvas{inset:0;width:100%;height:100%;opacity:0}
.portrait-effects{inset:0;width:100%;height:100%;z-index:1;visibility:hidden}
.crown-effects{inset:0;width:100%;height:100%;z-index:2;visibility:hidden}
.wand-pointer{position:absolute;left:-19px;top:-21px;width:76px;height:76px;z-index:4;pointer-events:none;overflow:visible;transform-origin:19px 21px;will-change:transform;filter:drop-shadow(0 1px 1px #48375130)}
.stage:is([data-mode="wand"],[data-mode="orbit"]){touch-action:none}
.stage[data-view="ready"][data-mode="orbit"]{cursor:grab;user-select:none;-webkit-user-select:none}
.stage[data-orbit-dragging] .stage-bg,.stage[data-orbit-dragging] .cat-target,.stage[data-orbit-dragging]{cursor:grabbing!important}
.orbit-note{position:absolute;z-index:3;bottom:max(clamp(5px,1.05dvh,15px),env(safe-area-inset-bottom));left:50%;translate:-50% 0;max-width:calc(100% - 24px);padding:clamp(4px,.95dvh,7px) 12px;display:flex;align-items:center;gap:8px;border:1px solid #fff9;border-radius:999px;background:#fbf9fff0;color:#4d475e;font-size:12px;pointer-events:none;box-shadow:0 1px 4px #5049591c}
.orbit-note>span{display:flex;align-items:center;gap:9px;white-space:nowrap}
.orbit-note svg{width:17px;height:17px;flex:none;fill:none;stroke:currentColor;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round}
.orbit-divider{width:1px;height:12px;background:#b8b0c5}
.stage[data-wand-active="true"],.stage[data-wand-active="true"] .cat-target{cursor:none}
.stage[data-view="ready"] .cat-canvas{opacity:1}
.stage[data-view="ready"] :is(.portrait-effects,.crown-effects){visibility:visible}
.stage:not([data-view="ready"]) .cat-target{visibility:hidden}
.model-note{position:absolute;left:50%;bottom:max(15px,env(safe-area-inset-bottom));translate:-50% 0;z-index:3;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 10px;align-items:center;width:max-content;max-width:calc(100% - 36px);padding:8px 12px;border:1px solid #fff9;border-radius:9px;background:#fbf9fff7;color:#4d475e;font-size:13px;line-height:1.35;box-shadow:0 2px 8px #43395522;pointer-events:none;cursor:default}
.model-note[data-status="error"]{padding:3px 4px 3px 12px}
#load-progress{grid-column:1/-1;width:100%;height:4px;appearance:none;border:0;border-radius:3px;background:#e4deed;color:#736184}
#load-progress::-webkit-progress-bar{background:#e4deed;border-radius:3px}
#load-progress::-webkit-progress-value{background:#736184;border-radius:3px}
#load-progress::-moz-progress-bar{background:#736184;border-radius:3px}
#load-retry{min-height:44px;padding:0 12px;border:0;border-radius:6px;background:var(--button-active);color:#fff;font-size:12px;font-weight:650;pointer-events:auto;cursor:pointer}
#load-retry:hover{background:#655773}
.cat-target{position:absolute;z-index:1;border:0;padding:0;background:none;touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab}
.cat-target:active{cursor:grabbing}
.stage[data-view="ready"][data-mode="pet"] :is(.stage-bg,.cat-target){cursor:url('../assets/pet-hand.svg') 16 3,grab}
.cat-target[data-mode="chin"]{cursor:pointer}
.chin-cue{display:none;fill:none;stroke:#fff8f2;stroke-width:1.5px;stroke-dasharray:2.5 3;filter:drop-shadow(0 0 1px #59475b)}
.stage[data-mode="chin"] .chin-cue:not(.is-touching){display:block}
.cat-target:focus-visible{outline-offset:-10px;border-radius:30%}
.tools{position:absolute;z-index:3;display:flex;align-items:start;gap:var(--toolbar-gap);top:max(var(--inset),env(safe-area-inset-top))}
.tools-left{left:max(var(--inset),env(safe-area-inset-left))}
.tools-right{right:max(var(--inset),env(safe-area-inset-right));flex-direction:column}
.tool{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1px;width:var(--tool-size);height:var(--tool-size);padding:2px 0;border:1px solid #fffc;border-radius:clamp(5px,.64vw,9px);background:var(--button-surface);color:var(--button-ink);box-shadow:0 1px 2px #50495929;white-space:nowrap;font-size:clamp(10px,.95vw,12px);font-weight:550;line-height:1.13}
.tool svg,.popover svg{width:clamp(13px,1.46vw,19px);height:clamp(13px,1.46vw,19px);stroke:currentColor;fill:none;stroke-width:1.55;stroke-linecap:round;stroke-linejoin:round;flex:none}
button.tool:hover{background:#fff}
.tool.primary-tool,.tool[aria-pressed="true"],.tool:not(.primary-tool)[aria-expanded="true"]{--button-surface:var(--button-active);background:var(--button-active);color:#fff;border-color:#4d475e}
.tool.primary-tool[aria-expanded="true"]{background:#eeeaf3;color:var(--button-active);border-color:#f6f4fa}
button.tool:active{transform:translateY(1px)}
.xiaohongshu-label{cursor:default}
.popover{position:absolute;top:0;z-index:4;background:var(--button-surface);border:1px solid #fffc;border-radius:clamp(5px,.65vw,9px);box-shadow:0 3px 10px #43395528;color:var(--button-ink)}
.mode-list{right:calc(var(--tool-size) + var(--toolbar-gap));width:clamp(112px,12vw,155px);max-height:calc(100dvh - max(var(--inset),env(safe-area-inset-top)) - 6px);overflow-y:auto;padding:2px}
.popover-heading,.mode{display:flex;align-items:center;gap:clamp(6px,1vw,12px);padding:0 clamp(6px,.8vw,10px);font-size:clamp(11px,1vw,14px);text-align:left}
.popover-heading{height:calc(var(--tool-size) - 5px);margin-bottom:2px;color:#fff;background:var(--button-active);border-radius:5px;font-weight:650}
.mode{position:relative;width:100%;min-height:clamp(26px,3.3vw,42px);border:0;border-radius:5px;background:none}
.mode-orbit{margin-top:3px;border-top:1px solid #e6e1ed;border-top-left-radius:0;border-top-right-radius:0}
.mode:hover,.mode:focus-visible{background:#e9e5ef}
.mode[aria-pressed="true"]::after{content:'';width:5px;height:5px;border-radius:50%;margin-left:auto;background:#6f6386}
.copy-popover{padding:12px 13px;width:min(224px,66vw);font-size:13px;line-height:1.4}
.copy-popover strong{font-size:14px;color:#332d43}
.copy-popover p{margin:6px 0 0}
.help-panel{top:calc(var(--tool-size) + var(--toolbar-gap));left:0}
.help-panel{max-height:calc(100dvh - var(--tool-size) - 3 * var(--inset) - env(safe-area-inset-top));overflow-y:auto}
.cats-panel{top:calc(var(--tool-size) + var(--toolbar-gap));left:0;width:min(216px,calc(100vw - 2 * var(--inset)));max-height:calc(100dvh - var(--tool-size) - 3 * var(--inset) - env(safe-area-inset-top));padding:5px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y}
.cats-panel h2{margin:0 0 4px;padding:7px 9px;background:var(--button-active);color:#fff;border-radius:5px;font-size:13px;font-weight:650;line-height:1.25}
.cat-choices{display:grid;gap:2px}
.cat-choice{display:grid;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:44px;width:100%;padding:4px 8px;text-align:left;border:1px solid transparent;border-radius:5px;background:none}
.cat-choice[aria-pressed="true"]{border-color:#e6deed;background:#f1edf5}
.cat-choice:hover{background:#e9e5ef}
.cat-choice:focus-visible{outline-offset:-2px}
.cat-choice strong{color:#342d44;font-size:13px;font-weight:650;line-height:1.25}
.cat-choice small{color:#60566c;font-size:10px;font-weight:500}
.cat-swatch{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:#eee0d1;color:#604837}
.cat-swatch svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round}
[data-cat-choice="kitten"] .cat-swatch{background:#f3dce6;color:#783e56}
[data-cat-choice="golden"] .cat-swatch{background:#f6e4bb;color:#704914}
[data-cat-choice="silver"] .cat-swatch{background:#e5e9f0;color:#46546c}
[data-cat-choice="emerald"] .cat-swatch{background:#dcece4;color:#335b4a}
.cat-choice-state{font-size:10px;font-weight:650;white-space:nowrap;color:#584668}
.cat-choice[data-loading]{border-color:#b7a8c7;border-style:dashed;background:#f6f2f8}
.cat-picker-note{margin:4px 0 0;padding:6px 8px 3px;border-top:1px solid #e9e3ed;color:#60566c;font-size:11px;line-height:1.35}
#cats-tool:disabled{cursor:default;opacity:.62}
.shape-panel{--shape-accent:#736184;top:calc(var(--tool-size) + var(--toolbar-gap));left:0;width:min(236px,calc(100vw - 2 * var(--inset)));padding:10px 13px 13px;cursor:default;user-select:none;color:#3b3347}
.shape-header{display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid #e9e3ed;padding-bottom:3px;margin-bottom:8px}
.shape-header h2{margin:0;font-size:15px;font-weight:700;line-height:1.3}
.shape-default{border:0;border-radius:5px;background:transparent;color:#62536f;padding:0 5px;min-height:28px;font-size:12px;white-space:nowrap}
.shape-default:hover{background:#ebe5ef;color:#342a42}
.shape-control{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
.shape-control+.shape-control{border-top:1px solid #f0ebf2;padding-top:8px;margin-top:8px}
.shape-control label{font-size:13px;font-weight:650}
.shape-control output{padding:1px 5px;border-radius:4px;background:#ede8f1;color:#544461;font-size:11px;font-weight:650;font-variant-numeric:tabular-nums}
.shape-control input{appearance:none;-webkit-appearance:none;grid-column:1/-1;width:100%;height:30px;margin:0;cursor:ew-resize;border:0;border-radius:6px;background:linear-gradient(to right,var(--shape-accent) var(--shape-progress),#ddd5e3 var(--shape-progress)) no-repeat center/100% 4px;touch-action:none}
.shape-control input:focus-visible{outline:2px solid #3a294d;outline-offset:1px}
.shape-control input::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:15px;height:15px;border:2px solid var(--shape-accent);background:#fff;border-radius:50%;box-shadow:0 1px 2px #43395532}
.shape-control input::-moz-range-thumb{width:11px;height:11px;border:2px solid var(--shape-accent);background:#fff;border-radius:50%;box-shadow:0 1px 2px #43395532}
.shape-scale{grid-column:1/-1;display:flex;justify-content:space-between;color:#674f72;font-size:11px;line-height:1.2}
@media (pointer:coarse){#shape-tool{min-width:44px;min-height:44px}.shape-control input{height:44px}.shape-default{min-height:44px}}
@media (max-width:560px) and (min-height:530px){.shape-panel{position:fixed;top:auto;left:max(12px,env(safe-area-inset-left));bottom:calc(42px + env(safe-area-inset-bottom))}}
.cat-audio-status{top:auto;bottom:max(12px,env(safe-area-inset-bottom));left:50%;translate:-50% 0;width:max-content;max-width:80vw;z-index:5;padding:7px 10px;font-size:12px;pointer-events:none}
.music-status{top:calc(var(--tool-size) + var(--toolbar-gap));right:calc(var(--tool-size) + var(--toolbar-gap));width:max-content;max-width:min(60vw,220px);padding:7px 9px;font-size:12px}
@media (pointer:coarse){:root{--tool-size:44px;--toolbar-gap:5px}.tool{font-size:12px}.tool svg{width:17px;height:17px}.mode{min-height:44px}.mode-list{width:128px}}
@media (max-width:360px){.mode-list{width:112px}.copy-popover{width:min(194px,60vw)}}
@media (prefers-reduced-motion:reduce){.tool:active{transform:none}}

/* Reference layout: centered vertical toolbars. */
.tools{top:50%;transform:translateY(-50%);flex-direction:column}.tools-right #directory-tool{order:0}.tools-right #music-tool{order:1}.tools-right .xiaohongshu-label{order:2}.tools-right #play-tool{order:3}.tool.xiaohongshu-label{text-decoration:none;display:flex;align-items:center;justify-content:center}.tools-left .popover{left:calc(var(--tool-size) + 10px);top:0;max-height:75dvh}.tools-right .mode-list{top:0;max-height:75dvh}.brand-top,.brand-bottom{position:fixed;z-index:2;left:2%;right:2%;display:grid;grid-template-columns:1fr 1fr 1fr;color:#15131a;font:600 clamp(12px,.92vw,23px)/1.7 "Courier New",SimSun,monospace;pointer-events:none}.brand-top{top:max(12px,env(safe-area-inset-top))}.brand-top span:nth-child(2),.brand-bottom>span:nth-child(2){justify-self:center}.brand-top span:last-child,.brand-bottom>span:last-child{justify-self:end}.brand-bottom{bottom:max(12px,env(safe-area-inset-bottom))}.brand-bottom nav{display:flex;flex-direction:column}.brand-bottom a{color:inherit;text-decoration:none;pointer-events:auto}.brand-bottom a:hover{text-decoration:underline}.brand-bottom~*{pointer-events:auto}@media(max-width:560px){.tools-left .popover{position:fixed;left:calc(var(--tool-size) + 12px);top:0;bottom:auto;width:min(236px,calc(100vw - 2 * var(--tool-size) - 40px))}.brand-bottom{font-size:11px}.stage .view-status{bottom:65px}}

.orbit-note{bottom:76px!important}#cats-tool[aria-expanded=false]{background:var(--button-active);color:#fff}

/* A single-screen work must never create a page scrollbar. */
html,body{height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}body>.stage{position:fixed;inset:0;height:100dvh;min-height:0}

/* Match all framing labels to the tool button typography. */
#orbit-note{display:none!important}.brand-top,.brand-bottom{font-family:system-ui,sans-serif;font-weight:650;color:var(--button-ink)}

