/* Tinplate Arena 3D - stage and UI. Scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
.as-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.as-bar .btn { min-height: 44px; min-width: 44px; background: #E2562B; }
.as-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.as-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.as-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.as-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.as-guide p { margin-bottom: .5rem; font-size: .95rem; }

#stage { --acc:#e2562b; --acc2:#ffb347; --ink:#1d2540; --panel:#222b4a; --pale:#eef2ff; --good:#4ad45a; --bad:#ff3b4d;
  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: #1d2540; color: #fff; font-family: "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; line-height: 1.25; touch-action: none; }
#stage.is-big, #stage:fullscreen, #stage:-webkit-full-screen { 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; z-index: 0; }
#stage #app canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#stage #touch { position: absolute; inset: 0; z-index: 1; touch-action: none; }
#stage #ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#stage button { font-family: inherit; cursor: pointer; touch-action: manipulation; color: inherit; }
#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(#1d2540, #3a2f5c); }
#stage .load-in { display: flex; flex-direction: column; align-items: center; gap: 10px; 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; opacity: .85; }
#stage .spinner { width: 42px; height: 42px; border-radius: 50%; border: 6px solid rgba(255,255,255,.25); border-top-color: var(--acc2); animation: asspin .8s linear infinite; }
@keyframes asspin { 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,28,60,.9); font-weight: 700; }

/* HUD */
#stage .hud { position: absolute; inset: 0; pointer-events: none; padding: max(8px, env(safe-area-inset-top)) 10px 10px; }
#stage .hud > * { pointer-events: none; }
#stage .hud button { pointer-events: auto; }
#stage .hud-top { position: absolute; left: 10px; right: 64px; top: max(8px, env(safe-area-inset-top)); display: flex; gap: 6px; align-items: center; }
#stage .hud-score, #stage .hud-timer { background: rgba(20,28,60,.62); border-radius: 12px; padding: 6px 10px; font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
#stage .hud-score { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stage .hud-info { position: absolute; left: 12px; top: calc(max(8px, env(safe-area-inset-top)) + 38px); font-size: 10px; opacity: .8; text-shadow: 0 1px 2px #000; max-width: 70%; }
#stage .pausebtn { position: absolute; right: 8px; top: max(8px, env(safe-area-inset-top)); width: 48px; height: 48px; border-radius: 14px; border: 0; background: rgba(20,28,60,.7); font-weight: 900; font-size: 16px; letter-spacing: 1px; }
#stage .hud-buffs { position: absolute; left: 12px; top: calc(max(8px, env(safe-area-inset-top)) + 54px); font-size: 11px; font-weight: 800; color: var(--acc2); }
#stage .hud-hp { position: absolute; left: 10px; bottom: 12px; width: 44%; display: flex; align-items: center; gap: 6px; }
#stage .hud-hp .bar { position: relative; flex: 1; height: 14px; background: rgba(10,14,30,.7); border-radius: 8px; overflow: hidden; }
#stage .hud-hp .bar i { position: absolute; inset: 0; background: var(--good); transform-origin: left; transition: transform .1s; }
#stage .hud-hp .bar i.sh { background: #5fb6ff; opacity: .75; height: 5px; top: 0; bottom: auto; }
#stage .hud-hp span { font-weight: 900; font-size: 14px; text-shadow: 0 1px 2px #000; min-width: 28px; }
#stage .hud-ammo { position: absolute; left: 10px; bottom: 34px; font-size: 12px; text-shadow: 0 1px 2px #000; display: flex; gap: 8px; align-items: baseline; }
#stage .hud-ammo b { font-size: 13px; }
#stage .hud-slots { position: absolute; left: 10px; bottom: 56px; display: flex; gap: 6px; }
#stage .slot { min-width: 44px; height: 44px; padding: 0 8px; border-radius: 12px; border: 2px solid rgba(255,255,255,.35); background: rgba(20,28,60,.6); font-size: 11px; font-weight: 800; }
#stage .slot.on { border-color: var(--acc2); background: rgba(226,86,43,.75); }
#stage .hud-actions { position: absolute; right: 10px; bottom: 12px; width: 150px; height: 150px; }
#stage .abtn { position: absolute; border-radius: 50%; border: 3px solid rgba(255,255,255,.55); background: rgba(20,28,60,.55); font-weight: 900; font-size: 11px; letter-spacing: .5px; overflow: hidden; touch-action: none; }
#stage .abtn.dash { right: 0; bottom: 0; width: 84px; height: 84px; background: rgba(226,86,43,.78); font-size: 14px; }
#stage .abtn.dash i { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: rgba(0,0,0,.5); transform-origin: bottom; transform: scaleY(0); }
#stage .abtn.dash span { position: relative; z-index: 1; }
#stage .abtn.swap { right: 92px; bottom: 6px; width: 56px; height: 56px; }
#stage .abtn.reload { right: 14px; bottom: 92px; width: 56px; height: 56px; }
#stage .abtn:active { transform: scale(.94); }
#stage .hud.lefty .hud-actions { right: auto; left: 10px; } #stage .hud.lefty .abtn.dash { right: auto; left: 0; } #stage .hud.lefty .abtn.swap { right: auto; left: 92px; } #stage .hud.lefty .abtn.reload { right: auto; left: 14px; }
#stage .hud.lefty .hud-hp, #stage .hud.lefty .hud-ammo, #stage .hud.lefty .hud-slots { left: auto; right: 10px; }
#stage .hud.lefty .hud-hp { flex-direction: row-reverse; }
#stage .stick { position: absolute; left: 0; top: 0; width: 112px; height: 112px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); background: rgba(255,255,255,.1); }
#stage .stick.aim { border-color: rgba(255,179,71,.6); }
#stage .stick i { position: absolute; left: 34px; top: 34px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.7); }
#stage .hint-bubble { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); max-width: 86%; background: rgba(255,255,255,.95); color: var(--ink); font-weight: 800; font-size: 15px; text-align: center; padding: 10px 16px; border-radius: 16px; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
#stage .feed { position: absolute; left: 0; right: 0; top: 20%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#stage .feed .f { background: rgba(255,255,255,.92); color: var(--ink); font-weight: 800; font-size: 13px; padding: 4px 12px; border-radius: 99px; animation: asfeed 1.9s ease-out forwards; }
#stage .feed .f.good { background: var(--good); color: #063; } #stage .feed .f.bad { background: var(--bad); color: #fff; } #stage .feed .f.pw { background: var(--acc2); color: #4a2a00; }
@keyframes asfeed { 0% { opacity: 0; transform: translateY(8px); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
#stage .banner { position: absolute; left: 0; right: 0; top: 36%; text-align: center; text-shadow: 0 3px 0 rgba(0,0,0,.5); }
#stage .banner b { display: block; font-size: clamp(28px, 9vw, 44px); letter-spacing: 3px; }
#stage .banner span { font-size: 14px; font-weight: 700; }
#stage .flash { position: absolute; inset: 0; opacity: 0; transition: opacity .12s; }
#stage .lowhp { position: absolute; inset: 0; opacity: 0; transition: opacity .3s; box-shadow: inset 0 0 70px 10px rgba(255,59,77,.6); }

/* Screens */
#stage .screen { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; background: rgba(23,30,62,.94); touch-action: pan-y; }
#stage .topbar { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 8px; }
#stage .topbar .title { flex: 1; font-size: 18px; }
#stage .topbar .back { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.14); font-weight: 900; font-size: 18px; }
#stage .chipinfo { font-size: 12px; font-weight: 800; background: rgba(255,255,255,.12); padding: 6px 10px; border-radius: 99px; white-space: nowrap; }
#stage .scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 12px 16px; touch-action: pan-y; }
#stage .scroll h3 { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; opacity: .8; margin: 14px 0 6px; }
#stage .note { font-size: 12px; opacity: .8; margin: 6px 0; }
#stage .dock { padding: 8px 12px max(12px, env(safe-area-inset-bottom)); }
#stage .btn { display: block; width: 100%; min-height: 48px; padding: 10px 14px; border: 0; border-radius: 14px; background: rgba(255,255,255,.16); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 3px 0 rgba(0,0,0,.3); }
#stage .btn.big { min-height: 56px; font-size: 18px; background: var(--acc); letter-spacing: 1px; }
#stage .btn.accent { background: #3b7be0; }
#stage .btn.small { min-height: 44px; width: auto; font-size: 13px; padding: 8px 12px; }
#stage .btn.dim, #stage .btn:disabled { opacity: .5; }
#stage .btn.on { background: var(--good); color: #063; }
#stage .btn.danger { background: #7a2338; margin-top: 12px; width: 100%; }
#stage .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
#stage .btnrow { display: flex; gap: 8px; margin-top: 10px; }
#stage .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
#stage .home { margin: auto 0; padding: 20px 16px; text-align: center; overflow-y: auto; touch-action: pan-y; }
#stage .logo b { display: block; font-size: clamp(30px, 10vw, 46px); letter-spacing: 3px; color: var(--acc2); text-shadow: 0 4px 0 rgba(0,0,0,.4); line-height: 1; }
#stage .logo b.two { color: #fff; font-size: clamp(22px, 7vw, 32px); }
#stage .logo small { font-size: 11px; letter-spacing: 4px; opacity: .7; }
#stage .tag { font-size: 13px; opacity: .8; margin: 8px 0 14px; }
#stage .lvl { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; margin-bottom: 12px; }
#stage .xpbar { flex: 1; max-width: 140px; height: 10px; background: rgba(0,0,0,.4); border-radius: 6px; overflow: hidden; }
#stage .xpbar i { display: block; height: 100%; background: var(--acc2); }
#stage .goal { font-size: 12px; opacity: .85; margin: 14px 4px 0; }
#stage .cards { display: grid; gap: 8px; }
#stage .card { background: rgba(255,255,255,.1); border-radius: 14px; padding: 10px 12px; text-align: left; margin-bottom: 8px; }
#stage .card.pick { border: 2px solid transparent; width: 100%; display: block; }
#stage .card.pick.on { border-color: var(--acc2); background: rgba(226,86,43,.3); }
#stage .card b { display: block; font-size: 15px; } #stage .card small { font-size: 12px; opacity: .85; display: block; margin-top: 2px; }
#stage .card p { font-size: 13px; margin: 4px 0 6px; }
#stage .locked { opacity: .45; }
#stage .chips, #stage .swatches, #stage .seg { display: flex; flex-wrap: wrap; gap: 8px; }
#stage .chip { min-height: 44px; padding: 8px 14px; border-radius: 99px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); font-weight: 800; font-size: 13px; }
#stage .chip.on { background: var(--acc); border-color: var(--acc2); }
#stage .tabs { display: flex; gap: 6px; margin-bottom: 8px; }
#stage .tab { flex: 1; min-height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.1); font-weight: 800; }
#stage .tab.on { background: var(--acc); }
#stage .row { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.08); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
#stage .row.got { background: rgba(74,212,90,.2); }
#stage .row .grow { flex: 1; min-width: 0; } #stage .row b { display: block; font-size: 14px; } #stage .row small { display: block; font-size: 12px; opacity: .8; } #stage .row .mono { font-family: ui-monospace, Menlo, monospace; opacity: .65; }
#stage .row .col { display: flex; flex-direction: column; gap: 6px; } #stage .row em { font-style: normal; font-weight: 800; font-size: 12px; color: var(--acc2); }
#stage .pips { display: flex; gap: 4px; margin-top: 4px; } #stage .pips i { width: 16px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.2); } #stage .pips i.on { background: var(--acc2); }
#stage .sw { position: relative; width: 52px; height: 52px; border-radius: 14px; border: 3px solid rgba(255,255,255,.3); }
#stage .sw.on { border-color: #fff; } #stage .sw em { position: absolute; left: 0; right: 0; bottom: 2px; font-style: normal; font-size: 10px; font-weight: 900; text-shadow: 0 1px 2px #000; }
#stage .mission { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
#stage .mission i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(74,212,90,.35); } #stage .mission span, #stage .mission em { position: relative; } #stage .mission em { font-style: normal; color: var(--acc2); }
#stage .setting { margin-bottom: 12px; } #stage .setting b { display: block; margin-bottom: 6px; font-size: 13px; }
#stage .modal { margin: auto; width: calc(100% - 32px); max-width: 360px; background: var(--panel); border-radius: 18px; padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 0 rgba(0,0,0,.3); }
#stage .modal.wide { margin: 12px auto; } #stage .modal h2 { font-size: 26px; letter-spacing: 2px; } #stage .modal h2.win { color: var(--good); } #stage .modal h2.lose { color: #ff8a8a; }
#stage .modal .sub, #stage .tipline { font-size: 13px; opacity: .8; }
#stage .rows .r { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
#stage .rewards { display: flex; justify-content: center; gap: 16px; font-size: 18px; color: var(--acc2); }
#stage .bonus { list-style: none; font-size: 12px; text-align: left; display: grid; gap: 3px; } #stage .bonus li::before { content: "+ "; color: var(--good); font-weight: 900; }
#stage .toast { position: absolute; left: 12px; right: 12px; bottom: 16px; z-index: 30; text-align: center; background: rgba(255,255,255,.95); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-weight: 800; font-size: 13px; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #stage .spinner { animation-duration: 2s; } #stage .feed .f { animation: none; } }
#stage .newbest { color: var(--acc2); font-weight: 900; letter-spacing: 2px; font-size: 13px; animation: aspop .5s ease-out both; }
#stage .pbline { font-size: 12px; opacity: .8; }
#stage .banner b { animation: aspop .25s ease-out both; }
@keyframes aspop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { #stage .newbest, #stage .banner b { animation: none; } }

/* Full screen on phones: the shell fixes #stage under its dock; keep the playfield, touch layer and HUD below the dock. */
.game-wrap { display: flex; flex-direction: column; }
.game-wrap > .game-title { order: 5; margin: 1rem 0 0; }
.game-wrap > .as-bar { order: 4; }
.game-wrap > .as-keys { order: 6; }
html.pip-immersive #stage { aspect-ratio: auto; border-radius: 0; overflow: hidden !important; padding-top: 0 !important; background: #1d2540; }
html.pip-immersive #stage #app, html.pip-immersive #stage #touch, html.pip-immersive #stage #ui, html.pip-immersive #stage #ctxlost, html.pip-immersive #stage #loader {
  top: calc(var(--pip-dock-h, 52px) + env(safe-area-inset-top, 0px)); }
html.pip-immersive #stage #app canvas { width: 100%; height: 100%; }
html.pip-immersive .as-bar, html.pip-immersive .as-keys, html.pip-immersive .as-guide, html.pip-immersive .game-title, html.pip-immersive .game-header, html.pip-immersive .ad-well, html.pip-immersive footer, html.pip-immersive #similar-games { display: none !important; }
@media (orientation: landscape) and (max-height: 480px) {
  html.pip-immersive #stage #app, html.pip-immersive #stage #touch, html.pip-immersive #stage #ui, html.pip-immersive #stage #ctxlost, html.pip-immersive #stage #loader { top: env(safe-area-inset-top, 0px); }
  html.pip-immersive #stage .modal { max-height: 100%; overflow-y: auto; }
}
