:root {
  --ink: #07090f;
  --cream: #f3e6c8;
  --brass: #e2bf6e;
  --brass-dim: #8a6a33;
  --orange: #ff7a2a;
  --violet: #b87cff;
  --red: #ff4a3a;
  --teal: #3fe0d0;
  --panel: rgba(12, 12, 16, 0.82);
  --display: 'Limelight', 'Georgia', serif;
  --label: 'Bebas Neue', 'Impact', sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --comic: 'Bangers', 'Impact', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--cream); font-family: var(--body); -webkit-user-select: none; user-select: none; touch-action: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- floating text ---------- */
#fx-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.float-text { position: absolute; left: 0; top: 0; font-family: var(--label); font-size: 22px; letter-spacing: 1px; color: #ffe2a0; text-shadow: 0 2px 0 #000, 0 0 12px rgba(255, 160, 60, 0.7); white-space: nowrap; will-change: transform; }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 6; background: radial-gradient(ellipse at center, rgba(255, 40, 30, 0) 40%, rgba(255, 30, 20, 0.55) 100%); opacity: 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.card { position: absolute; top: max(12px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; background: linear-gradient(180deg, rgba(20, 16, 12, 0.88), rgba(10, 10, 14, 0.8)); border: 1px solid var(--brass-dim); border-radius: 40px 10px 10px 40px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(226, 191, 110, 0.15); }
.card.you { left: max(12px, env(safe-area-inset-left)); }
.card.rival { right: max(12px, env(safe-area-inset-right)); border-radius: 10px 40px 40px 10px; padding: 8px 8px 8px 14px; }
.badge { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 24px; color: #111; }
.badge.nova { background: radial-gradient(circle at 35% 30%, #ffd1a8, var(--orange)); box-shadow: 0 0 0 3px #1b1510, 0 0 0 5px var(--orange), 0 0 18px rgba(255, 122, 42, 0.6); }
.badge.vanta { background: radial-gradient(circle at 35% 30%, #e4ccff, #7a3fc0); box-shadow: 0 0 0 3px #1b1510, 0 0 0 5px var(--violet), 0 0 18px rgba(184, 124, 255, 0.6); }
.card-name { font-family: var(--label); font-size: 22px; letter-spacing: 2px; line-height: 1; }
.card-name small { font-family: var(--body); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; opacity: 0.6; margin: 0 4px; }
.card-body.right { text-align: right; }
.pips { display: flex; gap: 4px; margin: 5px 0 4px; }
.rival-pips { justify-content: flex-end; }
.pip { width: 16px; height: 12px; border-radius: 2px; border: 1px solid rgba(243, 230, 200, 0.35); background: rgba(255, 255, 255, 0.04); transition: all 0.25s; }
.pip.goal { border-color: var(--brass); }
.pip.on { background: var(--cream); border-color: var(--cream); box-shadow: 0 0 8px rgba(255, 230, 180, 0.8); }
.pip.on::after { content: ''; display: block; height: 3px; margin-top: 4px; background: #d22a1e; }
.rival-pips .pip.on { background: #d9c2ff; box-shadow: 0 0 8px rgba(184, 124, 255, 0.9); }
.card-sub { font-size: 12px; display: flex; gap: 10px; align-items: center; opacity: 0.9; }
.card-sub.right { justify-content: flex-end; }
.life { color: var(--orange); letter-spacing: 2px; font-size: 13px; }
.gadgets { color: var(--brass); font-size: 12px; }

.center-dial { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); text-align: center; }
.dial { position: relative; width: 120px; height: 66px; color: var(--brass); background: radial-gradient(ellipse at 50% 100%, rgba(30, 22, 12, 0.95) 60%, rgba(30, 22, 12, 0) 72%); }
.dial svg { width: 120px; height: 64px; filter: drop-shadow(0 0 6px rgba(226, 191, 110, 0.35)); }
#dial-needle { transition: transform 0.2s ease-out; transform-origin: 60px 60px; }
.dial strong { position: absolute; left: 0; right: 0; bottom: -2px; font-family: var(--label); font-size: 28px; letter-spacing: 2px; color: var(--cream); text-shadow: 0 0 10px rgba(255, 200, 120, 0.6); }
.dial-meta { display: flex; gap: 14px; justify-content: center; font-family: var(--label); font-size: 18px; letter-spacing: 1.5px; color: var(--brass); text-shadow: 0 2px 4px #000; }

#minimap { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 108px; width: 60px; height: 210px; border: 1px solid var(--brass-dim); border-radius: 6px; background: rgba(8, 8, 12, 0.72); }

#toasts { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 6px; width: min(92vw, 560px); }
.toast { padding: 7px 16px; border-radius: 4px; font-weight: 600; font-size: 15px; background: rgba(14, 12, 10, 0.88); border-left: 3px solid var(--brass); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); animation: toast-in 0.25s ease-out; text-align: center; }
.toast.good { border-color: var(--orange); }
.toast.bad { border-color: var(--violet); color: #ead8ff; }
.toast.warn { border-color: var(--red); }
.toast.brief { border-color: var(--teal); font-size: 17px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 0.4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }

.prompt { position: absolute; left: 0; top: 0; padding: 4px 10px; font-family: var(--label); font-size: 17px; letter-spacing: 1.5px; color: #111; background: var(--brass); border-radius: 3px; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6); }
.prompt::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--brass); }
.edge-arrow { position: absolute; left: 0; top: 0; padding: 4px 10px; font-family: var(--label); font-size: 16px; letter-spacing: 1.5px; color: #fff; background: rgba(90, 40, 150, 0.85); border: 1px solid var(--violet); border-radius: 20px; white-space: nowrap; box-shadow: 0 0 14px rgba(184, 124, 255, 0.5); }
.edge-arrow span { display: inline-block; }
#countdown { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--display); font-size: clamp(64px, 14vw, 150px); color: var(--cream); text-shadow: 0 0 30px rgba(255, 140, 60, 0.8), 0 6px 0 #000; }
#countdown.pop { animation: pop 0.6s ease-out; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } 40% { opacity: 1; } }
.icon-btn { pointer-events: auto; position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: 42px; height: 34px; border-radius: 6px; background: rgba(12, 12, 16, 0.7); border: 1px solid var(--brass-dim); color: var(--brass); font-weight: 700; }

/* ---------- touch ---------- */
#touch { position: fixed; inset: auto 0 0 0; height: 0; z-index: 11; }
#touch button { pointer-events: auto; background: rgba(20, 16, 12, 0.6); border: 1px solid rgba(226, 191, 110, 0.6); color: var(--cream); border-radius: 12px; font-family: var(--label); font-size: 20px; letter-spacing: 1px; touch-action: none; }
#touch button.on { background: rgba(226, 191, 110, 0.55); color: #111; }
.pad { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 58px); gap: 6px; }
.pad [data-act=up] { grid-column: 2; }
.pad [data-act=left] { grid-column: 1; grid-row: 2; }
.pad [data-act=down] { grid-column: 2; grid-row: 2; }
.pad [data-act=right] { grid-column: 3; grid-row: 2; }
.acts { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 70px 70px; grid-template-rows: 44px 70px; gap: 8px; }
.acts .small { grid-column: 1 / 3; font-size: 16px !important; }
.acts .fire { border-color: var(--orange) !important; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; }
.diff { display: inline-flex; border: 1px solid var(--brass-dim); border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.diff button { background: transparent; border: 0; padding: 9px 18px; font-family: var(--label); font-size: 18px; letter-spacing: 2px; color: var(--cream); opacity: 0.6; }
.diff button.on { background: var(--brass); color: #111; opacity: 1; }
.primary, .panel button { display: block; }
.primary { background: linear-gradient(180deg, #ffb070, var(--orange)); color: #140a02; border: 0; border-radius: 6px; padding: 14px 34px; font-family: var(--label); font-size: 26px; letter-spacing: 3px; box-shadow: 0 6px 24px rgba(255, 122, 42, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.2); transition: transform 0.12s; }
.primary:hover { transform: translateY(-2px); }
.title-links { display: flex; gap: 18px; margin-top: 14px; }
.link { background: none; border: 0; padding: 0; color: var(--brass); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }
.modal { background: rgba(4, 5, 8, 0.72); backdrop-filter: blur(4px); z-index: 30; }
.panel { background: linear-gradient(180deg, #17130f, #0d0c10); border: 1px solid var(--brass-dim); border-radius: 10px; padding: 26px 30px; max-width: 880px; width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7); }
.panel.narrow { max-width: 420px; text-align: center; }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 38px; margin: 0 0 12px; color: var(--cream); }
.panel h3 { font-family: var(--label); letter-spacing: 2px; font-size: 20px; color: var(--brass); margin: 0 0 4px; }
.panel p { line-height: 1.5; margin: 0 0 10px; opacity: 0.92; }
.panel button:not(.primary) { width: 100%; margin: 8px 0 0; padding: 11px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--brass-dim); border-radius: 6px; font-weight: 600; }
.panel .primary { width: 100%; margin-top: 16px; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 22px; }
.red { color: var(--red); } .violet { color: var(--violet); } .orange { color: var(--orange); }
.keys { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.keys td { padding: 6px 4px; border-bottom: 1px solid rgba(226, 191, 110, 0.15); }
.keys td:last-child { text-align: right; font-family: var(--label); letter-spacing: 1.5px; font-size: 17px; color: var(--brass); }
.grade { font-family: var(--display); font-size: 96px; line-height: 1; color: var(--orange); text-shadow: 0 0 30px rgba(255, 122, 42, 0.6); }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; text-align: left; margin: 14px 0; font-size: 15px; }
.stats dt { opacity: 0.7; } .stats dd { margin: 0; font-family: var(--label); font-size: 19px; letter-spacing: 1px; color: var(--brass); text-align: right; }
#loading { background: var(--ink); z-index: 50; transition: opacity 0.6s; }
.loader { font-family: var(--label); letter-spacing: 4px; font-size: 20px; color: var(--brass); display: flex; align-items: center; gap: 12px; }
.loader span { width: 18px; height: 18px; border: 2px solid var(--brass); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ================= MAIN MENU (high voltage) ================= */
#title { flex-direction: column; justify-content: flex-end; align-items: stretch; overflow: hidden; background: transparent; }
.hype { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rays { position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: .22; mix-blend-mode: screen;
  background: repeating-conic-gradient(from 0deg, var(--ray, #ff7a2a) 0 7deg, transparent 7deg 18deg); animation: spin-rays 16s linear infinite; transition: opacity .15s; }
.rays.violet { --ray: #9a55ff; }
.rays.flash { opacity: .55; }
@keyframes spin-rays { to { transform: rotate(360deg); } }
.halftone { position: absolute; inset: 0; opacity: .22; background-image: radial-gradient(rgba(0,0,0,.9) 1.2px, transparent 1.6px); background-size: 7px 7px; mix-blend-mode: multiply; }
.scan { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px); pointer-events: none; }
.slam { position: absolute; left: 0; right: 0; top: 24%; transform: translateY(-50%); text-align: center; font-family: var(--comic); font-size: clamp(64px, 17vw, 220px); line-height: .9; letter-spacing: 2px; color: #fff4d8; -webkit-text-stroke: 3px #120a04;
  text-shadow: 6px 6px 0 #ff7a2a, -6px -6px 0 #9a55ff, 0 0 40px rgba(255, 150, 60, .5); white-space: nowrap; }
.slam span { display: inline-block; animation: slam-in .32s cubic-bezier(.2, 1.6, .4, 1) both; }
.slam.alt span { color: #1a0f05; -webkit-text-stroke: 3px #fff4d8; text-shadow: 6px 6px 0 #9a55ff, -4px -4px 0 #ff7a2a; }
@keyframes slam-in { 0% { transform: scale(3.2) rotate(var(--rot, -8deg)); opacity: 0; filter: blur(6px); } 60% { opacity: 1; filter: none; } 100% { transform: scale(1) rotate(var(--rot2, -3deg)); } }
.bursts { position: absolute; inset: 0; }
.burst { position: absolute; padding: 18px 26px; font-family: var(--comic); font-size: clamp(22px, 4.2vw, 46px); letter-spacing: 1px; color: #120a04; background: #ffd23a;
  clip-path: polygon(50% 0, 61% 18%, 82% 6%, 78% 29%, 100% 34%, 83% 50%, 100% 66%, 77% 71%, 82% 94%, 61% 82%, 50% 100%, 39% 82%, 18% 94%, 22% 71%, 0 66%, 17% 50%, 0 34%, 22% 29%, 18% 6%, 39% 18%);
  animation: pop-burst .9s cubic-bezier(.2, 1.8, .4, 1) forwards; }
.burst.o { background: #ff7a2a; } .burst.v { background: #b87cff; } .burst.w { background: #fff4d8; }
@keyframes pop-burst { 0% { transform: scale(0) rotate(-30deg); } 25% { transform: scale(1.15) rotate(var(--r, 6deg)); } 80% { transform: scale(1) rotate(var(--r, 6deg)); opacity: 1; } 100% { transform: scale(.9) rotate(var(--r, 6deg)); opacity: 0; } }
.vs-split { position: absolute; left: 0; right: 0; top: 16%; display: flex; justify-content: space-between; align-items: center; padding: 0 3vw; opacity: 0; transition: opacity .12s; }
.vs-split.on { opacity: 1; }
.vs-card { width: min(34vw, 300px); padding: 14px 16px; font-family: var(--label); letter-spacing: 1.5px; background: rgba(10, 8, 6, .82); border: 3px solid; transform: skewX(-8deg); }
.vs-card.nova { border-color: var(--orange); box-shadow: 8px 8px 0 var(--orange); }
.vs-card.vanta { border-color: var(--violet); box-shadow: -8px 8px 0 var(--violet); text-align: right; }
.vs-split.on .vs-card.nova { animation: from-left .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.vs-split.on .vs-card.vanta { animation: from-right .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes from-left { from { transform: translateX(-120%) skewX(-8deg); } }
@keyframes from-right { from { transform: translateX(120%) skewX(-8deg); } }
.vs-card b { display: block; font-family: var(--comic); font-size: clamp(30px, 5vw, 52px); font-weight: 400; color: #fff4d8; }
.vs-card span { display: block; font-family: var(--body); font-size: 11px; opacity: .8; margin-bottom: 6px; text-transform: uppercase; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 3px; }
.vs-card.vanta .stat { flex-direction: row-reverse; }
.stat label { width: 62px; }
.stat i { flex: 1; height: 8px; background: rgba(255,255,255,.1); position: relative; overflow: hidden; }
.stat i::after { content: ''; position: absolute; inset: 0; width: calc(var(--v) * 100%); background: currentColor; animation: fill .6s ease-out both; }
.vs-card.nova .stat i { color: var(--orange); } .vs-card.vanta .stat i { color: var(--violet); }
.vs-card.vanta .stat i::after { left: auto; right: 0; }
@keyframes fill { from { width: 0; } }
.vs-mid { font-family: var(--comic); font-size: clamp(56px, 10vw, 120px); color: #fff4d8; -webkit-text-stroke: 3px #120a04; text-shadow: 5px 5px 0 #ff7a2a, -5px -5px 0 #9a55ff; animation: throb .35s ease-in-out infinite alternate; }
@keyframes throb { to { transform: scale(1.12) rotate(-4deg); } }
.meter { position: absolute; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); width: 170px; font-family: var(--label); letter-spacing: 2px; font-size: 13px; color: #fff4d8; }
.meter i { display: block; height: 8px; margin-top: 4px; background: linear-gradient(90deg, #ff3a2a, #ffd23a, #3fe0d0); transform-origin: left; border: 1px solid #000; }
.hype-count { position: absolute; right: max(14px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); font-family: var(--comic); font-size: clamp(22px, 3.5vw, 38px); color: #ffd23a; -webkit-text-stroke: 1.5px #120a04; text-shadow: 3px 3px 0 #9a55ff; transform: rotate(4deg); }
.hype-count.bump { animation: bump .2s ease-out; }
@keyframes bump { 50% { transform: rotate(4deg) scale(1.3); } }
.menu-ui { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 16px calc(58px + env(safe-area-inset-bottom)); text-align: center; }
.logo small { display: block; font-family: var(--label); letter-spacing: 5px; font-size: 14px; color: var(--brass); text-shadow: 0 2px 4px #000; }
.logo h1 { margin: 2px 0 4px; font-family: var(--display); font-weight: 400; font-size: clamp(40px, 6.4vw, 84px); line-height: .88; color: var(--cream); text-shadow: 0 0 40px rgba(255, 140, 60, .45), 0 5px 0 #000; }
.logo.kick h1 { animation: logo-kick .25s ease-out; }
@keyframes logo-kick { 40% { transform: scale(1.06) skewX(-4deg); text-shadow: 5px 0 0 #ff7a2a, -5px 0 0 #9a55ff; } }
.primary.big { font-family: var(--comic); font-size: clamp(26px, 4.4vw, 40px); letter-spacing: 2px; padding: 14px 38px; border-radius: 4px; transform: skewX(-8deg); box-shadow: 7px 7px 0 #9a55ff, 0 0 40px rgba(255, 122, 42, .55); animation: pulse-btn .357s ease-in-out infinite alternate; }
@keyframes pulse-btn { to { transform: skewX(-8deg) scale(1.05); } }
.menu-ui .diff { background: rgba(8, 8, 12, .7); margin: 0; }
.menu-ui .title-links { margin: 0; flex-wrap: wrap; justify-content: center; }
.menu-ui .link { text-shadow: 0 2px 4px #000; }
.ticker { position: absolute; left: 0; right: 0; bottom: 0; height: calc(34px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #ff7a2a; color: #120a04; overflow: hidden; border-top: 3px solid #120a04; z-index: 3; }
#ticker-track { white-space: nowrap; font-family: var(--label); font-size: 22px; letter-spacing: 2px; line-height: 34px; animation: tick 22s linear infinite; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
#title.calm .rays, #title.calm .slam, #title.calm .bursts, #title.calm .scan { display: none; }
#title.calm .primary.big { animation: none; }
@media (prefers-reduced-motion: reduce) { .rays, .slam span, .burst, .primary.big, .vs-mid, #ticker-track { animation: none !important; } }

/* ================= danger (last life) ================= */
#danger { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px 30px rgba(255, 20, 30, .55); transition: opacity .4s; }
#danger.on { opacity: 1; animation: heartbeat 0.83s ease-in-out infinite; }
@keyframes heartbeat { 0%, 100% { opacity: .55; } 12% { opacity: 1; } 24% { opacity: .6; } 36% { opacity: .9; } }

/* ================= responsive ================= */
@media (max-width: 760px) {
  .card { padding: 5px 10px 5px 5px; gap: 6px; }
  .card.rival { padding: 5px 5px 5px 10px; }
  .badge { width: 32px; height: 32px; font-size: 17px; }
  .card-name { font-size: 16px; }
  .pip { width: 11px; height: 9px; }
  .card-sub { font-size: 10px; }
  .center-dial { top: 64px; transform: translateX(-50%) scale(0.8); transform-origin: top center; }
  #minimap { top: 76px; width: 40px; height: 150px; }
  .toast { font-size: 13px; }
  .vs-split { top: 11%; }
  .vs-card { padding: 8px 10px; }
  .stat { font-size: 11px; } .stat label { width: 50px; }
  .slam { top: 40%; }
  .meter { width: 120px; font-size: 11px; }
}
@media (max-height: 480px) {
  .card { padding: 4px 9px 4px 4px; gap: 6px; top: 6px; }
  .card.rival { padding: 4px 4px 4px 9px; }
  .badge { width: 30px; height: 30px; font-size: 16px; }
  .card-name { font-size: 16px; }
  .pip { width: 11px; height: 9px; }
  .pips { margin: 3px 0 2px; }
  .card-sub { font-size: 10px; }
  .center-dial { top: 4px; transform: translateX(-50%) scale(0.7); transform-origin: top center; }
  #minimap { top: 64px; height: 120px; width: 34px; }
  #toasts { bottom: 90px; }
  .pad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(2, 50px); }
  .acts { grid-template-columns: 62px 62px; grid-template-rows: 38px 62px; }
  .logo h1 { font-size: 40px; } .logo small { font-size: 11px; }
  .vs-split { top: 4%; } .vs-card span, .stat { display: none; }
  .menu-ui { gap: 6px; padding-bottom: calc(44px + env(safe-area-inset-bottom)); }
  .primary.big { padding: 8px 24px; font-size: 24px; }
}
/* phone portrait: controls live in a bottom deck, HUD tightens up */
@media (orientation: portrait) and (max-width: 600px) {
  #touch:not([hidden]) ~ * { }
  .pad { grid-template-columns: repeat(3, 62px); grid-template-rows: repeat(2, 62px); gap: 8px; }
  .acts { grid-template-columns: 74px 74px; grid-template-rows: 46px 74px; }
  #toasts { bottom: calc(190px + env(safe-area-inset-bottom)); }
  .icon-btn { left: auto; right: max(12px, env(safe-area-inset-right)); bottom: auto; top: 118px; transform: none; }
  .center-dial { top: 58px; }
  #minimap { top: 160px; width: 34px; height: 130px; }
  .card { top: max(8px, env(safe-area-inset-top)); }
  .card .card-sub span.gadgets { display: none; }
  body.touch #hud::after { content: ''; position: fixed; left: 0; right: 0; bottom: 0; height: calc(170px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(6, 7, 12, 0), rgba(6, 7, 12, .75) 40%); pointer-events: none; z-index: -1; }
  .slam { font-size: 26vw; top: 36%; }
  .vs-split { flex-direction: row; top: 12%; padding: 0 8px; }
  .vs-card { width: 36vw; }
  .vs-mid { font-size: 44px; }
}
.keyflash { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; mix-blend-mode: normal; }
.keyflash.on { animation: keyflash .75s ease-out; }
@keyframes keyflash { 0% { opacity: 0; transform: scale(1.25); filter: saturate(2) contrast(1.4); } 12% { opacity: .95; } 70% { opacity: .7; } 100% { opacity: 0; transform: scale(1); } }
