/* Taxi Rush 3D - stage, HUD and menus. Everything is scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
.tr-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.tr-bar .btn { min-height: 44px; min-width: 44px; }
.tr-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.tr-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.tr-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.tr-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.tr-guide p { margin-bottom: .5rem; font-size: .95rem; }

#stage { --navy:#151a3a; --navy2:#232a58; --gold:#ffc928; --gold2:#e0a400; --green:#4cff8a; --red:#ff6b6b; --ink:#f5f7ff; --mut:#a9b2dd;
  position: relative; width: min(100%, calc(78vh * 0.5625)); width: min(100%, calc(78svh * 0.5625)); aspect-ratio: 9 / 16; margin: 0 auto; overflow: hidden;
  border-radius: 14px; background: linear-gradient(#6a8fd8, #bfe4ff); color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; line-height: 1.25; }
#stage.is-big { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; z-index: 99999; }
html.pip-immersive .game-wrap.pip-stage #stage { width: min(100%, calc((100vh - 64px) * 0.5625)); width: min(100%, calc((100dvh - 64px) * 0.5625)); }
.game-wrap:fullscreen #stage { width: min(100%, calc(100vh * 0.5625)); width: min(100%, calc(100dvh * 0.5625)); }
#stage *, #stage *::before, #stage *::after { box-sizing: border-box; }
#stage [hidden] { display: none !important; }
#stage #app { position: absolute; inset: 0; }
#stage #app canvas { display: block; width: 100%; height: 100%; }
#stage #ui { position: absolute; inset: 0; pointer-events: none; }
#stage button { font-family: inherit; cursor: pointer; touch-action: manipulation; }
#stage button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

#stage #loader { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: linear-gradient(#151a3a, #2a3470); }
#stage .load-in { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff; text-align: center; padding: 0 18px; }
#stage .load-in b { font-size: 26px; letter-spacing: 3px; color: var(--gold); }
#stage .spinner { width: 38px; height: 38px; border-radius: 50%; border: 5px solid rgba(255,255,255,.25); border-top-color: var(--gold); animation: trspin 0.9s linear infinite; }
@keyframes trspin { to { transform: rotate(360deg); } }
#stage #nogl, #stage #ctxlost { position: absolute; left: 12px; right: 12px; top: 40%; z-index: 40; padding: 14px; border-radius: 12px; background: rgba(20,24,50,.92); color: #fff; text-align: center; font-size: 15px; pointer-events: none; }

/* ---------------- HUD */
#stage .hud { position: absolute; inset: 0; pointer-events: none; }
#stage .hud-top { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; gap: 6px; align-items: flex-start; }
#stage .pausebtn { pointer-events: auto; flex: none; width: 46px; height: 46px; border-radius: 12px; border: 2px solid rgba(255,255,255,.7); background: rgba(21,26,58,.62); display: flex; gap: 5px; align-items: center; justify-content: center; padding: 0; }
#stage .pausebtn i { display: block; width: 6px; height: 18px; background: #fff; border-radius: 2px; }
#stage .hud-mid { flex: 1; min-width: 0; text-align: center; text-shadow: 0 2px 0 rgba(10,14,40,.7); }
#stage .timer { font-size: 30px; font-weight: 800; line-height: 1; color: #fff; }
#stage .timer.low { color: var(--red); animation: trpulse .5s ease-in-out infinite alternate; }
@keyframes trpulse { to { transform: scale(1.14); } }
#stage .cashrow { display: flex; justify-content: center; align-items: baseline; gap: 8px; margin-top: 2px; font-size: 13px; }
#stage .cash { font-size: 19px; color: var(--gold); }
#stage .goal { color: #fff; opacity: .9; }
#stage .goalbar { position: relative; height: 9px; margin: 4px auto 0; width: 92%; border-radius: 5px; background: rgba(10,14,40,.55); border: 1px solid rgba(255,255,255,.35); overflow: hidden; }
#stage .goalfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #ffc928, #ffe27a); transition: width .2s; }
#stage .gm { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; opacity: .8; }
#stage .mapwrap { flex: none; width: 88px; height: 88px; border-radius: 50%; border: 3px solid rgba(255,255,255,.75); overflow: hidden; background: rgba(21,26,58,.7); }
#stage .mapwrap canvas { width: 100%; height: 100%; display: block; }
#stage .guide { position: absolute; top: 100px; left: 8px; width: calc(100% - 16px); max-width: 300px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 14px; background: rgba(21,26,58,.62); }
#stage .garrow { width: 46px; height: 46px; flex: none; transition: transform .08s linear; }
#stage .gtext { display: flex; flex-direction: column; min-width: 0; }
#stage .gtext b { font-size: 15px; color: #fff; }
#stage .gtext span { font-size: 13px; color: var(--mut); }
#stage .farebar { flex-basis: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; visibility: hidden; }
#stage .farebar.on { visibility: visible; }
#stage .farefill { height: 100%; width: 0; background: var(--green); }
#stage .speedo { position: absolute; bottom: 104px; left: 50%; transform: translateX(-50%); font-size: 20px; font-weight: 800; color: #fff; text-shadow: 0 2px 0 rgba(10,14,40,.7); opacity: .85; }
#stage .speedo::after { content: " km/h"; font-size: 11px; font-weight: 600; }
#stage .streak { position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 800; color: var(--gold); text-shadow: 0 2px 0 rgba(10,14,40,.8); }
#stage .feed { position: absolute; left: 0; right: 0; top: 38%; display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
#stage .fd { padding: 3px 12px; border-radius: 12px; font-weight: 800; font-size: 16px; color: #fff; background: rgba(21,26,58,.6); animation: trfd 1.7s ease-out forwards; }
#stage .fd.cash { font-size: 26px; color: var(--gold); }
#stage .fd.sub { font-size: 13px; font-weight: 600; color: #dfe6ff; }
#stage .fd.bad { color: var(--red); }
#stage .fd.style { color: #9be8ff; }
@keyframes trfd { 0% { opacity: 0; transform: translateY(10px) scale(.9); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
#stage .hint { position: absolute; left: 10px; right: 10px; bottom: 150px; padding: 8px 12px; border-radius: 12px; background: rgba(21,26,58,.82); color: #fff; font-size: 14px; text-align: center; border: 1px solid rgba(255,201,40,.7); }
#stage .bigmsg { position: absolute; left: 0; right: 0; top: 30%; text-align: center; font-size: 64px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 rgba(10,14,40,.7); }
#stage .bigmsg.pop { animation: trpop .45s ease-out; }
@keyframes trpop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
#stage .dragzone { position: absolute; left: 0; right: 0; top: 190px; bottom: 0; pointer-events: auto; touch-action: none; }

#stage .controls { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
#stage .lr, #stage .pedals { display: flex; gap: 10px; pointer-events: none; }
#stage .ctl { pointer-events: auto; touch-action: none; border: 3px solid rgba(255,255,255,.75); background: rgba(21,26,58,.55); color: #fff; border-radius: 18px; font-weight: 800; font-size: 15px; letter-spacing: 1px; user-select: none; -webkit-user-select: none; }
#stage .ctl.steer { width: 78px; height: 78px; padding: 14px; }
#stage .ctl.steer svg { width: 100%; height: 100%; display: block; }
#stage .ctl.pedal { width: 92px; height: 78px; }
#stage .ctl.gas { background: rgba(60,160,90,.6); }
#stage .ctl.brake { background: rgba(200,70,70,.6); }
#stage .ctl.horn { position: absolute; left: 0; bottom: 88px; width: 56px; height: 44px; border-radius: 14px; font-size: 12px; letter-spacing: .5px; }
#stage .controls.manual .pedals { flex-direction: column; gap: 6px; }
#stage .controls.manual .ctl.pedal { height: 66px; }
#stage .ctl.on { background: var(--gold); color: #1b1500; transform: scale(.94); }
#stage.is-big .ctl.steer, html.pip-immersive #stage .ctl.steer { width: 88px; height: 88px; }

/* ---------------- menus */
#stage .screens { position: absolute; inset: 0; z-index: 20; pointer-events: auto; background: linear-gradient(rgba(14,18,44,.72), rgba(14,18,44,.88)); }
#stage .panel { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 18px; touch-action: pan-y; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 8px; }
#stage .panel.title, #stage .panel.small, #stage .panel.results { justify-content: flex-start; }
#stage .panel.small { justify-content: center; }
#stage .topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; }
#stage .wallet { display: flex; gap: 8px; align-items: center; margin-left: auto; }
#stage .cashchip { background: rgba(255,201,40,.2); border: 1px solid var(--gold); color: var(--gold); border-radius: 14px; padding: 4px 10px; font-size: 15px; }
#stage .rankchip { color: var(--mut); font-size: 13px; }
#stage .ptitle { font-size: 24px; text-align: center; color: #fff; margin: 2px 0 4px; }
#stage .pbody { display: flex; flex-direction: column; gap: 8px; }
#stage .sec { font-size: 15px; color: var(--gold); margin-top: 6px; }
#stage .sub { font-size: 13px; color: var(--mut); text-align: center; }
#stage .sub2 { font-size: 12px; color: var(--mut); text-align: center; }
#stage .logo { text-align: center; margin-top: 30px; line-height: .95; text-shadow: 0 5px 0 rgba(0,0,0,.35); }
#stage .logo .l1 { display: block; font-size: 62px; font-weight: 900; color: var(--gold); letter-spacing: 6px; }
#stage .logo .l2 { display: block; font-size: 38px; font-weight: 900; color: #fff; letter-spacing: 4px; }
#stage .tag { text-align: center; color: var(--mut); font-size: 14px; margin: 8px 0 14px; }
#stage .menucol { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 330px; margin: 0 auto; }
#stage .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#stage .rankbar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.16); overflow: hidden; width: 100%; max-width: 330px; margin: 0 auto; }
#stage .rankfill { height: 100%; background: var(--gold); }
#stage .ranklabel { text-align: center; font-size: 12px; color: var(--mut); margin-top: 16px; }

#stage .btn { min-height: 46px; padding: 8px 16px; border-radius: 14px; border: 2px solid rgba(255,255,255,.55); background: var(--navy2); color: #fff; font-size: 16px; font-weight: 800; display: block; text-align: center; letter-spacing: .3px; }
#stage .btn.primary { background: linear-gradient(#ffd54a, #f0a800); border-color: #fff3b8; color: #231a00; }
#stage .btn.big { min-height: 56px; font-size: 21px; }
#stage .btn.small { min-height: 44px; padding: 6px 12px; font-size: 14px; }
#stage .btn.ghost { background: transparent; }
#stage .btn.danger { background: #6b2430; border-color: #ff9aa8; }
#stage .btn:disabled { opacity: .45; cursor: default; }
#stage .btn:active:not(:disabled) { transform: scale(.97); }

#stage .tabs { display: flex; gap: 6px; }
#stage .tab { flex: 1; min-height: 44px; font-size: 13px; padding: 6px 4px; }
#stage .tab.on { background: var(--gold); color: #231a00; border-color: #fff3b8; }
#stage .list { display: flex; flex-direction: column; gap: 8px; }
#stage .card { background: rgba(35,42,88,.85); border: 1px solid rgba(255,255,255,.2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
#stage .card.locked { opacity: .55; }
#stage .card.sel { border-color: var(--gold); }
#stage .card.done { border-color: var(--green); }
#stage .chead { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 15px; }
#stage .chead b { flex: 1; min-width: 0; }
#stage .stars { color: var(--gold); font-size: 15px; letter-spacing: 1px; white-space: nowrap; }
#stage .stars.big { font-size: 40px; text-align: center; }
#stage .cinfo { font-size: 12.5px; color: var(--mut); }
#stage .swatch { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff; display: block; flex: none; }
#stage .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
#stage .srow { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--mut); }
#stage .pips { display: inline-flex; gap: 3px; }
#stage .pips i { width: 12px; height: 8px; border-radius: 2px; background: rgba(255,255,255,.2); display: block; }
#stage .pips i.on { background: var(--gold); }
#stage .mbar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.16); overflow: hidden; }
#stage .mfill { height: 100%; background: var(--green); }
#stage .setrow { display: flex; flex-direction: column; gap: 4px; }
#stage .setlabel { font-size: 14px; color: #fff; }
#stage .seg { display: flex; gap: 6px; }
#stage .segbtn { flex: 1; min-height: 44px; font-size: 14px; padding: 6px 4px; }
#stage .segbtn.on { background: var(--gold); color: #231a00; border-color: #fff3b8; }
#stage .bigcash { text-align: center; font-size: 46px; font-weight: 900; color: var(--gold); text-shadow: 0 4px 0 rgba(0,0,0,.35); }
#stage .goalline, #stage .nextgoal { text-align: center; font-size: 13px; color: var(--mut); }
#stage .nextgoal { color: #fff; font-size: 14px; margin: 4px 0; }
#stage .lines { display: flex; flex-direction: column; gap: 3px; background: rgba(35,42,88,.7); border-radius: 12px; padding: 8px 12px; }
#stage .ln { display: flex; justify-content: space-between; font-size: 14px; }
#stage .news { display: flex; flex-direction: column; gap: 4px; }
#stage .newsline { font-size: 13px; color: var(--green); text-align: center; }

@media (max-height: 560px) {
  #stage .logo { margin-top: 6px; } #stage .logo .l1 { font-size: 44px; } #stage .logo .l2 { font-size: 28px; }
}
#stage .stars.big .spop { display: inline-block; animation: trpop .45s both; }
#stage .goalbar { position: relative; height: 10px; border-radius: 6px; background: rgba(255,255,255,.16); margin: 6px 4px 2px; }
#stage .goalfill { height: 100%; border-radius: 6px; background: var(--gold); transition: width .7s ease-out; }
#stage .goaltick { position: absolute; top: -3px; width: 3px; height: 16px; margin-left: -2px; border-radius: 2px; background: rgba(255,255,255,.55); }
#stage .goaltick.got { background: #fff; }
@media (prefers-reduced-motion: reduce) {
  #stage .stars.big .spop { animation: none; }
  #stage .goalfill { transition: none; }
  #stage .timer.low, #stage .fd, #stage .bigmsg.pop, #stage .spinner { animation: none; }
}

/* ---------------- full screen on phones (shell immersive + native): stage fills the area under the dock */
html.pip-immersive .game-wrap.pip-stage { display: flex; flex-direction: column; padding-left: 0; padding-right: 0; padding-bottom: 0; }
html.pip-immersive .game-wrap.pip-stage #stage { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; height: auto; aspect-ratio: auto; border-radius: 0; margin: 0; }
html.pip-immersive .game-wrap.pip-stage > .tr-bar,
html.pip-immersive .game-wrap.pip-stage > .tr-keys,
html.pip-immersive .game-wrap.pip-stage > .game-title,
html.pip-immersive .game-wrap.pip-stage > noscript { display: none; }
.game-wrap:fullscreen { display: flex; flex-direction: column; }
.game-wrap:fullscreen #stage { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; margin: 0; }
html.pip-immersive #stage .ctl, html.pip-immersive #stage .btn { min-width: 44px; min-height: 44px; }
@media (orientation: landscape) and (max-height: 520px) {
  html.pip-immersive #stage .ctl.steer { width: 76px; height: 76px; }
  html.pip-immersive #stage .panel { padding: 6px 10px 10px; gap: 6px; }
}
