/* VERSUS shared UI — overlays, HUD, buttons. Games link this file; don't fork it per game. */
@font-face { font-family: Orbitron; font-weight: 500; font-display: swap; src: url(../vendor/fonts/orbitron-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Orbitron; font-weight: 700; font-display: swap; src: url(../vendor/fonts/orbitron-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: Orbitron; font-weight: 900; font-display: swap; src: url(../vendor/fonts/orbitron-latin-900-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 400; font-display: swap; src: url(../vendor/fonts/chakra-petch-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 500; font-display: swap; src: url(../vendor/fonts/chakra-petch-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 600; font-display: swap; src: url(../vendor/fonts/chakra-petch-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 700; font-display: swap; src: url(../vendor/fonts/chakra-petch-latin-700-normal.woff2) format('woff2'); }

:root {
  --p1: #19f0ff; --p2: #ff2bd6; --gold: #ffd34d; --violet: #8a5cff; --bg: #07040f; --ink: #f6f2ff; --mute: #a99fd0;
  --panel: rgba(14, 8, 34, 0.72); --line: rgba(160, 130, 255, 0.22);
  --fd: Orbitron, 'Chakra Petch', system-ui, sans-serif; --fb: 'Chakra Petch', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--fb); }
body.vs-game { overflow: hidden; position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.vs-ic { display: inline-block; vertical-align: middle; flex: none; }

#vs-root { position: fixed; inset: 0; overflow: hidden; }
#vs-stage { position: absolute; inset: 0; }
#vs-stage canvas { display: block; width: 100% !important; height: 100% !important; }
#vs-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ---------- halves: per-player HUD / messages / virtual buttons ---------- */
#vs-halves { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.vs-half { position: absolute; }
.lay-stack .vs-half { left: 0; right: 0; height: 50%; }
.lay-stack .vs-half.p1 { bottom: 0; }
.lay-stack .vs-half.p2 { top: 0; transform: rotate(180deg); }
.lay-side .vs-half, .lay-shared .vs-half { top: 0; bottom: 0; width: 50%; }
.lay-side .vs-half.p1, .lay-shared .vs-half.p1 { left: 0; }
.lay-side .vs-half.p2, .lay-shared .vs-half.p2 { right: 0; }
.vs-hud-slot { position: absolute; top: max(10px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; }
.lay-stack .vs-hud-slot { top: 10px; left: 14px; align-items: flex-start; }
.lay-side .p1 .vs-hud-slot, .lay-shared .p1 .vs-hud-slot { left: 18px; align-items: flex-start; }
.lay-side .p2 .vs-hud-slot, .lay-shared .p2 .vs-hud-slot { right: 18px; align-items: flex-end; }
.ov-open:not([data-phase="matchEnd"]):not([data-phase="paused"]) .vs-hud-slot, .is-demo .vs-hud-slot { display: none; }
.ov-open #vs-topbar { display: none; }
.vs-score { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 10px; border-radius: 10px; background: rgba(8, 4, 20, 0.55); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); backdrop-filter: blur(6px); box-shadow: 0 0 18px color-mix(in srgb, var(--c) 25%, transparent); }
.vs-score.p1, .vs-hud-extra.p1, .vs-banner.p1 { --c: var(--p1); }
.vs-score.p2, .vs-hud-extra.p2, .vs-banner.p2 { --c: var(--p2); }
.vs-score b { font-family: var(--fd); font-weight: 900; font-size: 15px; letter-spacing: .08em; color: var(--c); text-shadow: 0 0 10px var(--c); }
.vs-pips { display: flex; gap: 5px; }
.vs-pips i { width: 14px; height: 14px; border-radius: 4px; transform: rotate(45deg) scale(.8); border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); transition: .35s cubic-bezier(.2, 1.8, .4, 1); }
.vs-pips i.on { background: var(--c); box-shadow: 0 0 12px var(--c), 0 0 2px #fff inset; transform: rotate(45deg) scale(1); }
.vs-hud-extra { font-family: var(--fd); font-weight: 700; font-size: 13px; letter-spacing: .08em; color: var(--c); text-shadow: 0 0 8px var(--c); padding: 0 4px; }
.vs-hud-extra:empty { display: none; }

/* ---------- center messages (countdown, round result, banners) ---------- */
.vs-msg { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 12; }
#vs-center { z-index: 12; }
.vs-big { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-family: var(--fd); font-weight: 900; }
.vs-big small { font-family: var(--fd); font-weight: 700; font-size: clamp(14px, 2.4vmin, 22px); letter-spacing: .35em; text-transform: uppercase; color: var(--ink); opacity: .85; text-shadow: 0 0 12px var(--violet); }
.vs-big.round small { animation: vsFade 1.2s ease both; }
.cd { font-size: clamp(90px, 26vmin, 240px); line-height: 1; color: #fff; text-shadow: 0 0 20px var(--violet), 0 0 60px var(--violet), 0 0 2px #fff; animation: vsCount .62s cubic-bezier(.2, 1.4, .3, 1) both; }
.lay-stack .cd { font-size: clamp(80px, 22vh, 170px); }
.cd.n3 { color: var(--p2); text-shadow: 0 0 24px var(--p2), 0 0 70px var(--p2); }
.cd.n2 { color: var(--gold); text-shadow: 0 0 24px #ff8a3d, 0 0 70px #ff8a3d; }
.cd.n1 { color: var(--p1); text-shadow: 0 0 24px var(--p1), 0 0 70px var(--p1); }
.cd.go { background: linear-gradient(90deg, var(--p1), #fff 50%, var(--p2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(255, 255, 255, .55)); animation: vsGo .6s cubic-bezier(.2, 1.4, .3, 1) both; }
.res { --c: #fff; font-size: clamp(38px, 9vmin, 92px); letter-spacing: .04em; text-transform: uppercase; color: var(--c); text-shadow: 0 0 18px var(--c), 0 0 50px var(--c); animation: vsSlam .5s cubic-bezier(.2, 1.5, .3, 1) both; }
.lay-stack .res { font-size: clamp(30px, 9vw, 54px); }
.vs-big.result.won .res { color: var(--c); }
.vs-big.result.lost .res { color: #8c84b0; text-shadow: none; opacity: .8; }
.vs-banner { --c: var(--gold); position: absolute; top: 22%; left: 50%; transform: translateX(-50%); white-space: nowrap; font-family: var(--fd); font-weight: 900; font-size: clamp(20px, 4vmin, 38px); letter-spacing: .12em; text-transform: uppercase; color: var(--c); text-shadow: 0 0 16px var(--c), 0 0 40px var(--c); animation: vsBanner 1.4s ease both; }
@keyframes vsCount { 0% { transform: scale(2.4); opacity: 0; filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: scale(1); } }
@keyframes vsGo { 0% { transform: scale(.4) rotate(-6deg); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes vsSlam { 0% { transform: scale(1.8); opacity: 0; letter-spacing: .4em; } 100% { transform: scale(1); opacity: 1; } }
@keyframes vsFade { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: .85; transform: none; } }
@keyframes vsBanner { 0% { opacity: 0; transform: translate(-50%, 14px) scale(.9); } 15%, 75% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -10px); } }

/* ---------- topbar (pause) ---------- */
#vs-topbar { position: absolute; z-index: 20; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
.lay-stack #vs-topbar { top: 50%; left: auto; right: 10px; transform: translateY(-50%); }
#vs-root:not([data-phase="play"]):not([data-phase="countdown"]) #vs-topbar, .is-demo #vs-topbar { display: none; }
.vs-icbtn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: rgba(14, 8, 34, .6); color: var(--ink); cursor: pointer; backdrop-filter: blur(8px); transition: .2s; text-decoration: none; }
.vs-icbtn:hover, .vs-icbtn:focus-visible { border-color: var(--p1); color: var(--p1); box-shadow: 0 0 14px rgba(25, 240, 255, .35); outline: none; }
.vs-icbtn.off { color: var(--mute); opacity: .7; }

/* ---------- overlay screens ---------- */
.vs-overlay { position: absolute; inset: 0; z-index: 30; display: none; place-items: center; padding: 20px; overflow-y: auto; }
.vs-overlay.open { display: grid; animation: vsOv .35s ease both; }
.vs-overlay.title { background: radial-gradient(ellipse at 50% 40%, rgba(7, 4, 15, .25), rgba(7, 4, 15, .82) 70%); }
.vs-overlay.howto, .vs-overlay:not(.title):not(.win).open { background: rgba(5, 2, 14, .72); backdrop-filter: blur(6px); }
.vs-overlay.win { background: radial-gradient(ellipse at 50% 45%, rgba(7, 4, 15, .35), rgba(7, 4, 15, .85) 75%); }
@keyframes vsOv { from { opacity: 0; } to { opacity: 1; } }
.vs-title { position: relative; width: min(760px, 100%); min-height: min(560px, 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 56px 0 24px; }
.vs-back { position: absolute; top: 0; left: 0; }
.vs-tr { position: absolute; top: 0; right: 0; }
.vs-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.vs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: rgba(14, 8, 34, .55); font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.vs-logo { position: relative; margin: 0; font-family: var(--fd); font-weight: 900; font-size: clamp(44px, 11vw, 112px); line-height: .95; letter-spacing: .02em; text-transform: uppercase;
  background: linear-gradient(100deg, var(--p1) 10%, #fff 48%, var(--p2) 90%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(138, 92, 255, .7)) drop-shadow(0 0 40px rgba(255, 43, 214, .35)); animation: vsSheen 6s ease-in-out infinite alternate; }
@keyframes vsSheen { to { background-position: 100% 0; } }
.vs-tag { margin: 0; max-width: 520px; font-size: clamp(15px, 2.2vw, 19px); color: #d9d2ff; line-height: 1.4; text-shadow: 0 2px 12px #000; }
.vs-warn { margin: 0; display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 10px; color: var(--gold); border: 1px solid rgba(255, 211, 77, .35); background: rgba(40, 28, 0, .4); font-size: 14px; }
.vs-modes { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.vs-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.vs-col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.vs-btn { --c: var(--violet); position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 14px; cursor: pointer;
  font-family: var(--fd); font-weight: 700; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink);
  border: 1.5px solid color-mix(in srgb, var(--c) 70%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, rgba(14, 8, 34, .85)), rgba(14, 8, 34, .85));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .04) inset, 0 8px 24px rgba(0, 0, 0, .4), 0 0 20px color-mix(in srgb, var(--c) 25%, transparent); transition: transform .15s, box-shadow .2s, border-color .2s; overflow: hidden; }
.vs-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%); transform: translateX(-120%); transition: transform .6s; }
.vs-btn:hover::after, .vs-btn:focus-visible::after { transform: translateX(120%); }
.vs-btn:hover, .vs-btn:focus-visible { transform: translateY(-2px); outline: none; border-color: var(--c); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 10px 30px rgba(0, 0, 0, .5), 0 0 32px color-mix(in srgb, var(--c) 60%, transparent); }
.vs-btn:active { transform: translateY(1px) scale(.98); }
.vs-btn.primary { --c: var(--p1); }
.vs-btn.cpu { --c: var(--p2); }
.vs-btn.ghost { --c: rgba(160, 130, 255, .6); background: rgba(14, 8, 34, .5); }
.vs-btn.big { min-height: 64px; padding: 0 30px; font-size: 18px; border-radius: 18px; min-width: 220px; }
.vs-seg { display: inline-flex; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: rgba(14, 8, 34, .6); }
.vs-seg button { border: 0; background: none; color: var(--mute); font-family: var(--fd); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.vs-seg button.on { color: #12051c; background: var(--p2); box-shadow: 0 0 16px rgba(255, 43, 214, .6); }
.vs-seg button:focus-visible { outline: 2px solid var(--p1); }
.vs-link { border: 0; background: none; color: var(--mute); font: 600 14px var(--fb); letter-spacing: .06em; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.vs-link:hover { color: var(--ink); }
.vs-panel { position: relative; width: min(720px, 100%); padding: clamp(20px, 4vw, 36px); border-radius: 24px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .03) inset, 0 0 60px rgba(138, 92, 255, .12); text-align: center; display: flex; flex-direction: column; gap: 20px; }
.vs-panel h2 { margin: 0; font-family: var(--fd); font-weight: 900; font-size: clamp(22px, 4vw, 32px); letter-spacing: .1em; text-transform: uppercase; display: flex; gap: 12px; justify-content: center; align-items: center; }
.vs-pause { width: min(380px, 100%); }
.vs-sound { margin-top: 2px; }
.vs-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.vs-step { padding: 16px 12px; border-radius: 16px; background: rgba(255, 255, 255, .035); border: 1px solid var(--line); animation: vsStep .45s ease backwards; animation-delay: var(--d); }
@keyframes vsStep { from { opacity: 0; transform: translateY(10px); } }
.vs-step .ic { width: 62px; height: 62px; margin: 0 auto 10px; border-radius: 18px; display: grid; place-items: center; color: var(--p1); background: radial-gradient(circle, rgba(25, 240, 255, .16), transparent 70%); border: 1px solid rgba(25, 240, 255, .35); box-shadow: 0 0 22px rgba(25, 240, 255, .18); }
.vs-step:nth-child(even) .ic { color: var(--p2); border-color: rgba(255, 43, 214, .35); background: radial-gradient(circle, rgba(255, 43, 214, .16), transparent 70%); box-shadow: 0 0 22px rgba(255, 43, 214, .18); }
.vs-step b { display: block; font-family: var(--fd); font-size: 14px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.vs-step p { margin: 0; font-size: 14px; color: #cfc6f5; line-height: 1.35; }
.vs-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.vs-keys > div { padding: 14px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 6%, transparent); }
.vs-keys .p1 { --c: var(--p1); } .vs-keys .p2 { --c: var(--p2); }
.vs-keys h4 { margin: 0 0 8px; font-family: var(--fd); color: var(--c); letter-spacing: .14em; text-shadow: 0 0 10px var(--c); }
.vs-k { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 14px; color: #d9d2ff; }
.vs-k em { font-style: normal; }
.vs-k .cap { display: inline-flex; gap: 4px; min-width: 92px; }
kbd { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 7px; font: 700 12px var(--fd); color: var(--c, #fff); border: 1px solid color-mix(in srgb, var(--c, #fff) 55%, transparent); border-bottom-width: 3px; background: rgba(0, 0, 0, .35); }
.vs-touchhelp { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.vs-touchhelp .vs-k { flex-direction: column; gap: 6px; color: var(--p1); }
.vs-touchhelp em { color: #d9d2ff; font-size: 13px; }
.vs-note { margin: 0; color: var(--mute); font-size: 14px; display: flex; gap: 8px; justify-content: center; align-items: center; }

/* winner */
.vs-win { --c: var(--p1); border-color: color-mix(in srgb, var(--c) 50%, transparent); box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 80px color-mix(in srgb, var(--c) 30%, transparent); width: min(560px, 100%); }
.vs-crown { color: var(--gold); filter: drop-shadow(0 0 14px var(--gold)); animation: vsCrown 1.2s cubic-bezier(.2, 1.5, .3, 1) both; }
@keyframes vsCrown { 0% { transform: translateY(-40px) scale(.4) rotate(-20deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.vs-wintitle { margin: 0; font-family: var(--fd); font-weight: 900; font-size: clamp(44px, 11vw, 88px); text-transform: uppercase; line-height: .95; color: var(--c); text-shadow: 0 0 20px var(--c), 0 0 60px var(--c); animation: vsSlam .6s cubic-bezier(.2, 1.5, .3, 1) .1s both; }
.vs-final { font-family: var(--fd); font-weight: 900; font-size: 44px; display: flex; justify-content: center; gap: 16px; align-items: center; }
.vs-final .p1 { color: var(--p1); text-shadow: 0 0 16px var(--p1); } .vs-final .p2 { color: var(--p2); text-shadow: 0 0 16px var(--p2); } .vs-final i { font-style: normal; color: var(--mute); }
.vs-stats { color: #cfc6f5; font-size: 14px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.vs-mirror { display: none; }
.lay-stack .vs-mirror { display: flex; flex-direction: column; position: absolute; top: 0; left: 0; right: 0; height: 44%; transform: rotate(180deg); align-items: center; justify-content: center; gap: 8px; color: var(--c); font-family: var(--fd); font-weight: 900; text-transform: uppercase; }
.lay-stack .vs-mirror b { font-size: clamp(34px, 11vw, 56px); text-shadow: 0 0 18px var(--c), 0 0 50px var(--c); }
.lay-stack .vs-mirror.lost b { color: #8c84b0; text-shadow: none; }
.lay-stack .vs-mirror .vs-ic { color: var(--gold); filter: drop-shadow(0 0 12px var(--gold)); }
.lay-stack .vs-mirror span { font-size: 26px; color: var(--mute); } .vs-mirror i { font-style: normal; } .vs-mirror i.p1 { color: var(--p1); } .vs-mirror i.p2 { color: var(--p2); }
.lay-stack .vs-overlay.win { align-items: end; }
.lay-stack .vs-overlay.win .vs-panel { margin-bottom: 4vh; }

/* rotate notice */
#vs-rotate { z-index: 60; background: var(--bg); text-align: center; color: var(--p1); font-family: var(--fd); }
.need-rotate #vs-rotate { display: grid; }
#vs-rotate .vs-ic { animation: vsRot 2s ease-in-out infinite; }
@keyframes vsRot { 50% { transform: rotate(90deg); } }

/* virtual buttons */
.vs-vbtn { position: absolute; pointer-events: auto; border-radius: 50%; display: grid; place-items: center; touch-action: none; color: var(--c); border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); background: radial-gradient(circle, color-mix(in srgb, var(--c) 18%, transparent), rgba(8, 4, 20, .5) 70%); box-shadow: 0 0 20px color-mix(in srgb, var(--c) 35%, transparent); font: 700 11px var(--fd); letter-spacing: .1em; transition: transform .08s; }
.vs-vbtn.p1 { --c: var(--p1); } .vs-vbtn.p2 { --c: var(--p2); }
.vs-vbtn.on { transform: scale(.92); background: color-mix(in srgb, var(--c) 40%, transparent); box-shadow: 0 0 34px var(--c); }
.vs-vbtn span { position: absolute; bottom: -18px; }
[data-phase="title"] .vs-vbtn, [data-phase="matchEnd"] .vs-vbtn { opacity: 0; }

@media (max-width: 560px) {
  .vs-btn.big { min-width: 0; width: 100%; }
  .vs-modes { width: 100%; flex-direction: column; }
  .vs-keys { grid-template-columns: 1fr; }
  .vs-steps { grid-template-columns: 1fr 1fr; }
  .vs-step { padding: 12px 8px; }
  .vs-step p { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .vs-logo { animation: none; } }
.vs-vslider { position: absolute; pointer-events: auto; touch-action: none; border-radius: 99px; --c: var(--p1); background: rgba(8, 4, 20, .55); border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 0 16px color-mix(in srgb, var(--c) 25%, transparent); }
.vs-vslider.p2 { --c: var(--p2); }
.vs-vslider.h { height: 54px; } .vs-vslider.v { width: 54px; }
.vs-vslider i { position: absolute; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, #fff, var(--c) 45%, color-mix(in srgb, var(--c) 30%, transparent) 70%); box-shadow: 0 0 20px var(--c); transform: translate(-50%, -50%); }
.vs-vslider.h i { top: 50%; } .vs-vslider.v i { left: 50%; }
[data-phase="title"] .vs-vslider, [data-phase="matchEnd"] .vs-vslider { opacity: 0; }
