/* Submarine Hunt 3D - stage, HUD and menu screens. Everything is scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
#stage { --teal:#1fb3c9; --deep:#0b2a40; --panel:#0e2a3f; --amber:#ffb02e; --ink:#e8f6ff; --good:#5fe08a; --bad:#ff5a4a;
  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: #0b3550; 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 { position: absolute; inset: 0; }
#stage #app canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#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 [hidden] { display: none !important; }

#stage #loader { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: linear-gradient(#0b3550, #04121d); }
#stage .load-in { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #bfeaff; text-align: center; }
#stage .load-in b { font-size: clamp(20px, 6vw, 30px); letter-spacing: 3px; }
#stage .spinner { width: 42px; height: 42px; border-radius: 50%; border: 6px solid rgba(255,255,255,.2); border-top-color: var(--teal); animation: shspin .9s linear infinite; }
@keyframes shspin { 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(4,18,29,.9); color: #fff; font-weight: 700; }

/* ---- HUD */
#stage #hud { position: absolute; inset: 0; pointer-events: none; }
#stage #joyzone { position: absolute; left: 0; bottom: 0; width: 56%; height: 54%; pointer-events: auto; touch-action: none; }
#stage #joyzone::after { content: "STEER"; position: absolute; left: 18px; bottom: 20px; width: 84px; height: 84px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; letter-spacing: 1px; color: rgba(255,255,255,.4); pointer-events: none; }
#stage #joybase { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); opacity: 0; pointer-events: none; }
#stage #joybase.on { opacity: 1; }
#stage #joyknob { position: absolute; left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
#stage .hud-top { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; right: 60px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
#stage .hullbox { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 1px 2px #000; }
#stage .hullbox .bar { width: 130px; height: 12px; border-radius: 6px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.35); overflow: hidden; }
#stage #hpfill { display: block; height: 100%; width: 100%; background: var(--good); }
#stage .objtxt { font-size: 13px; font-weight: 800; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
#stage .subrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#stage .chip { font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.3); display: inline-flex; align-items: center; gap: 6px; }
#stage .chip.noise #noisefill { display: inline-block; height: 7px; width: 0; min-width: 2px; max-width: 60px; border-radius: 4px; background: var(--good); }
#stage .pausebtn { position: absolute; top: max(8px, env(safe-area-inset-top)); right: 8px; width: 46px; height: 46px; border-radius: 12px; border: 0; background: rgba(0,0,0,.55); color: #fff; font-weight: 900; font-size: 16px; letter-spacing: 1px; pointer-events: auto; }
#stage #radar { position: absolute; top: 78px; left: 8px; width: 84px; height: 84px; border-radius: 8px; pointer-events: none; }
#stage #depthstrip { position: absolute; right: 8px; top: 132px; width: 46px; height: 220px; border-radius: 12px; border: 2px solid rgba(255,255,255,.4); background: linear-gradient(#6fd5ee, #1a6f94 55%, #07213a); pointer-events: auto; touch-action: none; }
#stage #depthstrip .dl { position: absolute; left: 0; right: 0; text-align: center; font-size: 8px; font-weight: 900; letter-spacing: 1px; color: rgba(255,255,255,.85); pointer-events: none; }
#stage #depthstrip .dl.top { top: 3px; } #stage #depthstrip .dl.bot { bottom: 3px; }
#stage #depthsub { position: absolute; left: 6px; right: 6px; height: 12px; margin-top: -6px; border-radius: 6px; background: var(--amber); box-shadow: 0 0 8px rgba(255,176,46,.9); pointer-events: none; }
#stage #depthtgt { position: absolute; left: -4px; right: -4px; height: 0; border-top: 2px dashed #fff; margin-top: -1px; pointer-events: none; opacity: .85; }
#stage #ticks { position: absolute; inset: 0; pointer-events: none; }
#stage .tick { position: absolute; left: 3px; width: 10px; height: 5px; margin-top: -2px; border-radius: 2px; }
#stage .act { position: absolute; border-radius: 50%; border: 3px solid rgba(255,255,255,.7); color: #fff; font-weight: 900; letter-spacing: 1px; pointer-events: auto; touch-action: none; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,.4); }
#stage .act.down { transform: scale(0.94); filter: brightness(1.25); }
#stage .act.fire { right: 14px; bottom: 28px; width: 80px; height: 80px; background: #d9462f; font-size: 15px; }
#stage .act.ping { right: 106px; bottom: 24px; width: 66px; height: 66px; background: #1f8fb3; font-size: 13px; }
#stage .act.decoy { right: 22px; bottom: 120px; width: 58px; height: 58px; background: #8a6a1d; font-size: 10px; }
#stage .act i { width: 26px; height: 5px; margin-top: 3px; border-radius: 3px; background: #ffd0c8; }
#stage .act u { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); text-decoration: none; pointer-events: none; }
#stage .act em { font-style: normal; font-size: 13px; color: #ffe9a8; }
#stage .hint { position: absolute; left: 14px; right: 14px; top: 29%; text-align: center; background: rgba(4,18,29,.8); border: 1px solid rgba(120,220,255,.5); padding: 8px 12px; border-radius: 12px; font-size: 14px; font-weight: 700; pointer-events: none; }
#stage .warn { position: absolute; left: 0; right: 0; top: 20%; text-align: center; font-size: 22px; font-weight: 900; letter-spacing: 2px; color: #ff6a4a; text-shadow: 0 2px 4px #000, 0 0 10px #ff3a1a; pointer-events: none; animation: shblink .35s steps(2) infinite; }
@keyframes shblink { 50% { opacity: .55; } }
#stage .feed { position: absolute; left: 0; right: 0; top: 40%; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#stage .fe { background: rgba(4,18,29,.8); padding: 3px 12px; border-radius: 99px; font-size: 13px; font-weight: 800; animation: shfeed 2.4s ease-out forwards; }
#stage .fe.kill { color: #ffd070; } #stage .fe.alert { color: #ff8a6a; } #stage .fe.good { color: var(--good); }
@keyframes shfeed { 0% { opacity: 0; transform: translateY(8px); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
#stage .arrow { position: absolute; left: 50%; top: 52%; width: 0; height: 0; border-left: 16px solid var(--amber); border-top: 9px solid transparent; border-bottom: 9px solid transparent; pointer-events: none; opacity: .85; filter: drop-shadow(0 0 4px #000); }
#stage .flash { position: absolute; inset: 0; opacity: 0; transition: opacity .25s; pointer-events: none; }

/* ---- screens */
#stage .screen { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(2,12,20,.72); pointer-events: auto; touch-action: pan-y; }
#stage .panel { width: 100%; max-height: 100%; background: var(--panel); border: 2px solid rgba(120,220,255,.3); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
#stage .panel.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#stage .panel h2 { font-size: 20px; letter-spacing: 1px; } #stage .panel h3 { font-size: 13px; letter-spacing: 2px; color: #7fd8ee; margin-top: 6px; text-transform: uppercase; }
#stage .ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#stage .logo { text-align: center; line-height: 1; margin: 2px 0 4px; } #stage .logo small { display: block; font-size: 15px; letter-spacing: 8px; color: #7fd8ee; } #stage .logo b { font-size: 40px; letter-spacing: 3px; color: #fff; text-shadow: 0 3px 0 #0a6a86; }
#stage .rankrow { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; } #stage .xp { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,.15); overflow: hidden; } #stage .xp i { display: block; height: 100%; background: var(--teal); }
#stage .sal { color: #ffd070; } #stage .sal.big { font-size: 18px; font-weight: 900; }
#stage .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#stage .btn { min-height: 46px; padding: 8px 12px; border: 0; border-radius: 12px; background: #1f6f95; color: #fff; font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 #0f4560; }
#stage .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0f4560; }
#stage .btn.primary { background: var(--amber); color: #2b1a00; box-shadow: 0 4px 0 #a86a00; min-height: 54px; font-size: 16px; }
#stage .btn.dim { opacity: .55; } #stage .btn.buy { background: #2f9a5a; box-shadow: 0 3px 0 #1b6a3a; min-width: 84px; } #stage .btn.danger { background: #c4372a; box-shadow: 0 3px 0 #86231a; }
#stage .mini { min-height: 44px; min-width: 44px; padding: 4px 14px; border-radius: 10px; border: 2px solid rgba(120,220,255,.4); background: transparent; color: #fff; font-weight: 800; font-size: 13px; }
#stage .mini.sel { background: var(--teal); color: #04202b; }
#stage .small { font-size: 12px; color: #a9c9d8; } #stage .warnp { color: #ff9a8a; }
#stage .chip2 { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #7fd8ee; font-weight: 800; }
#stage .facts { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; } #stage .facts li { background: rgba(255,255,255,.07); padding: 6px 10px; border-radius: 8px; }
#stage .card { display: flex; align-items: center; gap: 10px; min-height: 56px; width: 100%; text-align: left; padding: 8px 10px; background: rgba(255,255,255,.08); border: 2px solid rgba(120,220,255,.25); border-radius: 12px; color: #fff; }
#stage .card b { font-size: 20px; width: 30px; text-align: center; color: var(--amber); } #stage .card span { flex: 1; display: flex; flex-direction: column; } #stage .card small { font-size: 11px; color: #9ac; }
#stage .card.locked { opacity: .45; } #stage .card em { font-style: normal; font-size: 12px; font-weight: 800; }
#stage .stars { color: #ffc94a; letter-spacing: 2px; font-size: 18px; } #stage .stars s { color: rgba(255,255,255,.2); text-decoration: none; }
#stage .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border-radius: 10px; padding: 8px 10px; }
#stage .row.off { opacity: .55; } #stage .row > span { display: flex; flex-direction: column; min-width: 0; flex: 1; } #stage .row small { font-size: 11px; color: #9ac; } #stage .row em { font-style: normal; font-size: 12px; font-weight: 800; color: #ffd070; white-space: nowrap; }
#stage .pips { display: flex !important; flex-direction: row !important; gap: 3px; margin-top: 3px; } #stage .pips i { width: 16px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); } #stage .pips i.on { background: var(--good); }
#stage .set { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; font-size: 14px; }
#stage .set input[type=range] { flex: 1; max-width: 60%; min-height: 44px; touch-action: pan-y; } #stage .seg { display: flex; gap: 4px; }
#stage .results h2 { text-align: center; font-size: 24px; } #stage .results.won h2 { color: var(--good); } #stage .results.lost h2 { color: #ff8a6a; } #stage .results .stars { text-align: center; font-size: 30px; }
#stage .ach { font-size: 12px; color: #ffd070; text-align: center; } #stage .next { font-size: 13px; text-align: center; color: #bfeaff; font-weight: 700; }
#stage .pausep { text-align: center; }

/* ---- page chrome below the stage (not part of the game) */
.sh-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.sh-bar .btn { min-height: 44px; min-width: 44px; }
.sh-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.sh-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.sh-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.sh-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.sh-guide p { margin-bottom: .5rem; font-size: .95rem; }
@media (prefers-reduced-motion: reduce) { #stage .warn, #stage .fe { animation: none; } }
#stage .startot { text-align: center; color: #ffc94a; margin: 2px 0 6px; }
#stage .card.nextup { border-color: #ffc94a; box-shadow: 0 0 0 2px rgba(255,201,74,.25); }
#stage .card em.newtag { color: #ffc94a; border: 1px solid #ffc94a; border-radius: 8px; padding: 2px 8px; }
#stage .results .stars { animation: shStarPop .6s ease-out both; }
#stage .results .facts li:last-child { color: #ffd98a; }
@keyframes shStarPop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { #stage .results .stars { animation: none; } }

/* ---- depth finish: static vignette and surface light over the 3D view (no per-frame cost) ---- */
#stage #app::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 55%, rgba(2,12,22,.5) 100%), linear-gradient(rgba(180,235,255,.12), rgba(180,235,255,0) 28%); }

/* ---- full screen under the shell: the stage fills the area below the dock, no duplicate button, no page chrome ---- */
html.pip-immersive .sh-bar, html.pip-immersive .sh-keys, html.pip-immersive .sh-guide, html.pip-immersive .ad-well, html.pip-immersive .game-header, html.pip-immersive #similar-games, html.pip-immersive footer,
html.pip-native .sh-bar, html.pip-native .sh-keys { display: none !important; }
html.pip-immersive #stage {
  position: fixed; z-index: 1; margin: 0; aspect-ratio: auto; max-width: none; border-radius: 0;
  top: calc(var(--pip-vvt, 0px) + var(--pip-dock-h, 52px) + env(safe-area-inset-top, 0px));
  left: calc(env(safe-area-inset-left, 0px) + var(--pip-rail-w, 0px)); right: env(safe-area-inset-right, 0px);
  width: auto; height: calc(var(--pip-vvh, 100dvh) - var(--pip-dock-h, 52px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
html.pip-native #stage { position: fixed; inset: 0; z-index: 1; margin: 0; width: 100%; height: 100%; aspect-ratio: auto; max-width: none; border-radius: 0; }
html.pip-immersive #stage .hud-top, html.pip-immersive #stage .pausebtn { top: 8px; }
html.pip-native #stage .hud-top, html.pip-native #stage .pausebtn { top: max(8px, env(safe-area-inset-top)); }
@media (orientation: landscape) and (max-height: 480px) {
  #stage #radar { top: 62px; } #stage #depthstrip { top: 62px; height: min(220px, calc(100% - 140px)); }
}
