/* ============================================
   GAME SAGE — ARCADE STATION Design System
   Neon cabinet look: glowing, chunky, playful.
   Class + variable names are a stable API used
   by every game page — extend, never rename.
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700;800&family=Press+Start+2P&display=swap');

:root {
  --bg: #0a0918;
  --bg-soft: #171432;
  --card: #1e1a3f;
  --card-hover: #282256;
  --ink: #f4f2ff;
  --ink-dim: #a29cc9;
  --coral: #ff4d7d;
  --teal: #22e6c8;
  --yellow: #ffd23d;
  --purple: #8b5cf6;
  --blue: #38bdf8;
  --green: #4ade80;
  --neon-pink: #ff2fb3;
  --neon-cyan: #29f3ff;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --glow-pink: 0 0 18px rgba(255,47,179,.45);
  --glow-cyan: 0 0 18px rgba(41,243,255,.4);
  --glow-yellow: 0 0 22px rgba(255,210,61,.4);
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --font-arcade: 'Press Start 2P', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(700px 460px at 12% -10%, rgba(139,92,246,.30), transparent),
    radial-gradient(560px 380px at 96% 4%, rgba(255,47,179,.16), transparent),
    radial-gradient(800px 540px at 50% 112%, rgba(41,243,255,.10), transparent);
  background-attachment: fixed;
}
/* Subtle CRT scanlines over everything */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

h1, h2, h3, .display { font-family: var(--font-display); }
.arcade-text { font-family: var(--font-arcade); letter-spacing: 1px; }

/* ---------- Layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- Nav / marquee ---------- */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.logo {
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem;
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  text-shadow: 0 0 12px rgba(255,47,179,.55), 0 0 32px rgba(255,47,179,.25);
  animation: neon-breathe 3.2s ease-in-out infinite;
}
.logo .dice { font-size: 1.7rem; display:inline-block; animation: wiggle 3s ease-in-out infinite; filter: drop-shadow(0 0 8px rgba(255,210,61,.7)); }
@keyframes wiggle { 0%,100%{transform:rotate(-8deg)} 50%{transform:rotate(10deg)} }
@keyframes neon-breathe {
  0%,100% { text-shadow: 0 0 12px rgba(255,47,179,.55), 0 0 32px rgba(255,47,179,.25); }
  50%     { text-shadow: 0 0 18px rgba(41,243,255,.6), 0 0 44px rgba(41,243,255,.28); }
}

/* ---------- Buttons: chunky arcade plungers ---------- */
.btn {
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  border: none; cursor: pointer; border-radius: 999px;
  padding: 13px 26px; color: #14121f;
  background: linear-gradient(180deg, #ffe27a, var(--yellow) 55%, #eab308);
  box-shadow: 0 6px 0 #a16207, 0 10px 22px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.55);
  transition: transform .09s, box-shadow .09s, filter .15s;
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
  position: relative;
}
.btn:hover { filter: brightness(1.07) saturate(1.1); transform: translateY(-2px); box-shadow: 0 8px 0 #a16207, 0 14px 26px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.55), var(--glow-yellow); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #a16207, 0 4px 10px rgba(0,0,0,.4), inset 0 2px 0 rgba(255,255,255,.4); }
.btn.coral { background: linear-gradient(180deg, #ff7fa1, var(--coral) 55%, #d92963); color: #fff; box-shadow: 0 6px 0 #8f1d44, 0 10px 22px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.35); text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.btn.coral:hover { box-shadow: 0 8px 0 #8f1d44, 0 14px 26px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.35), var(--glow-pink); }
.btn.coral:active { box-shadow: 0 1px 0 #8f1d44, 0 4px 10px rgba(0,0,0,.4); }
.btn.teal { background: linear-gradient(180deg, #7cf2de, var(--teal) 55%, #0d9488); color: #073430; box-shadow: 0 6px 0 #0f5f57, 0 10px 22px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.5); }
.btn.teal:hover { box-shadow: 0 8px 0 #0f5f57, 0 14px 26px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.5), var(--glow-cyan); }
.btn.teal:active { box-shadow: 0 1px 0 #0f5f57, 0 4px 10px rgba(0,0,0,.4); }
.btn.purple { background: linear-gradient(180deg, #b18cff, var(--purple) 55%, #6d28d9); color: #fff; box-shadow: 0 6px 0 #4c1d95, 0 10px 22px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.35); }
.btn.purple:active { box-shadow: 0 1px 0 #4c1d95, 0 4px 10px rgba(0,0,0,.4); }
.btn.ghost { background: rgba(255,255,255,.03); color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--ink-dim); text-shadow: none; }
.btn.ghost:hover { box-shadow: inset 0 0 0 2.5px var(--neon-cyan), var(--glow-cyan); color: #fff; }
.btn.ghost:active { transform: translateY(2px); }
.btn.big { font-size: 1.2rem; padding: 17px 36px; }
.btn.small { font-size: .85rem; padding: 8px 18px; box-shadow: 0 4px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.45); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 64px 0 46px; position: relative; }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem); font-weight: 700; line-height: 1.08;
  letter-spacing: -1px;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--neon-pink), var(--yellow), var(--neon-cyan));
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: grad-slide 5s linear infinite;
  filter: drop-shadow(0 0 14px rgba(255,47,179,.35));
}
@keyframes grad-slide { to { background-position: 200% center; } }
.hero p { color: var(--ink-dim); font-size: 1.2rem; max-width: 560px; margin: 18px auto 30px; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.badge-row { display:flex; gap:10px; justify-content:center; margin-top: 26px; flex-wrap: wrap; }
.pill {
  background: var(--bg-soft); border: 1.5px solid rgba(255,255,255,.09);
  padding: 8px 16px; border-radius: 999px; font-size: .85rem; color: var(--ink-dim); font-weight: 700;
}
.pill.lit { border-color: rgba(255,210,61,.5); color: var(--yellow); box-shadow: inset 0 0 12px rgba(255,210,61,.12); }

/* Blinking INSERT COIN line */
.insert-coin {
  font-family: var(--font-arcade); font-size: .72rem; color: var(--yellow);
  letter-spacing: 2px; margin-top: 30px; animation: coin-blink 1.4s steps(2) infinite;
  text-shadow: 0 0 10px rgba(255,210,61,.6);
}
@keyframes coin-blink { 50% { opacity: .15; } }

/* Floating arcade sprites behind hero */
.sprites { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.sprites span {
  position: absolute; font-size: 1.6rem; opacity: .18;
  animation: floaty 9s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.4));
}
.sprites span:nth-child(1) { left: 6%;  top: 18%; animation-delay: 0s; }
.sprites span:nth-child(2) { left: 88%; top: 12%; animation-delay: -2s; font-size: 2rem; }
.sprites span:nth-child(3) { left: 12%; top: 72%; animation-delay: -4s; font-size: 1.3rem; }
.sprites span:nth-child(4) { left: 82%; top: 66%; animation-delay: -6s; }
.sprites span:nth-child(5) { left: 48%; top: 8%;  animation-delay: -3s; font-size: 1.2rem; }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-22px) rotate(8deg); } }

/* Neon grid floor under the hero */
.neon-floor {
  position: absolute; left: -10%; right: -10%; bottom: -8px; height: 130px;
  background:
    linear-gradient(transparent, rgba(41,243,255,.06)),
    repeating-linear-gradient(90deg, rgba(41,243,255,.16) 0 1px, transparent 1px 70px),
    repeating-linear-gradient(0deg, rgba(255,47,179,.14) 0 1px, transparent 1px 26px);
  transform: perspective(340px) rotateX(58deg);
  transform-origin: bottom; pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, #000 45%);
  mask-image: linear-gradient(transparent, #000 45%);
}

/* ---------- Ticker marquee ---------- */
.ticker-wrap {
  overflow: hidden; border-top: 1.5px solid rgba(255,255,255,.08); border-bottom: 1.5px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02); margin: 8px 0 4px; padding: 9px 0; white-space: nowrap;
}
.ticker {
  display: inline-block; font-family: var(--font-arcade); font-size: .62rem; letter-spacing: 2px;
  color: var(--ink-dim); animation: ticker-scroll 26s linear infinite; padding-left: 100%;
}
.ticker b { color: var(--neon-cyan); font-weight: normal; }
@keyframes ticker-scroll { to { transform: translateX(-100%); } }

/* ---------- Game grid: arcade cabinets ---------- */
.section-head { display:flex; align-items:baseline; justify-content:space-between; margin: 40px 0 20px; flex-wrap: wrap; gap: 8px; }
.section-head h2 { font-size: 1.9rem; text-shadow: 0 0 16px rgba(139,92,246,.5); }
.section-head .sub { color: var(--ink-dim); font-weight: 700; font-size: .9rem; }

.game-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px; padding-bottom: 70px;
}
.game-card {
  background: linear-gradient(180deg, var(--card-hover), var(--card) 30%);
  border-radius: var(--radius);
  padding: 0; cursor: pointer; position: relative; overflow: hidden;
  border: 1.5px solid rgba(255,255,255,.07);
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column;
}
.game-card:hover {
  transform: translateY(-7px) rotate(-.6deg);
  border-color: rgba(41,243,255,.45);
  box-shadow: 0 18px 34px rgba(0,0,0,.5), var(--glow-cyan);
}
/* cabinet marquee strip */
.game-card .cab-marquee {
  background: linear-gradient(90deg, rgba(255,47,179,.22), rgba(139,92,246,.22), rgba(41,243,255,.22));
  border-bottom: 1.5px solid rgba(255,255,255,.08);
  padding: 16px 18px 12px; display: flex; align-items: center; gap: 12px;
}
.game-card .emoji {
  font-size: 2.4rem; display: block;
  filter: drop-shadow(0 0 10px rgba(255,210,61,.55));
  transition: transform .18s;
}
.game-card:hover .emoji { transform: scale(1.18) rotate(-8deg); }
.game-card h3 { font-size: 1.2rem; }
/* cabinet screen */
.game-card .cab-screen { padding: 14px 18px 12px; flex: 1; }
.game-card p { color: var(--ink-dim); font-size: .9rem; line-height: 1.45; }
.game-card .meta { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
/* cabinet control deck */
.game-card .cab-deck {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px 13px; border-top: 1.5px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.18);
}
.game-card .press-start {
  font-family: var(--font-arcade); font-size: .6rem; letter-spacing: 1px; color: var(--yellow);
  text-shadow: 0 0 8px rgba(255,210,61,.5);
}
.game-card:hover .press-start { animation: coin-blink 1s steps(2) infinite; }
.game-card .deck-dots { display: flex; gap: 6px; }
.game-card .deck-dots i {
  width: 10px; height: 10px; border-radius: 50%; display: block;
  box-shadow: inset 0 -2px 3px rgba(0,0,0,.5), 0 0 6px currentColor;
}
.game-card .deck-dots i:nth-child(1) { background: var(--coral); color: var(--coral); }
.game-card .deck-dots i:nth-child(2) { background: var(--yellow); color: var(--yellow); }
.game-card .deck-dots i:nth-child(3) { background: var(--teal); color: var(--teal); }

.tag {
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 10px; border-radius: 999px;
}
.tag.online { background: rgba(34,230,200,.16); color: var(--teal); }
.tag.same-screen { background: rgba(255,210,61,.15); color: var(--yellow); }
.tag.async { background: rgba(139,92,246,.18); color: #b9a3ff; }
.tag.new { background: rgba(255,77,125,.18); color: var(--coral); }
.tag.players { background: rgba(255,255,255,.08); color: var(--ink-dim); }
.game-card .ribbon {
  position: absolute; top: 14px; right: -34px; transform: rotate(38deg);
  background: var(--coral); color: #fff; font-size: .68rem; font-weight: 800;
  padding: 4px 40px; letter-spacing: 1px; z-index: 2;
  box-shadow: 0 0 14px rgba(255,77,125,.6);
}

/* ---------- Modal: CONTINUE? screen ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,5,14,.8); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg-soft); border-radius: var(--radius); max-width: 480px; width: 100%;
  padding: 34px 30px; border: 1.5px solid rgba(255,47,179,.35);
  box-shadow: var(--shadow), 0 0 40px rgba(255,47,179,.15);
  text-align: center; position: relative;
}
.modal h2 { font-size: 1.6rem; margin-bottom: 8px; text-shadow: 0 0 14px rgba(255,47,179,.4); }
.modal p { color: var(--ink-dim); margin-bottom: 22px; }
.modal .close-x {
  position: absolute; top: 14px; right: 18px; background: none; border: none;
  color: var(--ink-dim); font-size: 1.4rem; cursor: pointer;
}
.modal .close-x:hover { color: var(--coral); }
.plan-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 10px; }
.plan {
  background: var(--card); border-radius: var(--radius-sm); padding: 20px 14px;
  border: 2px solid rgba(255,255,255,.08); cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.plan:hover { border-color: var(--teal); transform: translateY(-3px); box-shadow: var(--glow-cyan); }
.plan.best { border-color: var(--yellow); position: relative; box-shadow: inset 0 0 20px rgba(255,210,61,.07); }
.plan.best:hover { box-shadow: var(--glow-yellow), inset 0 0 20px rgba(255,210,61,.07); }
.plan.best::after {
  content: '👑 BEST VALUE'; position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--yellow); color: #14121f; font-size: .62rem; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .5px; white-space: nowrap;
}
.plan .price { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; }
.plan .per { color: var(--ink-dim); font-size: .8rem; font-weight: 700; }
.plan .name { font-weight: 800; font-size: .95rem; margin-bottom: 6px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1px; }

/* ---------- User chip / banners ---------- */
.user-chip {
  display: flex; align-items: center; gap: 10px; background: var(--bg-soft);
  border: 1.5px solid rgba(255,255,255,.1); padding: 6px 14px 6px 6px; border-radius: 999px;
  cursor: pointer; font-weight: 700; font-size: .9rem; transition: border-color .15s;
}
.user-chip:hover { border-color: var(--neon-cyan); }
.user-chip img { width: 32px; height: 32px; border-radius: 50%; }
.trial-banner {
  background: linear-gradient(90deg, rgba(139,92,246,.25), rgba(34,230,200,.2));
  border: 1.5px solid rgba(255,255,255,.12); border-radius: var(--radius-sm);
  padding: 12px 20px; margin: 10px 0 0; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 700;
}
.trial-banner .left { display:flex; align-items:center; gap: 10px; }

/* ---------- Game page shell ---------- */
.game-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; max-width: 900px; margin: 0 auto;
}
.game-topbar .back { color: var(--ink-dim); text-decoration: none; font-weight: 800; font-size: .95rem; transition: color .15s, text-shadow .15s; }
.game-topbar .back:hover { color: var(--neon-cyan); text-shadow: 0 0 10px rgba(41,243,255,.5); }
.game-stage { max-width: 900px; margin: 0 auto; padding: 10px 20px 60px; }
.panel {
  background: linear-gradient(180deg, var(--card-hover), var(--card) 35%);
  border-radius: var(--radius); padding: 30px;
  border: 1.5px solid rgba(255,255,255,.08); text-align: center;
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
}
.room-code-display {
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; letter-spacing: 8px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 14px 10px; margin: 14px 0;
  color: var(--yellow); user-select: all;
  text-shadow: 0 0 16px rgba(255,210,61,.55);
  border: 1.5px solid rgba(255,210,61,.25);
}
.input {
  font-family: var(--font-display); font-size: 1.3rem; text-align: center; letter-spacing: 4px;
  background: var(--bg); color: var(--ink); border: 2px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm); padding: 13px 16px; width: 100%; max-width: 300px;
  text-transform: uppercase; outline: none; margin: 10px 0;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--teal); box-shadow: var(--glow-cyan); }
.player-list { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.player-pill {
  background: var(--bg); border-radius: 999px; padding: 8px 16px; font-weight: 800;
  border: 1.5px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 8px;
}
.player-pill.host::after { content: '👑'; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(26px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%) translateY(140px);
  background: var(--ink); color: #14121f; font-weight: 800; padding: 13px 26px;
  border-radius: 999px; box-shadow: var(--shadow), 0 0 24px rgba(255,255,255,.25);
  transition: transform .3s; z-index: 200; max-width: min(92vw, 480px); text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- Footer ---------- */
footer { text-align: center; color: var(--ink-dim); padding: 30px 0 40px; font-size: .85rem; font-weight: 700; }

/* ---------- Loading ---------- */
.loader { display: inline-block; width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .logo, .hero h1 .grad, .insert-coin, .ticker, .sprites span, .logo .dice { animation: none !important; }
}

@media (max-width: 560px) {
  .plan-row { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 28px; }
  .neon-floor { height: 90px; }
  .logo { font-size: 1.2rem; white-space: nowrap; }
  .nav .btn.small { font-size: .72rem; padding: 7px 12px; white-space: nowrap; }
  .insert-coin { font-size: .6rem; }
}
