/* ============================================================================
   hud.css — HUD layout pass 2 (js/hud.js builds the groups). Loaded after style.css and livemap.css.
   One place for everything: top-left = where / when / how you feel; top-centre = where to go (one pill) and a
   short notice under it; top-right = minimap (tap: big map) with 📱 ☰ beside it and the money under it; bottom =
   the one context prompt and the thumb buttons. Counters peek only when they change. Chips calm down (fade) when
   the HUD is not being used.
   ============================================================================ */
:root{--hud-m:14px;--mini:176px;--btn:38px;--chip-bg:rgba(255,253,246,.93)}
body.touch{--hud-m:10px;--mini:84px;--btn:40px}

/* ---- top-left cluster */
#hud-tl{position:absolute;left:calc(var(--sl,0px) + var(--hud-m));top:calc(var(--st,0px) + 10px);display:flex;flex-direction:column;align-items:flex-start;gap:5px;max-width:min(330px,32vw);pointer-events:none;transition:opacity .6s}
#hud-tl>*{position:static!important;left:auto!important;top:auto!important;right:auto!important;bottom:auto!important;transform:none!important;max-width:100%;margin:0}
#hud-tl #loc{max-width:100%}
#loc-area{font-size:19px;letter-spacing:.07em}
#loc-near{margin-top:1px;font-size:13px}
#loc-near:empty{display:none}
#hud-tl #clock{pointer-events:auto;cursor:pointer;background:var(--chip-bg);border:1.5px solid var(--ink);border-radius:999px;padding:2px 10px;font-weight:800;font-size:12.5px;box-shadow:0 2px 0 rgba(27,42,52,.3);white-space:nowrap}
#hud-tl #clock:empty{display:none}
#hud-tl #clock:hover{background:#fff}
#hud-tl #life-hud{display:none;gap:4px}
#hud-tl #life-hud.on{display:flex}
#hud-tl .lh-me{position:relative;padding:2px 9px 2px 7px;gap:8px;border-width:1.5px;border-radius:999px;box-shadow:0 2px 0 rgba(27,42,52,.3);font-size:11.5px;min-height:24px}
#hud-tl .lh-date,#hud-tl .lh-cash,#hud-tl #life-hud .lh-phone{display:none!important}
#hud-tl .lh-n u{width:30px;height:8px}
#hud-tl #train-panel{width:240px}
#hud-tl #story-card{width:min(220px,32vw)}

/* the landmark card (ui.js UI.discover): small, short, in the corner */
#disc{display:none;align-items:flex-start;gap:8px;max-width:min(290px,32vw);background:rgba(27,42,52,.9);color:#fff;border:2px solid var(--ink);border-radius:12px;padding:6px 10px 7px 12px;box-shadow:inset 4px 0 0 var(--yellow),0 3px 0 rgba(0,0,0,.35);pointer-events:auto;cursor:pointer;animation:discin .3s ease-out}
#disc.show{display:flex}
#disc i{font-style:normal;font-size:20px;line-height:1.1}
#disc div{min-width:0}
#disc small{display:block;font:800 10px Figtree,sans-serif;letter-spacing:.1em;text-transform:uppercase;color:#f2cd37}
#disc b{display:block;font:700 15px/1.15 Fredoka,Figtree,sans-serif}
#disc span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:12px;line-height:1.3;color:#d3dee6;margin-top:1px}
#disc span:empty{display:none}
#disc:not(.new){box-shadow:inset 4px 0 0 #9fd1f0,0 3px 0 rgba(0,0,0,.35)}
#disc:not(.new) small{color:#9fd1f0}
@keyframes discin{from{opacity:0;transform:translateX(-12px)}to{opacity:1;transform:none}}

/* ---- top-right: minimap (tap = map), round buttons beside it, money under it */
#minimap{width:var(--mini)!important;height:var(--mini)!important;right:calc(var(--sr,0px) + var(--hud-m))!important;top:calc(var(--st,0px) + 10px)!important;pointer-events:auto;cursor:pointer;transition:opacity .6s}
#hud-btns{position:absolute;top:calc(var(--st,0px) + 10px);right:calc(var(--sr,0px) + var(--hud-m) + var(--mini) + 10px);display:flex;gap:8px;pointer-events:none;transition:opacity .6s}
#hud-btns>*{position:relative!important;inset:auto!important;transform:none;pointer-events:auto;width:var(--btn)!important;height:var(--btn)!important;--s:var(--btn);border-radius:50%;border:2px solid var(--ink);background:var(--chip-bg);box-shadow:0 2px 0 rgba(27,42,52,.45);display:grid;place-items:center;padding:0;margin:0;font-size:calc(var(--btn) * .48);line-height:1;color:var(--ink);cursor:pointer}
#hud-btns>.tb{display:flex}
#hud-btns>.tb i{font-size:calc(var(--btn) * .5)}
#hud-btns>.tb span{display:none}
#hud-btns .lh-phone{background:var(--yellow)}
#hud-btns .lh-phone:not(.on){display:none!important}
#hud-btns #help-btn{font-weight:800}
body.touch #hud-btns #help-btn{display:none!important}
#hud-btns>*::before{content:"";position:absolute;inset:-5px}
body.touch.ui-open #hud-btns,body.rot-show #hud-btns{visibility:hidden}
#tb-map,#tb-fs,#env-btn{display:none!important}
#wallet{right:calc(var(--sr,0px) + var(--hud-m))!important;top:calc(var(--st,0px) + 10px + var(--mini) + 6px)!important;font-size:12.5px;padding:2px 9px;border-radius:999px;transition:opacity .6s}
/* counters: only for a moment when they change (the journal has them) */
#quest-btn,#passport{display:none!important;right:calc(var(--sr,0px) + var(--hud-m))!important;font-size:11.5px!important;padding:2px 9px!important;border-radius:999px!important;border-width:1.5px!important;animation:peekin .3s ease-out}
#quest-btn.peek,#passport.peek{display:block!important}
#quest-btn,#passport{top:calc(var(--st,0px) + 10px + var(--mini) + 32px)!important}
#passport.second{top:calc(var(--st,0px) + 10px + var(--mini) + 57px)!important}
body:not(.touch) #story-card{right:calc(var(--sr,0px) + var(--hud-m));top:calc(var(--st,0px) + 10px + var(--mini) + 86px);width:220px}
body:not(.touch) #story-xp{top:calc(var(--st,0px) + 10px + var(--mini) + 70px)}
@keyframes peekin{from{opacity:0;transform:translateX(10px)}to{opacity:1;transform:none}}

/* ---- top-centre: the one navigation pill (waypoint or nearest MRT), notices under it */
body:not(.live) #mrt-hint{left:50%!important;right:auto!important;bottom:auto!important;top:calc(var(--st,0px) + 10px)!important;transform:translateX(-50%)!important;width:max-content;max-width:clamp(160px,calc(100vw - 2 * (var(--hud-m) + var(--mini) + 2 * var(--btn) + 40px)),560px);text-align:center;font-size:13px;line-height:1.3;padding:4px 12px;border-radius:999px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:opacity .6s}
#mrt-hint kbd{display:inline-block;background:#fff;color:var(--ink);border-radius:4px;font:800 10.5px Figtree,sans-serif;padding:0 4px;margin-left:2px;vertical-align:1px}
body.touch:not(.live) #mrt-hint{font-size:11.5px;padding:3px 10px;max-width:clamp(150px,calc(100vw - 2 * (max(var(--sl),var(--sr)) + 250px)),380px)}
#toastlane{position:fixed;left:0;right:0;top:0;height:0;z-index:28;pointer-events:none}
body:not(.live) #toast{position:absolute;left:50%;top:calc(var(--st,0px) + 46px);transform:translate(-50%,-6px);background:rgba(27,42,52,.92);color:#fff;border:2px solid var(--ink);border-radius:12px;padding:6px 12px 6px 15px;font-weight:700;font-size:13.5px;line-height:1.3;box-shadow:inset 4px 0 0 var(--yellow),0 3px 0 rgba(0,0,0,.35);max-width:min(460px,calc(100vw - 2 * (var(--hud-m) + 330px)));text-align:center;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;opacity:0;transition:opacity .25s,transform .25s}
body:not(.live) #toast.show{opacity:1;transform:translate(-50%,0)}
body.touch:not(.live) #toast{top:calc(var(--st,0px) + 40px);font-size:12px;padding:5px 10px 5px 13px;border-width:1.5px;max-width:clamp(200px,calc(100vw - 2 * (max(var(--sl),var(--sr)) + 258px)),380px)}
/* above an open panel the notice sits at the very top, over the panel's title bar */
body.ui-open:not(.live) #toast,body.menu-paused:not(.live) #toast{top:calc(var(--st,0px) + 6px)}
body.nohud #toastlane,body.story-cine #toastlane,body.cs-on #toastlane,body:not(.playing) #toastlane{display:none}
#view-bar{top:auto!important;bottom:calc(var(--sb,0px) + 60px)}

/* ---- bottom: the context prompt, the mode pill (desktop only), music */
#prompt{bottom:calc(var(--sb,0px) + 16px);font-size:13.5px;padding:7px 14px;border-radius:999px;max-width:min(760px,calc(100% - 40px))}
#mode{left:var(--hud-m);bottom:16px;font-size:12px;padding:3px 10px;border-width:1.5px;border-radius:999px;box-shadow:0 2px 0 rgba(27,42,52,.3);transition:opacity .6s}
body.touch #mode{display:none!important}
#music-toast{left:calc(var(--sl,0px) + var(--hud-m))!important;top:auto!important;bottom:calc(var(--sb,0px) + 52px)!important}
body.touch #music-toast{bottom:calc(var(--sb,0px) + 140px)!important}
body.touch #prompt{bottom:calc(var(--sb,0px) + 8px);font-size:12px;padding:4px 11px;border-radius:999px;max-width:clamp(160px,calc(100vw - 2 * (max(var(--sl),var(--sr)) + 236px)),440px)}

/* ---- calm HUD (js/hud.js): the chips step back until you need them */
body.hud-calm #hud-tl>:not(#disc):not(#train-panel):not(#loc),body.hud-calm #hud-btns,body.hud-calm #wallet,body.hud-calm #mode{opacity:.45}
body.hud-calm #hud-tl>#loc{opacity:.6}
body.hud-calm #minimap{opacity:.8}
body.hud-calm:not(.live) #mrt-hint{opacity:.72}
body.hud-calm #t-ghost{opacity:.45}
#hud-tl>*,#t-ghost{transition:opacity .6s}

/* ---- speech bubbles (js/dialogue.js lays them out) */
.bubble{max-width:210px;line-height:1.25;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;will-change:transform}
.bubble::after{left:var(--tail,50%)}
.bubble.lift::after{display:none}
body.touch .bubble{max-width:160px;font-size:11px;padding:3px 7px}

/* ---- phone thumb buttons: smaller, one arc around the action button */
body.touch #touch #tb-act{--s:68px;right:calc(var(--sr) + 12px);bottom:calc(var(--sb) + 12px)}
body.touch #touch[data-m=walk] #tb-jump{--s:52px;right:calc(var(--sr) + 100px);bottom:calc(var(--sb) + 20px)}
body.touch #touch[data-m=walk] #tb-run{--s:42px;right:calc(var(--sr) + 84px);bottom:calc(var(--sb) + 84px)}
body.touch #touch[data-m=walk] #tb-alt{--s:48px;right:calc(var(--sr) + 22px);bottom:calc(var(--sb) + 98px)}
body.touch #touch[data-m=walk] #tb-cam{--s:40px;right:calc(var(--sr) + 172px);bottom:calc(var(--sb) + 22px)}
body.touch #touch[data-m=walk] #tb-bike{--s:46px;right:calc(var(--sr) + 150px);bottom:calc(var(--sb) + 76px)}
body.touch #touch[data-m=walk] #tb-dive{--s:50px;right:calc(var(--sr) + 150px);bottom:calc(var(--sb) + 76px)}
body.touch.on-bike #touch[data-m=walk] #tb-bike{--s:52px;right:calc(var(--sr) + 100px);bottom:calc(var(--sb) + 20px)}
.tb{border-width:2.5px}
.tb.big{border-width:3px}
/* the other modes keep their places (drive / taxi / platform / train), just a touch smaller */
body.touch #touch[data-m=drive] #tb-cam{--s:40px}
body.touch #touch[data-m=train] #tb-cam,body.touch #touch[data-m=platform] #tb-cam{--s:44px;right:calc(var(--sr) + 172px);bottom:calc(var(--sb) + 22px)}
body.touch #touch[data-m=platform] #tb-alt{right:calc(var(--sr) + 150px);bottom:calc(var(--sb) + 86px)}
body.touch #touch[data-m=train] #tb-cam{right:calc(var(--sr) + 22px);bottom:calc(var(--sb) + 98px)}

/* ---- phone sizes */
body.touch #hud-tl{gap:4px;max-width:min(240px,30vw)}
body.touch #loc-area{font-size:13px}
body.touch #loc-near{font-size:11px}
body.touch #hud-tl #clock{font-size:11px;padding:1px 8px}
body.touch #hud-tl .lh-me{font-size:11px;padding:1px 7px 1px 6px;gap:6px;min-height:22px}
body.touch #hud-tl .lh-n u{width:22px;height:7px}
body.touch #hud-tl #train-panel{width:188px}
body.touch #disc{max-width:min(240px,30vw);padding:4px 8px 5px 6px;gap:6px}
body.touch #disc b{font-size:13px}
body.touch #disc span{font-size:11px}
body.touch #disc i{font-size:17px}
body.touch #wallet{font-size:11px!important;padding:1px 8px!important}
@media (max-width:760px){ :root{--mini:120px} body.touch{--mini:84px} }
@media (max-height:500px){ body.touch #hud-tl #story-card{width:min(200px,32vw)} }
/* story milestone banners stay clear of the notice lane */
body.touch #story-banner{top:calc(var(--st,0px) + 74px)}
body:not(.touch) #story-banner{top:max(19%,96px)}
