/* Depot Parker 3D - stage, HUD, screens. Everything is scoped under #stage so site styles never leak in. */
html.pip-big, html.pip-big body { overflow: hidden; }
#stage { --o: #ff9f1c; --o2: #ffb347; --ink: #121a26; --card: rgba(18,26,38,.92); --line: rgba(255,255,255,.14); --good: #44d17a; --bad: #ff5a4a;
  position: relative; width: min(100%, max(300px, calc(78vh * 0.5625))); width: min(100%, max(300px, calc(78svh * 0.5625))); aspect-ratio: 9 / 16; margin: 0 auto; overflow: hidden;
  border-radius: 14px; background: #1b2330; color: #fff; 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 { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; }
html.pip-big #stage { position: fixed; z-index: 99999; }
html.pip-immersive .game-wrap > :not(#stage) { display: none; }
#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 button { font-family: inherit; color: 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: 60; display: flex; align-items: center; justify-content: center; background: linear-gradient(#26364d, #121a26); }
#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: 3px; color: var(--o); }
#stage .spinner { width: 40px; height: 40px; border-radius: 50%; border: 5px solid rgba(255,255,255,.25); border-top-color: var(--o); animation: tpspin .8s linear infinite; }
@keyframes tpspin { to { transform: rotate(360deg); } }
#stage #ctxlost { position: absolute; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(18,26,38,.92); font-weight: 700; }

/* ---------- HUD ---------- */
#stage #hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#stage #hud button, #stage #hud .wheel { pointer-events: auto; touch-action: none; }
#stage .hud-top { position: absolute; left: 8px; right: 8px; top: max(8px, env(safe-area-inset-top)); display: flex; gap: 6px; align-items: center; }
#stage .stat { background: rgba(10,16,26,.62); border-radius: 12px; padding: 4px 9px; min-height: 36px; display: flex; flex-direction: column; justify-content: center; }
#stage .stat .lbl { font-size: 9px; letter-spacing: 1.5px; opacity: .75; }
#stage .stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
#stage .dmg { flex: 1; position: relative; height: 36px; background: rgba(10,16,26,.62); border-radius: 12px; overflow: hidden; }
#stage .dmg i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #44d17a, #ffd23f, #ff5a4a); background-size: 300px 100%; transition: width .2s; }
#stage .dmg span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; letter-spacing: 2px; text-shadow: 0 1px 2px #000; }
#stage .dmg.hot { animation: tpblink .5s infinite alternate; }
@keyframes tpblink { to { opacity: .6; } }
#stage .icon { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(10,16,26,.72); font-weight: 800; letter-spacing: 1px; }
#stage .hold { position: absolute; left: 20%; right: 20%; top: 60px; height: 26px; background: rgba(10,16,26,.7); border-radius: 13px; overflow: hidden; text-align: center; }
#stage .hold i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--good); width: 0; }
#stage .hold span { position: relative; font-size: 12px; font-weight: 700; line-height: 26px; }
#stage .hint { position: absolute; left: 12px; right: 12px; top: 96px; background: rgba(255,210,63,.95); color: #2a2000; border-radius: 12px; padding: 8px 12px; font-size: 14px; font-weight: 700; text-align: center; }
#stage .toast { position: absolute; left: 50%; top: 28%; transform: translateX(-50%); padding: 6px 16px; border-radius: 20px; font-weight: 800; font-size: 18px; background: rgba(10,16,26,.8); white-space: nowrap; }
#stage .toast.good { background: rgba(40,160,90,.92); } #stage .toast.bad { background: rgba(210,60,50,.92); } #stage .toast.warn { background: rgba(255,150,30,.95); color: #2a1500; }
#stage .side { position: absolute; right: 10px; bottom: 150px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
#stage .chip { min-height: 44px; padding: 0 12px; border-radius: 22px; border: 0; background: rgba(10,16,26,.72); font-size: 13px; font-weight: 700; }
#stage .gear { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; background: rgba(10,16,26,.8); font-size: 26px; font-weight: 800; }
#stage .gear.rev { background: #c0392b; }
#stage .spd { font-size: 12px; opacity: .85; background: rgba(10,16,26,.55); padding: 2px 8px; border-radius: 8px; }
#stage .pad { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 10px max(10px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
#stage .wheel { position: relative; width: 124px; height: 124px; border-radius: 50%; border: 12px solid #2a2f3a; background: rgba(10,16,26,.45); touch-action: none; box-shadow: 0 0 0 2px rgba(255,255,255,.18) inset; }
#stage .wheel.on { border-color: #3a4152; }
#stage .wheel .sp { position: absolute; background: #2a2f3a; }
#stage .wheel .sp.a { left: 0; right: 0; top: calc(50% - 5px); height: 10px; }
#stage .wheel .sp.b { top: 50%; bottom: 0; left: calc(50% - 5px); width: 10px; }
#stage .wheel .mark { position: absolute; left: calc(50% - 5px); top: -12px; width: 10px; height: 16px; background: var(--o); border-radius: 3px; z-index: 2; }
#stage .zones { display: flex; gap: 10px; }
#stage .zones button { width: 72px; height: 88px; border-radius: 16px; border: 0; background: rgba(10,16,26,.62); font-size: 28px; }
#stage .zones button.on, #stage .pedals button.on { background: var(--o); color: #2a1500; }
#stage [data-controls="wheel"] .zones, #stage [data-controls="zones"] .wheel { display: none; }
#stage .pedals { display: flex; gap: 10px; align-items: flex-end; }
#stage .pedals button { border: 0; border-radius: 16px; font-weight: 800; letter-spacing: 1px; background: rgba(10,16,26,.62); font-size: 13px; }
#stage .pedals .brake { width: 64px; height: 84px; } #stage .pedals .gas { width: 74px; height: 112px; background: rgba(40,140,80,.8); }
#stage .pedals .gas.on { background: var(--good); }

/* ---------- screens ---------- */
#stage #ui { position: absolute; inset: 0; z-index: 20; }
#stage .screen { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: max(10px, env(safe-area-inset-top)) 12px 14px; background: linear-gradient(rgba(14,20,30,.72), rgba(14,20,30,.9)); }
#stage .screen[data-screen="pause"], #stage .screen[data-screen="results"] { display: flex; align-items: center; justify-content: center; background: rgba(10,14,22,.7); }
#stage .screen[data-screen="brief"] { background: linear-gradient(rgba(14,20,30,.35) 0, rgba(14,20,30,.35) 18%, rgba(14,20,30,.92) 52%); padding-top: 38%; }
#stage .bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
#stage .bar h2 { font-size: 18px; flex: 1; text-align: center; }
#stage .back { min-height: 44px; min-width: 64px; background: none; border: 0; font-size: 14px; font-weight: 700; text-align: left; }
#stage .coins { font-weight: 800; color: #ffd23f; display: inline-flex; align-items: center; gap: 4px; min-width: 64px; justify-content: flex-end; }
#stage .coins i, #stage .buy i { width: 14px; height: 14px; border-radius: 50%; background: #ffd23f; box-shadow: inset -2px -2px 0 #d9a400; display: inline-block; }
#stage .menu { display: flex; flex-direction: column; gap: 10px; min-height: 100%; justify-content: center; }
#stage .logo { text-align: center; line-height: 1; margin-bottom: 4px; }
#stage .logo b { display: block; font-size: 38px; letter-spacing: 4px; } #stage .logo b.o { color: var(--o); font-size: 44px; } #stage .logo small { letter-spacing: 6px; opacity: .8; }
#stage .rank { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
#stage .meter { flex: 1; height: 10px; background: rgba(255,255,255,.14); border-radius: 5px; overflow: hidden; } #stage .meter i { display: block; height: 100%; background: var(--o); }
#stage .big { min-height: 58px; border: 0; border-radius: 16px; background: var(--o); color: #2a1500; font-size: 19px; font-weight: 800; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }
#stage .big small { font-size: 12px; font-weight: 600; opacity: .8; }
#stage .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#stage .grid2 button { min-height: 62px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 15px; font-weight: 700; padding: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#stage .grid2 button small { font-size: 11px; font-weight: 500; opacity: .75; } #stage .grid2 .span { grid-column: 1 / -1; }
#stage .tabs { display: flex; gap: 8px; margin-bottom: 8px; }
#stage .tab { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 800; } #stage .tab.on { background: var(--o); color: #2a1500; } #stage .tab.lock { opacity: .55; }
#stage .zone { font-size: 13px; margin-bottom: 8px; opacity: .9; } #stage .note { font-size: 13px; opacity: .85; margin: 6px 0 10px; }
#stage .lvls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
#stage .lvl { min-height: 72px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; align-items: center; padding: 6px 10px; text-align: left; column-gap: 6px; }
#stage .lvl b { grid-row: 1 / 3; font-size: 22px; color: var(--o); } #stage .lvl small { font-size: 11px; opacity: .8; } #stage .lvl.lock { opacity: .45; }
#stage .st { color: #55606f; font-size: 15px; } #stage .st.on { color: #ffd23f; } #stage .stars.big { font-size: 34px; text-align: center; } #stage .stars.big .st { font-size: 36px; }
#stage .list { display: flex; flex-direction: column; gap: 8px; }
#stage .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); text-align: left; width: 100%; }
#stage button.row { flex-wrap: wrap; } #stage .row.lock { opacity: .5; } #stage .row.got { border-color: var(--good); } #stage .row small { display: block; font-size: 12px; opacity: .75; } #stage .row.danger { border-color: rgba(255,90,74,.5); }
#stage .tick { font-size: 13px; font-weight: 800; color: #ffd23f; }
#stage .buy { min-height: 44px; min-width: 76px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--o); color: #2a1500; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: 5px; } #stage .buy:disabled { background: #3b4352; color: #9aa4b5; }
#stage .pips { display: flex; gap: 4px; margin-top: 4px; } #stage .pips i { width: 16px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); } #stage .pips i.on { background: var(--o); }
#stage h3 { font-size: 14px; letter-spacing: 1px; margin: 14px 0 8px; opacity: .85; }
#stage .paints { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#stage .paint { min-height: 64px; border-radius: 12px; border: 2px solid transparent; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; } #stage .paint.sel { border-color: #fff; } #stage .paint:disabled { opacity: .5; }
#stage .paint span { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 2px solid rgba(255,255,255,.4); } #stage .paint small { font-size: 10px; }
#stage .seg { display: flex; gap: 4px; } #stage .seg button { min-height: 44px; min-width: 52px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); font-weight: 700; font-size: 13px; } #stage .seg button.on { background: var(--o); color: #2a1500; border-color: var(--o); }
#stage .modal { width: 100%; max-width: 340px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: center; max-height: 100%; overflow-y: auto; touch-action: pan-y; }
#stage .modal h2 { font-size: 24px; }
#stage .stats { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; font-size: 12px; } #stage .stats span { background: rgba(255,255,255,.08); border-radius: 8px; padding: 4px 8px; } #stage .stats b { margin-left: 3px; }
#stage .rew { font-size: 13px; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.07); } #stage .rew.gold { background: rgba(255,210,63,.2); color: #ffd23f; } #stage .goal { font-size: 13px; opacity: .9; }
#stage .brief { display: flex; flex-direction: column; gap: 10px; } #stage .brief ul { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; } #stage .brief li { background: rgba(255,255,255,.07); border-radius: 8px; padding: 6px 10px; }
#stage .veh { font-size: 18px; color: var(--o); }

/* ---------- page around the stage ---------- */
.tp-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: .75rem 0 .25rem; }
.tp-bar .btn { min-height: 44px; min-width: 44px; }
.tp-keys { text-align: center; font-size: .8rem; color: #64748b; margin: .25rem 0 0; }
.tp-guide { max-width: 640px; margin: 1.5rem auto; padding: 0 1rem; line-height: 1.6; }
.tp-guide h2 { font-size: 1.25rem; margin-bottom: .5rem; } .tp-guide h3 { font-size: 1rem; margin: 1rem 0 .25rem; } .tp-guide p { margin-bottom: .5rem; font-size: .95rem; }
@media (max-width: 380px) { #stage .wheel { width: 108px; height: 108px; } #stage .pedals .gas { width: 66px; height: 100px; } #stage .pedals .brake { width: 56px; height: 76px; } #stage .zones button { width: 62px; } }
@media (prefers-reduced-motion: reduce) { #stage .dmg.hot, #stage .spinner { animation: none; } }

/* ---------- full screen polish (pass 3) ---------- */
/* the shell already offers Full screen, so the page-level duplicate button steps aside */
body:has(.pip-btn--fs) .tp-bar { display: none; }
#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(8,12,20,.38) 100%); }
#stage.is-big .hud-top, html.pip-native #stage .hud-top { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); }
#stage.is-big .pad, html.pip-native #stage .pad { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
#stage.is-big .screen, html.pip-native #stage .screen { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
@media (orientation: landscape) and (max-height: 520px) {
  #stage .screen { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 8px; }
  #stage .menu { gap: 6px; }
  #stage .big { min-height: 48px; font-size: 17px; }
  #stage .wheel { width: 108px; height: 108px; }
  #stage .zones button { height: 76px; }
  #stage .pedals .gas { height: 96px; } #stage .pedals .brake { height: 72px; }
  #stage .screen .menu, #stage .screen .brief { max-width: 560px; margin-left: auto; margin-right: auto; width: 100%; }
  #stage .screen[data-screen="brief"] { padding-top: max(6px, env(safe-area-inset-top)); background: rgba(14,20,30,.86); }
  #stage .brief { gap: 6px; } #stage .brief ul { gap: 3px; font-size: 12px; }
  #stage .brief .big { min-height: 48px; flex-shrink: 0; }
}
