:root {
  --bg: #0d0b1a;
  --panel: #171430;
  --ink: #e8ecf2;
  --muted: #7f8ba8;
  --accent: #ffcf4a;
  --accent2: #59e0b8;
  --phantom: #ab9ff2;
  --danger: #ff5d73;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  background: #0d0b1a;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  background: rgba(9, 7, 22, 0.82);
  text-align: center;
  padding: 16px;
  overflow-y: auto;
}
/* center content when it fits, scroll from the top when it doesn't */
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }

.hidden { display: none !important; }

.title {
  font-size: clamp(22px, 5vw, 44px);
  line-height: 1.25;
  color: var(--accent);
  text-shadow: 3px 3px 0 #7a2d8f, 6px 6px 0 #12102a;
  letter-spacing: 2px;
}

.tagline { color: var(--muted); font-size: clamp(8px, 1.4vw, 11px); }

.subtitle {
  font-size: clamp(16px, 3vw, 26px);
  color: var(--danger);
  text-shadow: 3px 3px 0 #12102a;
}
#spectate .subtitle { color: var(--accent2); }

.scoreline { font-size: clamp(12px, 2.4vw, 20px); color: var(--accent); }
.submitline { font-size: clamp(8px, 1.4vw, 11px); color: var(--accent2); min-height: 1em; }

.btn-col { display: flex; flex-direction: column; gap: 10px; align-items: center; }

.pxbtn {
  font-family: inherit;
  font-size: clamp(9px, 1.6vw, 13px);
  color: var(--ink);
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 #000;
  padding: 10px 18px;
  cursor: pointer;
  min-width: 220px;
}
.pxbtn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 #000; }
.pxbtn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }
.pxbtn.big { background: #274a2c; border-color: var(--accent2); color: var(--accent2); }
.pxbtn.phantom { background: #2d2650; border-color: var(--phantom); color: var(--phantom); }
.pxbtn.small { min-width: 0; padding: 6px 10px; font-size: 9px; }

#wallet-box {
  border: 2px solid var(--phantom);
  padding: 10px;
  background: rgba(43, 36, 79, 0.6);
  font-size: 9px;
  color: var(--phantom);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
#board { width: min(420px, 92vw); }
.board-tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 8px; }
.tab {
  font-family: inherit; font-size: 8px; padding: 6px 10px; cursor: pointer;
  background: transparent; color: var(--muted); border: 2px solid var(--muted);
}
.tab.active { color: var(--accent); border-color: var(--accent); }

#board-list {
  list-style: none;
  border: 2px solid var(--muted);
  background: rgba(23, 20, 48, 0.7);
  padding: 8px;
  max-height: 26vh;
  overflow-y: auto;
  font-size: 9px;
  text-align: left;
}
#board-list li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 2px; border-bottom: 1px solid #262347;
}
#board-list li:last-child { border-bottom: none; }
#board-list .rank { color: var(--muted); }
#board-list .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board-list .pts { color: var(--accent); }
#board-list .prize { color: var(--accent2); font-size: 0.85em; }
#board-list li:nth-child(1) .rank { color: var(--accent); }

.muted { color: var(--muted); }
.small-note { font-size: 8px; margin-top: 6px; }
.footer { font-size: 8px; color: var(--muted); }

#strips {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
}
#topbar, #cabar {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 34px;
  font-size: clamp(8px, 1.4vw, 11px);
  background: rgba(9, 7, 22, 0.92);
  padding: 0 56px;
  white-space: nowrap;
  overflow: hidden;
}
#topbar { border-bottom: 2px solid var(--accent); color: var(--accent); }
#topbar-next { color: var(--accent2); font-size: 0.85em; }
#cabar { border-bottom: 2px solid var(--accent2); color: var(--accent2); }
#ca-label { flex: 0 0 auto; }
#ca-text {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
  color: var(--ink);
}
#ca-copy { flex: 0 0 auto; }
#ca-copy { box-shadow: 2px 2px 0 #000; border-color: var(--accent2); color: var(--accent2); }

#quitbtn {
  position: absolute;
  top: 50px; right: 10px;
  z-index: 16;
}

#logo-img {
  image-rendering: pixelated;
  width: clamp(72px, 12vh, 120px);
  height: auto;
}

#x-link {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 20;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  color: var(--ink);
  background: rgba(23, 20, 48, 0.85);
  border: 2px solid var(--muted);
  box-shadow: 3px 3px 0 #000;
}
#x-link:hover { border-color: var(--ink); transform: translate(-1px, -1px); }

#bank {
  width: min(420px, 92vw);
  border: 2px solid var(--accent);
  background: rgba(43, 36, 20, 0.35);
  padding: 10px;
  font-size: 9px;
}
.bank-head { color: var(--accent); margin-bottom: 6px; }
#bank-total { font-size: clamp(11px, 2vw, 16px); color: var(--accent); }
#bank-sub { font-size: 8px; margin-top: 4px; }
#bank-standings {
  list-style: none;
  margin-top: 8px;
  text-align: left;
  max-height: 22vh;
  overflow-y: auto;
}
#bank-standings li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 3px 2px; border-top: 1px solid #3a3320;
}
#bank-standings .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bank-standings .prize { color: var(--accent2); }

