*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:#0b1a2a;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;color:#fff;touch-action:none;user-select:none;-webkit-user-select:none}
#c{position:fixed;inset:0;width:100%;height:100%;display:block}
.hidden{display:none!important}
#loader{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:radial-gradient(circle at 50% 35%,#1d4466,#0b1a2a 70%);z-index:20;transition:opacity .6s}
.lbox{width:min(84vw,380px);text-align:center}
.ltitle{font-size:46px;font-weight:800;letter-spacing:6px}.ltitle span{color:#f2c14e}
.lsub{opacity:.75;margin:6px 0 26px;font-size:14px}
.bar{height:8px;border-radius:8px;background:rgba(255,255,255,.15);overflow:hidden}
.bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#f2c14e,#ffdf8a);transition:width .2s}
#lmsg{margin-top:12px;font-size:13px;opacity:.8}
.btn{background:rgba(10,22,36,.62);color:#fff;border:1px solid rgba(255,255,255,.25);border-radius:12px;padding:9px 12px;font-size:14px;font-weight:600;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
.btn:active{background:rgba(242,193,78,.6)}
#topbar{position:fixed;top:calc(env(safe-area-inset-top) + 10px);left:10px;display:flex;gap:8px;z-index:5;flex-wrap:wrap;max-width:calc(100vw - 150px)}
#places{position:fixed;top:calc(env(safe-area-inset-top) + 58px);left:10px;display:flex;flex-direction:column;gap:6px;z-index:6}
#places .btn{text-align:left;min-width:190px}
#mini{position:fixed;top:calc(env(safe-area-inset-top) + 10px);right:10px;width:130px;height:130px;border-radius:50%;overflow:hidden;border:3px solid rgba(255,255,255,.85);box-shadow:0 4px 14px rgba(0,0,0,.35);z-index:5;background:#c9b48a}
#minimap{width:100%;height:100%}
#north{position:absolute;left:50%;top:4px;transform-origin:0 61px;font-size:11px;font-weight:800;color:#e33;margin-left:-4px;text-shadow:0 0 3px #fff}
#info{position:fixed;right:12px;bottom:calc(env(safe-area-inset-bottom) + 34px);text-align:right;z-index:5;text-shadow:0 2px 6px rgba(0,0,0,.6)}
#speed{font-size:34px;font-weight:800}#speed small{font-size:14px;font-weight:600}
#road{font-size:13px;max-width:52vw;opacity:.95}
#joy{position:fixed;left:22px;bottom:calc(env(safe-area-inset-bottom) + 30px);width:130px;height:130px;border-radius:50%;background:rgba(10,22,36,.35);border:2px solid rgba(255,255,255,.35);z-index:5}
#knob{position:absolute;left:40px;top:40px;width:50px;height:50px;border-radius:50%;background:rgba(255,255,255,.75);box-shadow:0 2px 8px rgba(0,0,0,.4)}
#alt{position:fixed;right:14px;bottom:calc(env(safe-area-inset-bottom) + 120px);display:flex;flex-direction:column;gap:10px;z-index:5}
.round{width:52px;height:52px;border-radius:50%;font-size:18px;padding:0}
#hint{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(env(safe-area-inset-bottom) + 170px);background:rgba(10,22,36,.6);padding:8px 14px;border-radius:12px;font-size:13px;opacity:0;transition:opacity .5s;pointer-events:none;z-index:5;text-align:center;max-width:86vw}
#fps{position:fixed;left:10px;top:calc(env(safe-area-inset-top) + 56px);font:12px monospace;background:rgba(0,0,0,.5);padding:3px 6px;border-radius:6px;z-index:5}
#attr{position:fixed;right:6px;bottom:calc(env(safe-area-inset-bottom) + 4px);font-size:11px;z-index:30;background:rgba(255,255,255,.75);padding:2px 6px;border-radius:6px}
#attr a{color:#123;text-decoration:none}
@media (pointer:fine){#joy{display:none}}
#places{max-height:calc(100vh - 290px);overflow-y:auto;-webkit-overflow-scrolling:touch}
@media (max-width:480px){#places,#fps{top:calc(env(safe-area-inset-top) + 106px)}}
/* safe areas (notch in landscape) */
#topbar,#places,#fps{left:calc(env(safe-area-inset-left) + 10px)}
#mini{right:calc(env(safe-area-inset-right) + 10px)}
#info{right:calc(env(safe-area-inset-right) + 12px)}
#alt{right:calc(env(safe-area-inset-right) + 14px)}
#joy{left:calc(env(safe-area-inset-left) + 22px)}
#attr{right:calc(env(safe-area-inset-right) + 6px)}
#places{max-height:calc(100vh - 230px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
body.placesOpen #joy,body.placesOpen #hint{display:none}
@media (max-height:500px){
  #mini{width:96px;height:96px}
  #north{transform-origin:0 44px}
  #joy{width:112px;height:112px;bottom:calc(env(safe-area-inset-bottom) + 16px)}
  #knob{left:31px;top:31px}
  #alt{bottom:calc(env(safe-area-inset-bottom) + 76px)}
  #info{bottom:calc(env(safe-area-inset-bottom) + 22px)}
  #speed{font-size:28px}
  #hint{bottom:calc(env(safe-area-inset-bottom) + 16px);max-width:46vw}
  #places{display:grid;grid-template-columns:repeat(3,minmax(140px,1fr));max-height:calc(100vh - 64px - env(safe-area-inset-top));top:calc(env(safe-area-inset-top) + 54px)}
  #places .btn{min-width:0;padding:7px 10px;font-size:13px}
  #topbar{max-width:calc(100vw - 130px)}
}

/* ===== GTA-style landscape HUD ===== */
#mini{top:auto;right:auto;left:calc(env(safe-area-inset-left) + 12px);bottom:calc(env(safe-area-inset-bottom) + 12px);width:128px;height:128px;border:4px solid rgba(12,18,26,.85);box-shadow:0 0 0 2px rgba(255,255,255,.55),0 6px 18px rgba(0,0,0,.45);cursor:pointer}
#north{transform-origin:0 56px}
#mapHint{position:absolute;right:6px;bottom:4px;font-size:13px;opacity:.85}
#info{right:auto;left:50%;transform:translateX(-50%);bottom:calc(env(safe-area-inset-bottom) + 8px);text-align:center}
#road{font-size:13px;font-weight:700;max-width:40vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#altv{font-size:22px;font-weight:800}
#gauge{position:fixed;width:112px;height:112px;right:calc(env(safe-area-inset-right) + 196px);bottom:calc(env(safe-area-inset-bottom) + 10px);z-index:5;pointer-events:none}
#joy{left:calc(env(safe-area-inset-left) + 160px);bottom:calc(env(safe-area-inset-bottom) + 16px)}
#pedals{position:fixed;right:calc(env(safe-area-inset-right) + 12px);bottom:calc(env(safe-area-inset-bottom) + 12px);width:180px;height:170px;z-index:6}
.pedal{position:absolute;border-radius:50%;border:2px solid rgba(255,255,255,.45);color:#fff;font-size:22px;font-weight:800;display:flex;flex-direction:column;align-items:center;justify-content:center;backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);touch-action:none}
.pedal small{font-size:8.5px;letter-spacing:.5px;margin-top:2px;opacity:.9}
.pg{right:0;bottom:0;width:92px;height:92px;background:rgba(40,160,80,.55)}
.pb{right:98px;bottom:0;width:74px;height:74px;background:rgba(200,50,40,.5)}
.ph{right:14px;bottom:100px;width:64px;height:64px;background:rgba(10,22,36,.6);font-size:18px}
.pedal.down{filter:brightness(1.5);transform:scale(.94)}
body.droneMode #pedals,body.droneMode #gauge{display:none}
#alt{right:calc(env(safe-area-inset-right) + 18px);bottom:calc(env(safe-area-inset-bottom) + 24px)}
#attr{right:calc(env(safe-area-inset-right) + 6px);top:calc(env(safe-area-inset-top) + 4px);bottom:auto;font-size:9px;padding:1px 5px;background:rgba(255,255,255,.6)}
#topbar{gap:6px;max-width:calc(100vw - 300px)}
#topbar .btn{padding:7px 9px;font-size:12.5px}
#hint{bottom:auto;top:calc(env(safe-area-inset-top) + 58px)}
#fps{top:calc(env(safe-area-inset-top) + 100px)}
@media (pointer:fine){#pedals{display:none}#gauge{right:calc(env(safe-area-inset-right) + 16px)}}
@media (max-height:500px){
  #mini{width:112px;height:112px;top:auto}
  #north{transform-origin:0 48px}
  #joy{width:104px;height:104px;left:calc(env(safe-area-inset-left) + 140px);bottom:calc(env(safe-area-inset-bottom) + 14px)}
  #knob{left:27px;top:27px}
  #gauge{width:96px;height:96px;right:calc(env(safe-area-inset-right) + 190px)}
  #topbar{max-width:calc(100vw - 20px)}
  #topbar .btn{padding:6px 8px;font-size:11.5px;border-radius:10px}
  #hint{top:calc(env(safe-area-inset-top) + 48px);max-width:60vw}
  #places{top:calc(env(safe-area-inset-top) + 46px)}
}
/* full-screen map */
#bigmap{position:fixed;inset:0;z-index:40;background:#3f86a8}
#bigc{position:absolute;inset:0;width:100%;height:100%;touch-action:none}
#bmTop{position:absolute;top:calc(env(safe-area-inset-top) + 10px);left:50%;transform:translateX(-50%);background:rgba(10,22,36,.75);padding:7px 14px;border-radius:12px;font-size:13px;font-weight:600}
#bmBar{position:absolute;bottom:calc(env(safe-area-inset-bottom) + 12px);left:50%;transform:translateX(-50%);display:flex;gap:8px}
.btn.gold{background:rgba(242,193,78,.9);color:#1a1a1a}.btn:disabled{opacity:.45}
/* portrait: ask to rotate */
#rotate{display:none;position:fixed;inset:0;z-index:100;background:radial-gradient(circle at 50% 40%,#1d4466,#0b1a2a 70%);flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px}
.rotIco{width:120px;height:120px;display:flex;align-items:center;justify-content:center}
.phone{width:46px;height:80px;border:5px solid #f2c14e;border-radius:10px;position:relative;animation:rot 2.2s ease-in-out infinite}
.phone:after{content:'';position:absolute;left:50%;bottom:4px;width:8px;height:8px;margin-left:-4px;border-radius:50%;background:#f2c14e}
@keyframes rot{0%,20%{transform:rotate(0)}55%,100%{transform:rotate(-90deg)}}
.rotT{font-size:24px;font-weight:800}.rotS{font-size:14px;opacity:.8}
@media (orientation:portrait) and (pointer:coarse){#rotate{display:flex}}
/* ---- v3 HUD: minimap top-left in the top bar, joystick bottom-left, notch/safe-area aware */
#mini{top:calc(env(safe-area-inset-top) + 8px);bottom:auto;right:auto;left:calc(env(safe-area-inset-left) + 10px);width:100px;height:100px}
#north{transform-origin:0 42px}
#topbar{top:calc(env(safe-area-inset-top) + 10px);left:calc(env(safe-area-inset-left) + 120px);max-width:calc(100vw - 120px - env(safe-area-inset-left) - env(safe-area-inset-right) - 170px)}
#places,#fps{left:calc(env(safe-area-inset-left) + 120px);top:calc(env(safe-area-inset-top) + 54px)}
#joy{left:calc(env(safe-area-inset-left) + 24px);bottom:calc(env(safe-area-inset-bottom) + 16px)}
#hint{top:calc(env(safe-area-inset-top) + 56px);bottom:auto}
#pedals{right:calc(env(safe-area-inset-right) + 12px)}
@media (orientation:landscape) and (max-height:500px){
  #mini{width:92px;height:92px}
  #north{transform-origin:0 38px}
  #topbar{left:calc(env(safe-area-inset-left) + 112px)}
  #places,#fps{left:calc(env(safe-area-inset-left) + 112px);top:calc(env(safe-area-inset-top) + 48px)}
  #joy{left:calc(env(safe-area-inset-left) + 22px)}
}
