/* v3.10.104: shared runtime theme, contrast protection and responsive containment */
:root {
  --theme-bg: #090507;
  --theme-surface: #190b10;
  --theme-text: #fff7e6;
  --theme-muted: #d8c9a6;
  --theme-primary: #a7192d;
  --theme-accent: #f2ca4d;
}

html, body, .app-shell, .app-main, .page-shell, .player-shell, main,
.auth-screen, .dashboard-screen, .player-dashboard {
  background-color: var(--theme-bg) !important;
  color: var(--theme-text) !important;
}

.sidebar, .app-header, .player-header, .mobile-header, .site-header,
.panel, .card, .modal-card, .auth-card, .dashboard-card, .wallet-card,
.featured-game-card, .compact-game-card, .support-popup-view,
.payment-modal-card, .withdrawal-method-card, .gateway-payment-method {
  background-color: var(--theme-surface) !important;
  color: var(--theme-text) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 26%, transparent) !important;
}

h1, h2, h3, h4, h5, strong, label, th, td, .brand-name, .sidebar-system-name {
  color: var(--theme-text) !important;
}
p, small, .muted, .helper, .card-description, .game-description, .field small {
  color: var(--theme-muted) !important;
}
a { color: var(--theme-accent); }
.button-primary, .primary-button, .nav-button.active, .sidebar-nav button.active,
.mobile-bottom-nav-button.active, .featured-game-card .play-button {
  background: var(--theme-primary) !important;
  color: var(--theme-button-text, #fff) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 42%, transparent) !important;
}
.input, .select, .textarea, input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  background: color-mix(in srgb, var(--theme-bg) 72%, var(--theme-surface)) !important;
  color: var(--theme-text) !important;
  border-color: color-mix(in srgb, var(--theme-accent) 25%, transparent) !important;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--theme-muted) 72%, transparent) !important; opacity: 1; }

*, *::before, *::after { box-sizing: border-box; }
.app-main, .page-shell, .player-shell, main, .view, .panel, .card, .form-grid, .field { min-width: 0; }
.topbar, .app-header, .player-header, .page-heading, .toolbar, .action-row,
.form-actions, .modal-header, .wallet-actions { flex-wrap: wrap !important; }
.topbar > *, .app-header > *, .page-heading > *, .toolbar > * { min-width: 0; }
button, .button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.table-wrap, .table-container, [class*="table-wrap"] { max-width: 100%; overflow: auto !important; overscroll-behavior-inline: contain; }
table { width: 100%; }
td, th, .toast, .message, .alert { overflow-wrap: anywhere; }
.modal-card, .payment-modal-card, .support-popup-view { max-width: min(100% - 20px, 980px) !important; max-height: calc(100dvh - 20px); overflow: auto; }

.featured-game-card, .compact-game-card, .dashboard-card, .payment-history-card {
  content-visibility: auto;
  contain-intrinsic-size: 280px;
}

@media (max-width: 820px) {
  .page-heading, .toolbar, .action-row { align-items: stretch !important; }
  .toolbar .button, .action-row .button { flex: 1 1 140px; }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-span-2 { grid-column: 1 !important; }
}

@media (max-width: 520px) {
  .topbar, .app-header, .player-header { gap: 7px !important; }
  .page-heading, .modal-header { flex-direction: column; align-items: stretch !important; }
  .button, button { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
