/* ============================================================================
   CoinForge — game, page and admin styles
   ========================================================================== */

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

.game-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.game-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 420px;
}

.game-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.game-head h1 { margin: 0; font-size: 22px; font-weight: 800; }
.game-head .sub { color: var(--text-muted); font-size: 13px; font-weight: 700; }

.game-hint { color: var(--text-faint); font-size: 12.5px; font-weight: 700; }

.bet-summary {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}
.bet-summary b { color: var(--text); font-variant-numeric: tabular-nums; }

.history-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-pill {
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
  background: var(--red-dim);
  color: var(--red);
  animation: feedIn 0.25s ease;
}
.hist-pill.low { background: var(--green-dim); color: var(--green); }
.hist-pill.mid { background: var(--gold-dim); color: var(--gold); }

.result-flash {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 800;
  text-align: center;
  animation: feedIn 0.2s ease;
}
.result-flash.win { background: var(--green-dim); color: var(--green); }
.result-flash.loss { background: var(--red-dim); color: var(--red); }

/* ---------------------------------------------------------------------------
   Crash
   --------------------------------------------------------------------------- */

.crash-stage { position: relative; flex: 1; min-height: 330px; display: flex; flex-direction: column; }
.crash-canvas { width: 100%; height: 100%; flex: 1; display: block; }
.crash-mult {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  font-size: 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: color 0.15s;
  pointer-events: none;
}
.crash-mult.live { color: var(--text); }
.crash-mult.cashed { color: var(--green); }
.crash-mult.busted { color: var(--red); }
.crash-mult .x { font-size: 26px; color: var(--text-muted); }
.crash-timer { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); color: var(--text-faint); font-size: 13px; font-weight: 700; }

/* ---------------------------------------------------------------------------
   Mines
   --------------------------------------------------------------------------- */

.mines-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.mine-tile {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface-elev);
  border: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
  padding: 0;
  color: var(--text-muted);
}
.mine-tile:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.mine-tile:disabled { cursor: default; }
.mine-tile.revealed { background: var(--green-dim); border-color: rgba(148, 216, 45, 0.4); color: var(--green); animation: popIn 0.18s ease; }
.mine-tile.boom { background: var(--red-dim); border-color: rgba(239, 68, 68, 0.5); color: var(--red); animation: shake 0.35s ease; }
.mine-tile.shown-mine { background: var(--red-dim); border-color: rgba(239, 68, 68, 0.35); color: var(--red); opacity: 0.85; }
@keyframes popIn { 0% { transform: scale(0.7); } 70% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.mines-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------------------
   Dice
   --------------------------------------------------------------------------- */

.dice-stage { display: flex; flex-direction: column; gap: 20px; align-items: center; justify-content: center; flex: 1; padding: 20px 0; }
.dice-result {
  font-size: 58px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.dice-result.win { color: var(--green); }
.dice-result.loss { color: var(--red); }
.dice-bar { position: relative; width: 100%; max-width: 620px; height: 14px; }
.dice-bar .db-track {
  position: absolute; inset: 0;
  background: var(--red-dim);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.dice-bar .db-winzone {
  position: absolute; top: 0; bottom: 0;
  background: var(--green-dim);
  border-radius: var(--radius-pill);
}
.dice-bar .db-marker {
  position: absolute; top: -7px;
  width: 4px; height: 28px;
  background: var(--gold);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: left 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.2);
  box-shadow: 0 0 10px rgba(255, 212, 59, 0.6);
}
.dice-bar .db-labels { display: flex; justify-content: space-between; margin-top: 12px; color: var(--text-faint); font-size: 12.5px; font-weight: 800; }

.dice-quick { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* ---------------------------------------------------------------------------
   Limbo
   --------------------------------------------------------------------------- */

.limbo-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; flex: 1; }
.limbo-result {
  font-size: 74px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.limbo-result.win { color: var(--green); text-shadow: 0 0 34px rgba(148, 216, 45, 0.35); }
.limbo-result.loss { color: var(--red); }
.limbo-target-label { color: var(--text-muted); font-weight: 800; }
.limbo-vs { color: var(--text-faint); font-size: 20px; font-weight: 800; }

/* ---------------------------------------------------------------------------
   Coin flip
   --------------------------------------------------------------------------- */

.flip-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; flex: 1; perspective: 900px; }
.coin3d {
  width: 168px; height: 168px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 2.6s cubic-bezier(0.25, 0.7, 0.2, 1);
}
.coin-face {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 800;
  backface-visibility: hidden;
  border: 6px solid;
}
.coin-heads {
  background: linear-gradient(145deg, #ffe680, #d9a900);
  color: #4a3800;
  border-color: #b8860b;
  box-shadow: 0 0 46px rgba(255, 212, 59, 0.25);
}
.coin-tails {
  background: linear-gradient(145deg, #9db7ff, #4263eb);
  color: #0a1354;
  border-color: #2c46b8;
  transform: rotateY(180deg);
  box-shadow: 0 0 46px rgba(66, 99, 235, 0.25);
}
.flip-status { font-size: 26px; font-weight: 800; }
.flip-status.win { color: var(--green); }
.flip-status.loss { color: var(--red); }

.side-pick { display: flex; gap: 10px; }
.side-btn {
  flex: 1;
  background: var(--surface-elev);
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.13s;
}
.side-btn:hover { border-color: var(--gold); color: var(--text); }
.side-btn.on { border-color: var(--gold); background: var(--gold-dim); color: var(--gold); }

/* ---------------------------------------------------------------------------
   Wheel
   --------------------------------------------------------------------------- */

.wheel-stage { display: flex; align-items: center; justify-content: center; flex: 1; position: relative; }
.wheel-wrap { position: relative; width: min(400px, 82vw); aspect-ratio: 1; }
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 5;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 22px solid var(--gold);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}
.wheel-svg { width: 100%; height: 100%; transition: transform 5.2s cubic-bezier(0.15, 0.85, 0.22, 1); }
.wheel-result-badge { margin-top: 14px; text-align: center; font-size: 30px; font-weight: 800; }
.wheel-result-badge.win { color: var(--green); }
.wheel-result-badge.loss { color: var(--red); }

/* ---------------------------------------------------------------------------
   Plinko
   --------------------------------------------------------------------------- */

.plinko-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; justify-content: center; }
.plinko-canvas { width: 100%; max-width: 560px; height: auto; }
.buckets { display: flex; width: 100%; max-width: 560px; gap: 3px; }
.bucket {
  flex: 1;
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  padding: 6px 1px;
  border-radius: 5px;
  background: var(--surface-elev);
  color: var(--text-muted);
}
.bucket.hit { animation: bucketHit 0.5s ease; }
@keyframes bucketHit {
  0% { transform: scaleY(1); }
  40% { transform: scaleY(1.45); filter: brightness(1.6); }
  100% { transform: scaleY(1); }
}

/* ---------------------------------------------------------------------------
   Home
   --------------------------------------------------------------------------- */

.hero {
  background:
    radial-gradient(600px 300px at 15% -20%, rgba(66, 99, 235, 0.16), transparent),
    radial-gradient(500px 260px at 90% -30%, rgba(255, 212, 59, 0.08), transparent),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.hero h1 { margin: 0; font-size: clamp(26px, 4.5vw, 40px); font-weight: 800; line-height: 1.15; }
.hero h1 .accent { color: var(--gold); }
.hero p { margin: 0; color: var(--text-muted); font-size: 15.5px; max-width: 640px; font-weight: 600; }
.hero-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--text);
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
  position: relative;
}
.game-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.game-card.disabled { opacity: 0.45; pointer-events: none; }
.game-card .gc-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
}
.game-card .gc-name { font-weight: 800; font-size: 17px; }
.game-card .gc-tag { color: var(--text-muted); font-size: 12.5px; font-weight: 600; line-height: 1.4; }
.game-card .gc-play {
  margin-top: auto;
  color: var(--accent-soft);
  font-weight: 800;
  font-size: 13px;
  display: flex; align-items: center; gap: 5px;
}
.game-card .gc-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10.5px; font-weight: 800;
  background: var(--gold-dim); color: var(--gold);
  padding: 2px 9px; border-radius: var(--radius-pill);
}

.home-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13.5px;
}
.lb-row:nth-child(odd) { background: var(--surface-light); }
.lb-rank { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-elev); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.lb-rank.r1 { background: var(--gold-dim); color: var(--gold); }
.lb-rank.r2 { background: rgba(192, 197, 206, 0.16); color: #c0c5ce; }
.lb-rank.r3 { background: rgba(205, 127, 50, 0.18); color: #e8955c; }
.lb-user { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-game { color: var(--text-faint); font-size: 12px; }
.lb-val { margin-left: auto; font-weight: 800; color: var(--green); white-space: nowrap; }
.lb-val.mult { color: var(--accent-soft); }

/* ---------------------------------------------------------------------------
   Auth pages
   --------------------------------------------------------------------------- */

.auth-wrap { max-width: 420px; margin: 4vh auto 0; width: 100%; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 25px; }
.auth-card .sub { color: var(--text-muted); font-weight: 600; margin-bottom: 20px; font-size: 14px; }
.auth-alt { text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 14px; font-weight: 700; }

/* ---------------------------------------------------------------------------
   Profile / fairness
   --------------------------------------------------------------------------- */

.seed-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.seed-row .sr-label { width: 110px; font-size: 12px; font-weight: 800; color: var(--text-muted); flex-shrink: 0; }
.seed-row .sr-value { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--text-dim); word-break: break-all; }

.verify-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------------------------------------------------------------------
   Admin
   --------------------------------------------------------------------------- */

.admin-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 24px; }
.admin-badge {
  background: var(--accent-dim); color: var(--accent-soft);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: 12px; font-weight: 800;
}

.admin-user-row { cursor: pointer; }
.admin-user-row:hover td { background: var(--accent-dim) !important; }

.game-config-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.game-config-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.game-config-card h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.cfg-row:last-of-type { border-bottom: none; }
.cfg-row label { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.cfg-row .input, .cfg-row .select { width: 150px; padding: 6px 10px; font-size: 13px; }
.cfg-row .switch { transform: scale(0.9); }

/* The class sits on the <textarea> ITSELF (not a wrapper). */
textarea.array-editor {
  width: 100%; min-height: 68px; resize: vertical;
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius); color: var(--text-dim);
  font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 8px 10px;
}

.inline-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-fields .field { margin-bottom: 0; flex: 1; min-width: 130px; }

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.kv-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }

@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .home-cols { grid-template-columns: 1fr; }
  .verify-row { grid-template-columns: 1fr; }
  .crash-mult { font-size: 34px; }
  .limbo-result { font-size: 52px; }
  .dice-result { font-size: 44px; }
}
