/* =========================================
   CHASTER-STYLE, CLEAN LAYOUT – WIDER (Modern polish)
   ========================================= */

:root {
  --surface-main: #1f1d2b;
  --surface-elevated: #272533;
  --surface-soft: #272533;
  --surface-chip: #272533;

  --border-subtle: #36354a;
  --border-soft: #44435a;

  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --accent-soft: rgba(99,102,241,0.22);

  --text: #f9fafb;
  --muted: #9ca3af;
  --muted-soft: #6b7280;

  --danger: #ef4444;
  --danger-soft: rgba(239,68,68,0.18);
  --success: #22c55e;
  --success-soft: rgba(34,197,94,0.18);

  --radius-card: 14px;
  --radius-soft: 10px;
  --radius-pill: 999px;

  --shadow-soft: 0 6px 14px rgba(15,23,42,0.45);
  --shadow-chip: 0 8px 18px rgba(15,23,42,0.6);

  --transition-fast: 0.16s ease-out;

  --focus-ring: 0 0 0 3px rgba(99,102,241,0.22);
}

/* =========================================
   RESET / BASE
   ========================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface-main);
  display: block;
}

/* force light text */
body,
.card,
.game-card-list,
.game-history,
.log-box,
.payout-card {
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

/* slim scrollbars */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--surface-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(75,85,99,0.85);
  border-radius: 999px;
}

/* nicer focus */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 10px;
}

/* =========================================
   APP WRAPPER – WIDER
   ========================================= */

.app {
  width: 100%;
  max-width: 1280px;
  min-width: 0;
  margin: 12px auto 16px;
  padding: 0 10px;
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =========================================
   TOP BAR
   ========================================= */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-chip {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  border: 1px solid rgba(129,140,248,0.9);
  font-size: 20px;
  box-shadow: var(--shadow-chip);
}

h1 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* =========================================
   PILLS
   ========================================= */

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  font-size: 11px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
}
.pill-dot.bad { background: var(--danger); }
.pill-dot.neutral { background: rgba(156,163,175,0.85); }

.pill-label { color: var(--muted); }
.pill-value { font-weight: 600; font-size: 12px; }

/* Bank pill more obvious */
.pill-bank { gap: 8px; }
.pill-bank .pill-value { min-width: 72px; text-align: right; }

.pill-bank.bank-active{
  border-color: rgba(99,102,241,0.65);
  background: rgba(99,102,241,0.10);
  box-shadow: 0 0 0 1px rgba(99,102,241,0.15) inset;
}
.pill-bank.bank-active:hover{
  box-shadow: 0 0 0 1px rgba(99,102,241,0.25) inset, 0 10px 20px rgba(15,23,42,0.35);
  transform: translateY(-1px);
}

/* =========================================
   WARNINGS
   ========================================= */

.warning-text {
  font-size: 11px;
  color: var(--danger);
}

/* =========================================
   MAIN LAYOUT – WIDER SIDEBAR
   ========================================= */

.main-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

/* cards */
.card {
  padding: 10px 12px;
  border-radius: var(--radius-card);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-header h2 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card-header small {
  font-size: 11px;
  color: var(--muted);
}

/* =========================================
   SIDEBAR – GAMES & LIMITS
   ========================================= */

.sidebar-card { min-height: 380px; }

.game-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.game-card-list {
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid transparent;
  background: var(--surface-elevated);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity 0.1s;
  text-align: left;
}

.game-card-list:hover:not(.disabled) {
  border-color: var(--accent-soft);
  background: #2a2c45;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.game-card-list.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-card-list.active {
  border-color: rgba(99,102,241,0.45);
  background: #313458;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.12) inset;
}

.game-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--surface-elevated);
  border: 1px solid rgba(129,140,248,0.9);
}

.game-name { font-weight: 600; font-size: 12px; }
.game-sub  { font-size: 11px; color: var(--muted-soft); }

.game-card-right {
  text-align: right;
  font-size: 10px;
}

.badge {
  align-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  padding: 1px 6px;
  display: inline-flex;
  gap: 4px;
  font-size: 10px;
  margin-bottom: 1px;
  background: #26273d;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
}
.badge-dot.on { background: var(--success); }
.badge-dot.off { background: var(--danger); }

.game-range {
  font-size: 10px;
  color: var(--muted);
}

/* =========================================
   MAIN COLUMN
   ========================================= */

.main-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-card-main { min-height: 380px; }

.panel-placeholder {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 70px 10px;
}

/* header */
.game-panel-header { margin-bottom: 8px; }

.game-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-panel-title .icon {
  font-size: 16px;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
}

.game-panel-title-text span:first-child {
  font-size: 13px;
  font-weight: 600;
}

.game-panel-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* 2-column body */
.game-panel-body {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) 240px;
  gap: 10px;
  align-items: flex-start;
}

/* =========================================
   GP MAIN – game controls
   ========================================= */

.gp-main {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-elevated);
  padding: 10px 11px 12px;
  position: relative;
  overflow: hidden;
}

/* result flash */
.panel-flash-pos::before,
.panel-flash-neg::before {
  content: "";
  position: absolute;
  inset: -40%;
  opacity: 0.24;
  pointer-events: none;
}
.panel-flash-pos::before { background: var(--success-soft); }
.panel-flash-neg::before { background: var(--danger-soft); }

/* =========================================
   STAKE CARD
   ========================================= */

.stake-card {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-soft);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.stake-label-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.stake-title { font-size: 12px; }
.stake-range-text { font-size: 11px; color: var(--muted); }

.stake-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.stake-range { flex: 1; }

.stake-input {
  background: #151827;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  padding: 4px 6px;
  color: var(--text);
  font-size: 12px;
  min-width: 72px;
}
input[type="number"]::placeholder { color: #6b7280; }
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* ---------- MODERN RANGE SLIDER (VISIBLE IN CHROME + FIREFOX) ---------- */
/* Key fix: style the TRACK pseudo-elements, not just input background. */
input[type="range"]{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;           /* gives room for thumb */
  background: transparent; /* important */
  margin: 2px 0 0;
}

/* WebKit track */
input[type="range"]::-webkit-slider-runnable-track{
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08); /* visible track */
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18) inset;
}
/* WebKit thumb */
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #f9fafb;
  border: 2px solid var(--accent-strong);
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
  margin-top: -5px; /* center on 10px track */
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
input[type="range"]:hover::-webkit-slider-thumb{
  transform: scale(1.05);
}
input[type="range"]:focus-visible::-webkit-slider-thumb{
  box-shadow: 0 0 0 4px rgba(99,102,241,0.22), 0 10px 20px rgba(0,0,0,0.35);
}

/* Firefox track */
input[type="range"]::-moz-range-track{
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18) inset;
}
/* Firefox progress (nice “filled” look) */
input[type="range"]::-moz-range-progress{
  height: 10px;
  border-radius: 999px;
  background: rgba(99,102,241,0.55);
}
/* Firefox thumb */
input[type="range"]::-moz-range-thumb{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #f9fafb;
  border: 2px solid var(--accent-strong);
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
input[type="range"]:hover::-moz-range-thumb{
  transform: scale(1.05);
}
input[type="range"]:focus-visible::-moz-range-thumb{
  box-shadow: 0 0 0 4px rgba(99,102,241,0.22), 0 10px 20px rgba(0,0,0,0.35);
}

/* =========================================
   BUTTONS
   ========================================= */

.btn {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.10);
  background: #151827;
  color: var(--text);
  padding: 8px 14px;
  min-height: 40px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity 0.1s;
  white-space: nowrap;
}

.btn .icon { font-size: 13px; }

.btn.primary {
  background: var(--accent-strong);
  border-color: rgba(99,102,241,0.35);
}

.btn.secondary {
  border-color: var(--border-subtle);
  background: #202235;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(255,255,255,0.16);
}

.btn.primary:hover:not(:disabled) {
  background: #5b55f0;
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(15,23,42,0.5);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.btn-tiny {
  padding: 6px 10px;
  min-height: 32px;
  font-size: 12px;
  border-radius: 10px;
  box-shadow: none;
}

.primary-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

/* =========================================
   STATUS LINE
   ========================================= */

.status-line {
  font-size: 12px;
  margin-top: 3px;
  min-height: 18px;
  color: var(--muted);
}

.status-line.status-ok { color: var(--success); font-weight: 500; }
.status-line.status-bad { color: var(--danger); font-weight: 500; }

/* =========================================
   LOGS & HISTORY
   ========================================= */

.log-box {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #202235;
  padding: 6px 8px;
  font-size: 12px;
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
}

.log-line .time { color: var(--muted); font-size: 11px; }
.delta-pos { color: var(--success); }
.delta-neg { color: var(--danger); }

.bottom-log-card { margin-top: 2px; }

.game-history {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #25263a;
  padding: 7px 8px 9px;
  min-height: 170px;
}

.game-history-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* =========================================
   SLOTS – casino reel machine (Chaster colours)
   ========================================= */

.casino-slots {
  margin-bottom: 12px;
}

.casino-slots-frame {
  background: linear-gradient(180deg, #1e1e2e 0%, #15152a 100%);
  border: 3px solid var(--accent);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 0 0 1px rgba(99,102,241,0.2), inset 0 0 40px rgba(0,0,0,0.4);
}

.casino-slots-reels {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.casino-reel {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: #0c0c14;
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.7);
}

.casino-reel-window {
  height: 100%;
  overflow: hidden;
}

.casino-reel-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 28px;
  transition: transform 0.1s linear;
  will-change: transform;
}

.casino-reel-strip.casino-reel-spin {
  transition: none;
  animation: casinoReelSpin 0.06s linear infinite;
}

@keyframes casinoReelSpin {
  from { transform: translateY(0); }
  to { transform: translateY(-56px); }
}

.casino-reel-sym {
  height: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.casino-slots-payline {
  height: 3px;
  background: var(--accent);
  margin: 4px 8px 6px;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(99,102,241,0.5);
}

.casino-slots-result {
  display: flex;
  justify-content: center;
  gap: 4px;
  font-size: 20px;
}

.slot-symbol {
  display: inline-block;
  min-width: 28px;
  text-align: center;
}

.slot-symbol.settle {
  animation: slotSettle 0.25s ease-out;
}

@keyframes slotSettle {
  0% { transform: scale(1.2); }
  70% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

/* =========================================
   CRASH
   ========================================= */

.crash-bar-wrap {
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: #111827;
  padding: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}

.crash-bar {
  height: 12px;
  border-radius: 7px;
  width: 0%;
  background: var(--accent-strong);
  transition: width 0.08s linear;
}

.crash-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

/* =========================================
   ROULETTE – wheel + result (Chaster frame)
   ========================================= */

.casino-roulette {
  margin-bottom: 12px;
}

.casino-roulette-wheel-wrap {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 0 auto 16px;
}

.casino-roulette-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 24px solid #d4af37;
  filter: drop-shadow(0 0 4px rgba(212,175,55,0.9)) drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  z-index: 2;
}

.casino-roulette-wheel {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  transition: transform 4s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.casino-roulette-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.roulette-box {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #26283f;
  padding: 8px 12px;
  margin-bottom: 7px;
}

.roulette-result-pill {
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: #111827;
}

.roulette-result-pill .num {
  font-weight: 600;
  font-size: 15px;
}

.roulette-result-pill .color {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.select {
  background: #151827;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  padding: 5px 7px;
  color: var(--text);
  font-size: 12px;
}

.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.stake-card-compact { margin-top: 4px; }

/* =========================================
   BLACKJACK
   ========================================= */

.bj-hands {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
}

.bj-hand-split { margin-bottom: 4px; }

.bj-hand-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* split labels */
.bj-split-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  margin-right: 4px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border-subtle);
  background: #111827;
}
.bj-split-label.active {
  color: #f9fafb;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: 0 0 0 1px var(--accent-soft);
  font-weight: 600;
}
.bj-split-total { margin-right: 6px; font-size: 11px; color: var(--muted); }
.bj-split-sep { display: inline-block; width: 8px; }

.bj-row-label { font-size: 11px; color: var(--muted); margin-bottom: 2px; }

.bj-hand {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #111827;
  padding: 5px 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 22px;
}

.bj-card {
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  padding: 3px 7px;
  font-size: 12px;
  background: #272941;
}

.bj-card.hidden {
  color: var(--muted);
  border-style: dashed;
  background: #111827;
}

.bj-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
}

.bj-buttons-row .btn {
  min-width: 90px;
  justify-content: center;
}

.bj-btn-main { box-shadow: 0 9px 18px rgba(79,70,229,0.6); }

.bj-total {
  margin-left: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* =========================================
   PAYOUT CARDS
   ========================================= */

.payout-card {
  margin-top: 7px;
  padding: 7px 8px;
  border-radius: 9px;
  background: #23253a;
  border: 1px solid var(--border-subtle);
  font-size: 11px;
}

.payout-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.payout-title { font-size: 11px; font-weight: 600; }
.payout-subtitle { font-size: 10px; color: #9ca3af; }

.payout-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.payout-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e5e7eb;
}

.payout-row span:last-child { font-variant-numeric: tabular-nums; }

.payout-note {
  margin-top: 5px;
  font-size: 10px;
  color: #6b7280;
}

/* =========================================
   BANK UI
   ========================================= */

.bank-banner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.bank-banner-left{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bank-banner-title{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bank-banner-sub{
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 1200px) {
  .app { max-width: 100%; }
}

@media (max-width: 1040px) {
  .main-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar-card { order: 0; }
  .main-column { order: 1; }
}

@media (max-width: 768px) {
  .app {
    margin-top: 8px;
    margin-bottom: 16px;
    padding: 0 10px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-right { align-items: flex-start; }

  .game-panel-body { grid-template-columns: minmax(0, 1fr); }
  .game-history { order: -1; }
}

@media (max-width: 520px) {
  .app { padding: 0 8px; }

  .slots-display { font-size: 26px; }

  .bj-buttons-row .btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .primary-actions-row .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .bank-banner{flex-direction:column;align-items:stretch;}
  .bank-banner .btn{width:100%;}
}

@media (min-width: 1400px) {
  body { font-size: 15px; }
}

/* Blackjack credit – subtle, blends in but still noticeable */
.bj-credit{
  margin-top: 10px;
  text-align: center;
}

/* Subtle bubble */
.bj-credit-bubble{
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;

  /* very subtle tint over your surface palette */
  background:
    linear-gradient(135deg,
      rgba(236, 72, 153, 0.16) 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(39, 37, 51, 0.18) 100%
    ) padding-box,
    rgba(255, 255, 255, 0.10) border-box;

  border: 1px solid transparent;
  box-shadow: 0 8px 18px rgba(0,0,0,0.28);

  line-height: 1.35;
  position: relative;
  overflow: hidden;

  transform: translateY(0);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

/* Subtle sheen */
.bj-credit-bubble::before{
  content:"";
  position:absolute;
  inset:-60% -70%;
  background: radial-gradient(circle at 18% 18%,
    rgba(255,255,255,0.16),
    rgba(255,255,255,0.00) 55%
  );
  opacity: 0.35;
  transform: rotate(12deg);
  pointer-events:none;
}

/* Subtle gray text (not bold) */
.bj-credit-bubble,
.bj-credit-bubble *{
  color: rgba(235,235,245,0.72);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(0,0,0,0.18);
}

.bj-credit-bubble a{
  color: rgba(235,235,245,0.76);
  text-decoration: none;
}

.bj-credit-bubble a:hover{
  color: rgba(235,235,245,0.92);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Hover: gentle lift + *subtle* pink glow */
.bj-credit-bubble:hover{
  transform: translateY(-1px);
  box-shadow:
    0 12px 26px rgba(0,0,0,0.34),
    0 0 0 1px rgba(236, 72, 153, 0.14) inset,
    0 0 14px rgba(236, 72, 153, 0.12);
}

.bj-credit-bubble:hover::before{
  opacity: 0.55;
}

/** Fixes cause im lazy */

/* Universal log styling (Activity log + Game history) */
.log-line{
  color: rgba(235,235,245,0.72) !important;
}

.log-line .time{
  color: rgba(235,235,245,0.50) !important;
}

/* Deltas inherit the line color (no green/red) */
.log-line .delta-pos,
.log-line .delta-neg{
  color: inherit !important;
}

/* =========================================
   ANNOUNCEMENT BAR
   ========================================= */

.announcement-bar {
  width: 100%;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(79, 70, 229, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 10px;
  margin-bottom: 4px;
}

.announcement-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1280px;
  margin: 0 auto;
}

.announcement-bar-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.announcement-bar-content {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}

.announcement-bar-content strong {
  color: var(--text);
}

/* =========================================
   CHANGELOG BUTTON + MODAL
   ========================================= */

.changelog-btn {
  margin-left: 8px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.changelog-btn:hover {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
}

.docs-link {
  margin-left: 8px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
}
.docs-link:hover {
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
}

.changelog-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.changelog-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.changelog-modal-box {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  border-radius: var(--radius-card);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.changelog-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.changelog-modal-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.changelog-modal-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.changelog-modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.changelog-modal-body {
  padding: 14px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
}

.changelog-loading,
.changelog-empty {
  color: var(--muted);
  margin: 0;
}

.changelog-entry {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.changelog-entry:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.changelog-entry-header {
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}

.changelog-version {
  display: inline-block;
  padding: 2px 6px;
  margin-right: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
}

.changelog-date {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

.changelog-entry-body {
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.changelog-entry-body br {
  display: block;
  content: "";
  margin-top: 4px;
}

/* =========================================
   RESPONSIVE – all screen sizes
   ========================================= */

html {
  overflow-x: hidden;
}

@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .main-column {
    order: 2;
    min-width: 0;
  }
  .sidebar-card {
    order: 1;
    min-height: auto;
  }
  .game-panel-body {
    grid-template-columns: 1fr;
  }
  .game-history,
  .log-box {
    min-height: 140px;
  }
  .gp-main {
    min-width: 0;
  }
}

@media (max-width: 768px) {
  .app {
    gap: 10px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
  .top-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .game-panel-body {
    gap: 8px;
  }
  .primary-actions-row {
    gap: 6px;
  }
}

@media (max-width: 640px) {
  .app {
    margin: 8px auto 12px;
    padding: 0 8px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
    gap: 8px;
  }
  .top-left {
    flex: 1 1 auto;
    min-width: 0;
  }
  .top-right {
    flex: 1 1 100%;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
  }
  .pill-row {
    flex-wrap: wrap;
  }
  .pill-bank .pill-value {
    min-width: 56px;
  }
  h1 {
    font-size: 12px;
    letter-spacing: 0.12em;
  }
  .subtitle {
    font-size: 10px;
  }
  .card {
    padding: 10px;
  }
  .game-card-list {
    padding: 10px 12px;
    min-height: 48px;
  }
  .gp-main {
    padding: 10px;
  }
  .stake-card {
    padding: 8px;
  }
  .game-panel-title .icon {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  .btn {
    padding: 10px 14px;
    min-height: 44px;
    font-size: 13px;
  }
  .btn-tiny {
    padding: 6px 10px;
    min-height: 36px;
    font-size: 11px;
  }
  .changelog-btn {
    min-height: 32px;
    padding: 6px 10px;
  }
  .log-box {
    max-height: 180px;
  }
}

@media (max-width: 400px) {
  .top-right {
    flex-direction: column;
    align-items: stretch;
  }
  .pill-row {
    justify-content: flex-start;
  }
  .pill-label {
    font-size: 10px;
  }
  .game-name {
    font-size: 11px;
  }
  .game-range {
    font-size: 9px;
  }
  .announcement-bar-content {
    font-size: 11px;
  }
}