/* Orbit Sling 3D - stage + in-game UI. Everything is scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
#stage { --ind: #4b3fd6; --ind-d: #2f2796; --cy: #7fe0ff; --gold: #ffd84a; --mint: #6dffb0; --ink: #e9ecff; --card: rgba(24,28,70,.82);
  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: #0a1f44; 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; }
.game-wrap.pip-stage #stage { width: min(100%, calc((100vh - 64px) * 0.5625)); width: min(100%, calc((100svh - 64px) * 0.5625)); }
#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 [hidden] { display: none !important; }
#stage #app { position: absolute; inset: 0; touch-action: none; }
#stage #app canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#stage #ui { position: absolute; inset: 0; pointer-events: none; }
#stage #ui button, #stage #ui .screens { pointer-events: auto; }
#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(#0a1f44, #1c4a8a); }
#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: 42px; height: 42px; border-radius: 50%; border: 6px solid rgba(255,255,255,.25); border-top-color: var(--gold); animation: osspin .8s linear infinite; }
@keyframes osspin { to { transform: rotate(360deg); } }
#stage #ctxlost { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(10,16,40,.88); color: #fff; font-weight: 700; }

/* HUD */
#stage .hud { position: absolute; inset: 0; pointer-events: none; padding: max(8px, env(safe-area-inset-top)) 10px 8px; }
#stage .hud-top { display: flex; gap: 6px; padding-right: 52px; flex-wrap: wrap; }
#stage .stat { background: rgba(10,16,50,.6); border-radius: 12px; padding: 4px 9px; font-size: 13px; font-weight: 700; min-height: 28px; display: flex; align-items: center; }
#stage .stat b { color: var(--cy); }
#stage .hstars { color: var(--gold); letter-spacing: 2px; }
#stage .pausebtn { position: absolute; top: max(8px, env(safe-area-inset-top)); right: 8px; width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(10,16,50,.7); color: #fff; font-weight: 800; font-size: 16px; letter-spacing: 1px; pointer-events: auto; }
#stage .fuel { position: absolute; left: 10px; right: 10px; top: max(46px, calc(env(safe-area-inset-top) + 40px)); display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; opacity: .95; }
#stage .fuel .bar { flex: 1; height: 8px; background: rgba(255,255,255,.18); border-radius: 5px; overflow: hidden; }
#stage .fuel .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffa23a, #ffd84a); transform-origin: left; transform: scaleX(1); }
#stage .fuel .bar i.low { background: #ff5a5a; }
#stage .fuel span { min-width: 64px; text-align: right; }
#stage .hint-bubble { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); width: 84%; background: rgba(255,255,255,.95); color: #1d2450; font-weight: 800; font-size: 14px; text-align: center; padding: 10px 14px; border-radius: 16px; box-shadow: 0 4px 0 rgba(20,20,80,.4); pointer-events: none; }
#stage .banner { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); padding: 10px 20px; border-radius: 16px; font-size: 22px; font-weight: 900; letter-spacing: 1px; background: rgba(10,16,50,.8); color: #fff; text-align: center; white-space: nowrap; animation: ospop .25s ease-out; pointer-events: none; }
#stage .banner.good { color: var(--mint); } #stage .banner.bad { color: #ff9a8a; }
@keyframes ospop { from { transform: translateX(-50%) scale(.7); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
#stage .hud-bottom { position: absolute; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: stretch; }
#stage .hbtn { flex: 0 0 25%; min-height: 56px; border-radius: 16px; border: 0; background: rgba(10,16,50,.7); color: #fff; font-weight: 800; font-size: 14px; pointer-events: auto; }
#stage .hold { flex: 1; min-height: 56px; border-radius: 16px; border: 0; font-weight: 900; letter-spacing: 2px; font-size: 16px; color: #fff; pointer-events: auto; touch-action: none; box-shadow: 0 4px 0 rgba(0,0,0,.35); }
#stage .hold.boost { background: #e8742a; } #stage .hold.brake { background: #2f7fd0; }
#stage .hold.on { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); filter: brightness(1.2); }
#stage .hold:disabled { opacity: .45; }
#stage .toast { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); max-width: 88%; background: rgba(255,255,255,.96); color: #1d2450; font-weight: 800; font-size: 13px; padding: 8px 14px; border-radius: 12px; z-index: 20; pointer-events: none; text-align: center; }

/* Screens */
#stage .screens { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-y; background: linear-gradient(rgba(8,12,40,.62), rgba(8,12,40,.82)); }
#stage .scr { min-height: 100%; padding: max(12px, env(safe-area-inset-top)) 14px 18px; display: flex; flex-direction: column; gap: 10px; max-width: 460px; margin: 0 auto; }
#stage .scr.center { justify-content: center; text-align: center; }
#stage .scr.home { justify-content: center; text-align: center; }
#stage .scr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#stage .scr-head h2, #stage .scr.center h2 { font-size: 22px; letter-spacing: 1px; }
#stage h3 { font-size: 15px; margin-top: 6px; }
#stage .logo { display: flex; flex-direction: column; align-items: center; line-height: 1; }
#stage .logo b { font-size: clamp(32px, 11vw, 46px); letter-spacing: 4px; color: #fff; text-shadow: 0 3px 0 var(--ind); }
#stage .logo span { font-size: 18px; letter-spacing: 8px; color: var(--gold); font-weight: 900; margin-top: 4px; }
#stage .tag, #stage .note, #stage .sub2 { font-size: 13px; opacity: .85; margin: 0; }
#stage .chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
#stage .chip { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px; background: rgba(255,255,255,.14); border-radius: 99px; font-weight: 800; font-size: 12px; white-space: nowrap; }
#stage .col { display: flex; flex-direction: column; gap: 8px; }
#stage .row { display: flex; gap: 8px; } #stage .row > * { flex: 1; }
#stage .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 14px; border: 0; border-radius: 14px; background: var(--ind); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 4px 0 var(--ind-d); }
#stage .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ind-d); }
#stage .btn:disabled { background: #4a5070; box-shadow: 0 4px 0 #2e3350; opacity: .7; }
#stage .btn.big { min-height: 56px; font-size: 19px; letter-spacing: 1px; background: #e8742a; box-shadow: 0 5px 0 #a24a10; }
#stage .btn.accent { background: #1f9a6a; box-shadow: 0 4px 0 #136c48; }
#stage .btn.ghost { background: rgba(255,255,255,.12); box-shadow: none; }
#stage .btn.small { min-height: 44px; min-width: 64px; font-size: 13px; padding: 6px 12px; }
#stage .btn.danger { background: #c94646; box-shadow: 0 4px 0 #8a2a2a; } #stage .btn.danger.armed { background: #ff3a3a; }
#stage .tabs { display: flex; gap: 6px; }
#stage .tab { flex: 1; min-height: 44px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; border-radius: 12px; font-weight: 800; font-size: 14px; }
#stage .tab.on { background: var(--ind); border-color: #fff; } #stage .tab.lock { opacity: .55; }
#stage .sysname { display: flex; flex-direction: column; font-size: 13px; } #stage .sysname b { font-size: 18px; }
#stage .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#stage .tile { min-height: 76px; border-radius: 14px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 18px; font-weight: 900; }
#stage .tile.done { border-color: var(--gold); } #stage .tile.lock { opacity: .4; }
#stage .tile .stars, #stage .bigstars { color: var(--gold); letter-spacing: 2px; font-size: 15px; }
#stage .bigstars { font-size: 38px; }
#stage .card { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px; }
#stage .card.got { border: 2px solid var(--mint); }
#stage .card .grow { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 14px; }
#stage .sub { font-size: 12px; opacity: .8; font-weight: 600; } #stage .pips { color: var(--gold); letter-spacing: 3px; font-size: 13px; }
#stage .seg { display: flex; gap: 4px; } #stage .seg-b { min-height: 44px; min-width: 52px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); border-radius: 10px; font-weight: 800; font-size: 13px; color: #fff; } #stage .seg-b.on { background: var(--ind); border-color: #fff; }
#stage .skins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#stage .skin { min-height: 84px; border-radius: 12px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; }
#stage .skin.on { border-color: var(--mint); } #stage .skin i { width: 22px; height: 22px; border-radius: 50%; display: block; }
#stage .parts { display: flex; flex-direction: column; gap: 4px; background: var(--card); border-radius: 14px; padding: 10px; font-size: 14px; }
#stage .parts div { display: flex; justify-content: space-between; } #stage .parts .tot { border-top: 1px solid rgba(255,255,255,.2); padding-top: 4px; margin-top: 2px; font-size: 15px; }
#stage .toastline { font-size: 13px; font-weight: 800; color: var(--mint); }
#stage .goal { margin: 0; font-weight: 800; font-size: 13px; background: rgba(75,63,214,.5); border-radius: 10px; padding: 8px 10px; }

@media (orientation: landscape) and (max-height: 520px) { #stage.is-big .scr { max-width: 560px; } #stage.is-big .hold, #stage.is-big .hbtn { min-height: 52px; } }
@media (max-height: 560px) { #stage .logo b { font-size: 28px; } #stage .bigstars { font-size: 28px; } }
@media (prefers-reduced-motion: reduce) { #stage * { animation: none !important; transition: none !important; } }

/* page chrome under the game */
.os-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.os-bar .btn { min-height: 44px; min-width: 44px; }
.os-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.os-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.os-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.os-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.os-guide p { margin-bottom: .5rem; font-size: .95rem; }

/* Full screen (shell native + immersive): the stage fills the area under the dock, the 3D view refits to it. */
.os-bar[hidden] { display: none; }
#stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5; box-shadow: inset 0 0 70px rgba(4,8,30,.55); border-radius: inherit; }
html.pip-immersive .game-wrap.pip-stage { display: flex; flex-direction: column; padding: 0; }
html.pip-immersive .game-wrap.pip-stage #stage { width: 100%; max-width: none; height: auto; flex: 1 1 auto; min-height: 0; aspect-ratio: auto; border-radius: 0; margin: 0; }
html.pip-immersive .os-bar, html.pip-immersive .os-keys, html.pip-immersive .ad-well, html.pip-immersive .os-guide, html.pip-immersive #similar-games, html.pip-immersive footer { display: none !important; }
html.pip-immersive #stage .hold, html.pip-immersive #stage .hbtn, html.pip-immersive #stage .pausebtn { min-height: 48px; }
html.pip-immersive #stage .hud-bottom { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
@media (orientation: landscape) and (max-height: 520px) {
  html.pip-immersive #stage .scr { max-width: 560px; padding-top: 8px; padding-bottom: 10px; gap: 6px; }
  html.pip-immersive #stage .hint-bubble { top: 18%; width: 60%; }
  html.pip-immersive #stage .banner { top: 34%; font-size: 18px; }
}
