/* ==========================================================================
   TAYA CHESS - PROFESSIONAL DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

/* Modern CSS Reset & Color Variables */
:root {
  /* Color Palette */
  --bg-main: #060913;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --bg-surface-active: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --mint: #10b981;
  --mint-hover: #059669;
  --mint-glow: rgba(16, 185, 129, 0.15);
  
  --gold: #f59e0b;
  --gold-hover: #d97706;
  --gold-glow: rgba(245, 158, 11, 0.15);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-glow: rgba(239, 68, 68, 0.15);

  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.3);
  --border-focus: #38bdf8;
  
  /* Fonts */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  
  /* Layout & Utility */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 50px -15px rgba(0, 0, 0, 0.5);
}

/* Base Body Setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background-color: var(--bg-main);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  background: radial-gradient(circle at 10% 15%, #0f172a 0%, var(--bg-main) 70%);
  position: relative;
  overflow-x: hidden;
}

/* Prevent hydration flash of the welcome page before auth session resolves */
body.auth-pending .topbar,
body.auth-pending .main-wrapper {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.topbar, .main-wrapper {
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  transition: var(--transition);
}

a {
  color: var(--mint);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--text-primary);
}

/* Subtle Textures & Ambient Glows */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.015;
  z-index: 99;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.04) 0%, rgba(0, 0, 0, 0) 70%);
  top: -200px;
  right: -100px;
  pointer-events: none;
  z-index: 0;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-active);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   HEADER TOPBAR SECTION
   ========================================================================== */
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--border);
  background-color: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-container {
  width: min(1200px, calc(100% - 40px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.05em;
  font-size: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 20px;
  color: var(--mint);
  box-shadow: var(--shadow-sm);
}

.brand-accent {
  color: var(--mint);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Online Counter Badge */
.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background-color: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 99px;
  color: var(--mint);
  font-size: 13px;
  font-weight: 500;
}

.live-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Wallet Status chip */
.wallet-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 16px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: left;
}
.wallet-chip:hover {
  border-color: var(--gold);
}
.wallet-label-mini {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 1px;
}
.wallet-chip strong {
  font-size: 15px;
  color: var(--gold);
  font-weight: 700;
}

/* Standard Buttons styling */
.primary, .secondary, .danger-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.primary {
  background-color: var(--mint);
  color: #0c160f;
}
.primary:hover:not(:disabled) {
  background-color: var(--mint-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.primary:active:not(:disabled) {
  transform: translateY(0);
}
.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.secondary {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-active);
  border-color: var(--text-muted);
}

.danger-button {
  background-color: var(--danger-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}
.danger-button:hover {
  background-color: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.operations-button {
  padding: 8px 16px;
  background-color: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
}
.operations-button:hover {
  background-color: #38bdf8;
  color: #0c121d;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}
.operations-button.player-button {
  background-color: rgba(16, 185, 129, .1);
  border-color: rgba(16, 185, 129, .3);
  color: var(--mint);
}
.operations-button.player-button:hover { background-color: var(--mint); color: #0c160f; }

.logout-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}
.logout-button:hover {
  color: var(--danger);
  background-color: rgba(239, 68, 68, 0.05);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-surface-active);
  border: 2px solid var(--border-active);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}

/* ==========================================================================
   MAIN STRUCTURAL WRAPPER
   ========================================================================== */
.main-wrapper {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Utility Hidden state */
.hidden {
  display: none !important;
}

.captcha-container {
  margin: 0 0 18px;
}

.captcha-container altcha-widget {
  display: block;
  width: 100%;
  --altcha-max-width: 100%;
}

.captcha-container altcha-widget:not(:defined) {
  display: none;
}

.captcha-status {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.75);
  font-size: 13px;
}

.captcha-status.error {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(127, 29, 29, 0.22);
}

.development-captcha {
  display: grid;
  grid-template-columns: 1fr 110px;
  align-items: center;
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.08);
}

.development-captcha label {
  color: var(--text-primary);
  font-weight: 700;
}

.development-captcha input {
  width: 100%;
}

.development-captcha small {
  grid-column: 1 / -1;
  color: var(--text-muted);
}

.modal-action {
  margin-top: 20px;
}

/* ==========================================================================
   WELCOME VIEW (AUTH DUAL COLUMN SCREEN)
   ========================================================================== */
.welcome-view {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 60px;
  padding: 40px 0 80px;
}

.hero-showcase {
  display: flex;
  flex-direction: column;
}

.eyebrow {
  color: var(--mint);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 5.5vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-bottom: 24px;
}
.hero-title .highlight {
  color: var(--gold);
}

.hero-description {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 40px;
}

.trust-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.trust-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 460px;
}
.trust-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  background-color: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: var(--mint);
  flex-shrink: 0;
}
.trust-card strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 2px;
}
.trust-card span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

/* Authentication Card Styling */
.auth-container {
  display: flex;
  justify-content: flex-end;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 36px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 28px;
}
.auth-tabs button {
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.auth-tabs button.active {
  background-color: var(--bg-surface-elevated);
  color: var(--mint);
}

.card-kicker {
  font-size: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.auth-copy {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 20px;
}
.input-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}
.input-group input {
  width: 100%;
  padding: 12px 16px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.input-group input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  background-color: rgba(0, 0, 0, 0.35);
}

.password-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: -12px;
  margin-bottom: 20px;
}

/* Terms and Conditions Checkbox */
.terms-agreement-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 12px;
}
.terms-agreement-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--mint);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}
.checkbox-label {
  color: var(--text-secondary);
  line-height: 1.4;
}
.text-link-button {
  color: var(--mint);
  font-weight: 700;
  text-decoration: underline;
  display: inline;
}
.text-link-button:hover {
  color: var(--text-primary);
}

.auth-footer-note {
  display: block;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ==========================================================================
   LOBBY / DASHBOARD VIEW
   ========================================================================== */
.app-view {
  padding: 48px 0 80px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 36px;
}
.page-heading h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.compact {
  width: auto;
  min-width: 170px;
  padding: 10px 20px;
}

/* Warning & Info Banners */
.active-match-banner, .restriction-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
}

.active-match-banner {
  background-color: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--gold);
}
.restriction-banner {
  background-color: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
}

.banner-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.banner-info strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.banner-info span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 30px;
  align-items: flex-start;
}

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

/* Panel Containers */
.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.panel h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.panel-head p {
  font-size: 12px;
  color: var(--text-muted);
}

.count-badge {
  padding: 4px 10px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
}

/* Open Tables Listing styling */
.tables-list {
  min-height: 280px;
}

.table-row {
  padding: 18px 28px;
  display: grid;
  grid-template-columns: 1fr 140px 110px;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.table-row:last-child {
  border-bottom: none;
}
.table-row:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

.table-player {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mini-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background-color: var(--bg-surface-elevated);
  color: var(--mint);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--border);
}

.table-player strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}
.table-player span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.bet-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.bet-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--gold);
}

.join-button {
  padding: 8px 14px;
  border: 1px solid var(--border-active);
  background-color: rgba(16, 185, 129, 0.06);
  color: var(--mint);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.join-button:hover {
  background-color: var(--mint);
  color: #0c160f;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Empty State Widget */
.empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 36px;
  color: var(--bg-surface-active);
  margin-bottom: 12px;
}
.empty strong {
  display: block;
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 6px;
}
.empty p {
  font-size: 12px;
  max-width: 260px;
}

/* Match History Panel styling */
.history-list {
  max-height: 350px;
  overflow-y: auto;
}

.history-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.history-row:last-child {
  border-bottom: none;
}
.history-row:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

.outcome {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 58px;
}
.outcome.win {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--mint);
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.outcome.loss {
  background-color: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
}
.outcome.draw {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.history-opponent strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}
.history-opponent span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-report {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background-color: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition);
}
.history-report:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.history-result {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  text-align: right;
  color: var(--gold);
  min-width: 80px;
}
.history-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 680px) {
  .history-row {
    grid-template-columns: 70px 1fr auto;
    padding: 14px 16px;
    gap: 10px;
  }
  .history-report {
    display: none;
  }
  .history-result {
    font-size: 12px;
    min-width: auto;
  }
}


/* Sidebar Stack elements */
.side-stack {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Premium Simulated Wallet Card */
.wallet-card {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.wallet-gloss {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}
.wallet-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.wallet-label-premium {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #34d399;
}
.badge-simulated {
  background-color: rgba(255, 255, 255, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 8px;
  margin-left: 6px;
  color: #a7f3d0;
}
.badge-live {
  background-color: rgba(16, 185, 129, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 8px;
  margin-left: 6px;
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  letter-spacing: 0.08em;
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}
.forgot-password-row {
  text-align: center;
  margin-top: 10px;
}
.optional-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}
/* Small danger action button for admin user rows */
.danger-btn-sm {
  padding: 6px 10px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background-color: rgba(239, 68, 68, 0.06);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  transition: var(--transition);
}
.danger-btn-sm:hover {
  background-color: rgba(239, 68, 68, 0.18);
  border-color: var(--danger);
}
/* Audit log rows */
.audit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.audit-row:last-child { border-bottom: none; }
.audit-action {
  font-weight: 700;
  color: var(--text-primary);
  min-width: 160px;
}
.audit-time {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.wallet-card-chip {
  width: 32px;
  height: 24px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.wallet-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 12px;
}
.wallet-disclaimer {
  font-size: 11px;
  line-height: 1.4;
  color: #a7f3d0;
  opacity: 0.85;
  margin-bottom: 20px;
}
.wallet-action-btn {
  width: 100%;
  justify-content: center;
}

.wallet-actions {
  display: grid;
  gap: 10px;
}

/* Analytics Stats Grid styling */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.stat-box {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-box:nth-child(even) {
  border-right: none;
}
.stat-box:nth-child(n+3) {
  border-bottom: none;
}
.stat-lbl {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.stat-val {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--text-primary);
}
#statNet {
  color: var(--gold);
}

/* Players Online Panel */
.green-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--mint);
  box-shadow: 0 0 6px var(--mint);
}
.players-list {
  padding: 8px 24px;
  max-height: 240px;
  overflow-y: auto;
}
.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.player-row:last-child {
  border-bottom: none;
}
.player-row .mini-avatar {
  width: 28px;
  height: 28px;
  font-size: 10px;
}
.player-row strong {
  font-size: 13px;
  color: var(--text-secondary);
}
.player-row span {
  margin-left: auto;
  font-size: 9px;
  padding: 2px 6px;
  background-color: var(--bg-surface-elevated);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 700;
}

/* ==========================================================================
   CHESS MATCH GAME VIEW
   ========================================================================== */
.game-view {
  padding: 24px 0 60px;
}
.game-header-nav {
  margin-bottom: 16px;
}
.game-header-row {
  display: flex;
  align-items: center;
}
.mobile-game-pot,
.mobile-game-actions,
.mobile-move-bar,
.mobile-disconnect-notice {
  display: none;
}

.text-button {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.02);
}
.text-button:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-elevated);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 640px) minmax(0, 320px);
  justify-content: center;
  gap: 36px;
  align-items: flex-start;
}

.board-column {
  width: 100%;
  max-width: 640px;
  min-width: 0;
  justify-self: center;
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 14px 0;
}
.player-disc {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-surface-elevated);
  color: var(--mint);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid var(--border);
}
.player-disc.warm {
  color: var(--gold);
}

.player-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.player-info strong {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Digital Monospaced Game Clock */
.player-clock {
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 85px;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background-color: #060913;
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.player-clock.low {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
  background-color: rgba(239, 68, 68, 0.05);
  animation: clock-blink 1s infinite alternate;
}

@keyframes clock-blink {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.turn-tag {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 10px;
}
.turn-tag.active {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--mint);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Chessboard Housing Structure */
.board-shell {
  width: 100%;
  min-width: 0;
  background-color: #1b2437;
  padding: 12px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.chess-board {
  width: 100%;
  aspect-ratio: 1/1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  overflow: hidden;
  border-radius: 4px;
}

/* Chess Squares Styling */
.square {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1;
  user-select: none;
  transition: box-shadow 0.15s ease;
}

/* Classic Readable Chess Palette */
.square.light {
  background-color: #ececd7;
}
.square.dark {
  background-color: #739552;
}

/* Selection and moves markers */
.square.selected {
  box-shadow: inset 0 0 0 5px var(--gold);
}
.square.legal::after {
  content: "";
  position: absolute;
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background-color: rgba(15, 23, 42, 0.3);
}
.square.capture::after {
  content: "";
  position: absolute;
  width: 76%;
  height: 76%;
  border-radius: 50%;
  border: 5px solid rgba(15, 23, 42, 0.25);
  background: transparent;
}
.square.last {
  box-shadow: inset 0 0 0 99px rgba(245, 158, 11, 0.25);
}
.square.in-check,
.square.checkmated {
  background-image: radial-gradient(circle, rgba(254, 202, 202, 0.95) 0%, rgba(239, 68, 68, 0.78) 72%);
  box-shadow: inset 0 0 0 5px #dc2626, inset 0 0 22px rgba(127, 29, 29, 0.8);
}
.square.checkmated {
  background-image: radial-gradient(circle, #fecaca 0%, #ef4444 55%, #991b1b 100%);
  box-shadow: inset 0 0 0 5px #7f1d1d, inset 0 0 28px rgba(69, 10, 10, 0.95);
}
.square.checkmated::after {
  content: "MATE";
  position: absolute;
  z-index: 3;
  right: 3px;
  bottom: 3px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #450a0a;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(7px, 0.8vw, 10px);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
}
.square.checkmated .piece {
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.9)) drop-shadow(0 3px 3px rgba(69, 10, 10, 0.8));
  transform: scale(1.08);
}

.piece {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 90%;
  max-height: 90%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.piece.white {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.piece.black {
  color: #1a1a1a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* Match Escrow Info Panel */
.match-card {
  padding: 28px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.pot-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  color: var(--gold);
  margin-top: 4px;
}
.pot-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pot-note span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--mint);
}

.match-divider {
  height: 1px;
  background-color: var(--border);
  margin: 20px 0;
}

.match-status {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.move-history-container {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
}
.move-history-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.move-history {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  max-height: 180px;
  overflow-y: auto;
}
.move-number {
  color: var(--text-muted);
}

.match-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.match-actions button {
  width: 100%;
  justify-content: center;
}
.match-decision-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.draw-button {
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: var(--mint);
}
.draw-button.incoming {
  background: var(--mint);
  color: #0c160f;
  font-weight: 800;
}
.draw-offer-notice {
  padding: 10px 12px;
  border: 1px solid rgba(45, 212, 191, 0.22);
  border-radius: var(--radius-md);
  background: rgba(45, 212, 191, 0.07);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}
.draw-offer-notice .text-button {
  width: auto;
  margin-top: 6px;
  padding: 0;
  color: var(--danger);
  font-size: 11px;
}

.disconnect-notice {
  padding: 10px 14px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background-color: rgba(239, 68, 68, 0.05);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 16px;
}

/* ==========================================================================
   MODALS AND INTERACTION OVERLAYS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(6, 9, 19, 0.8);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: hidden;
  animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  padding: 32px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  animation: modal-slide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-slide {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  display: grid;
  place-items: center;
}
.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: var(--mint);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.draw-confirm-modal {
  width: min(470px, 100%);
  border-color: rgba(16, 185, 129, 0.28);
  background:
    radial-gradient(circle at 88% 8%, rgba(16, 185, 129, 0.12), transparent 34%),
    var(--bg-surface);
}

.draw-confirm-icon {
  font-size: 24px;
}

.draw-confirm-kicker {
  margin: -8px 0 8px;
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.draw-settlement-summary {
  display: grid;
  gap: 1px;
  margin: 4px 0 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--border);
}

.draw-settlement-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 15px;
  background: rgba(10, 17, 32, 0.88);
}

.draw-settlement-summary span {
  color: var(--text-muted);
  font-size: 12px;
}

.draw-settlement-summary strong {
  color: var(--text-primary);
  font-size: 12px;
}

.draw-settlement-summary .draw-zero-fee {
  color: var(--mint);
}

.draw-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
}

.draw-confirm-actions button {
  width: 100%;
  justify-content: center;
}

.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  margin-top: 18px;
}

/* Topup QR Section */
.gcash-qr {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.qr-image-button {
  position: relative;
  width: 90px;
  height: 90px;
  background-color: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  display: block;
}
.qr-image-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.qr-image-button span {
  position: absolute;
  inset: auto 0 0;
  background-color: rgba(6, 9, 19, 0.85);
  color: white;
  font-size: 8px;
  padding: 4px;
  text-align: center;
  opacity: 0;
  transition: var(--transition);
}
.qr-image-button:hover span {
  opacity: 1;
}

.gcash-qr-instruction strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.gcash-qr-instruction small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.amount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.amount-grid button {
  padding: 12px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
}
.amount-grid button:hover {
  border-color: var(--mint);
  color: var(--mint);
}
.amount-grid button.active {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: var(--mint);
  color: var(--mint);
}

.custom-topup-input, .custom-wager-input {
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px;
}
.custom-topup-input span, .custom-wager-input span {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 16px;
}
.custom-topup-input input, .custom-wager-input input {
  width: 100%;
  padding: 12px 10px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
}
.custom-topup-hint, .hint-small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.file-upload-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}
.file-upload-wrapper input[type="file"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  background-color: rgba(0, 0, 0, 0.1);
  cursor: pointer;
}
.file-upload-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-select {
  width: 100%;
  padding: 12px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
}

.visibility-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.visibility-options button {
  padding: 12px;
  border: 1px solid var(--border);
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  text-align: left;
}
.visibility-options button strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.visibility-options button span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}
.visibility-options button.active {
  background-color: rgba(16, 185, 129, 0.06);
  border-color: var(--mint);
}

.invite-terms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.invite-term-card {
  padding: 12px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}
.invite-term-card span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.invite-term-card strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
  margin-top: 2px;
}
.invite-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* QR full-screen review backdrop */
.qr-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(6, 9, 19, 0.9);
  display: grid;
  place-items: center;
  padding: max(30px, env(safe-area-inset-top)) max(30px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(30px, env(safe-area-inset-left));
  animation: fade-in 0.25s ease-out;
}
.qr-preview-card {
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.qr-preview-card img {
  width: 100%;
  max-height: calc(100dvh - 110px);
  height: auto;
  border-radius: var(--radius-lg);
  background-color: white;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}
.qr-preview-card p {
  font-weight: 700;
  color: white;
}
.qr-preview-close {
  position: fixed;
  top: 20px;
  right: 20px;
  font-size: 38px;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
}

/* ==========================================================================
   TERMS & CONDITIONS SPECIFIC RULES
   ========================================================================== */
.terms-modal {
  max-width: 580px;
  width: 100%;
}
.terms-scroll-box {
  margin-top: 18px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 280px;
  overflow-y: auto;
}
.terms-legal-text h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 14px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.terms-legal-text h3:first-child {
  margin-top: 0;
}
.terms-legal-text p, .terms-legal-text li {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.terms-legal-text ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

/* Game Results Overlay */
.result-modal {
  text-align: center;
}
.result-backdrop {
  place-items: center;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}
.result-backdrop .result-modal {
  width: min(420px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  pointer-events: auto;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}
.result-minimize {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1;
}
.result-modal.minimized {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(300px, calc(100vw - 40px));
  padding: 18px 58px 18px 18px;
  text-align: left;
}
.result-modal.minimized > :not(.result-badge):not(#resultTitle):not(.result-minimize) { display: none; }
.result-modal.minimized .result-badge { margin: 0 0 4px; }
.result-modal.minimized #resultTitle { margin: 0; font-size: 17px; }
@media (max-width: 900px) {
  .result-backdrop { place-items: center; padding: 14px; }
  .result-backdrop .result-modal { width: min(420px, 100%); max-height: calc(100dvh - 28px); padding: 26px 22px; }
  .result-modal.minimized { right: 12px; bottom: 12px; width: calc(100vw - 24px); padding: 16px 54px 16px 16px; }
}
.result-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--mint);
  border: 1px solid rgba(16, 185, 129, 0.2);
  margin-bottom: 14px;
}
.result-badge.loss {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.result-badge.draw {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-color: var(--border);
}
.result-icon {
  font-size: 48px;
  color: var(--gold);
  margin-bottom: 14px;
}
.result-amount {
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 20px 0;
}
.result-amount span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.result-amount strong {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--mint);
  margin-top: 4px;
}
.result-amount strong.negative {
  color: var(--danger);
}
.rematch-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.result-cancel {
  justify-content: center;
}
.lobby-countdown {
  font-size: 12px;
  color: var(--gold);
  margin-top: 14px;
}

/* ==========================================================================
   WAITING ROOM VIEW
   ========================================================================== */
.waiting-view {
  min-height: calc(100vh - 72px);
  padding: 30px 0 80px;
}
.waiting-header-nav {
  margin-bottom: 20px;
}
.waiting-card {
  max-width: 580px;
  margin: 40px auto 0;
  padding: 48px;
  text-align: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.waiting-pulse {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 24px;
  display: grid;
  place-items: center;
}
.waiting-knight-mark {
  position: relative;
  z-index: 2;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background-color: var(--mint);
  color: #0c160f;
  font-size: 24px;
  display: grid;
  place-items: center;
}
.waiting-pulse span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--mint);
  border-radius: 50%;
  animation: pulse-wave 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}
.waiting-pulse span:nth-child(2) {
  animation-delay: 0.6s;
}
.waiting-pulse span:nth-child(3) {
  animation-delay: 1.2s;
}

@keyframes pulse-wave {
  0% { transform: scale(0.6); opacity: 0; }
  30% { opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}

.waiting-card h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.waiting-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 420px;
  margin: 0 auto 28px;
}

.waiting-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 30px;
}
.waiting-detail-col {
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.15);
  border-right: 1px solid var(--border);
}
.waiting-detail-col:last-child {
  border-right: none;
}
.waiting-detail-col span {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.waiting-detail-col strong {
  display: block;
  font-size: 15px;
  color: var(--text-primary);
  margin-top: 2px;
}

.invite-share {
  text-align: left;
  padding: 20px;
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
.invite-share label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.invite-input-container {
  display: flex;
}
.invite-input-container input {
  flex: 1;
  padding: 10px 14px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  outline: none;
}
.invite-input-container button {
  padding: 0 16px;
  background-color: var(--mint);
  color: #0c160f;
  font-weight: 700;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 13px;
}
.invite-security-tip {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
}
.rotate-invite-btn {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  margin-top: 10px;
  text-decoration: underline;
}

.waiting-foot {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.live-dot-mini {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--mint);
  box-shadow: 0 0 6px var(--mint);
}

/* ==========================================================================
   OPERATIONS & STAFF PORTAL SECTION
   ========================================================================== */
.operations-view {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 72px);
  width: 100vw;
  margin-left: calc((100vw - min(1200px, calc(100vw - 40px))) / -2);
}

.operations-sidebar {
  background-color: #0c111e;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand span {
  width: 32px;
  height: 32px;
  background-color: var(--mint);
  color: #0c160f;
  font-size: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
}
.sidebar-brand strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}
.sidebar-brand small, .sidebar-footer small {
  display: block;
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.operations-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 20px;
}
.operations-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.operations-nav button span {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--text-muted);
}
.operations-nav button:hover, .operations-nav button.active {
  background-color: var(--bg-surface-elevated);
  color: var(--mint);
}
.operations-nav button.active span {
  color: var(--mint);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.sidebar-footer button {
  width: 100%;
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
}
.sidebar-footer button:hover {
  color: var(--text-primary);
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}
.sidebar-user-info .avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.sidebar-user-info strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
}

.operations-content {
  padding: 40px 50px 80px;
  overflow-y: auto;
  background-color: rgba(6, 9, 19, 0.4);
}

.operations-heading {
  align-items: center;
  margin-bottom: 28px;
}
.operations-heading p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}
.refresh-operations {
  width: auto;
  padding: 8px 16px;
}

/* Operations Metrics grid */
.operations-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.operations-metric {
  padding: 16px 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.operations-metric span {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.operations-metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text-primary);
  margin-top: 4px;
}

.operations-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.operations-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Operations Tables / lists */
.user-row, .approval-row, .report-row {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-surface);
  gap: 16px;
}
.user-row:last-child, .approval-row:last-child, .report-row:last-child {
  border-bottom: none;
}

.user-identity, .approval-row > div:first-child, .report-row > div:first-child {
  flex: 1;
}
.user-identity strong, .approval-row strong, .report-row strong {
  display: block;
  font-size: 14px;
  color: var(--text-primary);
}
.user-identity span, .approval-row span, .report-row span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.role-pill {
  padding: 4px 8px;
  border-radius: 4px;
  background-color: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-row select {
  padding: 6px 10px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}
.user-row button {
  padding: 6px 12px;
  background-color: var(--mint);
  color: #0c160f;
  font-weight: 700;
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.user-balance {
  font-weight: 700;
  color: var(--gold);
  font-size: 13px;
  width: 90px;
  text-align: right;
}

.approval-row button, .report-row button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.receipt-button {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
}
.approve-button {
  background-color: var(--mint);
  color: #0c160f;
}
.reject-button {
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.withdrawal-history-modal {
  width: min(860px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  overflow-y: auto;
}
.withdrawal-history-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 20px 0;
}
.withdrawal-history-summary .operations-metric { padding: 12px 14px; }
.withdrawal-history-summary .operations-metric strong { font-size: 17px; }
.withdrawal-history-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.withdrawal-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.withdrawal-history-row:last-child { border-bottom: 0; }
.withdrawal-history-row > div:first-child { min-width: 0; }
.withdrawal-history-row strong, .withdrawal-history-row span { display: block; }
.withdrawal-history-row span { margin-top: 3px; color: var(--text-muted); font-size: 11px; }
.withdrawal-history-row.outcome-win > div:first-child > strong { color: var(--mint); }
.withdrawal-history-row.outcome-loss > div:first-child > strong { color: var(--danger); }
.withdrawal-history-money { flex: 0 0 auto; text-align: right; }
.withdrawal-history-money strong { margin-top: 4px; color: var(--gold); }
.reject-button:hover {
  background-color: var(--danger);
  color: white;
}

.receipt-preview {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin-top: 14px;
  border: 1px solid var(--border);
}
.receipt-review-modal { width: min(760px, 100%); }
.receipt-review-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}
.receipt-review-details > div {
  padding: 12px 14px;
  background: rgba(0, 0, 0, .16);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.receipt-review-details span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.receipt-review-details strong { color: var(--text-primary); font-size: 13px; }
.receipt-review-details .receipt-review-id { grid-column: 1 / -1; }
.receipt-review-id strong { overflow-wrap: anywhere; }
.receipt-review-image-wrap {
  display: grid;
  place-items: center;
  max-height: 48vh;
  padding: 12px;
  overflow: auto;
  background: #050a08;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.receipt-review-image-wrap img {
  display: block;
  max-width: 100%;
  max-height: 44vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}
@media (max-width: 600px) {
  .receipt-review-details { grid-template-columns: 1fr; }
  .receipt-review-details .receipt-review-id { grid-column: auto; }
}

@media (max-width: 600px) {
  .modal-backdrop {
    place-items: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .modal {
    width: 100%;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 24px 18px;
    border-radius: 16px;
  }
  .modal-close {
    top: 12px;
    right: 12px;
  }
  .modal-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
  }
  .modal-title {
    padding-right: 34px;
    font-size: clamp(19px, 6vw, 22px);
  }
  .modal-subtitle {
    margin-bottom: 18px;
  }
  .gcash-qr {
    align-items: flex-start;
    padding: 12px;
  }
  .qr-image-button {
    width: clamp(72px, 25vw, 90px);
    height: clamp(72px, 25vw, 90px);
  }
  .gcash-qr-instruction {
    min-width: 0;
  }
  .gcash-qr-instruction strong,
  .gcash-qr-instruction small {
    overflow-wrap: anywhere;
  }
  .custom-topup-input,
  .custom-wager-input {
    min-width: 0;
    padding: 0 12px;
  }
  .custom-topup-input input,
  .custom-wager-input input,
  .modal-select {
    min-width: 0;
    font-size: 16px;
  }
  .file-upload-wrapper input[type="file"] {
    overflow: hidden;
  }
  .file-upload-wrapper input[type="file"]::file-selector-button {
    max-width: 48%;
  }
  #modalAction,
  .terms-accept-btn {
    width: 100%;
    justify-content: center;
  }
  .invite-terms {
    grid-template-columns: 1fr;
  }
  .result-actions {
    grid-template-columns: 1fr;
  }
  .draw-confirm-actions {
    grid-template-columns: 1fr;
  }
  .terms-scroll-box {
    max-height: min(42dvh, 280px);
    padding: 14px;
  }
  .receipt-review-image-wrap {
    max-height: 42dvh;
  }
  .receipt-review-image-wrap img {
    max-height: 38dvh;
  }
  .qr-preview-backdrop {
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  }
  .qr-preview-close {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
  }
}

@media (max-width: 380px) {
  .gcash-qr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }
  .amount-grid,
  .visibility-options {
    grid-template-columns: 1fr;
  }
}

.feature-empty {
  padding: 60px;
  text-align: center;
  color: var(--text-muted);
}
.feature-empty span {
  font-size: 40px;
  color: var(--bg-surface-active);
}
.feature-empty h3 {
  color: var(--text-primary);
  margin-top: 12px;
  margin-bottom: 4px;
}

/* ==========================================================================
   BATTLE INTRO AND NOTIFICATIONS
   ========================================================================== */
.battle-intro {
  position: fixed;
  inset: 0;
  z-index: 90;
  background-color: rgba(6, 9, 19, 0.95);
  display: grid;
  place-items: center;
  animation: fade-out-overlay 0.3s ease-in 1.8s forwards;
}

@keyframes fade-out-overlay {
  to { opacity: 0; visibility: hidden; }
}

.battle-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  animation: intro-pulse 1.8s ease-in-out infinite alternate;
}

@keyframes intro-pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.1); opacity: 0.9; }
}

.battle-axes-container {
  display: flex;
  font-size: 90px;
  z-index: 2;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.6));
}
.battle-axis-left {
  transform: rotate(35deg) translateX(15px);
  animation: clash-left 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.battle-axis-right {
  transform: scaleX(-1) rotate(35deg) translateX(15px);
  animation: clash-right 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes clash-left {
  0% { transform: translate(-100px, -50px) rotate(-45deg); opacity: 0; }
  40% { transform: translate(15px, 0) rotate(35deg); opacity: 1; }
  50% { transform: translate(0, 0) rotate(20deg); }
  70% { transform: translate(15px, 0) rotate(35deg); }
}
@keyframes clash-right {
  0% { transform: scaleX(-1) translate(-100px, -50px) rotate(-45deg); opacity: 0; }
  40% { transform: scaleX(-1) translate(15px, 0) rotate(35deg); opacity: 1; }
  50% { transform: scaleX(-1) translate(0, 0) rotate(20deg); }
  70% { transform: scaleX(-1) translate(15px, 0) rotate(35deg); }
}

.battle-title {
  position: absolute;
  z-index: 3;
  margin-top: 220px;
  text-align: center;
  animation: strike-text 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.battle-title small {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--mint);
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.battle-title strong {
  display: block;
  font-family: var(--font-display);
  font-size: 48px;
  color: white;
  letter-spacing: -0.02em;
}
.battle-subheading {
  display: block;
  margin-top: 10px;
  color: #f8ddb0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .05em;
}
.battle-intro.royalty {
  background: radial-gradient(circle at 50% 42%, rgba(113, 74, 20, .48), rgba(6, 9, 19, .97) 58%);
  animation: fade-out-overlay .3s ease-in 2.7s forwards;
}
.battle-intro.royalty .battle-glow {
  background: radial-gradient(circle, rgba(251, 191, 36, .34) 0%, rgba(180, 83, 9, .12) 42%, transparent 70%);
}
.battle-intro.royalty .battle-axes-container {
  font-size: 108px;
  filter: drop-shadow(0 0 24px rgba(251, 191, 36, .72));
}
.battle-intro.royalty .battle-title small { color: #fbbf24; }
.battle-intro.royalty .battle-title strong {
  color: #fff4cf;
  text-shadow: 0 0 28px rgba(251, 191, 36, .58);
}

@keyframes strike-text {
  0%, 30% { transform: translateY(40px); opacity: 0; }
  60% { transform: translateY(-5px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Toast Notifications styling */
.toast {
  position: fixed;
  z-index: 100;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 25px);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  background-color: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

/* Confetti Falling styles */
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 18px;
  background-color: var(--color);
  left: var(--left);
  animation: confetti-fall var(--duration) cubic-bezier(.2,.7,.4,1) forwards;
  animation-delay: var(--delay);
  transform: rotate(var(--rotation));
}
@keyframes confetti-fall {
  to {
    transform: translate3d(var(--drift), 110vh, 0) rotate(calc(var(--rotation) + 720deg));
    opacity: 0.1;
  }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 960px) {
  .welcome-view {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 20px;
  }
  .hero-showcase {
    text-align: center;
    align-items: center;
  }
  .hero-description {
    margin-left: auto;
    margin-right: auto;
  }
  .trust-card {
    max-width: 100%;
  }
  .auth-container {
    justify-content: center;
  }
  .auth-card {
    max-width: 100%;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .side-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .game-layout {
    grid-template-columns: 1fr;
  }
  .operations-view {
    grid-template-columns: 72px 1fr;
  }
  .operations-sidebar {
    padding: 20px 8px;
  }
  .sidebar-brand div, .operations-nav button .nav-label, .sidebar-user-info div {
    display: none;
  }

  .operations-nav button {
    justify-content: center;
    padding: 12px;
  }
  .operations-nav button span {
    font-size: 20px;
    width: auto;
  }
  .sidebar-footer button {
    display: none;
  }
}

@media (max-width: 680px) {
  .main-wrapper {
    width: calc(100% - 24px);
  }
  .game-view {
    padding: 8px 0 28px;
  }
  .game-header-nav {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(10, 17, 32, 0.92);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  .game-header-row {
    min-height: 50px;
    padding: 5px 7px;
    gap: 6px;
  }
  .game-header-row #backLobby {
    flex: 0 0 auto;
    padding: 7px 8px;
    font-size: 12px;
  }
  .mobile-game-pot {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 64px;
    margin-right: auto;
    padding: 3px 8px;
    border-left: 1px solid var(--border);
  }
  .mobile-game-pot span {
    color: var(--text-muted);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .mobile-game-pot strong {
    color: var(--gold);
    font-family: var(--font-display);
    font-size: 15px;
    line-height: 1.15;
    white-space: nowrap;
  }
  .mobile-game-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .mobile-action {
    min-width: 38px;
    height: 38px;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-size: 15px;
    line-height: 1;
  }
  .mobile-action span:last-child {
    margin-top: 2px;
    font-size: 8px;
    font-weight: 700;
  }
  .mobile-action.report {
    color: #f87171;
    font-size: 17px;
  }
  .mobile-action.draw {
    color: var(--mint);
  }
  .mobile-action.draw.incoming {
    border-color: var(--mint);
    background: rgba(45, 212, 191, 0.14);
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.08);
  }
  .mobile-action.resign {
    color: var(--danger);
  }
  .mobile-action:disabled {
    opacity: 0.52;
  }
  .mobile-move-bar {
    display: flex;
    align-items: center;
    min-height: 40px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.18);
  }
  .mobile-match-status {
    flex: 0 0 auto;
    max-width: 92px;
    padding: 0 10px;
    color: var(--mint);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
  }
  .mobile-move-history {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px 7px 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  .mobile-move-history::-webkit-scrollbar {
    display: none;
  }
  .mobile-move {
    flex: 0 0 auto;
    scroll-snap-align: end;
    padding: 5px 8px;
    border-radius: 7px;
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    white-space: nowrap;
  }
  .mobile-move small {
    margin-right: 3px;
    color: var(--text-muted);
    font-size: 8px;
  }
  .mobile-move.empty {
    color: var(--text-muted);
    font-family: inherit;
  }
  .mobile-disconnect-notice {
    margin: 0;
    border-width: 1px 0 0;
    border-radius: 0;
  }
  .game-layout {
    gap: 0;
  }
  .match-card {
    display: none;
  }
  .board-shell {
    padding: clamp(4px, 1.8vw, 8px);
    border-radius: 12px;
  }
  .topbar-container {
    width: calc(100% - 24px);
  }
  .header-actions .live-pill {
    display: none;
  }
  .side-stack {
    grid-template-columns: 1fr;
  }
  .table-row {
    grid-template-columns: 1fr auto;
  }
  .bet-cell {
    display: none;
  }
  .player-bar {
    gap: 8px;
    padding: 9px 11px;
    margin: 8px 0;
    border-radius: 12px;
  }
  .player-disc {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }
  .player-clock {
    font-size: 15px;
    padding: 6px 10px;
    min-width: 70px;
  }
  .turn-tag {
    display: none;
  }
  .player-info span {
    font-size: 9px;
  }
  .square {
    font-size: clamp(24px, 9vw, 44px);
  }
  .waiting-card {
    padding: 24px 16px;
  }
  .waiting-details {
    grid-template-columns: 1fr;
  }
  .waiting-detail-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .waiting-detail-col:last-child {
    border-bottom: none;
  }
  .operations-content {
    padding: 24px 16px;
  }
  .operations-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .user-row, .approval-row, .report-row {
    flex-wrap: wrap;
    padding: 14px 16px;
  }
  .user-balance {
    text-align: left;
    width: 100%;
    margin-top: 4px;
  }
}
