:root {
  --bg: #0e1014;
  --bg-elev: #171a21;
  --bg-elev-2: #1f2330;
  --border: #262b38;
  --text: #e8ebf2;
  --text-muted: #8a93a6;
  --accent: #7c5cff;
  --accent-2: #19d3a2;
  --danger: #ff5470;
  --warn: #ffb347;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

h1 { font-size: 28px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 12px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

.muted { color: var(--text-muted); margin: 0; }

.btn-primary, .btn-ghost, .btn-secondary {
  font: inherit;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn-primary:active, .btn-ghost:active, .btn-secondary:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: #6a4cf0; }
.btn-primary:disabled { background: #2a2f3d; color: var(--text-muted); border-color: var(--border); cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-elev-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-elev-2); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(14, 16, 20, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.brand-mark { color: var(--accent); font-size: 20px; }
.brand-name { font-size: 16px; }

.wallet {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
}
.wallet-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.wallet-value { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent-2); }
.wallet-value.flash { animation: flash 0.5s ease; }
@keyframes flash {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); color: var(--warn); }
  100% { transform: scale(1); }
}

.user { display: flex; align-items: center; gap: 4px; }
.user-name { color: var(--text-muted); font-size: 14px; }

/* Game-page topbar back-link */
.back-link {
  margin-right: auto;
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 14px;
}
.back-link:hover { color: var(--text); text-decoration: none; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.gain { border-color: var(--accent-2); }
.toast.loss { border-color: var(--danger); }
