:root{font-family:"Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,sans-serif;color:#584c49;background:#e9e2dc;font-synthesis:none;--pink:#b86e87;--line:#ebe2dc}
.stage[data-location=magic]{background:#0d1023;color:#e0d8f4}
.stage[data-location=magic] canvas{height:calc(100% - 208px)}
.stage[data-location=magic] .stage-button,.stage[data-location=magic] .icon-button{background:#22263de6;color:#e0d8f4;border-color:#79739460}
.stage[data-location=magic] .fps{color:#9c95b3;text-shadow:none}
.stage[data-location=magic] .jump-button{left:auto;right:16px;bottom:230px;translate:0 0;width:96px;min-height:44px;gap:5px;font-size:12px;color:#d4c5f0;background:#2c2946c9;border-color:#6e63855c;box-shadow:none}
.stage[data-location=magic] .jump-button svg{width:17px;height:17px}
.magic-controls{position:absolute;z-index:2;bottom:max(25px,calc(env(safe-area-inset-bottom) + 12px));left:20px;right:20px;padding:14px 16px 10px;border-radius:22px;background:linear-gradient(140deg,#24263dee,#1b1c32f5);border:1px solid #7e729840;box-shadow:0 -12px 55px #12122966}
.magic-heading{display:flex;align-items:center;justify-content:space-between;gap:6px;font-size:15px;letter-spacing:.07em;color:#e9dff8}
.magic-size-label{font-size:10px;letter-spacing:0;color:#9e96b5}.magic-size-label output{font-variant-numeric:tabular-nums;color:#ddd3ef;margin-left:5px}
#magic-meter{display:block;width:100%;height:3px;margin:10px 0 12px;border:0;background:#38334c;border-radius:4px;appearance:none}#magic-meter::-webkit-meter-bar{height:3px;background:#38334c;border:0}#magic-meter::-webkit-meter-optimum-value{background:linear-gradient(90deg,#a083db,#83d3e4)}#magic-meter::-moz-meter-bar{background:#a083db}
.spell-picker{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.spell-picker button{--spell:#ffac6f;display:flex;align-items:center;justify-content:center;gap:10px;position:relative;min-height:62px;touch-action:none;border:1px solid color-mix(in srgb,var(--spell) 30%,transparent);border-radius:15px;background:color-mix(in srgb,var(--spell) 8%,#171a2e);color:var(--spell);font-size:16px;font-weight:600;transition:box-shadow .15s,background .15s}.spell-picker button[data-spell=ice]{--spell:#88d8ff}.spell-picker button[data-spell=thunder]{--spell:#c7a0ff}.spell-picker button[aria-pressed=true]{box-shadow:inset 0 0 24px color-mix(in srgb,var(--spell) 12%,transparent),0 0 16px color-mix(in srgb,var(--spell) 9%,transparent);border-color:color-mix(in srgb,var(--spell) 65%,transparent)}.spell-picker button:active{background:color-mix(in srgb,var(--spell) 24%,#171a2e)}.spell-picker svg{width:28px;height:28px;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round;fill:color-mix(in srgb,var(--spell) 16%,transparent);filter:drop-shadow(0 0 5px color-mix(in srgb,var(--spell) 35%,transparent))}.spell-picker [data-spell=ice] svg{fill:none}.spell-picker small{position:absolute;right:7px;top:5px;font:9px system-ui;opacity:.5}.magic-status{margin:11px 0 3px;min-height:1.5em;color:#d4cae6;font-size:11px;text-align:center;line-height:1.5}.magic-hint{margin:0;color:#a49bb6;font-size:10px;text-align:center;line-height:1.6}
@media(max-width:360px){.magic-controls{left:12px;right:12px;padding:12px}.magic-heading{font-size:13px}.spell-picker{gap:6px}.spell-picker button{gap:6px;min-height:58px}.magic-size-label{font-size:9px}}
@media(max-height:620px) and (orientation:landscape){.stage[data-location=magic]{width:min(100%,920px)}.stage[data-location=magic] canvas{left:245px;width:calc(100% - 245px);height:100%}.magic-controls{left:12px;right:auto;width:228px;bottom:22px}.magic-heading{font-size:12px;letter-spacing:0}.magic-size-label{font-size:9px}.spell-picker{gap:5px}.spell-picker button{flex-direction:column;gap:4px;font-size:12px;min-height:71px}.spell-picker svg{width:24px;height:24px}.magic-status{min-height:3em}.stage[data-location=magic] .jump-button{bottom:22px}.magic-hint{font-size:10px}}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}button,input{font:inherit;-webkit-tap-highlight-color:transparent}button{color:inherit;cursor:pointer;touch-action:manipulation;user-select:none;-webkit-user-select:none}button:active{transform:scale(.96)}button:disabled{opacity:.4;cursor:default}button:focus-visible,input:focus-visible,canvas:focus-visible{outline:3px solid #bd7490;outline-offset:3px}[hidden]{display:none!important}
.stage{position:relative;isolation:isolate;width:min(100%,520px);height:100dvh;margin:auto;overflow:hidden;background:#f6eee9;box-shadow:0 0 70px #604b3718}canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:grab}
.stage[data-loading=true]>:not(#loading):not(#overlay){visibility:hidden}
.loading-screen{position:absolute;inset:0;z-index:7;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#f6eee9;padding:28px}.loading-screen img{border-radius:25px;box-shadow:0 9px 26px #b7759220}.loading-screen p{margin:24px 0 18px;font-size:13px;color:#8a6e76;letter-spacing:.06em}.loading-track{width:min(232px,100%);display:flex;align-items:center;gap:12px}.loading-track progress{appearance:none;-webkit-appearance:none;display:block;flex:1;min-width:0;height:7px;border:0;border-radius:10px;overflow:hidden;background:#e9dadf}.loading-track progress::-webkit-progress-bar{background:#e9dadf;border-radius:10px}.loading-track progress::-webkit-progress-value{background:#be8196;border-radius:10px;transition:width .12s ease}.loading-track progress::-moz-progress-bar{background:#be8196;border-radius:10px}.loading-track [data-percent]{min-width:3.4em;text-align:right;color:#997783;font:11px/1.4 system-ui,sans-serif;font-variant-numeric:tabular-nums}.compact-loading{margin-top:15px}.compact-loading p{font-size:11px;color:#8a7a73;margin:0 0 9px}.compact-loading .loading-track{width:100%}.sound-settings .setting-row{border:0;min-height:44px;margin-top:-10px;margin-bottom:12px}.audio-volume+.audio-volume{margin-top:12px}.setting-status{font-size:11px;line-height:1.6;color:#986571;margin:8px 0 0}
.edge-controls{position:absolute;top:max(14px,env(safe-area-inset-top));right:max(12px,env(safe-area-inset-right));display:flex;gap:7px;z-index:4}.icon-button{display:grid;place-items:center;width:44px;height:44px;padding:11px;border:1px solid #ffffffb3;border-radius:50%;background:#fffaf2ed;color:#78675f;box-shadow:0 2px 10px #5c493b08}.icon-button svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}.icon-button[aria-pressed=true]{background:#f0dce5;color:#a35372}
.jump-button{position:absolute;bottom:max(28px,calc(env(safe-area-inset-bottom) + 14px));left:50%;translate:-50% 0;width:156px;min-height:78px;display:flex;align-items:center;justify-content:center;gap:11px;border:1px solid #fff9;border-radius:40px;background:#fff7f4ec;box-shadow:0 8px 30px #84526922,inset 0 1px #fff;color:#a45d77;font-size:15px;font-weight:600;letter-spacing:.04em;z-index:2;}.jump-button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.goal{position:absolute;top:max(25px,calc(env(safe-area-inset-top) + 10px));left:16px;font-size:16px;color:#bd9147;letter-spacing:1px;pointer-events:none}.pause-shade{position:absolute;inset:0;background:#f6eee953;display:grid;place-items:center;pointer-events:none;z-index:3}.pause-shade span{padding:12px 20px;border-radius:24px;background:#fffaf0cc;font-size:13px;color:#887870;backdrop-filter:blur(8px)}
.overlay{position:absolute;inset:0;background:#f5eee9ed;z-index:8;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:28px;text-align:center}.overlay strong{font-size:19px}.overlay p{font-size:13px;line-height:1.8;overflow-wrap:anywhere}.primary-button{border:0;border-radius:24px;padding:14px 26px;background:var(--pink);color:white;min-height:48px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.fps{position:absolute;right:max(9px,env(safe-area-inset-right));bottom:max(7px,env(safe-area-inset-bottom));z-index:5;pointer-events:none;user-select:none;font:11px/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;font-variant-numeric:tabular-nums;color:#61585b;text-shadow:0 1px 3px #fffc}
dialog{width:min(460px,calc(100vw - 20px));max-height:calc(100dvh - max(24px,env(safe-area-inset-top)) - max(24px,env(safe-area-inset-bottom)));padding:0;border:1px solid #fff8;border-radius:26px;background:#fffaf5;color:#584c49;box-shadow:0 20px 90px #42382e35;overflow:auto;overscroll-behavior:contain}dialog::backdrop{background:#65574a40;backdrop-filter:blur(5px)}.settings-head{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;padding:17px 19px;background:#fffaf5f5;border-bottom:1px solid var(--line)}h1{font-size:18px;margin:0;font-weight:600;letter-spacing:.12em}.settings-body{padding:4px 24px 24px}.settings-body section{padding:20px 0;border-bottom:1px solid var(--line)}h2,.setting-label label{margin:0 0 12px;font-size:12px;font-weight:500;color:#8a7a73}.segmented{display:flex;padding:4px;gap:4px;border-radius:14px;background:#f0e9e3}.segmented button{flex:1;min-height:44px;border:0;border-radius:10px;background:transparent;font-size:12px}.segmented button[aria-pressed=true]{background:#fffdf9;color:#ac5d7c;box-shadow:0 2px 6px #5c493b08}.setting-label{display:flex;justify-content:space-between;align-items:center}.setting-label label{margin:0}.setting-label output{font-size:11px;color:var(--pink)}input[type=range]{width:100%;height:36px;accent-color:#be8196;margin:6px 0 0;touch-action:pan-x}.range-labels{display:flex;justify-content:space-between;font-size:10px;color:#a29289}.setting-row{display:flex;align-items:center;justify-content:space-between;min-height:62px;border-bottom:1px solid var(--line);font-size:12px}.toggle{width:52px;height:44px;border:0;border-radius:23px;background:transparent;padding:10px 0;position:relative}.toggle:before{content:"";position:absolute;left:0;top:10px;width:52px;height:24px;background:#e7ddd5;border-radius:20px}.toggle i{position:relative;display:block;width:18px;height:18px;margin:3px;border-radius:50%;background:white;transition:translate .15s}.toggle[aria-checked=true]:before{background:#c4879d}.toggle[aria-checked=true] i{translate:28px 0}.camera-controls,.move-controls{display:flex;gap:8px}.camera-controls button,.move-controls button,.wide-button{border:1px solid var(--line);border-radius:12px;background:#f9f2ec;min-height:44px;font-size:18px;flex:1}.wide-button{width:100%;font-size:13px}.move-controls{margin-top:9px}#water-particles{margin-top:20px;font-size:11px}
@media(max-width:360px){.edge-controls{gap:3px;right:8px}.goal{font-size:13px;left:10px;letter-spacing:0}.settings-body{padding-inline:16px}.jump-button{min-height:72px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}

.location-picker{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
#stage-error{white-space:pre-line;overflow-wrap:anywhere;font-size:12px;line-height:1.6}
.place-settings .setting-label:not(:first-child){margin-top:18px}.place-settings .setting-label label{font-size:14px}.location-picker button{padding:8px 5px}

html[lang=en]{font-family:system-ui,sans-serif}html[lang=en] h1{letter-spacing:.02em}

.stage-controls{position:absolute;top:max(14px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));right:120px;display:flex;align-items:center;gap:6px;z-index:4}.stage-controls .icon-button{flex:0 0 44px}.stage-button{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;min-height:44px;padding:8px 13px;border:1px solid #ffffffb3;border-radius:24px;background:#fffaf2ed;font-size:12px;max-width:100%}#stage-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.goal{top:max(72px,calc(env(safe-area-inset-top) + 58px))}.general-settings-link{margin-top:20px}#stage-settings-title{font-size:15px;letter-spacing:.02em}[data-close]{font-size:23px;flex-shrink:0}@media(max-width:360px){.stage-controls{left:8px;right:107px;gap:3px}.stage-button{padding-inline:10px;font-size:11px}}

.customize-button{position:absolute;bottom:max(126px,calc(env(safe-area-inset-bottom) + 112px));left:50%;translate:-50% 0;min-height:44px;white-space:nowrap;padding:10px 20px;border:1px solid #e5d4d9;border-radius:24px;background:#fffaf5eb;color:#9b5772;font-size:14px;z-index:2}
.room-editor{position:absolute;bottom:0;left:0;right:0;height:49%;z-index:5;background:#fffaf5;border-top:1px solid #ead8de;border-radius:24px 24px 0 0;box-shadow:0 -8px 30px #6f405518;display:flex;flex-direction:column;padding-bottom:env(safe-area-inset-bottom)}
.room-editor-head{display:flex;align-items:center;justify-content:space-between;padding:12px 20px;border-bottom:1px solid var(--line);flex-shrink:0}.room-editor-head h1{font-size:16px;letter-spacing:.02em}.room-done{min-width:76px;min-height:44px;border:0;border-radius:22px;background:#b76d87;color:white;font-size:14px}.room-editor-body{padding:14px 20px 22px;overflow:auto;overscroll-behavior:contain}.room-editor-body .segmented button{font-size:14px;min-height:44px}.character-range{margin-top:15px}.character-range label,.character-color-row label{font-size:14px;color:#695958}.character-range output{font-size:13px}.room-editor .range-labels{font-size:12px}.room-editor h2{font-size:14px}.character-color-row{display:flex;align-items:center;justify-content:space-between;margin-top:15px;gap:8px}.color-swatches{display:flex;gap:5px;align-items:center}.swatch{width:34px;height:38px;border:4px solid #fffaf5;border-radius:50%;box-shadow:0 0 0 1px transparent}.swatch[aria-pressed=true]{box-shadow:0 0 0 2px #936277}.pink{background:#ed87b0}.blue{background:#74bddd}.green{background:#8bbd87}.cream{background:#e8cd8c}.grey{background:#92939c}#character-color{width:34px;height:38px;padding:2px;border:1px solid #d5c7ca;border-radius:8px;background:transparent;cursor:pointer}.room-editor .setting-row{font-size:14px}.character-reset{display:block;margin:14px auto 0;min-height:44px;border:0;background:transparent;text-decoration:underline;text-underline-offset:4px;color:#9a6c7e;font-size:13px}.editing-character canvas{height:51%}.editing-character .jump-button,.editing-character .customize-button,.editing-character .fps{display:none}.editing-character .pause-shade{bottom:49%}.editing-character .edge-controls{z-index:4}.editing-character .stage-controls{z-index:4}
@media(max-width:360px){.room-editor-head,.room-editor-body{padding-left:14px;padding-right:14px}.color-swatches{gap:2px}.swatch{width:30px}.room-editor-body .segmented button{font-size:13px}}

/* Cloth play keeps fabric choices within reach without opening a modal. */
.stage[data-location=cloth] canvas{height:calc(100% - 290px)}
.cloth-controls{position:absolute;z-index:2;bottom:max(22px,calc(env(safe-area-inset-bottom) + 12px));left:50%;translate:-50% 0;width:min(440px,calc(100% - 28px));padding:16px 18px 12px;border:1px solid #fff9;border-radius:23px;background:#fffaf4ed;box-shadow:0 8px 40px #75594e14;}
.cloth-heading{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:12px;font-size:15px;color:#79655d;letter-spacing:.06em}.cloth-caption{font-size:12px;color:#a08a80;letter-spacing:0}.cloth-picker{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}.cloth-picker button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:76px;padding:8px 3px;border:1px solid #e9dfd5;border-radius:13px;background:#fffaf5;color:#806e65;font-size:12px}.cloth-picker button[aria-pressed=true]{border-color:#b88498;background:#f9edf1;box-shadow:0 0 0 1px #b8849860}.cloth-picker small{font-size:12px;color:#a66f3f}.fabric-swatch{display:block;width:34px;height:22px;border-radius:2px 7px 2px 7px;box-shadow:0 2px 4px #735e4e20;rotate:-6deg}.cotton{background:repeating-linear-gradient(0deg,#86bfc680 0 5px,#559ca780 5px 10px),repeating-linear-gradient(90deg,#86bfc6 0 5px,#65a9b4 5px 10px)}.satin{background:linear-gradient(130deg,#9270b2 10%,#d2bfe6 43%,#8b64ab 64%,#b595cd)}.gauze{background:#eac797;border:1px dashed #bf9663}.cloth-description{min-height:2.8em;margin:10px 0 8px;font-size:12px;line-height:1.5;color:#8b766b}.cloth-actions{display:flex;gap:8px}.cloth-actions button{flex:1;min-height:44px;border:1px solid #e4d8d0;border-radius:22px;font-size:12px;background:#f5e7ec;color:#9b6478}.cloth-actions button+button{background:#fffaf5;color:#948175}.cloth-status{font-size:12px;line-height:1.5;color:#9a8578;margin:8px 0 0;min-height:1.5em}.stage[data-location=cloth] .jump-button{left:auto;right:16px;bottom:calc(330px + env(safe-area-inset-bottom));translate:0 0;width:100px;min-height:48px;font-size:12px;gap:5px}.stage[data-location=cloth] .jump-button svg{width:18px;height:18px}
@media(max-height:620px){.cloth-controls{left:12px;bottom:12px;translate:0 0;width:260px;padding:10px 12px}.cloth-heading{font-size:12px;margin-bottom:7px}.cloth-caption{display:none}.cloth-picker button{min-height:57px;gap:3px}.fabric-swatch{width:24px;height:14px}.cloth-description{min-height:0;margin:7px 0;font-size:12px}.cloth-status{display:none}.cloth-actions button{min-height:36px}.stage[data-location=cloth] .jump-button{bottom:24px}}
@media(max-height:620px) and (orientation:landscape){.stage[data-location=cloth]{width:min(100%,920px)}.stage[data-location=cloth] canvas{left:260px;width:calc(100% - 260px);height:100%}.cloth-controls{width:236px}.stage[data-location=cloth] .jump-button{right:16px;bottom:16px}}
@media(max-height:620px) and (orientation:portrait){.stage[data-location=cloth] canvas{height:calc(100% - 225px)}.cloth-controls{width:calc(100% - 24px)}.stage[data-location=cloth] .jump-button{bottom:250px}}
@media(max-height:620px) and (orientation:landscape){.magic-heading{flex-wrap:wrap;row-gap:5px}.magic-heading>span:first-child{width:100%;font-size:14px;white-space:nowrap}.magic-size-label{margin-left:auto}}

/* Curtain controls leave the full height of the hanging fabric visible. */
.curtain-controls{position:absolute;z-index:4;left:50%;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(440px,calc(100% - 28px));padding:14px 16px 10px;border:1px solid #ffffffcf;border-radius:20px;background:#faf8f0ee;box-shadow:0 8px 32px #26332b18;backdrop-filter:blur(16px)}
.curtain-controls[hidden]{display:none}.curtain-picker{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.curtain-picker button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:64px;border:1px solid #d4d9d5;border-radius:12px;background:#ffffff66;color:#42514b;font-size:.875rem;cursor:pointer}.curtain-picker button[aria-pressed=true]{border-color:#4e746d;background:#e2eae6;box-shadow:inset 0 0 0 1px #4e746d}.curtain-swatch{display:block;width:36px;height:19px;border-radius:2px 2px 5px 5px;background:repeating-linear-gradient(90deg,#809e97 0,#c5d5cd 6px,#7a978f 12px)}.curtain-swatch.lace{background:repeating-linear-gradient(90deg,#d0d9d580 0,#fff8 5px,#d0d9d580 10px),repeating-linear-gradient(0deg,#aabdb780 0 1px,transparent 1px 4px)}.curtain-swatch.water{background:repeating-linear-gradient(95deg,#61b2cbb8 0,#b4f3f6c0 5px,#519bcb99 11px)}.curtain-opening{display:flex;align-items:center;gap:8px;margin-top:12px}.curtain-opening input{min-width:30px;flex:1;accent-color:#5d8279;cursor:ew-resize}.curtain-opening button{flex:none;border:0;border-radius:8px;padding:9px 7px;background:transparent;color:#435a52;font-size:.875rem;cursor:pointer}.curtain-opening button:hover{background:#dfe8e3}.curtain-opening #curtain-wind{border:1px solid #c4d0c9;padding:8px}.curtain-opening #curtain-wind[aria-pressed=true]{background:#dae6e0;border-color:#91ada0}.curtain-hint{margin:8px 0 0;text-align:center;color:#65756c;font-size:.8125rem;line-height:1.5}
.stage[data-location=curtains] .stage-controls{background:#fbfaf3e8}.stage[data-location=curtains] #scene{cursor:grab}
@media(max-height:520px){.curtain-controls{bottom:8px;padding:8px 12px;width:min(410px,calc(100% - 24px))}.curtain-picker button{min-height:37px;flex-direction:row}.curtain-swatch{width:23px;height:16px}.curtain-opening{margin-top:4px}.curtain-hint{display:none}}

.stage[data-location=curtains] canvas{height:calc(100% - 178px)}
.stage[data-location=curtains] .pause-shade{bottom:178px}
@media(max-height:520px){.stage[data-location=curtains]{width:min(100%,820px)}.stage[data-location=curtains] canvas{height:calc(100% - 111px)}.stage[data-location=curtains] .pause-shade{bottom:111px}}
