@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Playfair+Display:ital,wght@0,400;0,500;1,400&display=swap');
:root{--ink:#2e382e;--paper:#f5f2e9;--line:#cfccbe;--accent:#697257}*{box-sizing:border-box}body{margin:0;font:13px 'DM Sans',Arial,sans-serif;color:var(--ink);background:#e6e2d7;overflow:hidden}button,input,textarea,select{font:inherit;color:inherit}button,a,input,textarea,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer;border:1px solid var(--line);border-radius:40px;background:#f7f4eced;padding:12px 18px;transition:background .2s,transform .2s}button:hover{background:#fffdf6}button:active{transform:scale(.97)}button:disabled{opacity:.5;cursor:wait}button:focus-visible,input:focus-visible{outline:2px solid #7e8f67;outline-offset:3px}button.primary{background:var(--ink);border-color:var(--ink);color:white}.primary:hover{background:#46523e}#world,#world>canvas,.vignette{position:fixed;inset:0;width:100%;height:100%}.vignette{pointer-events:none;background:linear-gradient(0deg,#eee9dd44,transparent 25%,transparent 80%,#eee9dd66)}header{position:fixed;left:0;right:0;top:0;z-index:4;padding:28px 4%;display:flex;align-items:center;justify-content:space-between;pointer-events:none}header>*{pointer-events:auto}.brand{text-decoration:none;color:var(--ink);font:25px Georgia,serif;letter-spacing:-1px}.brand span{color:#92764e}.brand small{display:block;font:8px Arial;letter-spacing:3.5px;margin-top:9px}.top-actions{display:flex;gap:8px;align-items:center}.pill{border:1px solid #b1b4a8;border-radius:30px;padding:10px 14px;font-size:9px;letter-spacing:1px;background:#f1efe388}.tag{font-size:9px;letter-spacing:2.5px;line-height:1.8}#welcome{position:absolute;left:8%;top:23%;width:420px;padding:0 20px 20px 0}h1{font:clamp(64px,7vw,100px)/.98 'Playfair Display',Georgia,serif;letter-spacing:-3px;margin:25px 0}em{font-weight:normal;color:#747d61}#welcome p{font-size:14px;line-height:1.9;color:#6f7466}#welcome:before{content:'';position:absolute;inset:-120px -120px -80px -180px;background:radial-gradient(ellipse,#eeeaddf0 40%,#eeeadd00 72%);z-index:-1}.entry{margin-top:26px;display:flex;gap:8px;flex-direction:column;width:270px}.entry input{border:0;border-bottom:1px solid #b6b9a6;background:#f8f6ed88;padding:14px;border-radius:4px}.entry button{display:flex;justify-content:space-between;padding:17px 22px}.micro{font-size:11px!important;line-height:1.7!important;color:#777c6e}.features{display:flex;gap:23px;margin-top:38px;font-size:8px;letter-spacing:1.4px}.room-label{position:fixed;left:4%;top:125px;pointer-events:none}.room-label h2{font:27px Georgia;margin:8px 0}.room-label p{font-size:11px;color:#77816c}.tools{position:fixed;bottom:28px;left:50%;transform:translateX(-50%);display:flex;gap:6px;white-space:nowrap;z-index:4}.tools button{box-shadow:0 4px 18px #3331;font-size:12px}.crosshair{position:fixed;left:50%;top:50%;color:#fff;font-size:20px;pointer-events:none;text-shadow:0 0 4px #000}#context{position:fixed;bottom:100px;width:100%;text-align:center;font-size:11px;pointer-events:none}#joystick{position:fixed;bottom:105px;left:30px;width:105px;height:105px;border:1px solid #ffffff99;border-radius:50%;background:#ede9dd55;touch-action:none;z-index:4}#knob{width:45px;height:45px;background:#f5f3e4c9;border:1px solid #92998588;border-radius:50%;position:absolute;top:29px;left:29px;pointer-events:none}.look-hint{position:fixed;right:35px;bottom:145px;font-size:8px;letter-spacing:2px;color:#68715e;pointer-events:none}#loading{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);background:var(--paper);padding:18px 25px;border-radius:10px}#toast{position:fixed;bottom:225px;left:50%;transform:translateX(-50%);background:#2f3a2eeb;color:white;border-radius:12px;padding:14px 22px;z-index:25;display:none;max-width:85vw;text-align:center}dialog{max-height:88svh;overflow:auto;background:var(--paper);border:1px solid #fff8;color:var(--ink);border-radius:16px;padding:30px;width:min(570px,92vw);box-shadow:0 30px 100px #1720134d}dialog::backdrop{background:#222a225c;backdrop-filter:blur(9px)}dialog h2{font:38px/1.15 'Playfair Display',Georgia;margin:12px 0 22px;letter-spacing:-.7px}dialog p{line-height:1.8;color:#717765}.close{float:right;padding:8px 12px}label{display:block;font-size:11px;margin:15px 0 6px}input:not([type=file]),textarea,select{display:block;width:100%;padding:12px 14px;border:1px solid #d0d0c0;border-radius:7px;background:#fffdf5;margin-top:7px}textarea{height:95px;resize:vertical}input[type=file]{width:100%;margin:10px 0;font-size:11px}.upload{border:1px dashed #aeb79c;border-radius:8px;padding:18px;cursor:pointer;display:flex;justify-content:space-between}.photo-row{display:grid;grid-template-columns:54px 1fr 30px;gap:10px;align-items:center;border-bottom:1px solid #d7d8c9;padding:10px 0}.photo-row img{width:54px;height:65px;object-fit:cover}.photo-row input{font-size:11px;padding:7px;margin:3px 0}.photo-row textarea{height:45px;font-size:10px;padding:5px;margin:3px 0}.photo-row button{padding:6px}.two{display:grid;grid-template-columns:1fr 1fr;gap:15px}#photo-list{max-height:280px;overflow:auto}#inspect-img{width:100%;max-height:48svh;object-fit:contain;margin:16px 0}#inspect-number{display:block;margin-top:10px}#film{width:100%;max-height:45vh;background:#151b16;border-radius:5px;margin:10px 0}#question-text{font:25px Georgia}#messages{height:200px;overflow:auto;padding:12px}.message{margin:0 0 12px;line-height:1.6;overflow-wrap:anywhere}.message strong{font-size:10px;display:block;color:#7c846e}#chat{position:fixed;right:25px;bottom:90px;width:300px;background:#f7f5ebf5;border:1px solid #fff;border-radius:12px;z-index:7;box-shadow:0 10px 50px #24301c22}.chat-head{padding:12px 14px;border-bottom:1px solid #d1d5c5;display:flex;justify-content:space-between;align-items:center}.chat-head button{padding:3px 9px}#chat-form{display:flex;padding:9px;border-top:1px solid #ddd;gap:5px}#chat-form input{min-width:0;margin:0}#chat-form button{font-size:11px;padding:8px}.action-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:22px 0}.heart{position:fixed;top:-50px;font-size:25px;color:#c77885;animation:fall 4s linear forwards;pointer-events:none}#hearts{position:fixed;inset:0;pointer-events:none;z-index:20}@keyframes fall{to{transform:translateY(110vh) rotate(90deg);opacity:0}}[hidden]{display:none!important}@media(max-width:650px){header{padding:20px}.brand{font-size:22px}.top-actions{gap:5px}.top-actions button{padding:10px 12px}#customize span{display:none}.pill{font-size:8px;padding:8px}#welcome{left:8%;top:24%;width:85%}h1{font-size:72px}.features{gap:18px}.room-label{top:105px;left:22px}.room-label h2{font-size:22px;max-width:250px}.tools{bottom:20px;gap:4px}.tools button{padding:12px 10px;font-size:10px}#joystick{bottom:95px;left:22px}.look-hint{right:20px;bottom:139px;font-size:7px}dialog{padding:23px}.two{grid-template-columns:1fr}#chat{right:15px;bottom:80px;width:290px}#context{bottom:220px}}
/* Game controls and wardrobe */
body{font-size:16px}button,input,textarea,select,label{font-size:14px}.micro,.hint,.room-label p{font-size:12px!important}.tag{font-size:12px}.pill{font-size:12px}.tools button{font-size:14px}.tools{bottom:calc(20px + env(safe-area-inset-bottom))}.tools button{backdrop-filter:blur(8px)}header{padding-top:calc(18px + env(safe-area-inset-top))}#joystick{width:122px;height:122px;bottom:calc(105px + env(safe-area-inset-bottom));left:calc(25px + env(safe-area-inset-left));background:#34412f26;border:2px solid #ffffffbd;box-shadow:inset 0 0 20px #fff4}#knob{top:35px;left:35px;width:48px;height:48px;box-shadow:0 3px 12px #18251233}.look-hint{font-size:11px;max-width:170px;text-align:right;line-height:1.6}#answer-game{height:160px;position:relative;margin:15px 0;border:1px solid #d5d8c7;border-radius:12px;overflow:hidden;background:#ebeede}#yes{position:absolute;left:18px;bottom:18px;min-width:106px}#no-run{position:absolute;left:65%;top:24px;min-width:70px;min-height:44px;transition:left .13s ease,top .13s ease;touch-action:none}#answer-no,#later{margin-right:5px;margin-top:7px}#avatar-preview{min-height:220px;background:radial-gradient(ellipse at bottom,#cdd7c0,#eeeede 70%);border-radius:14px;display:grid;place-items:center}#avatar-preview svg{height:235px;width:180px}.wardrobe-layout{display:grid;grid-template-columns:1fr 1fr;gap:22px}.costume-colors{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin:18px 0}.costume-colors label{font-size:12px}.costume-colors input[type=color]{width:100%;height:42px;padding:4px;border-radius:8px;background:#fffdf4;border:1px solid #c4cbb5;cursor:pointer}#orientation-tip{position:fixed;z-index:9;left:5%;right:5%;bottom:30%;border-radius:12px;background:#303e30e8;color:white;padding:16px;font-size:14px;line-height:1.6}#orientation-tip button{padding:5px 10px;float:right;margin-left:8px}#wardrobe-open{padding:12px 15px}.room-label{max-width:45vw}.room-label h2{font-size:24px}#loading{z-index:10;font-size:14px;max-width:85vw;line-height:1.6}.photo-row input,.photo-row textarea{font-size:14px}.features{font-size:12px}
@media(max-width:650px){header{padding-left:18px;padding-right:18px}.brand{font-size:20px}.top-actions .pill{display:none}.top-actions button{padding:10px;min-height:44px}.room-label{max-width:75vw}.tools button{font-size:12px;padding:12px 9px}.look-hint{font-size:10px;max-width:140px}.entry{width:min(280px,100%)}.wardrobe-layout{gap:12px}.costume-colors{gap:5px}.costume-colors label{font-size:11px}}
@media(orientation:landscape) and (max-height:600px){header{padding:10px max(22px,env(safe-area-inset-right)) 8px max(22px,env(safe-area-inset-left))}.brand{font-size:20px}.brand small{display:none}.top-actions button{padding:9px 13px}.pill{font-size:11px}.room-label{top:65px;left:max(22px,env(safe-area-inset-left));max-width:40vw}.room-label .tag{display:none}.room-label h2{font-size:19px;margin:2px 0}.room-label p{margin:5px 0}.tools{left:auto;right:max(20px,env(safe-area-inset-right));transform:none;bottom:max(16px,env(safe-area-inset-bottom));gap:5px}.tools button{font-size:12px;padding:11px 12px}#joystick{bottom:24px;left:max(28px,env(safe-area-inset-left));width:112px;height:112px}#knob{top:30px;left:30px}#context{bottom:70px;left:auto;right:24px;width:auto;max-width:55vw;font-size:12px}.look-hint{right:28px;bottom:105px;max-width:220px;font-size:10px}#chat{right:20px;bottom:65px}#messages{height:120px}#welcome{top:23%;left:8%;width:76%;display:grid;grid-template-columns:1fr 1fr;column-gap:30px}#welcome .tag{grid-column:1}#welcome h1{grid-column:1;font-size:52px;margin:10px 0}#intro{display:none}#welcome .entry{grid-column:2;grid-row:1/3;margin-top:0;align-self:center}#entry-note{grid-column:2;grid-row:3;margin:0}#welcome .features{grid-column:1;font-size:11px;margin-top:10px}dialog{max-height:92svh}dialog h2{font-size:28px}#toast{bottom:90px}#orientation-tip{display:none!important}#film{max-height:40vh}}
/* Quiet play HUD: controls only, descriptions live in the help menu. */
.playing .room-label,.playing .look-hint,.playing #context,.playing #orientation-tip,.playing #presence{display:none!important}.playing header .brand{visibility:hidden}.playing #customize span{display:none}.playing header{padding-top:max(12px,env(safe-area-inset-top));padding-right:max(18px,env(safe-area-inset-right))}.playing .top-actions button{width:44px;height:44px;padding:0;background:#f7f4ecba;backdrop-filter:blur(9px);font-size:20px}.playing .tools button{min-width:44px;min-height:44px;padding:8px;font-size:20px;background:#f7f4ecbc}.playing .crosshair{display:none}#nearby-interact{position:fixed;right:max(25px,env(safe-area-inset-right));bottom:155px;width:55px;height:55px;background:#35442fe0;color:#fff;border:1px solid #ffffff88;box-shadow:0 4px 20px #27352133;font-size:26px;z-index:4}.playing #joystick{opacity:.78}.playing #joystick:active{opacity:1}#answer-game button{font-size:16px}.action-grid button{min-height:48px}.playing #toast{font-size:14px;background:#2f3a2edb;padding:10px 18px;pointer-events:none;bottom:90px}
@media(orientation:landscape) and (max-height:600px){#nearby-interact{right:max(25px,env(safe-area-inset-right));bottom:80px}.playing .tools{bottom:max(14px,env(safe-area-inset-bottom))}.playing .top-actions button{width:40px;height:40px}.playing #joystick{bottom:max(25px,env(safe-area-inset-bottom))}.playing #toast{bottom:75px}.wardrobe-layout{grid-template-columns:150px 1fr}#avatar-preview{min-height:180px}#avatar-preview svg{height:180px}.costume-colors{margin:8px 0}}
@media(prefers-reduced-motion:reduce){#no-run{transition:none}.heart{animation-duration:1.5s}}
#world-action{position:fixed;right:max(25px,env(safe-area-inset-right));bottom:220px;width:55px;height:55px;background:#f5f4e9e8;color:#34442e;border:2px solid #7e906b;box-shadow:0 4px 20px #27352133;font-size:26px;z-index:4;backdrop-filter:blur(8px)}#photo-nav{display:flex;gap:10px;justify-content:space-between;margin-top:18px}#inspect-img{cursor:zoom-in;transition:max-height .2s}#inspect-img.zoomed{max-height:none;cursor:zoom-out}#inspect-note{white-space:pre-wrap}
@media(orientation:landscape) and (max-height:600px){#world-action{right:max(90px,env(safe-area-inset-right));bottom:80px}}
/* Consistent, lightweight line icons. */
.top-actions button,.tools button,#world-action,#nearby-interact,.close,#chat-close{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.top-actions button svg,.tools button svg,#world-action svg,#nearby-interact svg,.close svg{display:block;width:22px;height:22px;pointer-events:none}.top-actions{gap:8px}.tools{gap:8px}.playing .tools button,.playing .top-actions button{width:44px;height:44px;min-width:44px;min-height:44px;border:1px solid #e9eadfbd;box-shadow:0 3px 16px #1420161c}.playing #world-action,.playing #nearby-interact{width:50px;height:50px}.close{width:38px;height:38px;padding:8px}#film[hidden]{display:none!important}
.action-grid button{display:flex;gap:10px;align-items:center;justify-content:flex-start;padding:12px 14px}.action-grid button svg{flex-shrink:0;width:22px;height:22px}
#avatar-preview{position:relative;overflow:hidden;min-height:280px}#avatar-preview canvas{display:block;width:100%;height:280px;cursor:grab}#avatar-preview canvas:active{cursor:grabbing}@media(orientation:landscape) and (max-height:600px){#avatar-preview{min-height:230px}#avatar-preview canvas{height:230px}}
/* Stable avatar viewport with explicit full-body and close-up framing. */
#wardrobe{width:min(760px,94vw)}#wardrobe .wardrobe-layout{grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:start;gap:20px}#avatar-preview{display:block;position:sticky;top:0;min-height:0;background:#e4e8da}#avatar-stage{width:100%;height:340px;overflow:hidden;display:grid;place-items:center}#avatar-stage canvas{width:100%;height:100%;display:block}#avatar-stage svg{height:100%;max-width:100%;width:100%}.preview-tools{display:flex;gap:6px;padding:10px;justify-content:center}.preview-tools button{font-size:12px;padding:9px 10px;min-height:38px}.preview-tools button[aria-pressed=true]{background:#34482f;color:#f5f6e8;border-color:#34482f}#wardrobe .wardrobe-layout>div:last-child{display:grid;grid-template-columns:1fr 1fr;gap:10px}#wardrobe .wardrobe-layout label{margin:0;min-width:0}#wardrobe .wardrobe-layout select{font-size:14px;min-height:44px}#wardrobe .wardrobe-layout label:first-child{grid-column:1/-1}
@media(max-width:650px) and (orientation:portrait){#wardrobe .wardrobe-layout{grid-template-columns:1fr}#avatar-stage{height:min(32svh,260px)}#avatar-preview{z-index:1}.preview-tools{padding:6px}.preview-tools button{font-size:12px}}
@media(orientation:landscape) and (max-height:600px){#wardrobe .wardrobe-layout{grid-template-columns:minmax(200px,.85fr) minmax(0,1.15fr)}#avatar-stage{height:235px}#wardrobe .wardrobe-layout>div:last-child{gap:8px}.preview-tools{padding:6px}}

/* Keep the live character beside every customization control, including phones. */
#wardrobe{max-height:94svh;padding:24px}#wardrobe .wardrobe-layout{grid-template-columns:minmax(130px,.9fr) minmax(150px,1.1fr);gap:16px;align-items:start}#wardrobe .wardrobe-layout>div:last-child{display:flex;flex-direction:column;gap:12px;max-height:60svh;overflow-y:auto;padding:0 3px 8px}#wardrobe .costume-colors{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:0}#wardrobe #avatar-stage{height: min(56svh,420px)}#wardrobe .preview-tools{flex-wrap:wrap}#wardrobe #costume-save{margin-top:16px;width:100%}
@media(max-width:650px){#wardrobe{width:96vw;padding:20px 12px}#wardrobe .wardrobe-layout{grid-template-columns:minmax(120px,.9fr) minmax(140px,1.1fr);gap:10px}#wardrobe .wardrobe-layout label,#wardrobe .wardrobe-layout select{font-size:12px}#wardrobe .preview-tools{gap:4px;padding:6px 3px}#wardrobe .preview-tools button{font-size:11px;padding:7px 5px}#wardrobe #avatar-stage{height: min(52svh,380px)}#wardrobe .wardrobe-layout>div:last-child{max-height:59svh}}
@media(orientation:landscape) and (max-height:600px){#wardrobe #avatar-stage{height:53svh}#wardrobe .wardrobe-layout>div:last-child{max-height:53svh}#wardrobe h2{margin:4px 0 12px}}

/* A second WebGL canvas belongs to the editor, never to the viewport. */
#wardrobe{width:min(960px,96vw);overflow:hidden}#wardrobe .wardrobe-layout{grid-template-columns:minmax(0,1fr) minmax(250px,.9fr);gap:24px;min-height:0}#wardrobe #avatar-preview{position:relative;top:auto;min-width:0;contain:layout paint;border:1px solid #c8d1bf;border-radius:16px;overflow:hidden}#wardrobe #avatar-stage{position:relative;width:100%;height:clamp(220px,54svh,460px);min-width:0;isolation:isolate;overflow:hidden}#wardrobe #avatar-stage canvas{position:relative;inset:auto;display:block;width:100%!important;height:100%!important;max-width:100%;max-height:100%;z-index:0}#wardrobe .wardrobe-layout>div:last-child{min-width:0;max-height:62svh;overscroll-behavior:contain}#wardrobe .wardrobe-layout label:first-child{grid-column:auto}#wardrobe .wardrobe-layout label,#wardrobe .wardrobe-layout select{font-size:14px}#wardrobe .preview-tools{position:relative;z-index:1;background:#e4e8da}.preview-caption{font-size:12px;color:#5f6e58;text-align:center;margin:0;padding:0 10px 12px}
@media(max-width:650px){#wardrobe .wardrobe-layout{grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr);gap:10px}#wardrobe #avatar-stage{height:clamp(210px,49svh,380px)}#wardrobe .wardrobe-layout>div:last-child{max-height:59svh}#wardrobe .wardrobe-layout select{padding:10px 6px}#wardrobe .costume-colors{grid-template-columns:repeat(2,minmax(0,1fr))}#wardrobe h2{font-size:28px}.preview-caption{font-size:12px;padding:0 5px 8px}}
@media(orientation:landscape) and (max-height:600px){#wardrobe{max-height:96svh;padding:12px 20px}#wardrobe #avatar-stage{height:49svh;min-height:130px}#wardrobe .wardrobe-layout>div:last-child{max-height:58svh}#wardrobe .preview-caption,#wardrobe>.micro{display:none}#wardrobe #costume-save{margin-top:10px}#wardrobe .preview-tools{padding:5px}}

#wardrobe .preview-pose-label{display:block;padding:0 10px 10px;font-size:12px;margin:0}#wardrobe #preview-pose{padding:8px 10px;margin-top:4px;min-height:38px;font-size:13px}.playing .tools{max-width:calc(100vw - 24px);gap:5px}.playing .tools button{flex-shrink:0}

#wardrobe{overflow-y:auto}#wardrobe #avatar-stage{height:min(42svh,360px);min-height:140px}@media(orientation:landscape) and (max-height:600px){#wardrobe #avatar-stage{height:38svh;min-height:120px}#wardrobe .preview-pose-label{padding:0 6px 5px}#wardrobe #preview-pose{min-height:32px;padding:5px 7px}}
@media(max-width:380px){.playing .tools button{padding:10px 8px;min-width:38px}.playing .tools{gap:4px}}

.file-selection{display:block;margin-top:10px;padding:12px;border:1px solid #a8b99f;border-radius:10px;background:#eef4e9;color:#243d23;font-size:14px;line-height:1.5;overflow-wrap:anywhere}input[type=file]{width:100%;min-width:0;min-height:48px}input[type=file]::file-selector-button{padding:10px 14px;margin-right:10px;border:1px solid #8c9f81;border-radius:8px;background:#f3f8ed;color:#243d23;cursor:pointer}
