/* arcade.css — styles for index.html (the Arcade page).
   Black, #33FF33, Press Start 2P for the wordmark, headings and numbers.
   Sentences and wallet addresses use IBM Plex Mono at 13px.
   classic.html and admin.html do not load this file. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --g: #33FF33;
  --g2: #1f9e1f;
  --g3: #0e430e;
  --board: clamp(320px, calc(100vh - 230px), 560px);
}
body {
  background: #000;
  color: var(--g);
  font: 13px/1.55 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Maintenance banner, shown while CONTEST_BREAK is active */
.contest-banner {
  padding: 10px 15px;
  border-bottom: 2px solid var(--g);
  font: 10px/1.7 'Press Start 2P', monospace;
  text-align: center;
}

/* ------------------------------------------------------------------ header */
.top {
  display: flex; align-items: center; gap: 20px;
  max-width: 1180px; margin: 0 auto; padding: 18px 24px;
  border-bottom: 2px solid var(--g3);
}
.wordmark {
  margin: 0;
  font: 22px/1 'Press Start 2P', monospace;
  text-shadow: 0 0 12px rgba(51, 255, 51, 0.7);
}
.top nav { display: flex; gap: 20px; margin-left: auto; }
.top nav a, .top nav button, .foot a, .foot button {
  padding: 4px 0; background: none; border: 0; color: var(--g2);
  text-decoration: none; text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px;
}
.top nav a:hover, .top nav button:hover, .foot a:hover, .foot button:hover { color: var(--g); }
.btn {
  display: inline-block;
  padding: 11px 14px; border: 2px solid var(--g);
  background: var(--g); color: #000;
  font: 10px/1 'Press Start 2P', monospace; text-transform: uppercase; text-decoration: none;
}
.btn:hover { background: #000; color: var(--g); }
.btn.ghost { background: #000; color: var(--g); }
.btn.ghost:hover { background: var(--g); color: #000; }
.is-connected #wallet-button { background: #000; color: var(--g); text-transform: none; }

/* ------------------------------------------------------------------ layout */
.stage {
  display: grid; grid-template-columns: 270px minmax(320px, 560px) 210px; gap: 32px;
  justify-content: center; align-items: start;
  max-width: 1180px; margin: 0 auto; padding: 24px 24px 56px;
}
.play { display: flex; flex-direction: column; align-items: center; gap: 12px; order: 2; }
.left { order: 1; display: flex; flex-direction: column; gap: 20px; }
.right { order: 3; display: flex; flex-direction: column; gap: 20px; }

/* --------------------------------------------------------------------- HUD */
.hud {
  display: grid; grid-template-columns: 1fr 1fr 1.5fr;
  width: min(100%, var(--board)); border: 2px solid var(--g3);
}
.hud div { padding: 9px 12px; display: flex; flex-direction: column; gap: 7px; }
.hud div + div { border-left: 2px solid var(--g3); }
.k { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--g2); }
.hud .v { font: 14px/1 'Press Start 2P', monospace; text-transform: uppercase; }

/* ------------------------------------------------------------------- board */
/* The frame sets the displayed size on desktop. arcadePage.js sets it on
   phones. The canvas grid is fixed by clientGame.js setup(). */
.frame { width: min(100%, var(--board)); border: 2px solid var(--g); }
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.board canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}
/* Phones: the clientWidth classic.html gives #mobile-game-container
   (viewport - 16px), so a phone gets the same grid on both pages. */
.is-mobile .frame { width: auto; border: 0; }
.is-mobile .board { width: calc(100vw - 16px); margin: 0 auto; box-shadow: 0 0 0 2px var(--g); }

.idle-hint {
  display: none;
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 12%;
  margin: 0; text-align: center; pointer-events: none;
  font: 10px/1.6 'Press Start 2P', monospace; text-transform: uppercase;
  animation: blink 1.1s steps(2, start) infinite;
}
.is-ready.is-idle .idle-hint { display: block; }
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .idle-hint { animation: none; } }

/* REKT layer. clientGame.js switches #rekt-popup between display none and flex. */
.over {
  position: absolute; z-index: 3; top: 0; right: 0; bottom: 0; left: 0;
  flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: rgba(0, 0, 0, 0.86);
}
.over .title { margin: 0 0 14px; font: 36px/1 'Press Start 2P', monospace; text-shadow: 0 0 14px rgba(51, 255, 51, 0.7); }
.over .title.small { font-size: 16px; }
.over p { margin: 0 0 14px; }
.over .v { font: 14px/1 'Press Start 2P', monospace; margin-left: 8px; }

.keys, .skin-credit { margin: 0; font-size: 12px; color: var(--g2); text-align: center; }
.skin-credit b { font-weight: 400; color: var(--g); }
.skin-credit a { text-decoration-color: var(--g2); text-underline-offset: 3px; }
.skin-credit a:hover { text-decoration-color: var(--g); }

/* State toggles set by arcadePage.js on <html> */
html:not(.is-out) .only-out,
.is-out .not-out { display: none !important; }

/* Keyboard wording by default, tap wording on phones and touch tablets */
.for-touch { display: none; }
.is-mobile .for-touch { display: inline; }
.is-mobile .for-keys { display: none; }
@media (hover: none) and (pointer: coarse) {
  .for-touch { display: inline; }
  .for-keys { display: none; }
}

/* ------------------------------------------------------------- direction pad */
/* Same arrangement as classic.html: up on top, left / down / right below. */
.pad { display: none; }
.is-mobile .pad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  grid-template-rows: repeat(2, 64px);
  grid-template-areas: ". up ." "left down right";
  gap: 8px;
  justify-content: center;
  touch-action: none;
}
/* Touch tablets at 768px and wider get the pad too. */
@media (hover: none) and (pointer: coarse) {
  .pad {
    display: grid;
    grid-template-columns: repeat(3, 76px);
    grid-template-rows: repeat(2, 64px);
    grid-template-areas: ". up ." "left down right";
    gap: 8px;
    justify-content: center;
    touch-action: none;
  }
}
.pad .up { grid-area: up; }
.pad .left-arrow { grid-area: left; }
.pad .down { grid-area: down; }
.pad .right-arrow { grid-area: right; }
.pad button {
  background: #000; color: var(--g); border: 2px solid var(--g); font-size: 22px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
.pad button:active { background: var(--g); color: #000; }

/* ------------------------------------------------------------------ panels */
.panel { border: 2px solid var(--g3); padding: 16px; }
.panel h2 { margin: 0 0 14px; font: 12px/1 'Press Start 2P', monospace; text-transform: uppercase; }
.panel p { margin: 0; }
.meta { display: flex; justify-content: space-between; color: var(--g2); }
.meta b { font-weight: 500; color: var(--g); }
.bar {
  height: 10px; margin: 8px 0 14px;
  background: repeating-linear-gradient(90deg, var(--g3) 0, var(--g3) 6px, transparent 6px, transparent 8px);
}
.bar i {
  display: block; height: 100%; width: calc(var(--cycle-progress, 0) * 100%);
  background: repeating-linear-gradient(90deg, var(--g) 0, var(--g) 6px, #000 6px, #000 8px);
}
.big { margin: 0 0 12px !important; font: 22px/1 'Press Start 2P', monospace; text-transform: uppercase; }
.note { margin-top: 10px !important; font-size: 12px; color: var(--g2); }

/* Leaderboard rows are built by arcadePage.js */
#leaderboard-list { list-style: none; margin: 0; padding: 0; }
.lb-row {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: baseline;
  padding: 4px 6px; margin: 0 -6px;
}
.lb-rank { color: var(--g2); }
.is-prize .lb-rank { color: var(--g); }
.lb-score { font: 11px/1 'Press Start 2P', monospace; }
.lb-row.is-you { background: var(--g); color: #000; }
.lb-row.is-you .lb-rank { color: #000; }
.lb-tag { margin-left: 4px; font-weight: 500; text-transform: uppercase; }
.lb-split {
  margin: 8px 0; padding-top: 8px; border-top: 2px dashed var(--g3);
  font-size: 11px; color: var(--g2); text-transform: uppercase; letter-spacing: 0.06em;
}
.lb-empty { color: var(--g2); }

/* ------------------------------------------------------------------ prizes */
.prize { border: 2px solid var(--g3); }
.prize:hover { border-color: var(--g); }
.prize a { display: block; text-decoration: none; }
.prize img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; image-rendering: pixelated; background: #061a06; }
.prize .cap { display: block; padding: 10px 12px; border-top: 2px solid var(--g3); }
.prize .place { display: block; font: 10px/1 'Press Start 2P', monospace; text-transform: uppercase; }
.prize .name { display: block; margin-top: 8px; font-size: 12px; color: var(--g2); }
.prize .name:empty { display: none; }
/* Raffle card: caption only, no image above it */
.prize.raffle .cap { border-top: 0; }
/* Text shown in place of the prize image while on break */
.prize-break-note { margin: 0; padding: 16px 12px; font: 10px/1.7 'Press Start 2P', monospace; }

.foot { display: none; }

/* ------------------------------------------------------------------ popups */
.modal {
  position: fixed; z-index: 1000; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, 0.85);
}
.modal-box {
  width: 100%; max-width: 480px; max-height: 100%; overflow-y: auto;
  padding: 22px; border: 2px solid var(--g); background: #000;
}
.modal-box.narrow { max-width: 340px; text-align: center; }
.modal-box h2 { margin: 0 0 18px; font: 14px/1.4 'Press Start 2P', monospace; text-transform: uppercase; }
.modal-box p { margin: 0 0 18px; }
.modal-box dl { margin: 0 0 20px; display: grid; grid-template-columns: 84px 1fr; gap: 12px 14px; }
.modal-box dt { color: var(--g2); text-transform: uppercase; font-size: 12px; letter-spacing: 0.06em; }
.modal-box dd { margin: 0; }
#wallet-selector-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; margin-bottom: 16px; }
.wallet-choice {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  background: #000; color: var(--g); border: 2px solid var(--g3); text-align: left;
}
.wallet-choice:hover { border-color: var(--g); }
.wallet-choice img, .wallet-choice .blank { width: 24px; height: 24px; border-radius: 4px; background: #222; flex: none; }

/* ------------------------------------------------------- narrow and phones */
@media (max-width: 1000px) {
  .stage { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 16px 8px 40px; }
  .play { order: 1; }
  .left { order: 2; }
  .right { order: 3; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .prize.raffle { grid-column: 1 / -1; }
  .left, .right { width: min(100%, 560px); margin: 0 auto; }
  .top { padding: 12px; gap: 10px; }
  .top nav { display: none; }
  .top .actions { margin-left: auto; }
  .wordmark { font-size: 18px; }
  .foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; padding: 0 12px 32px; }
}
.top .actions { display: flex; gap: 8px; align-items: center; }

/* Phone: header, HUD, board and pad on one screen (664px tall in iPhone Safari). */
.is-mobile .hud { width: calc(100vw - 16px); }
.is-mobile .top { padding: 8px 12px; }
.is-mobile .top .btn { padding: 9px 10px; font-size: 9px; }
.is-mobile .stage { padding-top: 10px; }
.is-mobile .play { gap: 10px; }
.is-mobile .hud div { padding: 6px 10px; gap: 5px; }
.is-mobile .hud .v { font-size: 12px; }
