/* ============================================================
   Neon Arcade — shared styles
   Dynamic / accent-driven styling lives inline in JS (main.js +
   per-game files). This sheet holds the static structure,
   background, chrome, and keyframes.
   ============================================================ */

* { box-sizing: border-box; }

/* The `hidden` attribute must always win, even over class rules like
   `.overlay { display:flex }` or `.game-screen { display:flex }`.
   Without this, those classes override the UA `[hidden]{display:none}`
   rule and the win/waiting overlays show on top of every game. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: #08060f;
  color: #f6ecff;
  font-family: 'Chakra Petch', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #ff2d9b; color: #08060f; }
input { font-family: 'Chakra Petch', sans-serif; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,45,155,.4); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.root { position: relative; min-height: 100vh; width: 100%; overflow: hidden; }

/* ---------- background layers ---------- */
.bg-gradient {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(120% 80% at 50% -10%, #2a0b3f 0%, #140820 38%, #08060f 75%);
}
.bg-stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  font-family: 'Press Start 2P', monospace;
}
.bg-stars span { position: absolute; }
.bg-grid {
  position: fixed; left: 0; right: 0; bottom: 0; height: 55vh; z-index: 0;
  background-image:
    linear-gradient(rgba(255,45,155,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,226,255,.13) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px;
  transform: perspective(340px) rotateX(62deg);
  transform-origin: bottom;
  animation: gridmove 4s linear infinite;
  -webkit-mask-image: linear-gradient(transparent, #000 60%);
  mask-image: linear-gradient(transparent, #000 60%);
}
.bg-sun {
  position: fixed; top: -12vh; left: 50%; transform: translateX(-50%);
  width: 120vw; height: 60vh; z-index: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,176,0,.16), transparent 70%);
}
.bg-scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; opacity: .5;
}
.bg-vignette {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  box-shadow: inset 0 0 200px rgba(0,0,0,.7);
}
.star-layer { position: fixed; inset: 0; z-index: 45; pointer-events: none; overflow: visible; }
.star-layer span {
  position: fixed; pointer-events: none;
  font-family: 'Press Start 2P', monospace;
  animation: starpop 1.6s ease-out forwards;
  will-change: transform, opacity;
}

/* ============================================================
   LOBBY
   ============================================================ */
.lobby { position: relative; z-index: 10; max-width: 1700px; margin: 0 auto; padding: 42px clamp(26px, 5vw, 70px) 80px; }

.lobby-head {
  position: relative; display: flex; align-items: flex-end;
  justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 8px;
}
.insert-coin {
  font-family: 'Press Start 2P', monospace; font-size: 9px; letter-spacing: 3px;
  color: #2de2ff; margin-bottom: 16px; text-shadow: 0 0 10px rgba(45,226,255,.8);
}
.title-row { display: flex; align-items: center; gap: 22px; margin-bottom: 2px; }
.coin-slot { perspective: 460px; flex: none; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.arcade-title {
  font-family: 'Press Start 2P', monospace; font-size: 46px; line-height: 1.1; margin: 0;
  color: #ff2d9b; text-shadow: 0 0 18px rgba(255,45,155,.65), 4px 4px 0 #b14bff;
  animation: flick 7s infinite;
}
.subtitle { font-size: 16px; color: #bda6d8; margin: 16px 0 0; max-width: 460px; letter-spacing: .3px; }

.head-right { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.sound-pill {
  cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 9px 14px;
  border: 1.5px solid rgba(45,226,255,.4); border-radius: 10px; background: rgba(45,226,255,.06);
  font-size: 12px; letter-spacing: 1px; color: #9fe9ff; user-select: none;
}
.sound-pill:hover { background: rgba(45,226,255,.14); }
.sound-ico { font-size: 13px; }
.sound-label { font-family: 'Press Start 2P', monospace; font-size: 8px; }
.conn-pill {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px;
  background: rgba(0,0,0,.3); border: 1.5px solid rgba(255,176,0,.33);
}
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: #ffb000; box-shadow: 0 0 10px #ffb000; animation: glowPulse 1.6s infinite; }
.conn-label { font-family: 'Press Start 2P', monospace; font-size: 8px; letter-spacing: 1px; color: #ffb000; }

/* home-screen player roster (Dress Up avatars) */
.roster { display: flex; align-items: center; gap: 8px; }
.roster-tag { font-family: 'Press Start 2P', monospace; font-size: 7px; letter-spacing: 1px; color: #74618f; margin-right: 2px; }
.roster-badge { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 6px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.14); }
.roster-fig { height: 34px; display: flex; align-items: flex-end; justify-content: center; }
.roster-fig.empty { width: 18px; align-items: center; }
.roster-lbl { font-family: 'Press Start 2P', monospace; font-size: 8px; letter-spacing: 1px; }

.mode-row { display: flex; align-items: center; gap: 14px; margin: 34px 0 24px; flex-wrap: wrap; }
.mode-tag { font-family: 'Press Start 2P', monospace; font-size: 8px; color: #74618f; letter-spacing: 1px; }
.mode-toggle { display: inline-flex; padding: 5px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1.5px solid rgba(177,75,255,.3); }
.mode-btn {
  cursor: pointer; padding: 10px 18px; border-radius: 8px; font-family: 'Press Start 2P', monospace;
  font-size: 9px; letter-spacing: 1px; transition: .18s; color: #9d88ba; background: transparent;
}
.mode-btn.active-pink { color: #08060f; background: #ff2d9b; box-shadow: 0 0 16px rgba(255,45,155,.6); }
.mode-btn.active-cyan { color: #08060f; background: #2de2ff; box-shadow: 0 0 16px rgba(45,226,255,.6); }
.mode-hint { font-size: 13.5px; color: #8c78a8; letter-spacing: .3px; }

.grid-wrap { position: relative; }
.gd-smoke { position: absolute; inset: 0; z-index: 11; pointer-events: none; overflow: visible; }
.gd-runner { position: absolute; top: 0; left: 0; z-index: 12; pointer-events: none; will-change: transform; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 16px; align-items: stretch; }

.lobby-foot { margin-top: 46px; text-align: center; font-size: 12.5px; color: #5f5078; letter-spacing: .4px; }
.lobby-foot span { color: #8c78a8; }

/* ---------- arcade cabinet card ---------- */
.cabinet {
  --pix: polygon(0 8px,4px 8px,4px 4px,8px 4px,8px 0, calc(100% - 8px) 0,calc(100% - 8px) 4px,calc(100% - 4px) 4px,calc(100% - 4px) 8px,100% 8px, 100% calc(100% - 8px),calc(100% - 4px) calc(100% - 8px),calc(100% - 4px) calc(100% - 4px),calc(100% - 8px) calc(100% - 4px),calc(100% - 8px) 100%, 8px 100%,8px calc(100% - 4px),4px calc(100% - 4px),4px calc(100% - 8px),0 calc(100% - 8px));
  position: relative; cursor: pointer; display: flex;
  padding: 1.5px;
  background: rgba(255,255,255,.10);
  overflow: visible;
  clip-path: var(--pix);
  transition: transform .16s, filter .16s, background-color .16s;
}
.cab-inner {
  flex: 1 1 auto; position: relative; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #241433, #0c0612);
  overflow: hidden;
  clip-path: var(--pix);
}
.cab-strip { position: absolute; top: 50px; bottom: 78px; width: 4px; opacity: .4; }
.cab-strip.left { left: 0; }
.cab-strip.right { right: 0; }
.cab-hood { position: relative; clip-path: polygon(0 0, 100% 0, 93% 100%, 7% 100%); padding: 13px 12px 14px; text-align: center; }
.cab-name { font-size: 15px; line-height: 1.1; color: #fff; letter-spacing: .5px; }
.cab-lightbar { height: 3px; }
.cab-screen {
  position: relative; margin: 13px 17px 0; border-radius: 6px;
  background: radial-gradient(120% 130% at 50% 26%, rgba(24,14,38,.5), #05030a);
  border: 3px solid #07040d; box-shadow: inset 0 0 24px rgba(0,0,0,.9); overflow: hidden;
}
.cab-screen .scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 3px); }
.cab-badge { position: absolute; top: 7px; right: 7px; font-family: 'Press Start 2P', monospace; font-size: 6.5px; letter-spacing: 1px; padding: 3px 4px; border-radius: 3px; background: rgba(0,0,0,.55); }
.cab-iconwrap { height: 104px; display: flex; align-items: center; justify-content: center; }
.cab-icon { width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; animation: floaty 3s ease-in-out infinite; }
.cab-tag { padding: 8px 14px 6px; text-align: center; font-size: 11.5px; color: #9d88ba; line-height: 1.4; min-height: 28px; }
.cab-deck { margin-top: auto; position: relative; clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%); background: linear-gradient(180deg, #301a48, #170c24); border-top: 2px solid rgba(255,255,255,.14); padding: 12px 16px 11px; }
.cab-deck-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.cab-joy { position: relative; width: 22px; height: 24px; flex: none; }
.cab-joy .base { position: absolute; bottom: 0; left: 2px; width: 18px; height: 7px; border-radius: 50%; background: rgba(0,0,0,.7); }
.cab-joy .stick { position: absolute; bottom: 4px; left: 9px; width: 4px; height: 12px; border-radius: 2px; background: #241236; }
.cab-joy .ball { position: absolute; bottom: 12px; left: 5px; width: 12px; height: 12px; border-radius: 50%; }
.cab-btns { display: flex; gap: 3px; flex: none; align-items: center; margin-left: 14px; }
.cab-btns div:nth-child(1) { transform: translateY(3px); }
.cab-btns div:nth-child(2) { transform: translateY(-5px); }
.cab-btns div:nth-child(3) { transform: translateY(3px); }
.cab-btns div { width: 12px; height: 12px; border-radius: 50%; }
.cab-door { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 9px 14px 11px; background: #09040f; }
.cab-door .slot { width: 15px; height: 5px; border-radius: 2px; background: #000; }
.cab-door .start { font-family: 'Press Start 2P', monospace; font-size: 7.5px; letter-spacing: 1px; }

/* ============================================================
   GAME SCREEN
   ============================================================ */
.game-screen { position: relative; z-index: 10; height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 22px;
  border-bottom: 1.5px solid rgba(255,45,155,.18); background: rgba(10,6,18,.6); backdrop-filter: blur(6px);
}
.exit-btn {
  cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 9px;
  border: 1.5px solid rgba(255,255,255,.12); font-family: 'Press Start 2P', monospace; font-size: 8px;
  letter-spacing: 1px; color: #bda6d8; transition: .15s;
}
.exit-btn:hover { border-color: #ff2d9b; color: #ff2d9b; }
.game-id { display: flex; align-items: center; gap: 12px; }
.game-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.game-title { font-family: 'Press Start 2P', monospace; font-size: 14px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.series { display: flex; align-items: center; gap: 11px; padding: 6px 13px; border-radius: 8px; background: rgba(0,0,0,.3); border: 1.5px solid rgba(255,255,255,.1); }
.series-tag { font-family: 'Press Start 2P', monospace; font-size: 7px; letter-spacing: 1px; color: #74618f; }
.series-p1, .series-p2 { display: flex; align-items: center; gap: 6px; }
.series .lbl { font-family: 'Press Start 2P', monospace; font-size: 8px; }
.series .num { font-family: 'Press Start 2P', monospace; font-size: 15px; }
.series-p1 .lbl, .series-p1 .num { color: #ff2d9b; text-shadow: 0 0 10px rgba(255,45,155,.7); }
.series-p2 .lbl, .series-p2 .num { color: #ffb000; text-shadow: 0 0 10px rgba(255,176,0,.7); }
.series-dot { color: #3a2a52; font-size: 11px; }
.mode-badge { font-family: 'Press Start 2P', monospace; font-size: 8px; letter-spacing: 1px; padding: 7px 11px; border-radius: 8px; background: rgba(0,0,0,.3); border: 1.5px solid rgba(255,255,255,.12); color: #9d88ba; }
.sound-btn { cursor: pointer; font-size: 15px; padding: 7px 11px; border-radius: 8px; border: 1.5px solid rgba(45,226,255,.3); color: #9fe9ff; }

.game-body { flex: 1; display: flex; min-height: 0; }
.board-area { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; min-width: 0; }
.status { margin-bottom: 20px; min-height: 30px; }
.board { position: relative; }

/* overlays */
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 20; }
.overlay.waiting { background: rgba(8,6,15,.82); backdrop-filter: blur(3px); }
.overlay.countdown { background: rgba(8,6,15,.7); backdrop-filter: blur(2px); }
.overlay.winner { background: rgba(8,6,15,.86); backdrop-filter: blur(4px); z-index: 25; animation: popIn .35s; }
.spinner { width: 46px; height: 46px; border: 3px solid rgba(255,45,155,.25); border-top-color: #ff2d9b; border-radius: 50%; animation: spin .9s linear infinite; margin-bottom: 22px; }
.ov-title { font-family: 'Press Start 2P', monospace; font-size: 12px; color: #ff2d9b; letter-spacing: 1px; text-align: center; line-height: 1.7; }
.ov-sub { margin-top: 14px; font-size: 13px; color: #8c78a8; }
.count-num { font-family: 'Press Start 2P', monospace; font-size: 64px; color: #ffb000; text-shadow: 0 0 26px rgba(255,176,0,.8); animation: popIn .4s; }
.win-kicker { font-family: 'Press Start 2P', monospace; font-size: 13px; color: #74618f; letter-spacing: 2px; margin-bottom: 18px; }
.win-text { font-family: 'Press Start 2P', monospace; font-size: 34px; text-align: center; line-height: 1.5; animation: floaty 2.4s ease-in-out infinite; white-space: pre-line; }
.win-actions { display: flex; gap: 14px; margin-top: 36px; }
.btn-rematch { cursor: pointer; padding: 14px 22px; border-radius: 10px; color: #08060f; font-family: 'Press Start 2P', monospace; font-size: 10px; letter-spacing: 1px; }
.btn-games { cursor: pointer; padding: 14px 22px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,.18); color: #bda6d8; font-family: 'Press Start 2P', monospace; font-size: 10px; letter-spacing: 1px; }

/* chat */
.chat { width: 312px; flex: none; border-left: 1.5px solid rgba(45,226,255,.16); background: rgba(10,6,18,.55); display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: 14px 16px; border-bottom: 1.5px solid rgba(255,255,255,.07); font-family: 'Press Start 2P', monospace; font-size: 9px; letter-spacing: 1px; color: #2de2ff; display: flex; align-items: center; gap: 8px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; min-height: 0; }
.chat-msg { display: flex; flex-direction: column; gap: 2px; animation: bobIn .25s; }
.chat-who { font-family: 'Press Start 2P', monospace; font-size: 7px; letter-spacing: 1px; }
.chat-text { font-size: 13.5px; line-height: 1.45; word-break: break-word; color: #e9dcf7; }
.chat-input-row { padding: 12px; border-top: 1.5px solid rgba(255,255,255,.07); display: flex; gap: 8px; }
.chat-input-row input { flex: 1; min-width: 0; background: rgba(0,0,0,.4); border: 1.5px solid rgba(255,45,155,.25); border-radius: 8px; padding: 10px 12px; color: #f6ecff; font-size: 13.5px; outline: none; }
.chat-send { cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; padding: 0 14px; border-radius: 8px; background: #ff2d9b; color: #08060f; font-family: 'Press Start 2P', monospace; font-size: 9px; box-shadow: 0 0 16px rgba(255,45,155,.5); }

/* ---------- keyframes ---------- */
@keyframes gridmove { from { background-position: 0 0, 0 0; } to { background-position: 0 80px, 0 80px; } }
@keyframes glowPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes flick { 0%, 100% { opacity: 1; } 48% { opacity: 1; } 49% { opacity: .4; } 50% { opacity: 1; } 92% { opacity: 1; } 93% { opacity: .5; } 94% { opacity: 1; } }
@keyframes blink { 50% { opacity: .15; } }
@keyframes popIn { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bobIn { 0% { transform: translateY(18px) scale(.9); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes coinspin { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: .12; transform: scale(.82); } 50% { opacity: .5; transform: scale(1.08); } }
@keyframes starpop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.2) rotate(0deg); } 22% { opacity: .9; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.25) rotate(45deg); } }
@keyframes gdsmoke { 0% { transform: translate(0,0) scale(.5); opacity: .6; } 100% { transform: translate(-16px,-12px) scale(2.7); opacity: 0; } }
