.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.2px;
  transition: transform 0.1s var(--ease), box-shadow 0.15s var(--ease), filter 0.15s var(--ease);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 40%);
  pointer-events: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn-primary {
  background: var(--grad-primary);
  color: #052a18;
  box-shadow: 0 6px 18px rgba(0, 230, 118, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 10px 28px rgba(0, 230, 118, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-bright);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-4);
  border-color: var(--bg-5);
}

.btn-danger {
  background: var(--grad-danger);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(255, 71, 120, 0.35);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-bright);
  background: rgba(45, 74, 100, 0.25);
}

.btn-block {
  width: 100%;
  padding: 16px 18px;
  font-size: 15px;
}

.btn-lg {
  padding: 18px 24px;
  font-size: 16px;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.input-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.input-label .hint {
  color: var(--text-dim);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input-wrap:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.15);
}

.input-wrap input {
  flex: 1;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  width: 100%;
  min-width: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.input-wrap input:disabled {
  opacity: 0.55;
}

.input-wrap .prefix,
.input-wrap .suffix {
  padding: 0 12px;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  height: 100%;
}

.input-wrap .prefix {
  border-right: 1px solid var(--border);
}

.input-wrap .suffix {
  border-left: 1px solid var(--border);
}

.input-wrap .adornment {
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--border);
}

.input-wrap .adornment button {
  padding: 0 12px;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 12px;
  background: transparent;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-wrap .adornment button:hover {
  background: var(--surface);
  color: var(--text);
}

.input-wrap .adornment button + button {
  border-left: 1px solid var(--border);
}

.card {
  background: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.3px;
}

.section-title .accent {
  width: 4px;
  height: 22px;
  background: var(--grad-primary);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.5);
}

.section-title .count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s var(--ease);
}

.stat:hover {
  border-color: var(--border-bright);
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}

.stat-value {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  color: var(--text);
  padding: 14px 22px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  z-index: 1000;
  border: 1px solid var(--border-bright);
  border-left: 3px solid var(--green);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

.tabs {
  display: flex;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: calc(var(--radius) - 4px);
  text-align: center;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.history-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.history-pill {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  transition: transform 0.15s var(--ease);
}

.history-pill:hover {
  transform: translateY(-1px);
}

.history-pill.win {
  background: rgba(0, 230, 118, 0.14);
  color: var(--green-bright);
  box-shadow: inset 0 0 0 1px rgba(0, 230, 118, 0.25);
}

.history-pill.loss {
  background: rgba(255, 71, 120, 0.14);
  color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(255, 71, 120, 0.25);
}

.flash-win {
  animation: flashWin 0.7s var(--ease);
}

.flash-loss {
  animation: flashLoss 0.7s var(--ease);
}

@keyframes flashWin {
  0% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.55); }
  100% { box-shadow: 0 0 0 22px rgba(0, 230, 118, 0); }
}

@keyframes flashLoss {
  0% { box-shadow: 0 0 0 0 rgba(255, 71, 120, 0.55); }
  100% { box-shadow: 0 0 0 22px rgba(255, 71, 120, 0); }
}

.game-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  max-width: 1320px;
  margin: 0 auto;
}

.game-controls {
  background: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: fit-content;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 88px;
}

.game-canvas {
  background: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 560px;
  position: relative;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.game-canvas::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(800px 400px at 50% -10%, rgba(51, 217, 255, 0.06), transparent 60%);
  pointer-events: none;
}

.bet-mode {
  display: flex;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
}

.bet-mode-btn {
  flex: 1;
  padding: 10px 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: calc(var(--radius) - 4px);
  text-align: center;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.bet-mode-btn:hover { color: var(--text); }
.bet-mode-btn.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 1000px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .game-controls {
    position: static;
  }
  .game-canvas {
    min-height: 380px;
    padding: 16px;
  }
}
