/* Skyhook Swing 3D - stage + in-game UI. Everything is scoped under #stage so site styles never leak in. */
html.gs-overlay, html.gs-overlay body { overflow: hidden; }
#stage { --ink:#1f2a44; --card:rgba(255,255,255,.94); --acc:#f26b3a; --acc-d:#c9501f; --sun:#ffd23f; --mint:#34d399;
  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(#5aa9ff 0%, #cdeeff 100%); 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 #stage { width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; }
html.pip-immersive .gs-bar, html.pip-immersive .gs-keys { display: none; }
#stage *, #stage *::before, #stage *::after { box-sizing: border-box; }
#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 .screen { 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 #loader { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: linear-gradient(#5aa9ff 0%, #cdeeff 100%); }
#stage #loader[hidden], #stage #ctxlost[hidden], #stage .hud[hidden], #stage .screen[hidden], #stage .hint-bubble[hidden], #stage .banner[hidden] { display: none; }
#stage .load-in { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff; text-shadow: 0 3px 0 rgba(20,40,110,.45); text-align: center; padding: 0 18px; }
#stage .load-in b { font-size: clamp(20px, 6vw, 30px); letter-spacing: 2px; }
#stage .load-in span { font-size: 14px; }
#stage .spinner { width: 42px; height: 42px; border-radius: 50%; border: 6px solid rgba(255,255,255,.35); border-top-color: var(--sun); animation: gsspin .8s linear infinite; }
@keyframes gsspin { 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(20,32,70,.85); color: #fff; font-weight: 700; }

/* HUD */
#stage .hud { position: absolute; inset: 0; padding: max(8px, env(safe-area-inset-top)) 10px 8px; pointer-events: none; }
#stage .hud-top { display: flex; align-items: flex-start; gap: 6px; }
#stage .stat { background: rgba(20,40,110,.58); color: #fff; border-radius: 12px; padding: 4px 10px; display: flex; align-items: baseline; gap: 6px; min-height: 36px; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
#stage .stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
#stage .stat .lbl { font-size: 10px; letter-spacing: 1px; opacity: .8; }
#stage .icon-btn { margin-left: auto; width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(20,40,110,.58); color: #fff; font-weight: 900; font-size: 16px; pointer-events: auto; }
#stage .prog { margin-top: 8px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
#stage .prog i { display: block; height: 100%; width: 0; background: var(--sun); }
#stage .hint-bubble { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); max-width: 86%; background: rgba(20,32,70,.82); color: #fff; padding: 10px 16px; border-radius: 16px; font-weight: 700; font-size: 15px; text-align: center; pointer-events: none; z-index: 5; }
#stage .banner { position: absolute; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; display: flex; flex-direction: column; align-items: center; color: #fff; text-shadow: 0 3px 0 rgba(20,40,110,.55); z-index: 5; }
#stage .banner b { font-size: clamp(26px, 8vw, 40px); }
#stage .banner span { font-size: 15px; }

/* screens */
#stage .screen { position: absolute; inset: 0; z-index: 10; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: max(14px, env(safe-area-inset-top)) 14px 18px; background: linear-gradient(rgba(14,22,50,.55), rgba(14,22,50,.78)); color: #fff; display: flex; flex-direction: column; gap: 10px; }
#stage .screen h2 { font-size: 24px; text-align: center; text-shadow: 0 2px 0 rgba(0,0,0,.3); margin: 2px 0; }
#stage .screen h3 { font-size: 15px; letter-spacing: 1px; text-transform: uppercase; opacity: .85; margin-top: 6px; }
#stage .logo { text-align: center; line-height: .95; margin: 6px 0 2px; text-shadow: 0 4px 0 rgba(0,0,0,.35); }
#stage .logo span { display: block; font-size: clamp(30px, 10vw, 46px); font-weight: 900; letter-spacing: 3px; color: #fff; }
#stage .logo b { display: inline-block; font-size: clamp(40px, 13vw, 62px); font-weight: 900; color: var(--sun); letter-spacing: 2px; }
#stage .logo small { font-size: 22px; font-weight: 900; color: var(--acc); margin-left: 6px; }
#stage .rankrow { display: flex; align-items: center; gap: 8px; }
#stage .chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.18); border-radius: 999px; padding: 5px 11px; font-weight: 800; font-size: 14px; white-space: nowrap; }
#stage .cog { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe98a, #e0a010); display: inline-block; box-shadow: inset 0 0 0 2px rgba(120,70,0,.5); }
#stage .bar { flex: 1; height: 10px; border-radius: 6px; background: rgba(255,255,255,.22); overflow: hidden; min-width: 40px; }
#stage .bar i { display: block; height: 100%; background: var(--mint); border-radius: 6px; }
#stage .big { min-height: 56px; border-radius: 16px; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 18px; font-weight: 800; padding: 8px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
#stage .big small { font-size: 12px; font-weight: 600; opacity: .85; }
#stage .big.primary { background: linear-gradient(var(--acc), var(--acc-d)); box-shadow: 0 4px 0 #8a3414; min-height: 64px; font-size: 22px; }
#stage .big[data-locked] { opacity: .55; }
#stage .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#stage .s-head { display: flex; align-items: center; gap: 8px; }
#stage .s-head h2 { flex: 1; margin-right: 44px; }
#stage .back { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 22px; font-weight: 900; }
#stage .tabs { display: flex; gap: 6px; justify-content: center; }
#stage .tab { flex: 0 0 auto; min-width: 48px; min-height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.16); color: #fff; font-weight: 800; font-size: 16px; padding: 0 12px; }
#stage .tab.wide { flex: 1; padding: 0 4px; font-size: 14px; }
#stage .tab.on { background: var(--sun); color: #3a2a00; }
#stage .tab.lock { opacity: .55; }
#stage .world-name { text-align: center; font-weight: 800; }
#stage .world-name em { font-style: normal; font-weight: 600; opacity: .85; font-size: 13px; display: block; }
#stage .lvgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#stage .lv { min-height: 92px; border-radius: 14px; border: 0; background: rgba(255,255,255,.2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; padding: 6px; }
#stage .lv b { font-size: 20px; } #stage .lv span { font-size: 13px; } #stage .lv small { font-size: 11px; opacity: .85; }
#stage .lv.lock { opacity: .5; }
#stage .st { font-size: 20px; color: rgba(255,255,255,.3); } #stage .st.on { color: var(--sun); text-shadow: 0 0 6px rgba(255,210,63,.8); }
#stage .note { font-size: 12.5px; opacity: .85; text-align: center; }
#stage .card { background: rgba(255,255,255,.14); border-radius: 14px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#stage .card b { display: block; font-size: 15px; } #stage .card .d { display: block; font-size: 12px; opacity: .85; }
#stage .pips { display: flex; gap: 4px; margin-top: 5px; } #stage .pip { width: 14px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.25); } #stage .pip.on { background: var(--sun); }
#stage .buy, #stage .sm { min-height: 44px; min-width: 64px; border-radius: 12px; border: 0; background: var(--mint); color: #053a2a; font-weight: 900; font-size: 15px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
#stage .sm { background: rgba(255,255,255,.25); color: #fff; } #stage .sm.buy { background: var(--mint); color: #053a2a; }
#stage .buy[data-poor] { background: rgba(255,255,255,.2); color: #fff; opacity: .7; }
#stage .danger { background: rgba(190,40,60,.35); } #stage .sm.danger { background: #e23b4e; color: #fff; }
#stage .segs { display: flex; gap: 6px; } #stage .seg { min-height: 44px; border-radius: 10px; border: 0; background: rgba(255,255,255,.2); color: #fff; font-weight: 800; padding: 0 10px; } #stage .seg.on { background: var(--sun); color: #3a2a00; }
#stage .itemgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#stage .item { background: rgba(255,255,255,.14); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; }
#stage .item.eq { outline: 2px solid var(--sun); }
#stage .sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.7); display: block; }
#stage .tag { font-size: 12px; font-weight: 800; opacity: .9; min-height: 44px; display: inline-flex; align-items: center; } #stage .tag.lock { opacity: .6; }
#stage .achs { display: flex; flex-direction: column; gap: 6px; }
#stage .ach { background: rgba(255,255,255,.1); border-radius: 12px; padding: 8px 12px; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; font-size: 13px; opacity: .75; }
#stage .ach span { grid-column: 1; font-size: 12px; opacity: .85; } #stage .ach em { grid-row: 1 / span 2; grid-column: 2; font-style: normal; font-weight: 800; align-self: center; }
#stage .ach.got { opacity: 1; background: rgba(52,211,153,.25); }
/* results */
#stage .stars { display: flex; justify-content: center; gap: 18px; }
#stage .starcol { display: flex; flex-direction: column; align-items: center; opacity: .7; } #stage .starcol.on { opacity: 1; } #stage .starcol .st { font-size: 46px; } #stage .starcol small { font-size: 11px; }
#stage .big-num { text-align: center; font-size: 34px; font-weight: 900; }
#stage .sub { text-align: center; opacity: .9; font-size: 14px; }
#stage .medal { font-size: 14px; padding: 3px 10px; border-radius: 999px; vertical-align: middle; color: #2b1d00; } #stage .m1 { background: #d9955b; } #stage .m2 { background: #cfd8e3; } #stage .m3 { background: var(--sun); }
#stage .rws { display: flex; flex-direction: column; gap: 6px; }
#stage .rw { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255,255,255,.12); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
#stage .rw b { font-weight: 900; color: var(--sun); }
#stage .goal { text-align: center; font-weight: 700; font-size: 14px; background: rgba(255,210,63,.18); border-radius: 10px; padding: 8px; }
#stage .s-home, #stage .s-pause, #stage .s-results { justify-content: center; }
#stage .s-pause { align-items: stretch; }

.gs-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.gs-bar .btn { min-height: 44px; min-width: 44px; }
.gs-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.gs-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.gs-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.gs-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.gs-guide p { margin-bottom: .5rem; font-size: .95rem; }
@media (max-height: 520px) and (orientation: landscape) { #stage { width: min(100%, calc(92vh * 0.5625)); } }
#stage .best { margin-top: 4px; display: inline-block; background: rgba(20,40,110,.5); color: #ffe9a8; font-size: 11px; letter-spacing: 1px; font-weight: 700; border-radius: 8px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
#stage .best[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { #stage *, #stage *::before, #stage *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } #stage .spinner { animation: none; } }

/* wave3 pass: full screen polish. The shell's own Full screen button is the only one; Play big is redundant. */
.gs-bar { display: none; }
#stage::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 62%, rgba(10,25,70,.22) 100%); }
html.pip-immersive #stage { touch-action: none; }
html.pip-immersive #stage .hud { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
html.pip-immersive #stage .screen { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
html.pip-immersive #stage .icon-btn { min-width: 44px; min-height: 44px; }
@media (orientation: landscape) and (max-height: 520px) {
  html.pip-immersive #stage .hud { padding-top: 6px; }
  html.pip-immersive #stage .screen { padding-top: 8px; padding-bottom: 8px; }
  html.pip-immersive #stage .hint-bubble { bottom: 8%; font-size: 13px; padding: 6px 12px; }
  html.pip-immersive #stage .banner { top: 14%; }
}
