/* PULSE ARCADE — shared synthwave styles */
:root {
  --bg-0: #07021a;
  --bg-1: #0e0530;
  --bg-2: #160a3d;
  --panel: rgba(22, 10, 54, 0.72);
  --panel-solid: #160a3d;
  --line: rgba(124, 92, 214, 0.35);
  --magenta: #ff2e97;
  --magenta-soft: #ff79c0;
  --cyan: #29e7ff;
  --cyan-soft: #8af3ff;
  --violet: #9d6bff;
  --sun-1: #ffd86b;
  --sun-2: #ff6f9c;
  --gold: #ffce5a;
  --text: #efe9ff;
  --muted: #a394d6;
  --danger: #ff3b6b;
  --ok: #43f59b;
  --shadow-neon: 0 0 18px rgba(41, 231, 255, 0.45);
  --shadow-mag: 0 0 18px rgba(255, 46, 151, 0.45);
  --font-display: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Chivo Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --maxw: 1080px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(1200px 700px at 50% -10%, var(--bg-2), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 70%);
  color: var(--text);
  font-family: var(--font-mono);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--cyan-soft); }

/* Animated synthwave grid backdrop (decorative, behind everything) */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(transparent 0, transparent calc(100% - 1px), rgba(41,231,255,0.18) 100%),
    linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(255,46,151,0.12) 100%);
  background-size: 60px 60px, 60px 60px;
  transform: perspective(420px) rotateX(62deg) scale(2.4);
  transform-origin: 50% 100%;
  opacity: 0.5;
  animation: gridrun 6s linear infinite;
}
.bg-sun {
  position: fixed; left: 50%; top: 8vh; width: 360px; height: 360px;
  transform: translateX(-50%); z-index: -3; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, var(--sun-1), var(--sun-2) 55%, transparent 72%);
  filter: blur(2px); opacity: 0.55;
}
@keyframes gridrun { from { background-position: 0 0, 0 0; } to { background-position: 0 60px, 60px 0; } }
@media (prefers-reduced-motion: reduce) { .bg-grid { animation: none; } }

/* Shell */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.site-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 14px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 34px; height: 34px; filter: drop-shadow(var(--shadow-neon)); }
.brand .name {
  font-family: var(--font-display); font-weight: 800; letter-spacing: 4px;
  font-size: 22px; text-transform: uppercase;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand .name b { color: var(--muted); -webkit-text-fill-color: var(--muted); font-weight: 400; font-size: 13px; letter-spacing: 3px; margin-left: 4px; }
.nav { display: flex; gap: 18px; align-items: center; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.nav a { color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--text); text-shadow: var(--shadow-neon); }

/* Hero */
.hero { text-align: center; padding: 40px 0 18px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 900; text-transform: uppercase;
  font-size: clamp(40px, 11vw, 104px); line-height: 0.92; margin: 0; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff, var(--cyan-soft) 40%, var(--magenta) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 42px rgba(255, 46, 151, 0.35);
}
.hero .tag { color: var(--muted); letter-spacing: 4px; text-transform: uppercase; font-size: clamp(11px, 2.6vw, 14px); margin-top: 14px; }
.hero .tag .dot { color: var(--magenta); margin: 0 8px; }

/* Game card grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; padding: 26px 0 60px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  backdrop-filter: blur(6px); min-height: 220px; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); border-color: rgba(41,231,255,0.6); box-shadow: var(--shadow-neon); }
.card.soon { opacity: 0.55; }
.card .thumb { height: 132px; position: relative; overflow: hidden; background: linear-gradient(160deg, #2a0f5e, #0c0530); }
.card .thumb canvas, .card .thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card .body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-family: var(--font-display); font-weight: 800; letter-spacing: 2px; text-transform: uppercase; font-size: 18px; }
.card .desc { color: var(--muted); font-size: 13px; line-height: 1.45; flex: 1; }
.card .row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.card .badge { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--cyan); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.card .badge.soon { color: var(--muted); }
.card a.play { color: var(--text); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.card a.stretch::after { content: ""; position: absolute; inset: 0; }

/* Buttons */
.btn {
  font-family: var(--font-display); font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  font-size: 13px; padding: 12px 22px; border-radius: 12px; cursor: pointer;
  color: #0a0420; background: linear-gradient(90deg, var(--cyan), var(--cyan-soft));
  border: none; box-shadow: var(--shadow-neon); transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.mag { background: linear-gradient(90deg, var(--magenta), var(--magenta-soft)); box-shadow: var(--shadow-mag); color: #1a0414; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--cyan); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

/* Footer */
.site-foot { color: var(--muted); font-size: 12px; text-align: center; padding: 30px 0 40px; letter-spacing: 1px; }
.site-foot .dot { color: var(--magenta); margin: 0 7px; }

/* Icons */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill { fill: currentColor; stroke: none; }

/* ---------- Game page ---------- */
.game-shell { display: grid; grid-template-columns: 1fr; gap: 22px; padding: 8px 0 50px; }
@media (min-width: 940px) { .game-shell { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; } }

.stage-card { position: relative; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #05010f; box-shadow: 0 18px 60px rgba(0,0,0,0.5); }
.stage { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 78vh; }
@media (min-width: 940px) { .stage { aspect-ratio: 4 / 3; } }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; }
.hud .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hud .stat { background: rgba(7,2,26,0.5); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; backdrop-filter: blur(3px); }
.hud .stat .k { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.hud .stat .v { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1; }
.hud .stat.best .v { color: var(--gold); font-size: 16px; }
.hud .stat.speed .v { color: var(--cyan); }
.hud .ctl-hint { align-self: center; color: var(--muted); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
.hud .corner-btns { position: absolute; top: 14px; right: 16px; display: flex; gap: 8px; pointer-events: auto; }
.iconbtn { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; cursor: pointer;
  background: rgba(7,2,26,0.55); border: 1px solid var(--line); color: var(--text); font-size: 18px; }
.iconbtn:hover { border-color: var(--cyan); color: var(--cyan); }

/* Overlays (ready / gameover) */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 22px; text-align: center;
  background: radial-gradient(circle at 50% 30%, rgba(22,10,61,0.65), rgba(5,1,15,0.92)); backdrop-filter: blur(3px); z-index: 4; }
.overlay.hidden { display: none; }
.overlay .panel { width: min(420px, 100%); }
.overlay h2 { font-family: var(--font-display); font-weight: 900; text-transform: uppercase; letter-spacing: 3px;
  font-size: clamp(30px, 8vw, 56px); margin: 0 0 6px;
  background: linear-gradient(180deg, #fff, var(--magenta)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.overlay .sub { color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-size: 12px; margin-bottom: 20px; }
.overlay .final { font-family: var(--font-display); font-weight: 900; font-size: clamp(44px, 13vw, 78px); color: var(--cyan); text-shadow: var(--shadow-neon); line-height: 1; }
.overlay .final-k { color: var(--muted); letter-spacing: 4px; text-transform: uppercase; font-size: 11px; margin-bottom: 4px; }
.overlay .newbest { color: var(--gold); letter-spacing: 3px; text-transform: uppercase; font-size: 13px; margin-top: 8px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.overlay .actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* Score post form */
.postbox { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; text-align: left; }
.postbox .lbl { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.platform-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.platform-toggle button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  background: rgba(7,2,26,0.5); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 10px;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 1px; transition: all .15s ease; }
.platform-toggle button .icon { width: 18px; height: 18px; }
.platform-toggle button.active { color: var(--text); border-color: var(--magenta); box-shadow: var(--shadow-mag); background: rgba(255,46,151,0.08); }
.handle-row { display: flex; align-items: center; gap: 8px; background: rgba(7,2,26,0.6); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.handle-row .flag-slot { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.handle-row .fi { width: 22px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,0.12); }
.handle-row .at { color: var(--muted); font-weight: 700; }
.handle-row input { flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-family: var(--font-mono); font-size: 15px; padding: 12px 0; letter-spacing: 0.5px; }
.handle-row input::placeholder { color: rgba(163,148,214,0.5); }
.posthint { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.posthint.err { color: var(--danger); }

/* ---------- Leaderboard ---------- */
.board-card { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); overflow: hidden; }
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.board-head h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: 2px; text-transform: uppercase; font-size: 16px; margin: 0; }
.tabs { display: flex; gap: 4px; background: rgba(7,2,26,0.55); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tabs button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 6px 14px; border-radius: 999px; }
.tabs button.active { background: linear-gradient(90deg, var(--cyan), var(--magenta)); color: #0a0420; font-weight: 700; }
.board-list { list-style: none; margin: 0; padding: 4px 8px 12px; max-height: 520px; overflow-y: auto; }
.board-list li { display: grid; grid-template-columns: 30px 24px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; }
.board-list li + li { border-top: 1px solid rgba(124,92,214,0.14); }
.board-list li.me { background: rgba(255,46,151,0.10); border: 1px solid rgba(255,46,151,0.3); }
.board-list .rank { font-family: var(--font-display); font-weight: 800; color: var(--muted); font-size: 14px; text-align: center; }
.board-list li:nth-child(1) .rank { color: var(--gold); }
.board-list li:nth-child(2) .rank { color: #cfd6e6; }
.board-list li:nth-child(3) .rank { color: #e6a36b; }
.board-list .fi { width: 22px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,0.12); }

/* ---------- FLOCK (neon shooting gallery) ---------- */
body.hunt .stage canvas { cursor: none; }
.hud .leftstats { display: flex; gap: 10px; align-items: flex-start; }
.hud .stat .ss { font-family: var(--font-display); font-weight: 800; font-size: 13px; color: var(--magenta);
  line-height: 1; margin-top: 4px; min-height: 13px; }
.hud .lives { position: absolute; left: 16px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.hud .lives .k { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.pips { display: flex; gap: 6px; }
.pip { width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--magenta-soft), var(--magenta));
  box-shadow: 0 0 8px rgba(255,46,151,0.7); transition: opacity .2s ease, filter .2s ease; }
.pip.gone { background: rgba(124,92,214,0.25); box-shadow: none; filter: grayscale(1); opacity: 0.45; }
.board-list .who { display: flex; flex-direction: column; min-width: 0; }
.board-list .who .h { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .who .h .icon { width: 13px; height: 13px; color: var(--muted); flex: none; }
.board-list .who .when { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.board-list .score { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--cyan); }
.board-empty { color: var(--muted); text-align: center; padding: 30px 16px; font-size: 13px; line-height: 1.5; }
.board-foot { padding: 10px 18px 16px; color: var(--muted); font-size: 11px; line-height: 1.5; border-top: 1px solid var(--line); }

/* Mobile control zones (visual hint only; whole stage is touch-steer) */
.touch-zones { position: absolute; inset: 0; display: flex; pointer-events: none; z-index: 3; opacity: 0; transition: opacity .2s; }
.touch-zones.show { opacity: 1; }
.touch-zones .tz { flex: 1; display: grid; place-items: center; color: rgba(255,255,255,0.18); }
.touch-zones .tz.l { border-right: 1px dashed rgba(255,255,255,0.08); }
.touch-zones .tz .icon { width: 38px; height: 38px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
