/* Longshot Range 3D - stage and in-game UI. Everything is scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
#stage { --u: 1; --pine: #2e5e4e; --pine-d: #1d3d32; --amber: #ffb000; --red: #e0392b; --ink: #e8efe9; --panel: rgba(12, 20, 18, .93);
  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: #0b1110; 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; }
#stage *, #stage *::before, #stage *::after { box-sizing: border-box; }
#stage #app, #stage #reticle, #stage #markers, #stage #scopemask { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#stage #app canvas { display: block; width: 100%; height: 100%; }
#stage #reticle, #stage #markers, #stage #scopemask { pointer-events: none; }
#stage #scopemask { background: radial-gradient(circle closest-side, transparent 97.5%, #05080a 99%); box-shadow: 0 0 0 2px #1b2622 inset; border-radius: 50%; }
#stage #scopemask { box-shadow: none; border-radius: 0; }
#stage #ui { position: absolute; inset: 0; pointer-events: none; }
#stage #ui button, #stage #ui .panel, #stage #ui input { pointer-events: auto; }
#stage button { font-family: inherit; cursor: pointer; touch-action: manipulation; color: inherit; }
#stage button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
#stage #ctxlost, #stage #nogl { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(8, 14, 12, .93); color: #fff; font-weight: 700; }
#stage #ctxlost[hidden], #stage #nogl[hidden], #stage #loader[hidden], #stage .hud[hidden], #stage .goalbar[hidden], #stage .screen[hidden], #stage .hint[hidden] { display: none; }
#stage #loader { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #2e5e4e, #0b1110 75%); }
#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: clamp(20px, 6vw, 30px); letter-spacing: 3px; }
#stage .load-in span { font-size: 14px; opacity: .9; }
#stage .spinner { width: 40px; height: 40px; border-radius: 50%; border: 5px solid rgba(255,255,255,.25); border-top-color: var(--amber); animation: srspin .8s linear infinite; }
@keyframes srspin { to { transform: rotate(360deg); } }

/* HUD */
#stage .hud { position: absolute; inset: 0; pointer-events: none; font-size: calc(13px * var(--u)); }
#stage .hud-top { position: absolute; left: 8px; right: 60px; top: max(8px, env(safe-area-inset-top)); display: flex; gap: 6px; }
#stage .stat { background: rgba(8, 16, 14, .72); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 3px 8px; display: flex; align-items: baseline; gap: 5px; min-height: 30px; flex: 0 1 auto; }
#stage .stat b { font-size: calc(17px * var(--u)); font-variant-numeric: tabular-nums; }
#stage .lbl { font-size: calc(9px * var(--u)); letter-spacing: 1px; opacity: .75; }
#stage .chip { font-style: normal; background: var(--amber); color: #3a2800; border-radius: 6px; padding: 0 5px; font-weight: 800; font-size: calc(11px * var(--u)); }
#stage .chip:empty { display: none; }
#stage .mag { font-size: calc(10px * var(--u)); letter-spacing: 1px; opacity: .85; }
#stage .windbox { position: absolute; left: 8px; top: calc(max(8px, env(safe-area-inset-top)) + 40px); background: rgba(8, 16, 14, .72); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; padding: 3px 9px; display: flex; align-items: baseline; gap: 5px; }
#stage .windbox b { font-size: calc(16px * var(--u)); font-variant-numeric: tabular-nums; }
#stage .pausebtn { position: absolute; top: max(8px, env(safe-area-inset-top)); right: 8px; width: 46px; height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(8, 16, 14, .8); font-weight: 800; letter-spacing: 2px; pointer-events: auto; }
#stage .read { position: absolute; background: rgba(8, 16, 14, .66); border-radius: 8px; padding: 2px 8px; display: flex; align-items: baseline; gap: 4px; }
#stage .read b { font-variant-numeric: tabular-nums; font-size: calc(15px * var(--u)); }
#stage .rd-tl { left: 8px; bottom: calc(100% - var(--sb, 0px)); }
#stage .hud .rd-tl, #stage .hud .rd-tr, #stage .hud .rd-holds { top: auto; bottom: auto; }
#stage .hud .rd-tl { left: 10px; top: 49%; }
#stage .hud .rd-tr { right: 10px; top: 49%; }
#stage .hud .rd-holds { left: 50%; transform: translateX(-50%); top: 61%; display: flex; gap: 8px; font-weight: 800; color: var(--amber); font-size: calc(13px * var(--u)); text-shadow: 0 1px 2px #000; }
#stage .hint { position: absolute; left: 12px; right: 12px; top: calc(max(8px, env(safe-area-inset-top)) + 76px); background: rgba(255, 176, 0, .94); color: #2c1f00; font-weight: 700; border-radius: 12px; padding: 8px 12px; text-align: center; font-size: calc(14px * var(--u)); }
#stage .feed { position: absolute; left: 0; right: 0; top: 22%; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#stage .fi { background: rgba(8, 16, 14, .78); border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: calc(13px * var(--u)); animation: srfade 2.4s forwards; }
#stage .fi.good { color: #9bf0b0; } #stage .fi.warn { color: #ffd37a; } #stage .fi.title { font-size: calc(15px * var(--u)); letter-spacing: 1px; }
@keyframes srfade { 0% { opacity: 0; transform: translateY(6px); } 10% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
#stage .flash { position: absolute; inset: 0; background: rgba(255, 240, 200, .5); opacity: 0; }
#stage .flash.on { opacity: 1; }
#stage .floats { position: absolute; inset: 0; overflow: hidden; }
#stage .fl { position: absolute; transform: translate(-50%, -50%); font-weight: 800; font-size: calc(17px * var(--u)); color: #fff; text-shadow: 0 1px 3px #000; animation: srfloat 1.1s forwards; }
#stage .fl.gold { color: var(--amber); }
@keyframes srfloat { 0% { opacity: 0; transform: translate(-50%, -30%); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }

/* controls */
#stage .ctl { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; min-height: 120px; padding: 0 14px max(12px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
#stage.lefty .ctl { flex-direction: row-reverse; }
#stage #btnFire, #stage #btnHold { pointer-events: auto; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); font-weight: 800; letter-spacing: 1px; position: relative; overflow: hidden; touch-action: none; }
#stage #btnFire { width: calc(96px * var(--u)); height: calc(96px * var(--u)); background: radial-gradient(circle at 40% 35%, #ff6a4d, #b3200f); font-size: calc(17px * var(--u)); color: #fff; box-shadow: 0 5px 0 #6c140a; }
#stage #btnFire.down { transform: translateY(3px); box-shadow: 0 2px 0 #6c140a; }
#stage #btnFire.wait { filter: saturate(.35) brightness(.75); }
#stage #btnHold { width: calc(84px * var(--u)); height: calc(84px * var(--u)); background: radial-gradient(circle at 40% 35%, #4f8fb0, #1d4560); font-size: calc(14px * var(--u)); color: #fff; box-shadow: 0 5px 0 #112b3d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
#stage #btnHold.down, #stage #btnHold.held { box-shadow: 0 2px 0 #112b3d; transform: translateY(3px); background: radial-gradient(circle at 40% 35%, #6ac0ea, #2a6f98); }
#stage #btnHold.winded { background: radial-gradient(circle at 40% 35%, #8a5a50, #4a2620); }
#stage #btnHold i { width: 56%; height: 7px; border-radius: 4px; background: rgba(0,0,0,.4); overflow: hidden; display: block; }
#stage #btnHold u { display: block; height: 100%; width: 100%; background: #bff2ff; text-decoration: none; }
#stage .mid { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-bottom: 4px; }
#stage .mid button { pointer-events: auto; min-width: 74px; min-height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: rgba(8, 16, 14, .82); font-weight: 800; font-size: calc(13px * var(--u)); padding: 0 12px; }
#stage .mid button:active { background: var(--pine); }

/* landscape: scope in the middle, buttons at the sides */
#stage.land .ctl { top: 0; height: auto; min-height: 0; padding: 0 16px; align-items: center; }
#stage.land .mid { flex-direction: row; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); margin: 0; }
#stage.land .hud .rd-tl, #stage.land .hud .rd-tr { top: 12%; }
#stage.land .hud .rd-holds { top: 90%; }

/* screens */
#stage .screen { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: max(10px, env(safe-area-inset-top)) 10px 10px; background: rgba(5, 9, 8, .55); pointer-events: auto; }
#stage .panel { width: 100%; max-width: 380px; max-height: 100%; display: flex; flex-direction: column; gap: 8px; background: var(--panel); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 12px; font-size: calc(14px * var(--u)); }
#stage .panel h2 { font-size: calc(21px * var(--u)); letter-spacing: .5px; }
#stage .panel h3.zone { font-size: calc(13px * var(--u)); text-transform: uppercase; letter-spacing: 1.5px; color: var(--amber); margin: 10px 0 4px; }
#stage .panel h3.zone em { font-style: normal; color: #9aa9a2; text-transform: none; letter-spacing: 0; }
#stage .scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; flex: 1 1 auto; padding-right: 2px; }
#stage .scroll, #stage .scroll * { touch-action: pan-y; }
#stage .shead { display: flex; align-items: center; gap: 10px; }
#stage .topbar { display: flex; justify-content: space-between; font-weight: 800; font-size: calc(13px * var(--u)); color: #cfe0d6; }
#stage .coin { color: var(--amber); }
#stage .small { font-size: calc(12px * var(--u)); color: #aab9b1; }
#stage .note { font-size: calc(12px * var(--u)); color: #9bf0b0; }
#stage .good { color: #9bf0b0; font-weight: 700; }
#stage .logo { text-align: center; margin: 6px 0 2px; }
#stage .logo span { display: block; font-size: calc(34px * var(--u)); font-weight: 800; letter-spacing: 4px; color: #fff; }
#stage .logo small { display: block; font-size: calc(13px * var(--u)); letter-spacing: 8px; color: var(--amber); }
#stage .rankbar { height: 8px; border-radius: 5px; background: rgba(255,255,255,.12); overflow: hidden; }
#stage .rankbar i { display: block; height: 100%; background: var(--amber); }
#stage .b { min-height: 46px; min-width: 46px; padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.22); background: #22423a; font-weight: 800; font-size: calc(14px * var(--u)); text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
#stage .b small { font-size: calc(10px * var(--u)); font-weight: 600; opacity: .8; }
#stage .b.big { min-height: 54px; background: var(--amber); color: #2c1f00; border-color: #ffd37a; font-size: calc(17px * var(--u)); }
#stage .b.hot { background: #b3560f; border-color: #ffb36b; }
#stage .b.ghost { background: transparent; }
#stage .b.sm { min-height: 44px; padding: 6px 12px; flex-direction: row; }
#stage .b.on { background: var(--pine); border-color: #9bf0b0; }
#stage .b.danger { background: #8e2a20; }
#stage .b:disabled { opacity: .45; }
#stage .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#stage .row { display: flex; gap: 8px; flex-wrap: wrap; } #stage .row .b { flex: 1 1 100px; } #stage .row.col { flex-direction: column; }
#stage .facts { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: calc(13px * var(--u)); }
#stage .facts b { color: var(--amber); font-weight: 700; margin-right: 4px; }
#stage .facts .good { color: #9bf0b0; }
#stage .levels { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#stage .lv { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 6px; text-align: left; min-height: 52px; padding: 6px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: #1b3a32; }
#stage .lv b { grid-row: 1 / 3; align-self: center; font-size: calc(18px * var(--u)); color: var(--amber); }
#stage .lv span { font-weight: 700; font-size: calc(12px * var(--u)); } #stage .lv i { font-style: normal; color: var(--amber); font-size: calc(12px * var(--u)); }
#stage .lv.locked { opacity: .45; }
#stage .card { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px; margin-bottom: 6px; border-radius: 10px; background: rgba(255,255,255,.06); }
#stage .card.dimcard { opacity: .7; }
#stage .card b { display: block; font-size: calc(14px * var(--u)); } #stage .card small { display: block; color: #aab9b1; font-size: calc(11px * var(--u)); }
#stage .tag { font-weight: 800; color: #9bf0b0; font-size: calc(12px * var(--u)); white-space: nowrap; } #stage .tag.dim { color: #aab9b1; }
#stage .pips { display: inline-flex; gap: 3px; margin-left: 8px; } #stage .pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.2); } #stage .pips i.on { background: var(--amber); }
#stage .bar { display: block; height: 6px; border-radius: 4px; background: rgba(255,255,255,.14); overflow: hidden; margin: 4px 0; } #stage .bar i { display: block; height: 100%; background: #9bf0b0; }
#stage .setrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
#stage .seg { display: flex; gap: 4px; } #stage .seg .b { padding: 4px 8px; }
#stage .res { text-align: center; } #stage .res .facts { text-align: left; }
#stage .stars { display: flex; justify-content: center; gap: 6px; font-size: calc(40px * var(--u)); }
#stage .stars span { color: rgba(255,255,255,.2); transform: scale(.4); opacity: 0; animation: srstar .5s forwards; }
#stage .stars span.on { color: var(--amber); }
@keyframes srstar { to { transform: scale(1); opacity: 1; } }
#stage .big-score { font-size: calc(38px * var(--u)); font-weight: 800; color: #fff; }
#stage .goal { font-size: calc(13px * var(--u)); color: #cfe0d6; background: rgba(255,255,255,.07); border-radius: 10px; padding: 8px; }
#stage .stand { list-style: none; display: flex; flex-direction: column; gap: 3px; } #stage .stand li { display: flex; justify-content: space-between; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.05); } #stage .stand li.you { background: var(--pine); font-weight: 800; }
#stage .pausep { max-width: 300px; text-align: center; }

@media (prefers-reduced-motion: reduce) { #stage .fi, #stage .fl, #stage .stars span { animation-duration: .01s; } }
.sr-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.sr-bar .btn { min-height: 44px; min-width: 44px; }
.sr-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.sr-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.sr-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.sr-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.sr-guide p { margin-bottom: .5rem; font-size: .95rem; }

/* goal bar */
#stage .goalbar { position: absolute; right: 8px; top: calc(max(8px, env(safe-area-inset-top)) + 58px); width: min(52%, 230px); background: rgba(8, 16, 14, .66); border-radius: 8px; padding: 3px 8px 5px; font-size: calc(11px * var(--u)); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
#stage .goalbar[hidden] { display: none; }
#stage .goalbar i { display: block; height: 4px; margin-top: 3px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; }
#stage .goalbar u { display: block; height: 100%; width: 0; background: var(--amber); text-decoration: none; transition: width .18s ease-out; }
@media (prefers-reduced-motion: reduce) { #stage .goalbar u { transition: none; } }

/* Full screen (shell immersive on iPhone, native on Android): the stage fills the shell's stage below the dock. */
html.pip-immersive .game-wrap.pip-stage, html.pip-native .game-wrap.pip-stage, .game-wrap.pip-stage:fullscreen { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
html.pip-immersive .game-wrap.pip-stage > #stage, html.pip-native .game-wrap.pip-stage > #stage, .game-wrap.pip-stage:fullscreen > #stage {
  flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; aspect-ratio: auto; margin: 0; border-radius: 0; }
html.pip-immersive .game-wrap.pip-stage > .sr-bar, html.pip-immersive .game-wrap.pip-stage > .sr-keys,
html.pip-native .game-wrap.pip-stage > .sr-bar, html.pip-native .game-wrap.pip-stage > .sr-keys,
.game-wrap.pip-stage:fullscreen > .sr-bar, .game-wrap.pip-stage:fullscreen > .sr-keys { display: none; }
html.pip-immersive #stage .pausebtn, html.pip-native #stage .pausebtn { min-width: 48px; min-height: 48px; }
