/* #41/#46: profile, phone and minimap presentation. Transport and navigation keep their own state. */
:root{
 --hud-surface:#091a2ceb;--hud-well:#10243a;--hud-edge:#365571;--hud-ink:#ecf3fc;
 --hud-muted:#9bb3ce;--hud-blue:#91baff;--hud-gold:#ffbf4b;--hud-gap:10px;
 --bolha-phone-width:220px;--bolha-hud-right:18px;--bolha-hud-bottom:18px;
 --bolha-phone-height:min(440px,calc(100dvh - var(--bolha-profile-height,272px) - var(--bolha-minimap) - 56px));
}
.hud-icon{display:block;width:22px;height:22px;flex:none}
#bolha-profile,#phone{color:var(--hud-ink);font-family:system-ui,sans-serif;font-weight:450}
#bolha-profile{position:fixed;top:max(18px,env(safe-area-inset-top));right:max(var(--bolha-hud-right),env(safe-area-inset-right));width:var(--bolha-phone-width);padding:8px;border:1px solid var(--hud-edge);border-radius:16px;background:var(--hud-surface);box-shadow:0 8px 28px #0004;z-index:25}
.profile-header{display:flex;align-items:center;gap:9px;min-height:45px;margin-bottom:8px}
.profile-avatar,.online-avatar{display:grid;place-items:center;flex:none;width:35px;height:38px;background:#253a52;border:1px solid #42607e55;border-radius:9px;color:#b5cce6}
.profile-avatar .hud-icon{width:25px;height:25px}.profile-identity{flex:1;min-width:0}
#bolha-profile #auth{position:static;display:flex;align-items:center;gap:6px;min-width:0;font:600 14px/1.3 system-ui;text-shadow:none}
#bolha-profile #auth>span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#bolha-profile.connected #auth>span:after{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:#27d59b;margin:0 0 1px 6px}
#bolha-profile #auth button{padding:5px;width:29px;height:29px;flex:none;display:grid;place-items:center;color:var(--hud-blue);background:#142b43;border:1px solid #42648555;border-radius:8px;box-shadow:none;text-shadow:none}
#bolha-profile #auth button .hud-icon{width:18px;height:18px}
#bolha-profile #auth.profile-guest button{display:block;width:100%;min-width:0;height:auto;min-height:28px;padding:3px 0;border:0;border-radius:4px;background:transparent;font:500 10.5px/1.4 system-ui;text-align:left;white-space:normal;overflow-wrap:anywhere;cursor:pointer}
#bolha-profile #auth.profile-guest button:hover{color:#c4dcff;text-decoration:underline;text-underline-offset:3px}
#bolha-profile #auth.profile-guest button:focus-visible{outline:2px solid var(--hud-blue);outline-offset:2px}
.profile-place{display:block;color:var(--hud-muted);font-size:10px;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-stats{display:grid;grid-template-columns:1fr 1fr;gap:0;padding:6px 0;border:1px solid #42648555;border-radius:9px;background:#0b1b2c;margin-bottom:7px}
.profile-stat{display:flex;align-items:center;gap:6px;min-width:0;padding:6px 7px;border:0;background:none;color:var(--hud-ink);font:600 11px/1.4 system-ui;text-align:left;cursor:pointer;font-variant-numeric:tabular-nums}
.profile-stat+button{border-left:1px solid #42648566}.profile-stat .hud-icon{width:18px;height:18px;color:var(--hud-gold)}
.profile-stat span{min-width:0;overflow-wrap:anywhere}.profile-stat:focus-visible{outline:2px solid var(--hud-blue);outline-offset:2px;border-radius:6px}
.bolha-hud #wallet-hud,.bolha-hud #work-badge{display:none!important}
#bolha-profile #bolha-online{border:0;border-radius:0;background:transparent;box-shadow:none;font:12px system-ui}
.online-header{display:flex;align-items:center;gap:5px;min-height:38px}
#bolha-online-toggle{display:flex;align-items:center;gap:6px;min-width:0;flex:1;padding:7px 0;background:none;color:var(--hud-ink);text-align:left;cursor:pointer}
#bolha-online-toggle span{flex:1;white-space:nowrap;font-weight:600;font-size:11px}#bolha-online-toggle .hud-icon{width:16px;height:16px;color:var(--hud-blue)}
#bolha-online-toggle .hud-icon:last-child{width:13px;height:13px;transition:transform .15s}#bolha-online-toggle .expanded{transform:rotate(180deg)}
#bolha-online-toggle:disabled{opacity:1;cursor:default}
#bolha-online-toggle:disabled .hud-icon:last-child{visibility:hidden}
.online-controls{display:flex;gap:4px;flex:none}
#bolha-profile .voice-chip{position:relative;display:grid;place-items:center;min-width:27px;width:27px;height:30px;padding:3px;gap:0;color:var(--hud-blue);border:1px solid #42648555;border-radius:7px;background:#132b43}
#bolha-profile .voice-chip small{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#bolha-profile .voice-chip .ic{width:17px;height:17px}
#bolha-profile .voice-chip.off{color:#ff7d84;background:#301c2a85;border-color:#5b344766}
#bolha-profile .voice-chip.off[data-kind=speaker]:after{left:3px;top:14px;width:21px;height:1.5px}
#bolha-profile button.voice-chip{font:inherit;cursor:pointer}#bolha-profile button.voice-chip:focus-visible,#bolha-online-toggle:focus-visible{outline:2px solid var(--hud-blue);outline-offset:1px}
#bolha-profile #bolha-online #bolha-online-list{max-height:144px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#6383aa #142b43;scrollbar-gutter:stable}
#bolha-profile #bolha-online #bolha-online-list::-webkit-scrollbar{width:4px}#bolha-profile #bolha-online #bolha-online-list::-webkit-scrollbar-thumb{background:#6383aa;border-radius:4px}
#bolha-profile #bolha-online #bolha-online-list .online-player{height:48px;min-height:48px;gap:5px;padding:5px 1px;border-top:1px solid #6d91b122;background:none}
#bolha-profile .online-avatar{width:22px;height:29px;border-radius:6px}#bolha-profile .online-avatar .hud-icon{width:16px;height:16px}
#bolha-profile .online-name{font-size:10.5px;font-weight:550}#bolha-profile .online-place{font-size:9px;margin-top:3px;color:var(--hud-muted)}
#bolha-profile .online-meta .online-place{margin-top:0}
#bolha-profile .online-voice-label{font-size:8.5px;line-height:12px;color:var(--hud-ink);background:#243e52}
#bolha-profile .online-voice-label .hud-icon{width:9px;height:9px}
#bolha-profile .online-states{gap:3px}#bolha-profile .online-states .voice-chip{width:23px;min-width:23px;height:29px}
#bolha-profile .online-states .voice-chip{background:transparent;border-color:transparent}
#bolha-profile .online-states .voice-chip .ic{width:15px;height:15px}#bolha-profile .online-states .voice-chip.off[data-kind=speaker]:after{left:2px;width:18px}
#bolha-profile .online-speaking .online-name{color:#54e4b3}#bolha-profile #bolha-online .online-player.online-speaking{box-shadow:inset 2px 0 #39ce9d;background:#144b3c25}
#bolha-phone-dock{top:calc(max(18px,env(safe-area-inset-top)) + var(--bolha-profile-height,272px) + var(--hud-gap));bottom:auto;gap:var(--hud-gap)}
#phone{height:var(--bolha-phone-height);min-height:280px;max-height:none;border:4px solid #111b28;border-radius:27px;background:linear-gradient(155deg,#102840,#071524 80%);box-shadow:0 0 0 1px #8493a0,0 0 0 3px #0b1119,0 8px 24px #0005;overflow:hidden}
#phone:after{content:'';position:absolute;bottom:6px;left:32%;right:32%;height:3px;border-radius:5px;background:#a7c9ff;pointer-events:none}
.phone-status{display:flex;align-items:center;justify-content:space-between;position:relative;min-height:29px;padding:4px 11px;color:#c5d9f1;font-size:10px;font-variant-numeric:tabular-nums}
#phone .phone-notch{position:absolute;top:5px;left:50%;transform:translateX(-50%);margin:0;width:52px;height:14px;border-radius:12px;background:#030910}
.phone-signal{display:flex;align-items:center;gap:5px;color:#a8c9f6}.phone-signal .hud-icon{width:14px;height:14px}.phone-signal .hud-icon:last-child{width:20px;height:14px}
#phone header{gap:4px;min-height:34px;padding:3px 10px 7px;border-color:#6d91b125;background:transparent}
#phone header strong{font-size:15px;font-weight:600;color:var(--hud-ink)}
#phone header button{display:grid;place-items:center;padding:4px;width:28px;height:28px;flex:none;color:var(--hud-blue);background:#142b4380;border:1px solid #42648555;border-radius:8px}
#phone header button .hud-icon{width:16px;height:16px}
#phone main{padding:10px;scrollbar-width:thin;scrollbar-color:#6383aa transparent;font-size:12px;color:var(--hud-ink)}
#phone.home main{display:flex;padding:5px 7px 15px;overflow:hidden}
#phone .phone-apps{flex:1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(5,minmax(0,1fr));gap:4px;width:100%}
#phone .phone-apps button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;min-height:0;min-width:0;padding:4px 0;font:450 9px/1.2 system-ui;background:#152e4633!important;color:var(--hud-ink)!important;border:1px solid #4264851c;border-radius:9px;box-shadow:none;white-space:normal;overflow:visible}
#phone .phone-apps button:hover{background:#22446766!important;border-color:#6383aa88}
#phone .phone-apps .phone-icon{font-size:0;line-height:1;color:var(--hud-blue)}#phone .phone-icon .hud-icon{width:25px;height:25px}
#phone .phone-apps [data-app=taxi] .phone-icon,#phone .phone-apps [data-app=wallet] .phone-icon{color:var(--hud-gold)}
#phone button:focus-visible{outline:2px solid var(--hud-blue);outline-offset:-2px}#phone button{background:#284f74;color:var(--hud-ink)}
#phone footer{padding:5px 10px 15px}#phone footer button{background:#203b56;color:var(--hud-ink);font-size:11px}
#phone :is(input:not([type=range]),textarea,select){background:#10253a;color:var(--hud-ink);border-color:#4d6e8e}
#phone .phone-note,#phone .phone-contact small{color:#b0c3da}#phone .phone-contact{border-color:#42648566}
#phone .phone-received{background:#20384e}#phone .phone-sent{background:#204b4b}#phone .phone-subtle{background:#233d58!important;color:var(--hud-ink)!important}#phone a{color:#9ec5ff}
#phone-unfold{position:relative;width:40px;height:71px;min-height:0;padding:0;align-self:flex-end;color:var(--hud-blue);border:2px solid #7191b4;border-radius:10px;background:#0b1b2cf2;box-shadow:0 0 0 2px #09111c,0 6px 16px #0004}
#phone-unfold:before,#phone-unfold:after{content:'';position:absolute;left:35%;right:35%;height:2px;background:var(--hud-blue);border-radius:4px}
#phone-unfold:before{top:5px}#phone-unfold:after{bottom:5px;left:27%;right:27%}
body:has(#start:not([hidden])) :is(#bolha-profile,#bolha-phone-dock){visibility:hidden}
@media(max-width:700px){
 :root{--bolha-hud-right:12px;--bolha-hud-bottom:12px;--bolha-phone-width:min(242px,calc(100vw - 24px));--hud-gap:10px}
 #bolha-profile{top:max(12px,env(safe-area-inset-top));padding:8px;border-radius:14px}
 #bolha-profile #auth{font-size:14px}.profile-header{margin-bottom:6px;min-height:38px}.profile-avatar{height:34px;width:32px}
 .profile-stat{font-size:11px;min-height:35px;padding:4px 6px}.profile-stats{padding:2px 0;margin-bottom:4px}
 .online-header{min-height:38px}#bolha-online-toggle{min-height:38px}#bolha-profile .online-controls .voice-chip{width:35px;height:35px}
 #bolha-profile #bolha-online #bolha-online-list{max-height:144px}#bolha-profile .online-states .voice-chip{min-width:30px;width:30px;height:34px}
 #bolha-phone-dock{top:calc(max(12px,env(safe-area-inset-top)) + var(--bolha-profile-height,145px) + var(--hud-gap));bottom:auto}
 #phone{position:fixed;right:50%;transform:translateX(50%);bottom:max(14px,env(safe-area-inset-bottom));width:min(320px,calc(100vw - 40px),calc((100dvh - 190px)/1.85));height:min(610px,calc(100dvh - 190px));min-height:260px;z-index:55;border-radius:30px}
 #phone main{font-size:13px}#phone.home main{padding:8px 9px 17px}
 #phone .phone-apps{gap:8px 5px}#phone .phone-apps button{font-size:11px;gap:9px;border-color:#42648555;background:#142c4580!important;border-radius:12px}
 #phone .phone-icon .hud-icon{width:31px;height:31px}#phone header{min-height:39px}#phone header strong{font-size:18px}#phone header button{height:34px;width:34px}
 #phone-unfold{position:fixed;right:max(22px,env(safe-area-inset-right));bottom:max(28px,env(safe-area-inset-bottom));width:45px;height:80px;z-index:26}
 #turn-help{display:none!important}
 #phone footer button{min-height:38px}
}
/* Short landscape screens use two columns: profile on the right, phone beside it. */
@media(max-height:500px) and (orientation:landscape){
 :root{--bolha-phone-width:200px;--bolha-hud-right:12px;--bolha-hud-bottom:12px;--bolha-phone-height:calc(100dvh - 32px)}
 #bolha-profile{top:max(12px,env(safe-area-inset-top));padding:6px}
 .profile-header{min-height:32px;margin-bottom:4px}.profile-avatar{width:28px;height:28px}.profile-place{font-size:9px}
 .profile-stat{font-size:10px;padding:3px 4px}.profile-stats{padding:3px 0;margin-bottom:3px}
 #bolha-profile #bolha-online #bolha-online-list{max-height:96px}
 #bolha-phone-dock{top:calc(max(12px,env(safe-area-inset-top)) + var(--bolha-profile-height,140px) + 8px)}
 #phone{position:fixed;right:calc(var(--bolha-hud-right) + var(--bolha-phone-width) + 14px);top:14px;bottom:auto;transform:none;width:210px;height:calc(100dvh - 28px);min-height:0}
 #phone .phone-apps button{font-size:9px;gap:4px}#phone .phone-icon .hud-icon{width:22px;height:22px}
 #phone-unfold{position:fixed;right:auto;left:calc(50% - 20px);bottom:28px;width:36px;height:64px}
}
.profile-guest-name{display:block;font:600 14px/1.4 system-ui}.profile-guest-name[hidden]{display:none}
#bolha-profile.connected .profile-guest-name:after{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;background:#27d59b;margin:0 0 1px 6px}
.profile-stat:first-child span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:700px){
 #brand #place{display:none}
 body{--hud-map-space:0px}
 #phone{--mobile-phone-room:calc(100dvh - var(--bolha-profile-height,150px) - var(--hud-map-space) - 48px);height:min(610px,var(--mobile-phone-room));width:min(320px,calc(100vw - 40px),calc(var(--mobile-phone-room)/1.85))}
}
/* On short phones a full-height phone replaces the profile until dismissed; app targets stay usable. */
@media(max-width:700px) and (max-height:740px) and (orientation:portrait){
 #phone{height:calc(100dvh - 32px);width:min(320px,calc(100vw - 32px),calc((100dvh - 32px)/1.9));bottom:16px}
 .bolha-phone-open #bolha-profile{visibility:hidden}
}
@media(min-width:701px) and (min-height:501px) and (max-height:800px){
 #phone{position:fixed;right:calc(var(--bolha-hud-right) + var(--bolha-phone-width) + 14px);top:18px;height:min(440px,calc(100dvh - 36px));width:var(--bolha-phone-width)}
}

/* #46: rectangular minimap, the same width and frame as the profile. */
:root{--bolha-minimap:140px}
#minimap{width:100%;height:var(--bolha-minimap);border:1px solid var(--hud-edge);border-radius:15px;background:var(--hud-surface);box-shadow:0 8px 28px #0004;overflow:hidden;padding:0}
#minimap canvas{width:100%;height:100%;border-radius:0}
#minimap:focus-visible{outline:2px solid var(--hud-blue);outline-offset:3px}
@media(max-width:700px){:root{--bolha-minimap:140px}}
@media(max-height:500px) and (orientation:landscape){:root{--bolha-minimap:110px}}
/* #72: mobile map opens from the phone's Map app instead of covering the city. */
@media(max-width:700px),(max-height:500px) and (orientation:landscape){
 body.bolha-hud #minimap{display:none}
}
/* Keep the existing turn banner readable below the mobile profile/map stack. */
@media(max-width:700px){
 body.bolha-hud #bolha-guide{top:calc(max(12px,env(safe-area-inset-top)) + var(--bolha-profile-height,150px) + var(--hud-map-space,0px) + var(--hud-gap));left:12px;right:12px;transform:none;max-width:calc(100vw - 24px);background:var(--hud-surface);border-color:var(--hud-edge)}
 body.bolha-phone-open #bolha-guide{visibility:hidden}
}

/* Keep the mobile walking/turning area below an open phone (#116). */
@media(max-width:700px) and (orientation:portrait){
 body.bolha-phone-open #phone{bottom:calc(164px + env(safe-area-inset-bottom));height:min(470px,calc(100dvh - 276px));min-height:190px;width:min(300px,calc(100vw - 40px),calc((100dvh - 276px)/1.6))}
 body.bolha-phone-open #action{bottom:calc(122px + env(safe-area-inset-bottom))}
}

/* #120: edit the name where it is shown, without opening the phone. */
.profile-name-row{display:flex;align-items:center;gap:3px;min-width:0}
.profile-name-row #auth{flex:1}
#bolha-profile .profile-name-action{display:grid;place-items:center;flex:none;width:28px;height:30px;min-height:0;padding:5px;border:0;border-radius:7px;background:transparent;color:var(--hud-blue);cursor:pointer;box-shadow:none}
#bolha-profile .profile-name-action .hud-icon{width:16px;height:16px}
#bolha-profile .profile-name-action:hover{background:#91baff18}
#bolha-profile .profile-name-action:focus-visible{outline:2px solid var(--hud-blue);outline-offset:1px}
#bolha-profile .profile-name-action:disabled{opacity:.5;cursor:wait}
#bolha-profile .profile-name-action[hidden],.profile-name-editor[hidden]{display:none}
.profile-name-editor{display:grid;grid-template-columns:minmax(0,1fr) 28px 28px;gap:3px;margin:0 0 8px}
#bolha-profile .profile-name-editor input{min-width:0;width:100%;box-sizing:border-box;padding:6px 8px;background:#10243a;border:1px solid #6383aa;border-radius:7px;color:var(--hud-ink);font:16px/1.3 system-ui}
.profile-name-editor input:focus{outline:2px solid var(--hud-blue);outline-offset:1px}
.profile-name-error{grid-column:1/-1;color:#ffbd9b;font:11px/1.4 system-ui;overflow-wrap:anywhere}
.profile-name-error:empty{display:none}
/* Backpack stays available through I; the permanent screen button is hidden. */
body.bolha-hud .market-bag-button{display:none!important}
