/* The world stays in view: one quiet header, three actions, details on demand. */
#game-shell{--hud-paper:#fff9f0;--hud-ink:#414b40;--hud-line:#c9ceb9;--hud-bottom:max(16px,env(safe-area-inset-bottom));--hud-top:max(20px,env(safe-area-inset-top))}
.world-header{top:var(--hud-top);left:max(24px,env(safe-area-inset-left));right:max(24px,env(safe-area-inset-right));gap:10px;z-index:4}
.world-header .brand-panel{min-width:0;height:44px;gap:9px;padding:8px 12px;border:1px solid var(--hud-line);border-radius:10px;box-shadow:0 3px 10px #26362210}
.world-header .pixel-heart{font-size:23px;text-shadow:none;color:#798c6f}
.world-header .wordmark{font-size:18px;letter-spacing:-.7px}
.world-header .wordmark>span,.world-header .location-divider,.world-header .weather-dot,.world-header .place-mood,.scene-caption{display:none}
.world-header .location-pill{pointer-events:auto;min-width:0;max-width:230px;min-height:44px;padding:9px 13px;gap:8px;margin:0;border:1px solid var(--hud-line);border-radius:10px;box-shadow:0 3px 10px #26362210;color:var(--hud-ink);background:var(--hud-paper)}
.location-pill strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.location-pill .icon{width:17px;height:17px}.place-chevron{margin-left:5px;color:#7b856f}
.hud-more{pointer-events:auto;display:flex;align-items:center;justify-content:center;gap:7px;min-height:44px;padding:8px 13px;margin-left:auto;border:1px solid var(--hud-line);border-radius:10px;background:var(--hud-paper);font-size:13px;font-weight:700;color:var(--hud-ink);box-shadow:0 3px 10px #26362210}
.hud-more>span:first-child{font-size:21px;line-height:1;letter-spacing:1px}
.world-header button[aria-expanded=true]{background:#e2e8d8}
#world-hud{position:absolute;top:calc(var(--hud-top) + 54px);left:24px;right:24px;z-index:4;display:grid;gap:8px;pointer-events:none}
#hud-progress{justify-self:end;max-width:min(330px,100%)}
#hud-progress:empty,#hud-progress:not(:has(button:not([hidden]))){display:none}
#hud-progress button{pointer-events:auto}
#hud-progress .creation-badge{position:static;inset:auto;transform:none;max-width:100%;min-height:44px;margin:0;padding:10px 14px;border:1px solid #c5b9d2;border-radius:10px;background:#f5f1ff;color:#655277;font-family:inherit;font-size:12px;font-weight:700;line-height:1.4;box-shadow:0 3px 10px #26362210;white-space:normal}
#hud-notices{justify-self:center;max-width:min(520px,100%)}
#world-hud #toast{position:static;transform:none;display:none;max-width:100%;margin:0;padding:10px 16px;border:1px solid var(--hud-line);border-radius:10px;background:var(--hud-paper);font-size:12px;line-height:1.6;box-shadow:0 3px 10px #26362210}
#world-hud #toast.show{display:block;opacity:1}

.world-footer{bottom:var(--hud-bottom);left:50%;right:auto;width:min(390px,calc(100vw - 24px));transform:translateX(-50%);gap:0;z-index:4}
.world-dock{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;min-height:62px;padding:5px;gap:4px!important;border:1px solid #aebba3;border-radius:14px;background:var(--hud-paper);box-shadow:0 3px 0 #536b4329,0 6px 16px #26362214}
.world-dock .dock-button{min-width:0;min-height:50px;padding:10px 9px!important;gap:7px;border:0;border-radius:9px;background:transparent;color:var(--hud-ink);font-size:13px;transform:none}
.world-dock .dock-button:hover{background:#e2e8d8;transform:none}
.world-dock .dock-button .icon{width:21px;height:21px}.world-dock .dock-button span{font-size:13px}
.world-dock .wardrobe-entry{order:0}.world-dock .wardrobe-entry small{display:none}
.world-dock .social-entry{order:1;background:#536b43;color:#fff9f0}
.world-dock .social-entry:hover{background:#435a34}
.world-dock .social-entry.has-invite{box-shadow:inset 0 0 0 2px #ddc07e}
.world-dock #expression-toggle{order:2}
.world-dock #expression-toggle[aria-expanded=true]{background:#e2e8d8}

/* Native popovers keep Escape, outside dismissal and one-open-at-a-time behavior. */
.hud-popover{position:fixed;margin:0;padding:14px;border:1px solid var(--hud-line);border-radius:14px;background:var(--hud-paper);color:var(--hud-ink);box-shadow:0 8px 24px #26362226;max-width:calc(100vw - 24px);max-height:calc(100dvh - 160px);overflow:auto;overscroll-behavior:contain}
.hud-popover:not(:popover-open){display:none}
.hud-panel-heading,.expression-bar .expression-title{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 10px;min-height:36px}
.hud-panel-heading h2,.expression-bar .expression-title{font-size:14px;font-weight:700}
.hud-panel-heading h2{margin:0}
.hud-panel-heading button,.expression-bar .expression-title button{width:44px;height:44px;margin:-6px -6px -6px 0;border-radius:8px;background:transparent;color:#6b775f;font-size:23px;font-weight:400}
.hud-panel-heading button:hover,.expression-bar .expression-title button:hover{background:#e2e8d8}
#travel-panel{top:calc(var(--hud-top) + 54px);left:max(24px,env(safe-area-inset-left));right:auto;bottom:auto;width:280px}
#travel-panel #district-nav{position:static;display:grid;gap:4px;max-width:none;width:100%;padding:0;margin:0;border:0;border-radius:0;background:none;box-shadow:none;overflow:visible;transform:none}
#travel-panel #district-nav button{min-height:44px;padding:11px 12px;border-radius:8px;text-align:left;font-size:13px;background:transparent;color:var(--hud-ink)}
#travel-panel #district-nav button:hover{background:#edf0e5}
#travel-panel #district-nav button[aria-current=true]{background:#e2e8d8;font-weight:700}
#world-menu{top:calc(var(--hud-top) + 54px);right:max(24px,env(safe-area-inset-right));left:auto;bottom:auto;width:320px}
#world-menu .player-card{position:static;inset:auto;min-width:0;width:100%;max-width:100%;height:auto;gap:8px;padding:0 0 14px;margin:0 0 12px;border:0;border-bottom:1px solid #e0e2d5;border-radius:0;box-shadow:none;background:none}
#world-menu .player-card canvas{display:block;flex-shrink:0;width:42px;height:52px}
#world-menu .player-card>div{min-width:0;gap:5px}
#world-menu .player-card strong{font-size:13px;overflow:hidden;text-overflow:ellipsis}
#world-menu .player-eyebrow{display:none}#world-menu #save-indicator{font-size:10px}
#world-menu .player-card button{min-width:44px;min-height:44px;margin-left:auto;padding:8px}
#hud-tools{display:grid;grid-template-columns:1fr 1fr;gap:6px}
#hud-tools>button{position:static;inset:auto;transform:none;margin:0;min-width:0;max-width:none;min-height:48px;height:auto;padding:10px 8px!important;border:0;border-radius:8px;background:#edf0e5;color:#526349;font-family:inherit;font-size:12px;font-weight:700;line-height:1.4;white-space:normal;box-shadow:none;text-align:center}
#hud-tools>button:hover{background:#e2e8d8}
#hud-tools .creation-badge{grid-column:1/-1;background:#eee8f5;color:#655277}
#hud-tools .wallet-hud{order:1}#hud-tools #season-toggle{order:2}#hud-tools #photo-button{order:3;gap:6px}#hud-tools #help-open{order:4}
#hud-tools #photo-button .icon{width:18px;height:18px}
#hud-menu-info{margin-top:14px;border-top:1px solid #e0e2d5;padding-top:12px}
#hud-menu-info .controls-hint{display:flex!important;flex-wrap:wrap;justify-content:center;gap:5px 8px;margin:0;padding:0;background:none;border-radius:0;font-size:11px;color:#727b65;white-space:normal}
#hud-menu-info .hint-separator{display:none}
#hud-menu-info .prototype-note{position:static;display:block;margin:10px 0 0;text-align:center;font-size:10px;color:#727b65;text-shadow:none}
#hud-menu-info .guest-welcome{position:static;inset:auto;transform:none;max-width:none;width:auto;display:block;margin:10px 0 0;padding:0;border:0;border-radius:0;box-shadow:none;background:none;text-align:center;font-size:12px;line-height:1.5}
#hud-menu-info .guest-welcome a{display:inline-flex;align-items:center;min-height:44px;color:#526349}

#expression-panel{top:auto;bottom:calc(var(--hud-bottom) + 76px);left:50%;right:auto;transform:translateX(-50%);width:330px;padding:14px;display:block}
#expression-panel:not(:popover-open){display:none}
#expression-panel #emote-buttons{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
#expression-panel #emote-buttons button{width:auto;min-width:0;min-height:59px;padding:8px 2px;gap:5px;border-radius:8px;background:#edf0e5}
#expression-panel #emote-buttons button>span{font-size:22px;height:25px}
#expression-panel #emote-buttons small{display:block;font-size:11px;color:#526349}
#expression-panel #emote-buttons kbd{display:none}
#expression-panel #sit-button{min-height:44px;margin-top:10px;padding:10px;font-size:13px}
#expression-panel #sit-button kbd{display:inline-flex;font-size:10px}
#expression-panel #motion-status{display:none}
#expression-panel #seat-turn-hint{font-size:11px;text-align:center;line-height:1.5}
#interaction{position:absolute;top:auto;bottom:calc(var(--hud-bottom) + 80px);left:50%;right:auto;transform:translateX(-50%);max-width:calc(100vw - 32px);min-height:44px;padding:5px 12px;border:1px solid var(--hud-line);border-radius:10px;background:var(--hud-paper);z-index:4;box-shadow:0 3px 10px #26362216;white-space:normal}
#interaction button{min-height:34px;line-height:1.4;font-size:13px;text-align:left}
#interaction[data-kind=door]{color:#fff9f0;background:#34493f;border-color:#768773}
#interaction[data-kind=door] button{color:inherit}#interaction[data-kind=door] kbd{background:#ede0b9;color:#34493f}
body:has(.hud-popover:popover-open) #interaction{visibility:hidden}
body:has(dialog[open]) :is(#world-hud,.world-header,.world-footer,#interaction,.joystick){visibility:hidden;pointer-events:none}
.joystick{border-color:#79866e;background:#fff9ee42;box-shadow:inset 0 0 16px #fff9ee55,0 1px 4px #26362218}
.joystick>span{border-color:#79866e;background:#fff9eee6;box-shadow:0 2px 0 #536b4333}
.joystick i{color:#414b40;text-shadow:0 1px 2px #fff9f0}
#world[data-entering=true]{animation:room-arrive .35s ease-out}
@keyframes room-arrive{from{filter:brightness(.65)}to{filter:brightness(1)}}
@media(prefers-reduced-motion:reduce){#world[data-entering=true]{animation:none}}
@media(max-width:700px){
 #game-shell{--hud-top:max(12px,env(safe-area-inset-top));--hud-bottom:max(12px,env(safe-area-inset-bottom))}
 .world-header{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));gap:7px}
 .world-header .brand-panel{padding:8px;gap:0;flex-shrink:0}.world-header .pixel-heart{display:none}.world-header .wordmark{font-size:15px}
 .world-header .location-pill{padding:8px 10px;gap:6px}.world-header .location-pill strong{font-size:12px}.place-chevron{margin-left:0}
 .hud-more{padding:8px 10px;flex-shrink:0;gap:4px;font-size:12px}.hud-more>span:first-child{display:none}
 #world-hud{left:12px;right:12px}
 #travel-panel{left:max(12px,env(safe-area-inset-left))}#world-menu{right:max(12px,env(safe-area-inset-right))}
 .world-dock .dock-button{padding:8px 4px!important;gap:6px}.world-dock .dock-button span{font-size:12px}
 .joystick{left:max(20px,env(safe-area-inset-left));bottom:calc(var(--hud-bottom) + 104px);width:88px;height:88px}.joystick>span{left:20px;top:20px;width:44px;height:44px}.joystick i{bottom:-19px;font-size:9px}
 #interaction{max-width:calc(100vw - 24px)}
}
@media(max-width:359px){.world-header .brand-panel{display:none}.world-header .location-pill{max-width:calc(100% - 68px)}.world-dock .dock-button{flex-direction:column;gap:3px}.world-dock .dock-button .icon{width:19px;height:19px}.world-dock .dock-button span{font-size:11px}}
@media(max-height:550px) and (orientation:landscape){
 #game-shell{--hud-top:max(8px,env(safe-area-inset-top));--hud-bottom:max(8px,env(safe-area-inset-bottom))}
 .world-header{left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right))}
 .world-footer{width:330px}.world-dock{min-height:56px}.world-dock .dock-button{min-height:44px}
 .hud-popover{max-height:calc(100dvh - 80px)}
 #world-menu{width:340px;right:max(12px,env(safe-area-inset-right))}
 #expression-panel{width:330px;bottom:calc(var(--hud-bottom) + 66px);max-height:calc(100dvh - 142px);padding:10px 14px}
 #interaction{bottom:calc(var(--hud-bottom) + 68px)}
 .joystick{bottom:calc(var(--hud-bottom) + 40px);width:80px;height:80px}.joystick>span{left:17px;top:17px;width:42px;height:42px}
}
