/* Nightcade FM — late-night arcade: neon, CRT, FGC, Japanese signage */

:root {
  --bg: #07061a;
  --bg-2: #0e0b2b;
  --panel: rgba(20, 15, 56, 0.72);
  --panel-edge: rgba(126, 104, 255, 0.28);
  --ink: #ece9ff;
  --ink-dim: #9c96c9;
  --magenta: #ff2e97;
  --cyan: #29f0ff;
  --yellow: #ffd23f;
  --orange: #ff8a1f;
  --red: #ff3b5c;
  --blue: #2f8cff;
  --green: #5dff9b;

  --f-pixel: "Press Start 2P", ui-monospace, monospace;
  --f-jp: "DotGothic16", "Press Start 2P", monospace;
  --f-body: "Chakra Petch", system-ui, sans-serif;

  --r: 6px;
  --gutter: clamp(16px, 3vw, 32px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 16px/1.5 var(--f-body);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 46, 151, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(41, 240, 255, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* synthwave floor grid at the bottom of the viewport */
body::before {
  content: "";
  position: fixed;
  left: -50%; right: -50%; bottom: 0;
  height: 45vh;
  background-image:
    linear-gradient(rgba(255, 46, 151, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 46, 151, 0.35) 1px, transparent 1px);
  background-size: 60px 60px;
  transform: perspective(300px) rotateX(60deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.5), transparent 80%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.5), transparent 80%);
  pointer-events: none;
  z-index: -1;
}

/* CRT scanlines + vignette */
.crt {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.45) 100%);
  mix-blend-mode: multiply;
}

a { color: var(--cyan); }
button, input { font: inherit; color: inherit; }

/* ------------------------------------------------------------ top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--panel-edge);
  background: rgba(7, 6, 26, 0.8);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}

.logo { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
.logo-word {
  font-family: var(--f-pixel);
  font-size: clamp(14px, 2vw, 20px);
  color: #fff;
  text-shadow: 0 0 6px var(--magenta), 0 0 18px var(--magenta), 0 0 36px rgba(255,46,151,0.6);
  letter-spacing: 1px;
}
.logo-fm { color: var(--cyan); text-shadow: 0 0 6px var(--cyan), 0 0 18px var(--cyan); }
.logo-jp {
  font-family: var(--f-jp);
  font-size: 12px;
  color: var(--yellow);
  letter-spacing: 6px;
  margin-top: 6px;
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.6);
}

.nav { display: flex; gap: 20px; margin-left: 16px; }
.nav a {
  color: var(--ink-dim);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 14px;
}
.nav a:hover, .nav a[aria-current="page"] { color: #fff; text-shadow: 0 0 10px var(--cyan); }
.nav-halloween { color: var(--orange) !important; }

.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.balance {
  font-family: var(--f-pixel);
  font-size: 12px;
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255,210,63,0.5);
  white-space: nowrap;
}
.user { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.user img { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--cyan); }
.user small { color: var(--ink-dim); font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r);
  border: 1px solid var(--green);
  background: rgba(83, 252, 24, 0.08);
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: rgba(83, 252, 24, 0.18); box-shadow: 0 0 14px rgba(83,252,24,0.35); }
.btn-ghost { border-color: var(--panel-edge); color: var(--ink-dim); background: transparent; }
.btn-ghost:hover { color: #fff; border-color: var(--ink-dim); background: transparent; box-shadow: none; }

/* ------------------------------------------------------------ layout */

.wrap { max-width: 1400px; margin: 0 auto; padding: 24px var(--gutter) 48px; }

.arena {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.panel, .betpanel, .stage, .tile {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--r);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 20px 50px rgba(0,0,0,0.35);
}

/* ------------------------------------------------------------ stream */

.stage { overflow: hidden; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ticker {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--panel-edge);
  font-size: 14px;
  overflow: hidden;
}
.ticker-label {
  font-family: var(--f-pixel);
  font-size: 9px;
  color: var(--bg);
  background: var(--cyan);
  padding: 5px 7px;
  border-radius: 3px;
  flex: none;
}
.ticker-track { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.ticker-online { margin-left: auto; color: var(--ink-dim); font-size: 13px; white-space: nowrap; }
.ticker-online::before { content: "●"; color: var(--red); margin-right: 6px; animation: blink 1.6s infinite; }

/* ------------------------------------------------------------ bet panel */

.betpanel { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.bp-head { display: flex; align-items: center; gap: 10px; }
.bp-game {
  font-family: var(--f-pixel);
  font-size: 10px;
  line-height: 1.6;
  color: var(--ink-dim);
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.badge {
  font-family: var(--f-pixel);
  font-size: 9px;
  padding: 6px 8px;
  border-radius: 3px;
  border: 1px solid currentColor;
  color: var(--ink-dim);
  white-space: nowrap;
}
.badge.open { color: var(--green); box-shadow: 0 0 12px rgba(93,255,155,0.35); animation: blink 1s steps(2) infinite; }
.badge.locked { color: var(--yellow); }
.badge.resolved { color: var(--magenta); }
.badge.cancelled { color: var(--ink-dim); }

.timer { position: relative; height: 18px; background: rgba(0,0,0,0.4); border-radius: 3px; overflow: hidden; }
.timer-bar {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--magenta), var(--yellow));
  box-shadow: 0 0 12px var(--magenta);
  transition: width 0.25s linear;
}
.timer-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--f-pixel); font-size: 9px;
  color: #fff; text-shadow: 0 1px 2px #000;
}

.fighters { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.fighter {
  border-radius: var(--r);
  padding: 12px 10px;
  text-align: center;
  border: 2px solid;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
  transition: box-shadow 0.3s, opacity 0.3s;
}
.fighter.p1 { border-color: var(--red); background: rgba(255, 59, 92, 0.1); }
.fighter.p2 { border-color: var(--blue); background: rgba(47, 140, 255, 0.1); }
.fighter.win.p1 { box-shadow: 0 0 24px var(--red); }
.fighter.win.p2 { box-shadow: 0 0 24px var(--blue); }
.fighter.lose { opacity: 0.4; }
.f-name { font-weight: 700; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.f-pool { font-family: var(--f-pixel); font-size: 13px; color: var(--yellow); }
.f-pool small { font-size: 8px; color: var(--ink-dim); }
.f-meta { font-size: 12px; color: var(--ink-dim); }
.f-rec { font-size: 12px; letter-spacing: 1px; color: var(--ink); min-height: 1.5em; }

.vs { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.vs > span:first-child {
  font-family: var(--f-pixel); font-size: 16px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--magenta);
}
.odds { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }

.betform { display: flex; flex-direction: column; gap: 10px; }
.amt { display: flex; align-items: center; gap: 10px; }
.amt span { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); }
.amt input {
  flex: 1; min-width: 0;
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--panel-edge);
  border-radius: var(--r);
  padding: 10px 12px;
  font-family: var(--f-pixel); font-size: 14px;
  color: var(--yellow);
}
.amt input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 10px rgba(41,240,255,0.35); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick button {
  background: transparent;
  border: 1px solid var(--panel-edge);
  border-radius: 4px;
  padding: 6px 0;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  color: var(--ink-dim);
}
.quick button:hover { color: #fff; border-color: var(--cyan); }
.quick .allin { color: var(--magenta); border-color: rgba(255,46,151,0.5); }

.betbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.betbtn {
  border: 0;
  border-radius: var(--r);
  padding: 14px 8px;
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  cursor: pointer;
  color: #fff;
  overflow-wrap: anywhere;
  transition: transform 0.08s, box-shadow 0.2s, opacity 0.2s;
}
.betbtn.p1 { background: linear-gradient(180deg, #ff5a76, #c8163a); box-shadow: 0 4px 0 #7d0b22; }
.betbtn.p2 { background: linear-gradient(180deg, #4ea0ff, #1557c9); box-shadow: 0 4px 0 #0b2f7a; }
.betbtn:hover:not(:disabled) { filter: brightness(1.12); }
.betbtn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.betbtn:disabled { opacity: 0.35; cursor: not-allowed; }

.bp-msg { margin: 0; min-height: 1.5em; font-size: 14px; color: var(--ink-dim); }
.bp-msg.error { color: var(--red); }
.bp-msg.good { color: var(--green); }
.bp-msg.big { font-family: var(--f-pixel); font-size: 11px; line-height: 1.7; }

/* ------------------------------------------------------------ panels */

.panel { padding: 18px; margin-top: 20px; }
.panel h2 {
  margin: 0 0 14px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #fff;
  display: flex; align-items: center; gap: 10px;
}
.h-jp {
  font-family: var(--f-jp);
  font-size: 14px;
  color: var(--bg);
  background: var(--magenta);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 2px;
}

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.bettors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bettor-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bettor-list li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
}
.bettor-list.p1 li { background: rgba(255,59,92,0.1); border-left: 3px solid var(--red); }
.bettor-list.p2 li { background: rgba(47,140,255,0.1); border-left: 3px solid var(--blue); }
.bettor-list .amt-v { font-family: var(--f-pixel); font-size: 10px; color: var(--yellow); align-self: center; }
.bettor-list .paid { color: var(--green); }
.bettor-list .lost { color: var(--ink-dim); text-decoration: line-through; }
.bettor-list .empty, .leaderboard .empty, .history .empty { background: none; border: 0; color: var(--ink-dim); font-style: italic; }
.name-trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.via-chat {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--green); border: 1px solid rgba(93,255,155,0.5);
  border-radius: 3px; padding: 0 4px; margin-left: 4px;
}
.steps code { font-family: var(--f-pixel); font-size: 10px; color: var(--yellow); }

.leaderboard { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.leaderboard li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px; align-items: center;
  padding: 7px 4px;
  border-bottom: 1px dashed rgba(126,104,255,0.18);
  font-size: 14px;
}
.leaderboard li:not(.empty)::before {
  counter-increment: rank;
  content: counter(rank, decimal-leading-zero);
  font-family: var(--f-pixel); font-size: 10px;
  color: var(--ink-dim);
}
.leaderboard li:nth-child(1)::before { color: var(--yellow); text-shadow: 0 0 8px var(--yellow); }
.leaderboard li:nth-child(2)::before { color: #d8d8e8; }
.leaderboard li:nth-child(3)::before { color: var(--orange); }
.leaderboard li.empty { display: block; }
.lb-bal { font-family: var(--f-pixel); font-size: 11px; color: var(--yellow); }
.lb-rec { font-size: 12px; color: var(--ink-dim); margin-left: 6px; }

.history { list-style: none; margin: 0; padding: 0; }
.history li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 8px 4px;
  border-bottom: 1px dashed rgba(126,104,255,0.18);
  font-size: 14px;
}
.history .h-game { grid-column: 1 / -1; font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1px; }
.history .h-win-1 { color: var(--red); font-weight: 700; }
.history .h-win-2 { color: var(--blue); font-weight: 700; }
.history .h-pot { font-family: var(--f-pixel); font-size: 10px; color: var(--yellow); align-self: center; }

/* ------------------------------------------------------------ stats page */

.stats-title {
  margin: 0 0 6px;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 2px;
  display: flex; align-items: center; gap: 10px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tab {
  padding: 8px 12px;
  border-radius: var(--r);
  border: 1px solid var(--panel-edge);
  background: rgba(0,0,0,0.25);
  color: var(--ink-dim);
  font-weight: 600;
  cursor: pointer;
}
.tab small { margin-left: 6px; font-family: var(--f-pixel); font-size: 9px; color: var(--yellow); }
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { color: #fff; border-color: var(--cyan); box-shadow: 0 0 12px rgba(41,240,255,0.35); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 20px; }
.tile { padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); }
.tile-value { font-family: var(--f-pixel); font-size: 16px; line-height: 1.4; color: var(--yellow); overflow-wrap: anywhere; }
.tile-note { font-size: 13px; color: var(--ink-dim); }

.find { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; max-width: 360px; }
.find span { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); }
.find input {
  flex: 1; min-width: 0;
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--panel-edge);
  border-radius: var(--r);
  padding: 8px 12px;
}
.find input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 10px rgba(41,240,255,0.35); }

.table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats-table th, .stats-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px dashed rgba(126,104,255,0.18);
  white-space: nowrap;
}
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table td:first-child { font-weight: 600; }
.stats-table th button {
  background: none; border: 0; padding: 0;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--ink-dim);
  cursor: pointer;
}
.stats-table th[aria-sort] button { color: #fff; }
.stats-table th[aria-sort="descending"] button::after { content: " ▼"; font-size: 9px; }
.stats-table th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 9px; }
.stats-table .num { font-family: var(--f-pixel); font-size: 10px; color: var(--yellow); }
.stats-table .empty { text-align: left; color: var(--ink-dim); font-style: italic; }

/* ------------------------------------------------------------ halloween promo */

.promo {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 20px;
  padding: 26px 24px;
  border-radius: var(--r);
  text-decoration: none;
  color: #fff;
  border: 1px solid rgba(255,138,31,0.5);
  background:
    radial-gradient(400px 200px at 90% 50%, rgba(255,138,31,0.35), transparent 70%),
    linear-gradient(135deg, #1a0a26, #2a0d1a);
  transition: box-shadow 0.2s;
}
.promo:hover { box-shadow: 0 0 30px rgba(255,138,31,0.35); }
.promo-kicker { font-size: 12px; letter-spacing: 3px; color: var(--orange); }
.promo-title {
  font-family: var(--f-pixel);
  font-size: clamp(18px, 3.4vw, 30px);
  color: var(--orange);
  text-shadow: 0 0 10px rgba(255,138,31,0.8), 3px 3px 0 #5a1a6b;
}
.promo-sub { color: #e8d6c8; }

/* ------------------------------------------------------------ how */

.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.steps strong { color: var(--cyan); }
.fine { margin: 14px 0 0; font-size: 13px; color: var(--ink-dim); }

/* ------------------------------------------------------------ footer */

.footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  padding: 28px var(--gutter);
  font-size: 13px;
  color: var(--ink-dim);
  border-top: 1px solid var(--panel-edge);
}
.footer .dot { opacity: 0.5; }
.insert { font-family: var(--f-pixel); font-size: 10px; color: var(--yellow); animation: blink 1.2s steps(2) infinite; align-self: center; }

@keyframes blink { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1000px) {
  .arena { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px 16px; }
  .nav { order: 3; width: 100%; margin: 0; gap: 12px; overflow-x: auto; }
  .nav-long { display: none; }
  .nav a { font-size: 12px; letter-spacing: 0.5px; white-space: nowrap; }
  .cols { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .bettors { grid-template-columns: 1fr; }
  .user span.uname { display: none; }
}
