/* ══════════════════════════════════════════════════════════════
   CASHU-IN · SUPER MARMOT POKER
   Authentic SNES-era UI · FF6 windows · Mode 7 table
   Pure CSS — no images, no canvas
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ═══════════════════════════════════════
   SNES PALETTE — 15-bit color depth
   (32768 possible, 256 simultaneous)
   ═══════════════════════════════════════ */
:root {
  /* ── FF6 Window System ── */
  --win-bg: #182090;
  --win-bg-dark: #101878;
  --win-bg-deep: #080850;
  --win-border-hi: #e8e8f8;
  /* top-left highlight */
  --win-border-md: #a0a0c0;
  /* mid border */
  --win-border-lo: #383858;
  /* bottom-right shadow */
  --win-border-dk: #181830;
  /* darkest edge */
  --win-corner: #6060a0;
  /* corner piece */

  /* ── World Background ── */
  --bg: #000010;
  --bg-tile-a: #080818;
  --bg-tile-b: #060614;
  --star-bright: #f8f8f8;
  --star-dim: #8888a8;

  /* ── Felt / Table ── */
  --felt: #185818;
  --felt-lite: #287828;
  --felt-dark: #0c3810;
  --felt-rim-hi: #50a048;
  --felt-rim-lo: #0c280c;
  --felt-wood: #604020;
  --felt-wood-hi: #906830;
  --felt-wood-lo: #382010;

  /* ── Text ── */
  --text: #f8f8f8;
  --text-shadow: #080808;
  --text-yellow: #f8e838;
  --text-gray: #888898;
  --text-cyan: #58f8f8;
  --text-orange: #f8a830;

  /* ── SNES Primaries ── */
  --red: #f83838;
  --red-dk: #a82020;
  --green: #38d850;
  --green-dk: #208830;
  --blue: #3898f8;
  --blue-dk: #2060b0;
  --yellow: #f8d830;
  --yellow-dk: #b89818;
  --purple: #b838f8;
  --purple-dk: #782098;
  --orange: #f89830;
  --orange-dk: #b06818;
  --teal: #38d8d8;
  --teal-dk: #208888;

  /* ── Gold / Chips ── */
  --gold: #f8d830;
  --gold-hi: #f8f078;
  --gold-lo: #b89818;
  --gold-shadow: #685010;

  /* ── System ── */
  --black: #000000;
  --px: 4px;
  /* base pixel unit */
}

/* ═══════════════════════════════════════
   RESET & SNES BASE RENDERING
   ═══════════════════════════════════════ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Kill all modern rendering */
  border-radius: 0 !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  line-height: 1.8;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  /* SNES text always has shadow */
  text-shadow: 1px 1px 0 var(--text-shadow);
}

/* ═══════════════════════════════════════
   GAME CONTAINER — SNES screen area
   256×224 feel, scaled up
   ═══════════════════════════════════════ */
#game-container {
  width: 100%;
  height: 100%;
  max-width: 768px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  /* Checkerboard tile background — like SNES world map */
  background:
    repeating-conic-gradient(var(--bg-tile-a) 0% 25%,
      var(--bg-tile-b) 0% 50%) 0 0 / 16px 16px,
    var(--bg);
}

/* Starfield overlay */
#game-container::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    /* Bright stars */
    radial-gradient(1px 1px at 52px 28px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 180px 65px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 340px 42px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 480px 90px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 620px 35px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 130px 170px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 400px 140px, var(--star-bright), transparent),
    radial-gradient(1px 1px at 710px 180px, var(--star-bright), transparent),
    /* Dim stars */
    radial-gradient(1px 1px at 90px 50px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 220px 110px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 310px 160px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 530px 20px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 680px 130px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 30px 140px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 560px 170px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 270px 80px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 750px 70px, var(--star-dim), transparent),
    radial-gradient(1px 1px at 150px 95px, var(--star-dim), transparent);
  animation: star-twinkle 3s step-start infinite;
}

/* Subtle vignette — SNES CRT feel */
#game-container::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
}

/* Everything inside needs z-index above overlays */
.screen {
  z-index: 2;
}

/* ═══════════════════════════════════════
   THE SNES WINDOW
   ─────────────────────────────────────
   This is the heart of the aesthetic.
   FF6-style: 4px beveled border frame
   around a deep blue gradient interior.

   Structure:
   ┌─ win-border-hi (bright) ──────────┐
   │ ┌─ win-border-md (mid) ─────────┐ │
   │ │ ┌─ win-bg gradient ─────────┐ │ │
   │ │ │                           │ │ │
   │ │ │      content area         │ │ │
   │ │ │                           │ │ │
   │ │ └───────── win-border-lo ─┘ │ │
   │ └─────────── win-border-dk ──┘ │
   └────────────────────────────────┘
   ═══════════════════════════════════════ */
.snes-win {
  position: relative;
  background: linear-gradient(180deg, var(--win-bg) 0%, var(--win-bg-dark) 60%, var(--win-bg-deep) 100%);
  /* 4-layer border bevel via box-shadow */
  box-shadow:
    /* outer highlight — top & left bright */
    inset 0 var(--px) 0 0 var(--win-border-hi),
    inset var(--px) 0 0 0 var(--win-border-hi),
    /* outer shadow — bottom & right dark */
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-dk),
    /* inner highlight band */
    inset 0 calc(2 * var(--px)) 0 0 var(--win-border-md),
    inset calc(2 * var(--px)) 0 0 0 var(--win-border-md),
    /* inner shadow band */
    inset 0 calc(-2 * var(--px)) 0 0 var(--win-border-lo),
    inset calc(-2 * var(--px)) 0 0 0 var(--win-border-lo),
    /* outer frame */
    0 0 0 var(--px) var(--win-border-dk);
  padding: calc(3 * var(--px));
}

/* Apply SNES window to all UI panels */
.menu-box,
.game-header,
.table-info-panel,
.log-box,
.modal-box,
.toast {
  position: relative;
  background: linear-gradient(180deg, var(--win-bg) 0%, var(--win-bg-dark) 60%, var(--win-bg-deep) 100%);
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-hi),
    inset var(--px) 0 0 0 var(--win-border-hi),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-dk),
    inset 0 calc(2 * var(--px)) 0 0 var(--win-border-md),
    inset calc(2 * var(--px)) 0 0 0 var(--win-border-md),
    inset 0 calc(-2 * var(--px)) 0 0 var(--win-border-lo),
    inset calc(-2 * var(--px)) 0 0 0 var(--win-border-lo),
    0 0 0 var(--px) var(--win-border-dk);
  border: none;
  outline: none;
  padding: calc(3 * var(--px));
}

/* Form box gets window treatment too */
.form-box {
  position: relative;
  background: linear-gradient(180deg, var(--win-bg) 0%, var(--win-bg-dark) 60%, var(--win-bg-deep) 100%);
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-hi),
    inset var(--px) 0 0 0 var(--win-border-hi),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-dk),
    inset 0 calc(2 * var(--px)) 0 0 var(--win-border-md),
    inset calc(2 * var(--px)) 0 0 0 var(--win-border-md),
    inset 0 calc(-2 * var(--px)) 0 0 var(--win-border-lo),
    inset calc(-2 * var(--px)) 0 0 0 var(--win-border-lo),
    0 0 0 var(--px) var(--win-border-dk);
  border: none;
  outline: none;
  padding: calc(3 * var(--px));
}

/* ═══════════════════════════════════════
   SCREEN MANAGEMENT
   ═══════════════════════════════════════ */
.screen {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  padding: 8px;
}

.screen.active {
  display: flex;
}

/* ═══════════════════════════════════════
   TITLE SCREEN
   ═══════════════════════════════════════ */
.title-art {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.splash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: min(96%, 560px);
  padding: 12px 10px 10px;
  background: linear-gradient(180deg, rgba(24, 32, 144, 0.95), rgba(8, 8, 80, 0.95));
  box-shadow:
    inset 0 0 0 2px var(--win-border-hi),
    inset 0 0 0 4px var(--win-border-md),
    inset 0 0 0 6px var(--win-border-lo),
    0 0 0 8px var(--win-border-dk),
    0 8px 0 8px rgba(0, 0, 0, 0.5);
}

.pixel-art {
  color: var(--yellow);
  font-size: 8px;
  line-height: 1.2;
  text-shadow:
    2px 2px 0 var(--yellow-dk),
    1px 1px 0 var(--yellow-dk);
  white-space: pre;
  /* Slight glow like SNES title screens */
  filter: drop-shadow(0 0 2px rgba(248, 216, 48, 0.4));
}

.splash-logo {
  width: min(100%, 520px);
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 0 var(--black));
}

.subtitle {
  font-size: 10px;
  color: var(--text-cyan);
  letter-spacing: 3px;
  text-shadow:
    1px 1px 0 var(--teal-dk),
    2px 2px 0 var(--black);
  animation: text-flash 2.5s step-end infinite;
}

/* ── Avatar sprites from image files ── */
.avatar-sprite {
  width: 32px;
  height: 32px;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  box-shadow:
    inset 0 0 0 2px var(--win-border-hi),
    inset 0 0 0 4px var(--win-border-dk),
    0 2px 0 0 var(--black);
}

.avatar-static {
  background-image: url('/avatars/avatar-0.png');
}

.avatar-0 {
  background-image: url('/avatars/avatar-0.png');
}

.avatar-1 {
  background-image: url('/avatars/avatar-1.png');
}

.avatar-2 {
  background-image: url('/avatars/avatar-2.png');
}

.avatar-3 {
  background-image: url('/avatars/avatar-3.png');
}

.avatar-4 {
  background-image: url('/avatars/avatar-4.png');
}

.avatar-5 {
  background-image: url('/avatars/avatar-5.png');
}

.avatar-6 {
  background-image: url('/avatars/avatar-6.png');
}

.avatar-7 {
  background-image: url('/avatars/avatar-7.png');
}

.splash-avatars {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 360px;
}

.title-avatar {
  transform: scale(3);
  margin: 16px 0 22px;
  filter: drop-shadow(0 4px 0 var(--black));
}

/* ── Title Menu ── */
.menu-box {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 auto;
  width: fit-content;
  min-width: 300px;
}

.menu-item {
  padding: 10px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
  color: var(--text);
  transition: none;
  /* SNES has no transitions */
}

.menu-item:hover,
.menu-item.selected {
  background: rgba(248, 248, 248, 0.08);
  color: var(--text-yellow);
  text-shadow: 1px 1px 0 var(--yellow-dk);
}

.menu-item .cursor {
  color: var(--text);
  opacity: 0;
  font-size: 8px;
  width: 10px;
  text-shadow: 1px 1px 0 var(--text-shadow);
}

.menu-item.selected .cursor,
.menu-item:hover .cursor {
  opacity: 1;
  animation: cursor-blink 0.5s step-end infinite;
}

.hint-text {
  text-align: center;
  color: var(--text-gray);
  font-size: 8px;
  padding: 16px;
  letter-spacing: 2px;
  animation: text-flash 3s step-end infinite;
}

/* ═══════════════════════════════════════
   FORM SCREENS (Create / Join)
   ═══════════════════════════════════════ */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  margin-bottom: 8px;
  /* Header gets its own window */
  background: linear-gradient(180deg, var(--win-bg) 0%, var(--win-bg-dark) 100%);
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-hi),
    inset var(--px) 0 0 0 var(--win-border-hi),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-dk),
    inset 0 calc(2 * var(--px)) 0 0 var(--win-border-md),
    inset calc(2 * var(--px)) 0 0 0 var(--win-border-md),
    inset 0 calc(-2 * var(--px)) 0 0 var(--win-border-lo),
    inset calc(-2 * var(--px)) 0 0 0 var(--win-border-lo),
    0 0 0 var(--px) var(--win-border-dk);
  border: none;
}

.screen-header h2 {
  font-size: 12px;
  color: var(--text-yellow);
  text-shadow:
    1px 1px 0 var(--yellow-dk),
    2px 2px 0 var(--black);
}

.back-arrow {
  color: var(--text-gray);
  cursor: pointer;
  font-size: 10px;
}

.back-arrow:hover {
  color: var(--text-yellow);
}

.form-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 500px;
  overflow-y: auto;
  flex: 1;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row label {
  font-size: 8px;
  color: var(--text-cyan);
  letter-spacing: 1px;
  text-shadow:
    1px 1px 0 var(--teal-dk);
}

.key-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.key-row input {
  flex: 1;
  min-width: 0;
}

/* ── SNES-style input fields ──
   Dark inset box — like RPG name entry */
input[type="text"],
input[type="number"] {
  background: var(--black);
  color: var(--text);
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 8px;
  padding: 8px;
  width: 100%;
  border: none;
  outline: none;
  text-shadow: 1px 1px 0 var(--text-shadow);
  /* Inset bevel — opposite of window (dark top-left, light bottom-right) */
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-dk),
    inset var(--px) 0 0 0 var(--win-border-dk),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-md),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-md);
}

input:focus {
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-dk),
    inset var(--px) 0 0 0 var(--win-border-dk),
    inset 0 calc(-1 * var(--px)) 0 0 var(--yellow-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--yellow-dk),
    0 0 0 2px var(--yellow-dk);
}

input::placeholder {
  color: var(--text-gray);
  font-size: 7px;
  text-shadow: none;
}

/* ═══════════════════════════════════════
   SNES BUTTONS
   ─────────────────────────────────────
   Not web buttons. These are SNES RPG
   command buttons — beveled, chunky,
   with a clear pressed state.
   ═══════════════════════════════════════ */
.pixel-btn {
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 8px;
  padding: 8px 16px;
  border: none;
  cursor: pointer;
  position: relative;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 var(--text-shadow);
  background: var(--win-bg-dark);
  outline: none;

  /* Beveled SNES button — raised */
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-hi),
    inset var(--px) 0 0 0 var(--win-border-hi),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-dk),
    0 var(--px) 0 0 var(--black);
  transition: none;
}

.pixel-btn:hover:not(:disabled) {
  color: var(--text-yellow);
  background: var(--win-bg);
}

.pixel-btn:active:not(:disabled) {
  /* SNES button press — inverted bevel, pushed down */
  transform: translateY(var(--px));
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-dk),
    inset var(--px) 0 0 0 var(--win-border-dk),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-hi),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-hi);
}

.pixel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pixel-btn.small {
  font-size: 7px;
  padding: 6px 8px;
  flex-shrink: 0;
}

.pixel-btn.wide {
  width: 100%;
  padding: 12px;
  font-size: 10px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════
   GAME TABLE SCREEN
   ═══════════════════════════════════════ */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.table-name-display {
  color: var(--text-yellow);
  font-size: 10px;
  text-shadow:
    1px 1px 0 var(--yellow-dk),
    2px 2px 0 var(--black);
}

.round-display {
  color: var(--text-gray);
  font-size: 8px;
}

.phase-display {
  color: var(--text-cyan);
  font-size: 8px;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 var(--teal-dk);
}

.table-info-btn {
  font-size: 7px !important;
  padding: 4px 6px !important;
}

/* ── Table Info Panel ── */
.table-info-panel {
  margin-bottom: 6px;
  flex-shrink: 0;
}

.table-info-panel .form-row {
  margin-bottom: 6px;
}

.table-info-panel .form-row:last-child {
  margin-bottom: 0;
}

/* ═══════════════════════════════════════
   POKER TABLE — SNES-style game board
   ─────────────────────────────────────
   Oval felt with wooden rim, pixel-art
   treatment. Like a top-down SNES RPG
   battle arena or card table.
   ═══════════════════════════════════════ */
.poker-table {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px;
}

.felt {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1.8 / 1;
  /* Flat SNES-style fill — no CSS3 radial gradients */
  background: var(--felt);
  /* Wooden rim — beveled like a SNES window but in wood tones */
  box-shadow:
    /* felt inner shadow */
    inset 0 8px 16px rgba(0, 0, 0, 0.3),
    inset 0 -4px 8px rgba(0, 0, 0, 0.2),
    /* inner rim highlight */
    inset 0 0 0 4px var(--felt-lite),
    inset 0 0 0 6px var(--felt-dark),
    /* wood rim */
    0 0 0 8px var(--felt-wood),
    0 0 0 10px var(--felt-wood-hi),
    0 0 0 14px var(--felt-wood-lo),
    0 0 0 16px var(--black);
  border-radius: 50% !important;
  /* override reset — table must be oval */
}

/* Felt pattern — SNES dithering simulation */
.felt::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50% !important;
  pointer-events: none;
  /* Checkerboard dither pattern like SNES Mode 7 textures */
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.02) 0% 25%,
      transparent 0% 50%) 0 0 / 4px 4px;
}

/* ── Pot ── */
.pot-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* Pixel art chip stack */
.pot-chips {
  width: 16px;
  height: 4px;
  margin: 0 auto 4px;
  background: var(--gold);
  box-shadow:
    /* chip stack — multiple coins */
    0 -4px 0 0 var(--gold),
    0 -8px 0 0 var(--gold),
    0 -12px 0 0 var(--gold),
    /* highlights */
    0 -4px 0 0 var(--gold),
    1px -5px 0 0 var(--gold-hi),
    1px -9px 0 0 var(--gold-hi),
    1px -13px 0 0 var(--gold-hi),
    /* shadows */
    -1px -3px 0 0 var(--gold-lo),
    -1px -7px 0 0 var(--gold-lo),
    -1px -11px 0 0 var(--gold-lo),
    /* base shadow */
    0 1px 0 0 var(--gold-shadow),
    0 2px 0 0 var(--black);
}

.pot-amount {
  font-size: 10px;
  color: var(--text-yellow);
  text-shadow:
    1px 1px 0 var(--yellow-dk),
    2px 2px 0 var(--black);
  white-space: nowrap;
}

/* ── Player Seats ── */
.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 70px;
}

.seat .player-name {
  font-size: 6px;
  color: var(--text-gray);
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.seat .player-chips {
  font-size: 7px;
  color: var(--text-yellow);
}

.seat .player-bet {
  font-size: 7px;
  color: var(--text-orange);
  min-height: 12px;
}

.seat .turn-indicator {
  color: var(--text-yellow);
  font-size: 8px;
  opacity: 0;
  animation: none;
}

.seat.active-turn .turn-indicator {
  opacity: 1;
  animation: arrow-bounce 0.5s step-start infinite;
}

.seat.active-turn .player-name {
  color: var(--text-yellow);
}

.seat.active-turn .avatar-sprite {
  animation: sprite-hop 0.4s step-start infinite;
}

.seat.folded {
  opacity: 0.3;
}

.seat.empty-seat .avatar-sprite {
  opacity: 0.12;
}

/* Seat positions */
.seat-0 {
  bottom: -10%;
  left: 50%;
  transform: translateX(-50%);
}

.seat-1 {
  bottom: 5%;
  left: 5%;
}

.seat-2 {
  top: 10%;
  left: 2%;
}

.seat-3 {
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
}

.seat-4 {
  top: 10%;
  right: 2%;
}

.seat-5 {
  bottom: 5%;
  right: 5%;
}

/* ═══════════════════════════════════════
   ACTION BUTTONS — SNES command menu
   ═══════════════════════════════════════ */

/* ── Wallet Bar ── */
.wallet-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0 2px;
  flex-shrink: 0;
}

.wallet-balance {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 8px;
  background: var(--black);
  border: var(--px) solid var(--win-border-dk);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.wallet-label {
  color: var(--green);
  font-size: 9px;
  letter-spacing: 1px;
}

.wallet-amount {
  color: var(--yellow);
  font-size: var(--text-base);
  font-weight: bold;
}

.wallet-unit {
  color: var(--text-muted);
  font-size: 9px;
}

.wallet-bar .action-btn {
  flex: 1;
}

.wallet-bar .small-action {
  flex: 0 0 auto;
  font-size: 9px;
  padding: 4px 6px;
}

/* ── Action Buttons Bar ── */
.action-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 2px 0 6px;
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  font-size: 8px;
}

.action-btn .btn-icon {
  font-size: 14px;
  font-family: system-ui;
  text-shadow: none;
}

.action-btn .btn-label {
  font-size: 7px;
}

/* ── Colored action buttons — SNES saturated flat fills ── */
.action-btn.claim {
  background: var(--purple-dk);
  box-shadow:
    inset 0 var(--px) 0 0 var(--purple),
    inset var(--px) 0 0 0 var(--purple),
    inset 0 calc(-1 * var(--px)) 0 0 #401060,
    inset calc(-1 * var(--px)) 0 0 0 #401060,
    0 var(--px) 0 0 var(--black);
}

.action-btn.check {
  background: var(--green-dk);
  box-shadow:
    inset 0 var(--px) 0 0 var(--green),
    inset var(--px) 0 0 0 var(--green),
    inset 0 calc(-1 * var(--px)) 0 0 #104018,
    inset calc(-1 * var(--px)) 0 0 0 #104018,
    0 var(--px) 0 0 var(--black);
}

.action-btn.raise {
  background: var(--orange-dk);
  box-shadow:
    inset 0 var(--px) 0 0 var(--orange),
    inset var(--px) 0 0 0 var(--orange),
    inset 0 calc(-1 * var(--px)) 0 0 #603008,
    inset calc(-1 * var(--px)) 0 0 0 #603008,
    0 var(--px) 0 0 var(--black);
}

.action-btn.fold {
  background: var(--red-dk);
  box-shadow:
    inset 0 var(--px) 0 0 var(--red),
    inset var(--px) 0 0 0 var(--red),
    inset 0 calc(-1 * var(--px)) 0 0 #501010,
    inset calc(-1 * var(--px)) 0 0 0 #501010,
    0 var(--px) 0 0 var(--black);
}

.action-btn.allin {
  background: #b81818;
  box-shadow:
    inset 0 var(--px) 0 0 #f83838,
    inset var(--px) 0 0 0 #f83838,
    inset 0 calc(-1 * var(--px)) 0 0 #601010,
    inset calc(-1 * var(--px)) 0 0 0 #601010,
    0 var(--px) 0 0 var(--black);
  animation: allin-flash 0.8s step-end infinite;
}

/* Press state for all action buttons */
.action-btn:active:not(:disabled) {
  transform: translateY(var(--px));
}

/* ── Start / Award Bars ── */
.start-bar,
.award-bar {
  padding: 6px 0;
  text-align: center;
  flex-shrink: 0;
}

.award-label {
  font-size: 10px;
  color: var(--text-yellow);
  margin-bottom: 8px;
  text-shadow:
    1px 1px 0 var(--yellow-dk),
    2px 2px 0 var(--black);
  animation: text-flash 1.2s step-end infinite;
}

#award-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ═══════════════════════════════════════
   ACTION LOG — SNES message window
   ═══════════════════════════════════════ */
.log-box {
  flex-shrink: 0;
  max-height: 80px;
}

.log-header {
  font-size: 7px;
  color: var(--text-cyan);
  padding: 4px 8px;
  border-bottom: 2px solid var(--win-border-lo);
  text-shadow: 1px 1px 0 var(--teal-dk);
}

.log-entries {
  padding: 4px 8px;
  max-height: 54px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-entry {
  font-size: 7px;
  color: var(--text-gray);
  line-height: 1.4;
}

.log-entry.action-check {
  color: var(--green);
}

.log-entry.action-call {
  color: var(--blue);
}

.log-entry.action-raise {
  color: var(--orange);
}

.log-entry.action-fold {
  color: var(--red);
}

.log-entry.action-claim {
  color: var(--purple);
}

.log-entry.action-win {
  color: var(--text-yellow);
}

/* ═══════════════════════════════════════
   MODAL — SNES dialog box
   ═══════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-box {
  text-align: center;
  min-width: 280px;
}

.modal-title {
  font-size: 12px;
  color: var(--text-yellow);
  margin-bottom: 4px;
  text-shadow:
    1px 1px 0 var(--yellow-dk),
    2px 2px 0 var(--black);
}

.modal-subtitle {
  font-size: 8px;
  color: var(--text-gray);
  margin-bottom: 12px;
}

.modal input {
  text-align: center;
  font-size: 14px;
  margin-bottom: 12px;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ── Wide modal variant ── */
.wide-modal {
  min-width: 320px;
  max-width: 400px;
}

/* ── Tab bar (SNES-style toggle) ── */
.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 1px;
  padding: 6px 4px;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  background: var(--win-bg-deep);
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-md),
    inset var(--px) 0 0 0 var(--win-border-md),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-dk);
}

.tab-btn.active {
  color: var(--yellow);
  background: var(--win-bg);
  box-shadow:
    inset 0 var(--px) 0 0 var(--win-border-hi),
    inset var(--px) 0 0 0 var(--win-border-hi),
    inset 0 calc(-1 * var(--px)) 0 0 var(--win-border-dk),
    inset calc(-1 * var(--px)) 0 0 0 var(--win-border-dk);
}

/* ── Tab panels ── */
.tab-panel {
  display: block;
}

.tab-panel.hidden {
  display: none;
}

/* ── Textarea in modals ── */
.modal textarea {
  width: 100%;
  font-family: inherit;
  font-size: 9px;
  color: var(--text-light);
  background: var(--black);
  border: var(--px) solid var(--win-border-dk);
  padding: 6px;
  resize: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.modal textarea::placeholder {
  color: var(--text-muted);
}

.modal textarea[readonly] {
  color: var(--green);
  cursor: text;
  user-select: all;
}

/* ── Lightning status ── */
.ln-status {
  font-size: 9px;
  color: var(--yellow);
  padding: 4px 0 8px;
  text-align: center;
  animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Cash out balance display ── */
.cash-out-balance {
  font-size: 16px;
  color: var(--yellow);
  text-align: center;
  padding: 8px 0;
  text-shadow:
    1px 1px 0 var(--yellow-dk),
    2px 2px 0 var(--black);
}

/* ═══════════════════════════════════════
   TOAST — SNES status message
   ═══════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 8px;
  color: var(--text);
  animation: toast-in 0.15s step-end, toast-out 0.15s step-end 2.85s forwards;
  pointer-events: auto;
}

.toast.error {
  color: var(--red);
}

.toast.success {
  color: var(--green);
}

/* ── Hidden ── */
.hidden {
  display: none !important;
}

/* ── Pulse ── */
.pulse {
  animation: allin-flash 1.5s step-end infinite;
}

/* ═══════════════════════════════════════
   ANIMATIONS — SNES-style step-based
   ─────────────────────────────────────
   Real SNES: no easing, no smooth.
   Everything is step-start or step-end.
   Frame-based, not interpolated.
   ═══════════════════════════════════════ */

/* Cursor blink — 2 frame animation */
@keyframes cursor-blink {

  0%,
  49.9% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

/* Text flash — like "PRESS START" */
@keyframes text-flash {

  0%,
  59.9% {
    opacity: 1;
  }

  60%,
  79.9% {
    opacity: 0.3;
  }

  80%,
  100% {
    opacity: 1;
  }
}

/* Arrow bounce — 2 positions only */
@keyframes arrow-bounce {

  0%,
  49.9% {
    transform: translateY(0);
  }

  50%,
  100% {
    transform: translateY(-4px);
  }
}

/* Sprite hop — 2 frame sprite movement */
@keyframes sprite-hop {

  0%,
  49.9% {
    transform: translateY(0);
  }

  50%,
  100% {
    transform: translateY(-3px);
  }
}

/* All-in flash — dramatic color swap */
@keyframes allin-flash {

  0%,
  39.9% {
    filter: brightness(1);
  }

  40%,
  59.9% {
    filter: brightness(1.4);
  }

  60%,
  100% {
    filter: brightness(1);
  }
}

/* Star twinkle — offset visibility */
@keyframes star-twinkle {

  0%,
  100% {
    opacity: 1;
  }

  33% {
    opacity: 0.7;
  }

  66% {
    opacity: 0.9;
  }
}

/* Toast — instant snap, not slide */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* ═══════════════════════════════════════
   SCROLLBAR — chunky pixel bar
   ═══════════════════════════════════════ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--black);
  box-shadow: inset 1px 0 0 var(--win-border-dk);
}

::-webkit-scrollbar-thumb {
  background: var(--win-bg-dark);
  box-shadow:
    inset 0 2px 0 0 var(--win-border-md),
    inset 2px 0 0 0 var(--win-border-md),
    inset 0 -2px 0 0 var(--win-border-dk),
    inset -2px 0 0 0 var(--win-border-dk);
}