/* LegendMC Casino */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=Press+Start+2P&display=swap');

:root {
  --bg-0: #0c0a08;
  --bg-1: #16120c;
  --bg-2: #1f1a12;
  --bg-3: #2c2418;
  --line: #4a3d28;
  --line-bright: #7a6238;

  --text: #f4ead4;
  --text-dim: #c4b08a;
  --text-mute: #8f7d5c;

  --gold: #e8b430;
  --gold-bright: #ffd76a;
  --gold-deep: #a87212;
  --gold-shadow: rgba(232, 180, 48, 0.28);

  --green: #5cd97a;
  --red: #f25555;
  --blue: #6eb5ff;

  --accent: var(--gold);
  --accent-bright: var(--gold-bright);

  --radius: 8px;
  --radius-sm: 5px;
  --shadow-1: 0 12px 40px rgba(0, 0, 0, 0.65);
  --shadow-2: 0 4px 0 rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-0);
  background-image:
    linear-gradient(180deg, rgba(232, 180, 48, 0.04) 0%, transparent 35%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.03) 2px,
      rgba(0, 0, 0, 0.03) 4px
    );
  background-attachment: fixed;
}

a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 0.6em 0; font-weight: 700; letter-spacing: 0.01em; }

.pixel { font-family: 'Press Start 2P', monospace; letter-spacing: 0.04em; font-weight: 400; }

/* Top bar -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 28px;
  background: linear-gradient(180deg, rgba(10, 8, 5, 0.95), rgba(10, 8, 5, 0.85));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar > .brand        { justify-self: start; }
.topbar > .nav-links    { justify-self: center; }
.topbar > .topbar-right { justify-self: end; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: block;
  box-shadow: 0 0 0 1px var(--line), 0 4px 14px rgba(245, 195, 74, 0.25);
  transition: transform 0.2s ease;
}
.brand:hover img { transform: rotate(-6deg) scale(1.05); }

.nav-links { display: flex; gap: 22px; align-items: center; }

@media (max-width: 980px) {
  .topbar { padding: 10px 16px; }
  .nav-links { gap: 14px; font-size: 13px; }
  #userName { display: none; }
}
@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .nav-links { justify-self: end !important; gap: 10px; font-size: 12px; }
  .topbar-right .balance-pill .label { display: none; }
}

.nav-links a {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--gold-bright); border-bottom-color: var(--gold); }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.balance-pill img { width: 22px; height: 22px; image-rendering: pixelated; }
.balance-pill .label { color: var(--text-dim); font-weight: 500; }
.balance-pill.bump {
  animation: balanceBump 0.5s ease;
  box-shadow: 0 0 0 3px var(--gold-shadow);
}
@keyframes balanceBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Buttons -------------------------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--line-bright);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--bg-3); border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--gold);
  border-color: var(--gold-bright);
  border-bottom-width: 3px;
  color: #1a1204;
  box-shadow: var(--shadow-2);
  text-transform: none;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  background: var(--gold-bright);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

.btn-success {
  background: linear-gradient(180deg, #6ee7a4, #22c55e);
  border-color: #86efac;
  color: #052e16;
}

.btn-danger {
  background: linear-gradient(180deg, #f87171, #ef4444);
  border-color: #fca5a5;
  color: #2a0a0a;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); border-color: var(--line-bright); background: var(--bg-2); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* Layout --------------------------------------------------------------- */

.page { max-width: 1200px; margin: 0 auto; padding: 28px 28px 80px; }
.page-narrow { max-width: 720px; }

.card {
  background: var(--bg-1);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-2);
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 18px; display: flex; align-items: center; gap: 10px; }

.muted { color: var(--text-dim); }
.tiny  { font-size: 12px; color: var(--text-mute); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 12px;
}

.kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.headline {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px 0;
}

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

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-page {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
}

@media (min-width: 860px) {
  .auth-page {
    grid-template-columns: 1fr minmax(300px, 400px);
    gap: 56px;
  }
}

.auth-side {
  display: none;
  padding: 8px 0;
}

@media (min-width: 860px) {
  .auth-side { display: block; }
}

.auth-side .headline {
  font-size: 2.5rem;
  color: var(--text);
}

.auth-side .lead {
  font-size: 1.05rem;
  color: var(--text-dim);
  margin: 0 0 28px 0;
  max-width: 36ch;
}

.auth-perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-perks li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.45;
}

.auth-perks li::before {
  content: '◆';
  color: var(--gold);
  font-size: 10px;
  margin-top: 5px;
  flex-shrink: 0;
}

.auth-card {
  width: 100%;
  background: var(--bg-1);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-1);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  text-align: center;
}
.auth-logo img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 2px solid var(--line-bright);
  image-rendering: pixelated;
}
.auth-logo .pixel {
  font-size: 11px;
  color: var(--gold-bright);
  line-height: 1.6;
}
.auth-logo .tagline {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
  max-width: 28ch;
}

.auth-tabs {
  display: flex;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tabs button {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-tabs button.active { background: var(--gold); color: #2b1d05; }

label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 500; }

input[type='text'], input[type='password'], input[type='number'], select {
  width: 100%;
  background: var(--bg-0);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-shadow); }

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10' fill='none'><path d='M1 1l6 7 6-7' stroke='%23c9b98c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  cursor: pointer;
  text-overflow: ellipsis;
}
select:hover { border-color: var(--line-bright); }
select option { background: var(--bg-1); color: var(--text); padding: 6px; }

.field { margin-bottom: 14px; }

.error-msg {
  margin-top: 12px; padding: 10px 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fecaca;
  border-radius: var(--radius-sm);
  font-size: 13px; display: none;
}
.error-msg.show { display: block; animation: shake 0.4s ease; }

.success-msg {
  margin-top: 12px; padding: 10px 12px;
  background: rgba(74, 222, 128, 0.10);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #bbf7d0;
  border-radius: var(--radius-sm);
  font-size: 13px; display: none;
}
.success-msg.show { display: block; animation: slideUp 0.3s ease; }

.info-msg {
  margin-top: 12px; padding: 10px 12px;
  background: rgba(96, 165, 250, 0.10);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #bfdbfe;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

input[type='email'] {
  width: 100%;
  background: var(--bg-0);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type='email']:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-shadow); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Lobby ---------------------------------------------------------------- */

.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; margin-bottom: 28px; }
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; } }

.hero-card {
  padding: 28px;
  background: var(--bg-1);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.hero-card.hero-main {
  border-left: 4px solid var(--gold);
}

.hero-logo {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 88px;
  height: 88px;
  opacity: 0.9;
  image-rendering: pixelated;
  pointer-events: none;
}

.hero-player {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.hero-player-text h1 {
  margin-bottom: 8px;
  max-width: none;
}

.mc-head {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 2px solid var(--line-bright);
  background: var(--bg-0);
  image-rendering: pixelated;
  flex-shrink: 0;
}

.topbar-head {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--line);
  image-rendering: pixelated;
  vertical-align: middle;
}

.guide-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.hero h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.02em;
  max-width: 14ch;
}
.hero p {
  color: var(--text-dim);
  margin: 0 0 18px 0;
  max-width: 42ch;
  font-size: 15px;
}

.balance-card { display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.balance-card .label { color: var(--text-dim); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.balance-card .value-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 6px; }
.balance-card .value-row img { width: 36px; height: 36px; image-rendering: pixelated; }
.balance-card .value { font-size: 28px; font-weight: 800; }
.balance-card .breakdown { color: var(--text-dim); font-size: 14px; }
.balance-card .actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 880px) { .game-grid { grid-template-columns: 1fr; } }

.game-card {
  display: block;
  position: relative;
  padding: 20px 20px 22px;
  background: var(--bg-1);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.game-card:hover {
  border-color: var(--gold);
  background: var(--bg-2);
  text-decoration: none;
}
.game-card h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.game-card p {
  margin: 0;
  color: var(--text-mute);
  font-size: 14px;
  line-height: 1.4;
}
.game-card .corner {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-transform: uppercase;
  background: var(--bg-0);
  border: 1px solid var(--line-bright);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Game shell ----------------------------------------------------------- */

.game-shell { display: grid; grid-template-columns: 280px 1fr; gap: 22px; align-items: start; }
@media (max-width: 980px) { .game-shell { grid-template-columns: 1fr; } }

.bet-panel { padding: 20px; }
.bet-panel h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: var(--gold-bright);
  margin-bottom: 12px;
  letter-spacing: 0.08em;
}

.bet-row { display: flex; gap: 6px; margin-bottom: 8px; }
.bet-row .btn { flex: 1; padding: 7px 0; font-size: 12px; font-weight: 600; }

.stat-row {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.stat-row:last-of-type { border-bottom: 0; }
.stat-row .k { color: var(--text-dim); }
.stat-row .v { font-weight: 600; }
.stat-row .v.gold { color: var(--gold-bright); }

.mine-counter {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.mine-counter img { width: 26px; height: 26px; image-rendering: pixelated; }
.mine-counter .text { font-weight: 700; color: #fca5a5; font-size: 14px; }
.mine-counter .sub { color: var(--text-dim); font-size: 12px; }

.game-board { padding: 22px; min-height: 480px; position: relative; overflow: hidden; }

/* Blackjack ----------------------------------------------------------- */

.bj-table { display: flex; flex-direction: column; gap: 24px; align-items: center; padding: 16px; position: relative; }
.hand { display: flex; align-items: center; gap: 18px; }
.hand-info { text-align: center; min-width: 140px; }
.hand-info .label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.hand-info .total {
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  color: var(--gold-bright);
  margin-top: 6px;
  transition: transform 0.2s ease;
}
.hand-info .total.pop { animation: totalPop 0.4s ease; }
@keyframes totalPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); color: #ffe07a; }
  100% { transform: scale(1); }
}

.cards { display: flex; gap: 8px; perspective: 800px; min-height: 100px; }

.card-face {
  width: 70px; height: 100px;
  background: #fff;
  color: #111;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  position: relative;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  border: 1px solid #ddd;
  animation: cardDeal 0.55s ease backwards;
  transform-style: preserve-3d;
}
.card-face.red { color: #e11d48; }
.card-face.back {
  background: linear-gradient(135deg, #c98a1f, #5a3a0c);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
}
.card-face .corner-tl, .card-face .corner-br {
  position: absolute; font-size: 11px; font-weight: 600;
}
.card-face .corner-tl { top: 5px; left: 6px; }
.card-face .corner-br { bottom: 5px; right: 6px; transform: rotate(180deg); }
.card-face .pip { font-size: 22px; }

@keyframes cardDeal {
  from { opacity: 0; transform: translateY(-24px) rotate(-10deg) scale(0.92); filter: brightness(0.7); }
  to   { opacity: 1; transform: translateY(0) rotate(0) scale(1); filter: brightness(1); }
}
.card-face.flip { animation: cardFlip 0.68s cubic-bezier(0.34, 0.72, 0.42, 1); }
@keyframes cardFlip {
  0%   { transform: rotateY(180deg); opacity: 0.35; filter: brightness(0.75); }
  100% { transform: rotateY(0);      opacity: 1; filter: brightness(1); }
}

.action-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.result-banner {
  text-align: center;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  animation: bannerIn 0.4s ease;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.result-banner.win  { background: rgba(74, 222, 128, 0.14); color: #bbf7d0; border: 1px solid rgba(74, 222, 128, 0.45); }
.result-banner.lose { background: rgba(239, 68, 68, 0.14);  color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.45); }
.result-banner.push { background: rgba(96, 165, 250, 0.14); color: #bfdbfe; border: 1px solid rgba(96, 165, 250, 0.45); }

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

.mines-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}

.tile {
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, #2c2316, #1c1610);
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.tile img { width: 70%; height: 70%; image-rendering: pixelated; pointer-events: none; }
.tile:hover:not(:disabled) {
  background: linear-gradient(180deg, #3a2d18, #25190f);
  box-shadow: 0 0 0 2px var(--gold-shadow);
  transform: translateY(-1px);
}
.tile:active:not(:disabled) { transform: translateY(1px); }

.tile.gem {
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.18), rgba(34, 197, 94, 0.08));
  border-color: rgba(74, 222, 128, 0.5);
  cursor: default;
  animation: gemPop 0.4s ease;
}
@keyframes gemPop {
  0%   { transform: scale(0.6) rotate(-12deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(4deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.tile.mine {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.20), rgba(127, 29, 29, 0.10));
  border-color: rgba(239, 68, 68, 0.5);
  cursor: default;
  animation: minePop 0.5s ease;
}
@keyframes minePop {
  0%   { transform: scale(0.5); opacity: 0; }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}
.tile.mine.exploded { animation: mineExplode 0.6s ease; }
@keyframes mineExplode {
  0%   { transform: scale(0.5); }
  20%  { transform: scale(1.6) rotate(-8deg); filter: brightness(2); }
  60%  { transform: scale(0.9) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.tile.disabled { opacity: 0.55; cursor: not-allowed; }

/* Big explosion overlay */
.fx-explosion {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 5;
}
.fx-explosion::before {
  content: '';
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 60, 0.85) 0%, rgba(239, 68, 68, 0.6) 35%, transparent 70%);
  animation: blast 0.8s ease forwards;
}
@keyframes blast {
  0%   { transform: scale(0.1); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}
.fx-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 4; animation: flash 0.4s ease forwards; }
@keyframes flash {
  0%   { opacity: 0; }
  10%  { opacity: 0.85; }
  100% { opacity: 0; }
}
.shake { animation: hardShake 0.55s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes hardShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 0, 0); }
  40%, 60% { transform: translate3d(7px, 0, 0); }
}

/* Stake-style win popup on game boards */
.game-win-popup {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 8;
}
.game-win-popup .gwp-inner {
  min-width: 140px;
  padding: 16px 20px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1a3d28 0%, #0f2618 100%);
  border: 2px solid #4ade80;
  box-shadow:
    0 0 0 4px rgba(74, 222, 128, 0.15),
    0 12px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.22, 0.85, 0.32, 1), opacity 0.35s ease;
}
.game-win-popup.show .gwp-inner {
  transform: scale(1);
  opacity: 1;
}
.game-win-popup .gwp-mult {
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  color: #4ade80;
  line-height: 1.4;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}
.game-win-popup .gwp-line {
  height: 1px;
  margin: 10px 8px;
  background: linear-gradient(90deg, transparent, rgba(74, 222, 128, 0.5), transparent);
}
.game-win-popup .gwp-payout {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #d1fae5;
  line-height: 1.5;
}
.game-win-popup .gwp-sub {
  margin-top: 8px;
  font-size: 11px;
  color: #86efac;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Sparkles for wins */
.fx-sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.spark {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--gold-bright);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--gold-bright);
  animation: sparkRise 1.1s ease forwards;
}
@keyframes sparkRise {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-220px) scale(0.2); opacity: 0; }
}

/* Dragon Tower --------------------------------------------------------- */

.game-board.tower-board {
  min-height: min(640px, calc(100vh - 140px));
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.tower-board {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: min(600px, calc(100vh - 160px));
  overflow: hidden;
}

.tower-scene {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  min-height: 520px;
  overflow-y: auto;
  background-color: #0a0810;
  background-image: url('/assets/tower-bg.svg');
  background-size: cover;
  background-position: center 30%;
}

.tower-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 4, 8, 0.35) 0%, rgba(5, 4, 8, 0.15) 40%, rgba(5, 4, 8, 0.55) 100%);
  pointer-events: none;
}

.tower-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(520px, 96%);
  padding: 14px 12px 12px;
  border: 2px solid #4a4238;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(28, 24, 20, 0.92), rgba(14, 12, 10, 0.95));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.55);
}

.tower {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  max-width: 100%;
  margin: 0 auto;
}

.tower-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-1);
}

.tower-bar .bar-left,
.tower-bar .bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tower-bar .bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-0);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tower-bar .bar-btn:hover,
.tower-bar .bar-btn.active {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: var(--bg-2);
}

.tower-bar .bar-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.tower-live-stats {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  width: min(300px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 14, 10, 0.97), rgba(10, 8, 6, 0.98));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.tower-live-stats.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.tower-live-stats .ls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.tower-live-stats .ls-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tower-live-stats .ls-head h3 svg {
  width: 16px;
  height: 16px;
  fill: var(--gold);
}

.tower-live-stats .ls-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-mute);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.tower-live-stats .ls-close:hover { color: var(--text); background: var(--bg-2); }

.tower-live-stats .ls-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.tower-live-stats .ls-filter select {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
}

.tower-live-stats .ls-filter .ls-refresh {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-0);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}

.tower-live-stats .ls-filter .ls-refresh:hover { border-color: var(--gold); color: var(--gold); }

.tower-live-stats .ls-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px;
}

.tower-live-stats .ls-metric {
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-0);
  border: 1px solid var(--line);
}

.tower-live-stats .ls-metric .k {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.tower-live-stats .ls-metric .v {
  font-size: 16px;
  font-weight: 700;
}

.tower-live-stats .ls-metric .v.pos { color: #86efac; }
.tower-live-stats .ls-metric .v.neg { color: #fca5a5; }
.tower-live-stats .ls-metric .v.win-count { color: #86efac; }
.tower-live-stats .ls-metric .v.lose-count { color: #fca5a5; }

.tower-live-stats .ls-feed {
  flex: 1;
  min-height: 120px;
  max-height: 220px;
  overflow-y: auto;
  padding: 0 10px 12px;
}

.tower-live-stats .ls-feed .ls-empty {
  padding: 24px 8px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}

.tower-live-stats .ls-feed .ls-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.tower-live-stats .ls-feed .ls-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
}

.tower-live-stats .ls-feed .ls-row .dot.win { background: #4ade80; }
.tower-live-stats .ls-feed .ls-row .dot.lose { background: #ef4444; }

.tower-live-stats .ls-feed .ls-row .meta { color: var(--text-mute); font-size: 11px; }
.tower-live-stats .ls-feed .ls-row .delta { font-weight: 700; text-align: right; }
.tower-live-stats .ls-feed .ls-row .delta.pos { color: #86efac; }
.tower-live-stats .ls-feed .ls-row .delta.neg { color: #fca5a5; }

@media (max-width: 980px) {
  .tower-live-stats {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: var(--radius) var(--radius) 0 0;
    transform: translateY(100%);
  }
  .tower-live-stats.open { transform: translateY(0); }
}
.tower-row { display: flex; gap: 6px; align-items: center; }
.tower-row .row-label {
  width: 36px;
  flex-shrink: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  line-height: 1.4;
  color: var(--text-mute);
  text-align: right;
  padding-right: 2px;
}
.tower-row .row-mult {
  width: 56px;
  flex-shrink: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  line-height: 1.4;
  color: var(--gold-bright);
  text-align: left;
  padding-left: 2px;
  opacity: 0.7;
}
.tower-row .row-tiles {
  display: grid;
  flex: 1;
  gap: 6px;
  min-width: 0;
  max-width: 340px;
}

.tower-tile {
  height: 44px;
  min-height: 44px;
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  background: linear-gradient(180deg, #2c2316, #1c1610);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: grid;
  place-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  position: relative;
  overflow: hidden;
}
.tower-frame[data-tiles="2"] .tower-tile { height: 52px; min-height: 52px; }
.tower-frame[data-tiles="3"] .tower-tile { height: 48px; min-height: 48px; }
.tower-frame[data-tiles="4"] .tower-tile { height: 44px; min-height: 44px; }
.tower-tile img {
  width: auto;
  height: auto;
  max-width: 28px;
  max-height: 28px;
  image-rendering: pixelated;
  pointer-events: none;
  object-fit: contain;
}
.tower-tile.picked .egg-icon {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  pointer-events: none;
}
.tower-frame[data-tiles="4"] .tower-tile img { max-width: 24px; max-height: 24px; }
.tower-frame[data-tiles="3"] .tower-tile img { max-width: 26px; max-height: 26px; }
.tower-frame[data-tiles="2"] .tower-tile img { max-width: 30px; max-height: 30px; }
.tower-tile.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-shadow); animation: rowPulse 1.6s ease-in-out infinite; }
@keyframes rowPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold-shadow); }
  50%      { box-shadow: 0 0 0 4px rgba(255, 224, 122, 0.55); }
}
.tower-tile.locked { opacity: 0.45; cursor: not-allowed; }
.tower-tile.egg     { background: linear-gradient(180deg, rgba(74,222,128,0.2), rgba(34,197,94,0.08)); border-color: rgba(74,222,128,0.5); animation: gemPop 0.4s ease; }
.tower-tile.dragon  { background: linear-gradient(180deg, rgba(239,68,68,0.2), rgba(127,29,29,0.1)); border-color: rgba(239,68,68,0.5); animation: minePop 0.5s ease; }
.tower-tile:hover:not(.locked):not(.egg):not(.dragon) {
  background: linear-gradient(180deg, #3a2d18, #25190f);
  transform: translateY(-1px);
}

/* Cashout -------------------------------------------------------------- */

.payout-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 14px 0;
}
.payout-preview img { width: 44px; height: 44px; image-rendering: pixelated; }
.payout-preview .pp-text { font-size: 18px; font-weight: 700; }
.payout-preview .pp-sub  { color: var(--text-dim); font-size: 13px; }

.payout-list { list-style: none; margin: 0; padding: 0; }
.payout-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}
.payout-list .status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(245, 195, 74, 0.12);
  color: var(--gold-bright);
  border: 1px solid rgba(245, 195, 74, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Info panels (how to play) ------------------------------------------- */

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 720px) { .info-grid { grid-template-columns: 1fr; } }

.info-tile {
  padding: 14px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  position: relative;
  min-height: 80px;
}
.info-tile .num {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--gold-bright);
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.info-tile p { margin: 0; font-size: 13px; color: var(--text-dim); position: relative; z-index: 1; }

/* Page intro on game pages */
.game-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.game-header h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--gold-bright);
  margin: 0;
}
.game-header .tag { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

/* Floating coins (cashout) */
.coin {
  position: absolute;
  width: 22px; height: 22px;
  pointer-events: none;
  z-index: 6;
  animation: coinFly 1.4s ease forwards;
}
@keyframes coinFly {
  0%   { transform: translateY(20px) scale(0.8) rotate(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(-260px) scale(1) rotate(360deg); opacity: 0; }
}

/* Options dropdown (lives at the bottom of each game's bet panel) */
.options-drop {
  margin-top: 14px;
  padding: 10px 14px 12px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}
.options-drop[open] { border-color: var(--line-bright); }

.options-drop summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  list-style: none;
  padding: 4px 0;
}
.options-drop summary::-webkit-details-marker { display: none; }
.options-drop summary::after {
  content: '';
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s ease;
}
.options-drop[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.options-drop summary:hover { color: var(--text); }

.opt-icon {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  background: rgba(245, 195, 74, 0.1);
  border: 1px solid rgba(245, 195, 74, 0.4);
  padding: 3px 6px;
  border-radius: 4px;
}
.opt-title { font-family: inherit; font-weight: 700; }

.opt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 4px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.opt-row + .opt-row { border-top: 1px dashed var(--line); }
.opt-row span { user-select: none; }

.opt-row input[type="checkbox"] {
  width: 38px; height: 22px;
  appearance: none; -webkit-appearance: none;
  background: var(--bg-3);
  border: 1px solid var(--line-bright);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  margin: 0;
  outline: none;
  flex-shrink: 0;
}
.opt-row input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}
.opt-row input[type="checkbox"]:checked {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold-bright);
}
.opt-row input[type="checkbox"]:checked::before {
  transform: translateX(16px);
  background: #2b1d05;
}
.opt-row input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px var(--gold-shadow);
}

.opt-note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-mute);
}

/* Animation kill switch. Triggered by the Options panel via body.no-anim. */
body.no-anim *, body.no-anim *::before, body.no-anim *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  transition-delay: 0ms !important;
}

/* Toast notifications (replace the browser alert popup). */

.active-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 3, 8, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.active-game-overlay.show { opacity: 1; }
.active-game-card {
  width: min(420px, 100%);
  padding: 24px 22px 20px;
  border-radius: 12px;
  border: 1px solid var(--line-bright);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  text-align: center;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.22s ease;
}
.active-game-overlay.show .active-game-card {
  transform: translateY(0) scale(1);
}
.active-game-card .ag-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
  color: #1a1408;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 0 0 3px var(--gold-shadow);
}
.active-game-card h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  color: var(--gold-bright);
}
.active-game-card p {
  margin: 0 0 18px;
  color: var(--text-mute);
  font-size: 14px;
  line-height: 1.5;
}
.active-game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.active-game-actions .btn { min-width: 120px; }

.toast-host {
  position: fixed;
  top: 78px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100% - 44px);
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  min-width: 240px;
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }

.toast-error   { border-left-color: var(--red);   color: #fecaca; background: linear-gradient(180deg, rgba(239,68,68,0.12), var(--bg-1)); }
.toast-success { border-left-color: var(--green); color: #bbf7d0; background: linear-gradient(180deg, rgba(74,222,128,0.10), var(--bg-1)); }
.toast-info    { border-left-color: var(--gold);  color: var(--text); }

/* Stats page */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 980px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
  padding: 18px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat-card .stat-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.stat-card .stat-value.pos { color: #86efac; }
.stat-card .stat-value.neg { color: #fca5a5; }
.stat-card .stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.chart-wrap {
  position: relative;
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.chart-wrap svg {
  width: 100%;
  height: 260px;
  display: block;
}
.chart-wrap .empty {
  display: grid;
  place-items: center;
  height: 220px;
  color: var(--text-mute);
  font-size: 14px;
}

.game-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 720px) { .game-breakdown { grid-template-columns: 1fr; } }

.gb-card {
  padding: 16px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.gb-card .gb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.gb-card .gb-head img { width: 28px; height: 28px; image-rendering: pixelated; }
.gb-card .gb-head .name { font-weight: 700; }
.gb-card .gb-row {
  display: flex; justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  color: var(--text-dim);
}
.gb-card .gb-row .v { color: var(--text); font-weight: 600; }
.gb-card .gb-row .v.pos { color: #86efac; }
.gb-card .gb-row .v.neg { color: #fca5a5; }

.history-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 360px; overflow-y: auto;
}
.history-list li {
  display: grid;
  grid-template-columns: 16px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}
.history-list .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-mute); }
.history-list .dot.win  { background: #4ade80; }
.history-list .dot.lose { background: #ef4444; }
.history-list .dot.push { background: #60a5fa; }
.history-list .name { color: var(--text); font-weight: 600; }
.history-list .meta { color: var(--text-dim); font-size: 12px; }
.history-list .delta { font-weight: 700; font-family: 'Press Start 2P', monospace; font-size: 11px; }
.history-list .delta.pos { color: #86efac; }
.history-list .delta.neg { color: #fca5a5; }

.tabs {
  display: inline-flex;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.tabs button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 12px;
  transition: background 0.15s ease, color 0.15s ease;
}
.tabs button.active { background: var(--gold); color: #2b1d05; }
.tabs button:hover:not(.active) { color: var(--text); }

/* ----------------------------------------------------------------------
   Provably Fair page
---------------------------------------------------------------------- */

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.seed-box {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
  color: var(--text);
}

.seed-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.seed-history li {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
.seed-history .sh-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}
.seed-history .sh-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 4px 0;
  border-top: 1px dashed var(--line);
}
.seed-history .sh-row .k {
  color: var(--text-dim);
  flex: 0 0 130px;
  font-size: 12px;
  padding-top: 1px;
}
.seed-history .sh-row code {
  flex: 1;
  word-break: break-all;
}

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

.admin-page .game-header img { display: none; }
.admin-page .page { max-width: 1200px; }

.admin-shell { display: flex; flex-direction: column; gap: 14px; }
.admin-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-top h1 { margin: 0; font-size: 1.5rem; }
.admin-sub { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.admin-tabs button {
  border: none;
  background: transparent;
  color: var(--text-mute);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.admin-tabs button.active {
  background: var(--gold-shadow);
  color: var(--gold-bright);
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.admin-stat {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-stat .k { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-stat .v { font-size: 1.4rem; font-weight: 700; color: var(--gold-bright); }

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.live-games-host { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.live-game-card {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.live-game-card .lg-head { margin-bottom: 10px; }
.live-dot {
  font-size: 10px;
  text-transform: uppercase;
  color: #86efac;
  margin-left: 8px;
  font-weight: 700;
}
.live-game-card .lg-body { margin-bottom: 10px; }

.adm-mines-grid {
  display: grid;
  grid-template-columns: repeat(5, 36px);
  gap: 4px;
  margin: 8px 0;
}
.adm-tile {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--line);
}
.adm-tile.hidden,
.adm-tile.safe-hidden { background: #1a1610; color: var(--text-mute); }
.adm-tile.gem { background: rgba(74, 222, 128, 0.2); border-color: rgba(74, 222, 128, 0.5); color: #86efac; }
.adm-tile.mine { background: rgba(239, 68, 68, 0.35); border-color: rgba(239, 68, 68, 0.65); color: #fca5a5; font-weight: 800; }
.adm-tile.mine-hidden {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.25);
}
.adm-tile.sm { width: 28px; height: 28px; font-size: 9px; }
.adm-tile.picked { box-shadow: 0 0 0 2px var(--gold); }

.adm-floor {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  padding: 4px 6px;
  border-radius: 6px;
}
.adm-floor.current { background: rgba(255, 215, 100, 0.08); }
.adm-floor-label { width: 28px; font-size: 10px; color: var(--text-mute); font-family: 'Press Start 2P', monospace; }
.adm-floor-tiles { display: flex; gap: 4px; flex-wrap: wrap; }
.adm-floor-mult { margin-left: auto; font-size: 11px; color: var(--gold); }

.adm-bj { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.adm-card {
  display: inline-block;
  background: #fff;
  color: #111;
  border-radius: 4px;
  padding: 4px 8px;
  margin: 2px;
  font-size: 12px;
  font-weight: 700;
}
.adm-json {
  font-size: 11px;
  max-height: 200px;
  overflow: auto;
  background: #0a0810;
  padding: 8px;
  border-radius: 8px;
}

.ud-card.ud-full { grid-column: 1 / -1; }
.audit-list.compact li { padding: 8px 0; }

.admin-user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.admin-user-row .name { font-weight: 600; }
.admin-user-row .meta { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.ip-ban-list,
.ip-history-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.ip-ban-row,
.ip-history-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
}
.ip-ban-row .name code,
.ip-history-list li span:first-child {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}
.ip-history-list li { font-size: 12px; }

.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 2px;
}
.role-badge.admin   { background: rgba(255, 215, 100, 0.18); color: #ffd866; border: 1px solid rgba(255, 215, 100, 0.35); }
.role-badge.owner   { background: rgba(255, 153, 0, 0.22);  color: #ffa64d; border: 1px solid rgba(255, 153, 0, 0.4); }
.role-badge.banned  { background: rgba(252, 165, 165, 0.18); color: #fca5a5; border: 1px solid rgba(252, 165, 165, 0.35); }

.user-detail .ud-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}
.user-detail .ud-name { font-weight: 700; font-size: 18px; }
.user-detail .ud-balance {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--gold-bright);
  font-weight: 700;
}
.user-detail .ud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.user-detail .ud-card {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.user-detail .ud-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}

.ip-list { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow: auto; }
.ip-list li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.ip-list li:last-child { border-bottom: 0; }

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audit-list li {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

/* Status colours for payouts in the admin view */
.payout-list .status { text-transform: capitalize; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--line); }
.payout-list .status:where(:not(:empty)) { color: var(--text-dim); }

/* Options volume sliders */
.opt-row.opt-slider {
  display: grid;
  grid-template-columns: 1fr auto 44px;
  gap: 8px;
  align-items: center;
}
.opt-row.opt-slider input[type="range"] { width: 100%; accent-color: var(--gold); }
.opt-pct { font-size: 11px; color: var(--text-mute); text-align: right; }

/* Floating live stats (site-wide) */
.float-ls-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 900;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line-bright);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  color: var(--gold-bright);
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
}
.float-ls-fab svg { width: 22px; height: 22px; fill: currentColor; }
.float-ls-fab.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-shadow); }

.float-live-stats {
  position: fixed;
  right: 16px;
  bottom: 76px;
  z-index: 901;
  width: min(320px, calc(100vw - 32px));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 14, 10, 0.98), rgba(8, 6, 5, 0.99));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.float-live-stats.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.float-live-stats.dragging { user-select: none; cursor: grabbing; }

.fls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: grab;
  touch-action: none;
}
.fls-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.fls-close {
  width: 28px; height: 28px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-mute); font-size: 18px; cursor: pointer;
}
.fls-close:hover { color: var(--text); background: var(--bg-2); }

.fls-controls {
  display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.fls-controls select { flex: 1; min-width: 0; font-size: 11px; padding: 6px 8px; }
.fls-refresh {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg-0); color: var(--text-dim); cursor: pointer;
}

.fls-metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px;
}
.fls-metric {
  padding: 8px; border-radius: 8px; background: var(--bg-0); border: 1px solid var(--line);
}
.fls-metric .k { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.06em; }
.fls-metric .v { font-size: 15px; font-weight: 700; margin-top: 2px; }
.fls-metric .v.pos { color: #86efac; }
.fls-metric .v.neg { color: #fca5a5; }
.fls-metric .v.win-count { color: #86efac; }
.fls-metric .v.lose-count { color: #fca5a5; }

.fls-feed {
  flex: 1; min-height: 80px; max-height: 200px; overflow-y: auto; padding: 0 10px 12px;
}
.fls-empty { padding: 20px 8px; text-align: center; color: var(--text-mute); font-size: 12px; }
.fls-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 12px;
}
.fls-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-mute); }
.fls-row .dot.win { background: #4ade80; }
.fls-row .dot.lose { background: #ef4444; }
.fls-row .meta { color: var(--text-mute); font-size: 11px; }
.fls-row .delta { font-weight: 700; }
.fls-row .delta.pos { color: #86efac; }
.fls-row .delta.neg { color: #fca5a5; }

/* Dragon Tower mobile + touch */
@media (max-width: 980px) {
  .game-board.tower-board { min-height: min(520px, calc(100vh - 120px)); padding: 12px; }
  .tower-board { min-height: min(480px, calc(100vh - 140px)); }
  .tower-scene { min-height: 400px; padding: 12px 10px; }
  .tower-frame { max-width: min(440px, 100%); padding: 10px 8px; }
  .tower { gap: 5px; }
  .tower-row .row-label { width: 30px; font-size: 7px; }
  .tower-row .row-mult { width: 48px; font-size: 7px; }
  .tower-row .row-tiles { gap: 5px; max-width: 280px; }
  .tower-frame[data-tiles="2"] .tower-tile { height: 44px; min-height: 44px; }
  .tower-frame[data-tiles="3"] .tower-tile { height: 40px; min-height: 40px; }
  .tower-frame[data-tiles="4"] .tower-tile { height: 36px; min-height: 36px; }
  .float-live-stats {
    right: 8px; left: 8px; width: auto; bottom: 72px; max-height: 65vh;
  }
  .float-ls-fab { right: 12px; bottom: 12px; }
}
