/* World owns only its canvas and HUD; the theme retains the global shell.
   --hvw-footer-overlap is the dock overlap WITH this root, not the dock height.
   It must be 0px when the root already ends at the top of the mobile footer. */
body.hc-avatar-world-page{--hvw-lime:#deff88;--hvw-ink:#101814;height:auto}
html:has(body.hc-avatar-world-page){height:auto;min-height:0}
body.hc-avatar-world-page .hc-main{padding:0!important}
body.hc-avatar-world-page main{min-width:0}
body.hc-avatar-world-page #hc-content{min-height:0;padding-bottom:0}
#hvw-world{--hvw-footer-overlap:0px;--hvw-control-inset:24px;--hvw-joystick-bottom:max(140px,calc(var(--hvw-footer-overlap) + 36px));position:relative;isolation:isolate;min-height:480px;height:calc(100dvh - 88px);overflow:hidden;background:#182420;color:#fff;font-family:inherit}
#hvw-world *{box-sizing:border-box}
#hvw-world button,#hvw-world select,#hvw-world input,#hvw-world a{font:inherit}
#hvw-world button{cursor:pointer}
#hvw-world :is(button,a,input,select):focus-visible{outline:3px solid #e4ffa6;outline-offset:4px}
#hvw-world button:disabled{opacity:.5;cursor:wait}
#hvw-world [hidden]{display:none!important}
#hvw-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;outline:none;touch-action:none}
#hvw-canvas:focus-visible{outline:2px solid #deff88;outline-offset:-2px}
.hvw-play-ui{position:absolute;inset:0;pointer-events:none}
.hvw-hud{position:absolute;z-index:2;inset:20px var(--hvw-control-inset) auto;display:flex;justify-content:space-between;align-items:flex-start;gap:20px}
.hvw-location{display:flex;flex-direction:column;gap:4px;min-width:0;max-width:45%;text-shadow:0 1px 8px #000;font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:#e2eddb;line-height:1.35}
.hvw-world-label{font-size:10px;letter-spacing:.13em;color:#edf8e4}
.hvw-location strong{font-size:20px;font-weight:600;letter-spacing:-.03em;text-transform:none;color:#fff;overflow-wrap:anywhere}
#hvw-weather-label{font-size:10px;color:#e2eadb;letter-spacing:.03em}
.hvw-top-actions{display:flex;gap:7px;align-items:flex-start;flex:none;pointer-events:auto}
.hvw-icon-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:none;width:44px;height:44px;padding:0;background:#14251fe8;border:1px solid #dcebdc42;border-radius:13px;color:#f4f9ed;box-shadow:0 3px 10px #07150c20}
.hvw-icon-btn .hc-icon,.hvw-icon-btn svg{display:block;width:21px;height:21px;flex:none}
.hvw-icon-btn:hover{background:#2d4837;border-color:#c9e5a780}
.hvw-icon-btn[aria-pressed=true]{background:#dfff86;color:#192717}
.hvw-travel-btn{width:auto;min-width:94px;padding:0 13px;font-size:13px;font-weight:600}
[data-hvw-camera-icon]{display:none}
#hvw-world[data-camera=third] [data-hvw-camera-icon=third],#hvw-world[data-camera=first] [data-hvw-camera-icon=first]{display:inline-flex}
#hvw-status{position:absolute;z-index:5;top:96px;left:50%;transform:translateX(-50%);margin:0;padding:10px 16px;max-width:min(540px,85%);background:#15261df0;border:1px solid #e4ffa642;border-radius:13px;font-size:13px;line-height:1.4;text-align:center;overflow-wrap:anywhere;pointer-events:none}
#hvw-status:empty{display:none}
.hvw-desktop-help{position:absolute;right:var(--hvw-control-inset);bottom:24px;font-size:10px;line-height:1.8;text-align:right;color:#ecf4e5;text-shadow:0 2px 4px #000}
.hvw-desktop-help kbd{font:inherit;border:1px solid #ffffff50;padding:2px 5px;border-radius:4px;background:#1221199c}
.hvw-touch{display:none;pointer-events:none}
/* The only joystick child is its analog thumb. JS supplies pixel displacement. */
.hvw-joystick{--hvw-stick-x:0px;--hvw-stick-y:0px;position:absolute;z-index:4;bottom:var(--hvw-joystick-bottom);right:var(--hvw-control-inset);width:132px;height:132px;border-radius:50%;border:1px solid #d1e7bf55;background:radial-gradient(circle at center,#183927cc 0 39%,#13261dbb 40% 100%);box-shadow:inset 0 0 0 11px #e6f0de08,0 8px 24px #0002;touch-action:none;pointer-events:auto;user-select:none;-webkit-user-select:none;overscroll-behavior:contain}
.hvw-stick{position:absolute;top:50%;left:50%;display:block;width:52px;height:52px;border-radius:50%;border:1px solid #d0f8a5;background:#69c46c;box-shadow:inset 0 2px 2px #d9ffd84d,0 5px 14px #00140566;transform:translate(calc(-50% + var(--hvw-stick-x)),calc(-50% + var(--hvw-stick-y)));transition:transform .14s ease-out,background .14s ease;pointer-events:none;will-change:transform}
.hvw-joystick.is-active .hvw-stick{background:#a5e67c;transition:none}
#hvw-world[data-preview=true] .hvw-play-ui{display:none}
/* Guests can watch the public showcase, but only the two auth links are interactive. */
.hvw-guest-gate{position:absolute;z-index:20;inset:0;display:grid;align-items:start;justify-items:start;overflow:auto;padding:24px;background:#07190d35;backdrop-filter:blur(2px)}
.hvw-guest-card{width:min(390px,100%);padding:30px;border:1px solid #dcf2c94a;border-radius:24px;background:#12261ef5;box-shadow:0 20px 64px #0613096b;text-align:left}
.hvw-guest-mark{display:flex;align-items:center;justify-content:center;width:42px;height:42px;margin-bottom:20px;background:#deff8817;border:1px solid #deff882e;border-radius:13px;color:#deff88}
.hvw-guest-mark .hc-icon,.hvw-guest-mark svg{width:23px;height:23px;display:block}
#hvw-guest-title{margin:0 0 12px;color:#f8fcef;font-size:clamp(25px,4vw,30px);font-weight:600;line-height:1.18;letter-spacing:-.035em;overflow-wrap:anywhere}
#hvw-guest-message{margin:0;color:#d2dfce;font-size:15px;line-height:1.6}
#hvw-world[data-preview=true] #hvw-status{position:static;transform:none;max-width:none;margin:14px 0 0;padding:10px 12px;font-size:12px;text-align:left}
.hvw-guest-actions{display:grid;gap:10px;margin-top:25px}
#hvw-guest-travel{grid-column:1/-1;font-size:13px}
.hvw-primary,.hvw-secondary{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:12px 20px;border-radius:12px;font-weight:600;border:1px solid #c9dfbf50;text-decoration:none;line-height:1.4;text-align:center}
.hvw-primary{color:#172516;background:#deff88;border-color:#deff88}
.hvw-primary:hover{background:#eeffca;color:#172516}
.hvw-secondary{background:#1d3528;color:#f2f8ed}
.hvw-secondary:hover{background:#2b4736;color:#fff}
.hvw-noscript{position:absolute;inset:auto 20px 12px;z-index:21;font-size:12px;text-align:center;color:#fff}
/* Existing menu is shared by Pause, Map, Travel and Weather. */
#hvw-dialog{width:min(680px,calc(100vw - 32px));max-height:82dvh;margin:auto;padding:0;border:1px solid #c6d4c34a;border-radius:22px;background:#13241ef5;color:#f5faee;box-shadow:0 28px 100px #0008;overflow:hidden;color-scheme:dark}
#hvw-dialog::backdrop{background:#08110dc9;backdrop-filter:blur(6px)}
#hvw-dialog-close{position:absolute;right:16px;top:16px;z-index:1}
#hvw-dialog-content{padding:32px;overflow:auto;max-height:calc(82dvh - 2px);overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#82927c #14251e}
#hvw-dialog-content>button{margin:8px 8px 0 0}
#hvw-dialog h2{color:#fff;font-size:26px;line-height:1.2;letter-spacing:-.035em;margin:0 48px 10px 0}
#hvw-dialog p{color:#c6d6c7;line-height:1.6;font-size:14px}
#hvw-dialog h3{font-size:15px;color:#e5f7dc;margin-top:24px}
.hvw-settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin:20px 0}
.hvw-settings-grid label{display:grid;gap:8px;font-size:13px;color:#d6e8d0}
.hvw-settings-grid select{width:100%;background:#233e2f;border:1px solid #79996c;color:#fff;border-radius:9px;padding:9px}
.hvw-settings-grid input[type=range]{width:100%;accent-color:#dcff86}
.hvw-settings-grid input[type=checkbox]{accent-color:#dcff86}
.hvw-dialog-actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:24px}
.hvw-error{color:#ffcfaa!important}
.hvw-travel-search{display:grid;gap:8px;margin:20px 0 14px;color:#d6e8d0;font-size:13px}
.hvw-travel-search input{width:100%;min-height:48px;padding:12px 14px;border:1px solid #9dba8a66;border-radius:12px;background:#0f2018;color:#f4f9ed;outline-offset:2px}
.hvw-travel-search input::placeholder{color:#aebca5}
.hvw-travel-results{display:grid;gap:8px;list-style:none;margin:0;padding:0}
.hvw-city-option{display:flex;flex-direction:column;align-items:flex-start;gap:4px;width:100%;min-height:62px;padding:12px 15px;text-align:left;border:1px solid #ccdfbf33;border-radius:12px;background:#1a3325;color:#f3f9ed}
.hvw-city-option:hover,.hvw-city-option[aria-current=true]{border-color:#deff88;background:#2d4832}
.hvw-city-option strong{font-size:15px;font-weight:600}
.hvw-city-option small{font-size:12px;color:#bccdb4}
@media(max-width:1100px){
 #hvw-world{height:calc(100dvh - 80px)}
 .hvw-desktop-help{display:none}
}
@media(pointer:coarse),(max-width:900px){
 #hvw-world{--hvw-control-inset:18px}
 .hvw-guest-gate{justify-items:center}
 .hvw-touch{display:block}
 .hvw-desktop-help{display:none}
 .hvw-hud{inset:16px var(--hvw-control-inset) auto;gap:14px}
 .hvw-location{max-width:none;flex:1}
}
@media(max-width:700px){
 #hvw-world{--hvw-control-inset:16px;height:calc(100dvh - 138px);min-height:360px}
 .hvw-hud{gap:12px}
 .hvw-location{padding-top:4px;font-size:9px;gap:3px}
 .hvw-location strong{font-size:17px;line-height:1.25}
 .hvw-world-label,#hvw-weather-label{font-size:9px}
 .hvw-top-actions{display:grid;grid-template-columns:repeat(3,44px);gap:6px}
 .hvw-travel-btn{grid-column:span 2;min-width:0;width:100%}
 .hvw-settings-grid{grid-template-columns:1fr}
 #hvw-dialog-content{padding:26px}
 #hvw-dialog h2{font-size:23px}
 #hvw-status{top:122px;font-size:12px;max-width:calc(100% - 32px)}
 .hvw-guest-gate{padding:20px}
 .hvw-guest-card{padding:26px}
}
/* Short landscape viewports keep the controls inside the play area. */
@media(max-height:600px) and (pointer:coarse),(max-height:600px) and (max-width:900px){
 #hvw-world{--hvw-joystick-bottom:max(18px,calc(var(--hvw-footer-overlap) + 16px))}
 .hvw-joystick{width:108px;height:108px}
 .hvw-stick{width:46px;height:46px}
 .hvw-location{max-width:40%;padding:0}
 .hvw-top-actions{display:flex;gap:6px}
 .hvw-travel-btn{width:auto;min-width:82px}
 #hvw-weather-label{display:none}
 #hvw-status{top:72px}
 .hvw-guest-card{padding:20px 24px;width:min(460px,100%)}
 .hvw-guest-mark{display:none}
 #hvw-guest-title{font-size:25px}
 .hvw-guest-actions{grid-template-columns:1fr 1fr;margin-top:18px}
}
@media(prefers-reduced-motion:reduce){#hvw-world *{scroll-behavior:auto!important;transition:none!important}}
@media(prefers-reduced-transparency:reduce){.hvw-icon-btn,#hvw-status,.hvw-guest-card,#hvw-dialog{background:#14271e}.hvw-guest-gate,#hvw-dialog::backdrop{backdrop-filter:none}}

/* Compact city controls leave the avatar and street readable on phones. */
#hvw-world{--hvw-joystick-bottom:max(32px,calc(var(--hvw-footer-overlap) + 24px))}
#hvw-world,.hvw-touch,.hvw-joystick{touch-action:none;overscroll-behavior:contain}
@media(max-width:700px){
 .hvw-hud{display:grid;grid-template-columns:1fr;gap:10px;inset:12px 14px auto}
 .hvw-location{padding:0;max-width:100%}.hvw-location strong{font-size:16px}
 .hvw-top-actions{display:flex;gap:6px}.hvw-icon-btn{width:40px;height:40px;border-radius:12px}
 .hvw-travel-btn{width:auto;min-width:88px}.hvw-joystick{width:120px;height:120px;right:16px}.hvw-stick{width:46px;height:46px}
}
