/* Helicopter Rescue 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 { --sky:#2e86d6; --ink:#1d2d44; --accent:#e5483a; --sun:#ffc21a; --ok:#35d07a; --card:#fff;
  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(#2e86d6, #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, html.pip-immersive #stage, .game-wrap:fullscreen #stage { position: relative; width: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; margin: 0; height: calc(var(--pip-vvh, 100dvh) - var(--pip-dock-h, 56px) - 16px); }
#stage.is-big { position: fixed; inset: 0; height: 100%; z-index: 99999; }
#stage *, #stage *::before, #stage *::after { box-sizing: border-box; }
#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(#2e86d6, #bfe4ff); }
#stage #loader[hidden], #stage #ctxlost[hidden], #stage .hud[hidden], #stage .ctl[hidden], #stage .screen[hidden], #stage .hint-bubble[hidden], #stage .progress[hidden] { display: none; }
#stage .load-in { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff; text-shadow: 0 3px 0 rgba(10,40,90,.45); text-align: center; padding: 0 18px; }
#stage .load-in b { font-size: clamp(20px, 6vw, 30px); letter-spacing: 2px; }
#stage .spinner { width: 42px; height: 42px; border-radius: 50%; border: 6px solid rgba(255,255,255,.35); border-top-color: var(--sun); animation: hrspin .8s linear infinite; }
@keyframes hrspin { 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,.88); 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; padding-right: 50px; }
#stage .chip { background: rgba(14,36,70,.62); color: #fff; border-radius: 12px; padding: 4px 9px; display: flex; align-items: baseline; gap: 5px; min-height: 30px; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
#stage .chip b { font-size: 16px; font-variant-numeric: tabular-nums; }
#stage .chip .lbl { font-size: 9px; opacity: .8; letter-spacing: 1px; }
#stage .chip.warn { background: rgba(200,40,30,.85); }
#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(14,36,70,.7); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: 1px; pointer-events: auto; }
#stage .hud-row2 { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
#stage .bar.hull { position: relative; width: 84px; height: 20px; border-radius: 10px; background: rgba(14,36,70,.62); overflow: hidden; }
#stage .bar.hull i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--ok); }
#stage .bar.hull i.low { background: #ff5a4a; }
#stage .bar.hull span { position: relative; z-index: 1; display: block; text-align: center; font-size: 10px; line-height: 20px; color: #fff; letter-spacing: 1px; font-weight: 800; }
#stage .chip.wind .arr { display: inline-block; font-size: 14px; }
#stage .progress { position: absolute; left: 22%; right: 22%; top: 38%; height: 12px; border-radius: 6px; background: rgba(14,36,70,.6); overflow: hidden; }
#stage .progress i { display: block; height: 100%; background: var(--sun); width: 0; }
#stage .hint-bubble { position: absolute; left: 50%; top: 27%; transform: translateX(-50%); width: max-content; max-width: 86%; background: rgba(255,255,255,.95); color: var(--ink); font-weight: 800; font-size: 14px; text-align: center; padding: 8px 14px; border-radius: 14px; box-shadow: 0 3px 0 rgba(14,36,70,.35); }
#stage .banner { position: absolute; left: 0; right: 0; top: 14%; text-align: center; opacity: 0; transform: scale(.85); transition: opacity .25s, transform .25s; color: #fff; text-shadow: 0 3px 0 rgba(14,36,70,.6); padding: 0 12px; }
#stage .banner.show { opacity: 1; transform: scale(1); }
#stage .b-main { font-size: clamp(22px, 8vw, 36px); font-weight: 900; letter-spacing: 1px; }
#stage .b-sub { font-size: 14px; font-weight: 700; }
#stage .feed { position: absolute; left: 10px; top: 33%; display: flex; flex-direction: column; gap: 4px; }
#stage .feed-i { background: rgba(14,36,70,.7); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 9px; animation: hrfeed 2.2s forwards; width: max-content; }
#stage .feed-i.good { background: rgba(30,140,80,.85); }
#stage .feed-i.bad { background: rgba(190,50,40,.85); }
@keyframes hrfeed { 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,60,40,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
#stage .flash.on { opacity: 1; transition: none; }

/* controls */
#stage .ctl { position: absolute; inset: 0; pointer-events: none; }
#stage .stickzone { position: absolute; left: 0; top: 0; bottom: 0; width: 60%; pointer-events: auto; touch-action: none; }
#stage .stickbase, #stage .stickknob { position: absolute; left: 0; top: 0; border-radius: 50%; opacity: 0; pointer-events: none; }
#stage .stickbase { width: 108px; height: 108px; border: 3px solid rgba(255,255,255,.7); background: rgba(255,255,255,.18); }
#stage .stickknob { width: 52px; height: 52px; background: rgba(255,255,255,.8); box-shadow: 0 3px 0 rgba(14,36,70,.4); }
#stage .stickzone::after { content: "DRAG TO FLY"; position: absolute; left: 14px; bottom: 16px; font-size: 11px; letter-spacing: 1px; color: rgba(255,255,255,.75); font-weight: 800; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
#stage .cbtn { position: absolute; right: 12px; border: 0; color: #fff; font-weight: 900; pointer-events: auto; touch-action: none; box-shadow: 0 4px 0 rgba(14,36,70,.45); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#stage .cbtn small { font-size: 9px; letter-spacing: 1px; margin-top: 2px; }
#stage .cbtn.down, #stage .cbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(14,36,70,.45); filter: brightness(1.15); }
#stage .upbtn { bottom: 184px; width: 60px; height: 60px; border-radius: 16px; background: #2f7bd6; font-size: 20px; }
#stage .downbtn { bottom: 116px; width: 60px; height: 60px; border-radius: 16px; background: #2f7bd6; font-size: 20px; }
#stage .actbtn { bottom: 14px; width: 88px; height: 88px; border-radius: 50%; background: var(--accent); font-size: 14px; letter-spacing: 1px; }

/* screens */
#stage .screen { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(12,40,80,.55); pointer-events: auto; padding: 8px; }
#stage .panel { width: 100%; max-height: 100%; overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; background: var(--card); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 0 rgba(14,36,70,.35); }
#stage .ph { display: flex; align-items: center; gap: 8px; }
#stage .ph h2 { font-size: 20px; flex: 1; }
#stage .logo { text-align: center; }
#stage .logo small { display: block; font-size: 10px; letter-spacing: 2px; color: #5b6b82; }
#stage .logo b { font-size: clamp(26px, 9vw, 36px); line-height: 1.02; color: var(--accent); letter-spacing: 1px; text-shadow: 0 3px 0 rgba(14,36,70,.18); }
#stage .topline { display: flex; justify-content: space-between; font-size: 13px; color: #44546b; }
#stage .topline b { color: var(--ink); }
#stage .xp { height: 8px; border-radius: 4px; background: #e3e9f1; overflow: hidden; }
#stage .xp i { display: block; height: 100%; background: var(--sun); }
#stage .big { min-height: 52px; border: 0; border-radius: 14px; background: #e6edf7; color: var(--ink); font-weight: 800; font-size: 16px; padding: 8px 10px; box-shadow: 0 3px 0 rgba(14,36,70,.25); }
#stage .big small { display: block; font-size: 11px; font-weight: 600; color: #5b6b82; }
#stage .big.primary { background: var(--accent); color: #fff; }
#stage .big.primary small { color: #ffe0dc; }
#stage .big:active, #stage .mini:active { transform: translateY(2px); }
#stage .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#stage .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#stage .row3 button { min-height: 46px; border: 0; border-radius: 12px; background: #e6edf7; font-weight: 700; color: var(--ink); }
#stage .link { background: none; border: 0; color: #2f6bb8; font-weight: 700; min-height: 44px; text-decoration: underline; }
#stage .mini { min-height: 44px; min-width: 44px; border: 0; border-radius: 12px; background: #e6edf7; color: var(--ink); font-weight: 800; padding: 0 12px; font-size: 13px; text-transform: capitalize; }
#stage .mini.on { background: #cfe9d8; }
#stage .mini.buy { background: var(--sun); }
#stage .mini.poor { background: #ecd9a0; opacity: .8; }
#stage .mini.danger { background: #ff7a6a; color: #fff; }
#stage .list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; touch-action: pan-y; max-height: 62vh; max-height: 62svh; }
#stage .list.tall { max-height: 66vh; max-height: 66svh; }
#stage .list h3 { font-size: 13px; letter-spacing: 1px; color: #5b6b82; margin-top: 4px; }
#stage .mrow { display: flex; align-items: center; gap: 10px; min-height: 52px; border: 0; border-radius: 12px; background: #eef3fa; padding: 6px 10px; text-align: left; color: var(--ink); }
#stage .mrow.locked { opacity: .45; }
#stage .mrow .num { width: 28px; height: 28px; border-radius: 50%; background: var(--sky); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
#stage .mrow .nm { flex: 1; font-weight: 800; font-size: 14px; }
#stage .mrow small { display: block; font-weight: 600; font-size: 11px; color: #5b6b82; }
#stage .mrow .st { color: #e9a400; font-size: 15px; letter-spacing: 1px; }
#stage .goalline { font-size: 14px; }
#stage .mini-p { font-size: 12px; color: #44546b; }
#stage .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#stage .grid div { background: #eef3fa; border-radius: 10px; padding: 5px 8px; font-size: 11px; color: #5b6b82; display: flex; flex-direction: column; }
#stage .grid b { font-size: 17px; color: var(--ink); }
#stage .bigstars { text-align: center; font-size: 38px; color: #f0a800; letter-spacing: 6px; }
#stage .gain { font-weight: 800; font-size: 13px; color: #1f8a4c; }
#stage .goal { font-weight: 800; font-size: 13px; color: #2457a6; background: #e3edff; border-radius: 10px; padding: 7px 9px; }
#stage .card, #stage .urow { background: #eef3fa; border-radius: 12px; padding: 8px 10px; }
#stage .urow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#stage .chd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#stage .card small, #stage .urow small { display: block; font-size: 11px; color: #5b6b82; }
#stage .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 11px; margin-top: 4px; }
#stage .sbar { display: inline-block; vertical-align: middle; width: 46px; height: 6px; margin-left: 5px; background: #d3dce8; border-radius: 3px; overflow: hidden; }
#stage .sbar i { display: block; height: 100%; background: #2f7bd6; }
#stage .pips { display: flex; gap: 4px; margin-top: 4px; }
#stage .pips i { width: 16px; height: 6px; border-radius: 3px; background: #d3dce8; }
#stage .pips i.on { background: var(--sun); }
#stage .arow { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; background: #eef3fa; opacity: .7; }
#stage .arow.got { opacity: 1; background: #dff3e6; }
#stage .arow small { display: block; font-size: 11px; color: #5b6b82; }
#stage .tick { width: 22px; height: 22px; border-radius: 50%; background: #fff; text-align: center; color: #1f8a4c; font-weight: 900; flex: none; }
#stage .setrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; font-weight: 700; }
#stage .seg { display: flex; gap: 4px; }
#stage .plain { padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
@media (orientation: landscape) and (max-height: 520px) { #stage.is-big .panel, html.pip-immersive #stage .panel { max-width: 480px; } #stage .list, #stage .list.tall { max-height: 52vh; } }
@media (prefers-reduced-motion: reduce) { #stage * { animation: none !important; transition: none !important; } }

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

/* results polish: star pop, tip line; low hull edge pulse */
#stage .bigstars .pop { display: inline-block; opacity: .85; }
#stage .bigstars .pop.on { animation: hr-pop .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes hr-pop { 0% { transform: scale(.2) rotate(-25deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
#stage .tip { font-size: 13px; font-weight: 700; color: #7a4a00; background: #fff2d6; border-radius: 10px; padding: 7px 9px; }
#stage .hud.hurt::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px 14px rgba(255,60,40,.38); animation: hr-hurt 1.2s ease-in-out infinite; }
@keyframes hr-hurt { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* Wave 3: full screen fit. The wrap is the shell stage; make it a flex column and let #stage take what is left. */
html.pip-immersive .game-wrap, .game-wrap:fullscreen { display: flex; flex-direction: column; max-width: none; padding-left: 0; padding-right: 0; padding-bottom: 0; }
html.pip-immersive .game-wrap > .hr-bar, html.pip-immersive .game-wrap > .hr-keys, html.pip-native .game-wrap > .hr-bar, html.pip-native .game-wrap > .hr-keys,
.game-wrap:fullscreen > .hr-bar, .game-wrap:fullscreen > .hr-keys, html.pip-native .game-wrap > .game-title, .game-wrap:fullscreen > .game-title { display: none; }
html.pip-immersive .game-wrap > #stage, .game-wrap:fullscreen > #stage { position: relative; inset: auto; z-index: auto; flex: 1 1 0; min-height: 0; height: auto; width: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; margin: 0; }
html.pip-immersive .game-wrap, .game-wrap:fullscreen { overflow: hidden !important; }
.game-wrap:fullscreen { height: 100%; width: 100%; background: #1d2d44; }
/* soft vignette over the 3D view for depth; sits under the HUD */
#stage #app::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 58%, rgba(8,24,52,.22) 100%); }
