/* ============================================
   SQUARES FOR SPORTS - MODERN DESIGN SYSTEM
   Inspired by Google Material & Apple HIG
   ============================================ */

/* ============================================
   1. CSS VARIABLES & DESIGN TOKENS
   ============================================ */
:root {
  /* Primary Brand Colors - Modern Green Palette */
  --primary-50: #e8f5e9;
  --primary-100: #c8e6c9;
  --primary-200: #a5d6a7;
  --primary-300: #81c784;
  --primary-400: #66bb6a;
  --primary-500: #4caf50;  /* Main brand color */
  --primary-600: #43a047;
  --primary-700: #388e3c;
  --primary-800: #2e7d32;
  --primary-900: #1b5e20;

  /* Accent Colors - Professional Blue */
  --accent-500: #2196f3;
  --accent-600: #1976d2;
  --accent-700: #1565c0;

  /* Semantic Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Neutral Colors - High Contrast */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafb;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);

  /* Text Colors - WCAG AAA Compliant */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-inverse: #ffffff;
  --text-link: #2563eb;

  /* Typography Scale */
  --font-family-primary: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Inter', sans-serif;
  --font-family-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;

  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */

  /* Spacing Scale */
  --space-1: 0.25rem;      /* 4px */
  --space-2: 0.5rem;       /* 8px */
  --space-3: 0.75rem;      /* 12px */
  --space-4: 1rem;         /* 16px */
  --space-5: 1.25rem;      /* 20px */
  --space-6: 1.5rem;       /* 24px */
  --space-8: 2rem;         /* 32px */
  --space-10: 2.5rem;      /* 40px */
  --space-12: 3rem;        /* 48px */
  --space-16: 4rem;        /* 64px */

  /* Border Radius */
  --radius-sm: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-full: 9999px;

  /* Shadows - Subtle & Modern */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-Index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* ============================================
   2. RESET & BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
  min-height: 100vh;
  position: relative;
}

/* ============================================
   3. TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--text-5xl);
  font-weight: 700;
  letter-spacing: -0.025em;
}

h2 {
  font-size: var(--text-4xl);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--text-3xl);
  letter-spacing: -0.015em;
}

h4 {
  font-size: var(--text-2xl);
}

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
}

p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  line-height: 1.7;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

strong, b {
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   4. LAYOUT COMPONENTS
   ============================================ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm {
  max-width: 768px;
}

.container-lg {
  max-width: 1536px;
}

/* Modern Card Design */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  transition: all var(--transition-base);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--gray-200);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) var(--space-6);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.card-body {
  padding: 0;
}

/* ============================================
   5. BUTTONS - MODERN & ACCESSIBLE
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-base);
  font-weight: 500;
  font-family: var(--font-family-primary);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  outline: 2px solid transparent;
  outline-offset: 2px;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button - Modern Green */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px 0 rgba(76, 175, 80, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(76, 175, 80, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.25);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.35);
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.35);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--primary-600);
  border: none;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(76, 175, 80, 0.08);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

/* Button with Icon */
.btn-icon {
  padding: var(--space-3);
  aspect-ratio: 1;
}

/* ============================================
   6. FORMS - CLEAN & ACCESSIBLE
   ============================================ */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-family-primary);
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-control:hover:not(:focus) {
  border-color: var(--gray-400);
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.form-control:disabled {
  background: var(--gray-100);
  cursor: not-allowed;
}

/* Form Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: var(--space-10);
}

/* Form Textarea */
.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Form Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-3);
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-right: var(--space-3);
  cursor: pointer;
  accent-color: var(--primary-500);
}

.form-check-label {
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

/* Form Help Text */
.form-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
}

.form-error {
  color: var(--error);
}

/* ============================================
   7. NAVIGATION - MODERN HEADER
   ============================================ */
.navbar {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.navbar-brand img {
  height: 40px;
  width: auto;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-item {
  margin: 0;
}

.navbar-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.navbar-link:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  text-decoration: none;
}

.navbar-link.active {
  color: var(--primary-600);
  background: rgba(76, 175, 80, 0.1);
}

/* Mobile Menu Toggle */
.navbar-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
}

/* ============================================
   8. GAME BOARD - MODERN GRID
   ============================================ */
.game-board {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.squares-grid {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 2px;
  background: var(--gray-200);
  padding: 2px;
  border-radius: var(--radius-lg);
  max-width: 800px;
  margin: 0 auto;
}

.square {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  font-weight: 500;
}

.square:hover:not(.square-header):not(.square-taken):not(.square-disabled) {
  background: var(--primary-50);
  border-color: var(--primary-500);
  transform: scale(1.05);
  z-index: 1;
  box-shadow: var(--shadow-md);
}

.square-header {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
  color: var(--text-inverse);
  font-weight: 700;
  font-size: var(--text-lg);
  cursor: default;
}

.square-number {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.square-taken {
  background: var(--gray-100);
  cursor: not-allowed;
  position: relative;
}

.square-taken .player-name {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  padding: var(--space-1);
}

.square-mine {
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  border-color: var(--primary-500);
}

.square-winner {
  animation: winnerPulse 2s infinite;
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  border-color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

@keyframes winnerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ============================================
   9. ALERTS & NOTIFICATIONS
   ============================================ */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-base);
  border: 1px solid transparent;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
  border-color: rgba(16, 185, 129, 0.2);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  border-color: rgba(239, 68, 68, 0.2);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.2);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
  border-color: rgba(59, 130, 246, 0.2);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 300px;
  max-width: 500px;
  z-index: var(--z-tooltip);
  animation: slideInRight var(--transition-base) ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   10. MODALS - CLEAN & MODERN
   ============================================ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  overflow-y: auto;
  animation: fadeIn var(--transition-base);
}

.modal.show {
  display: block;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
}

.modal-dialog {
  position: relative;
  margin: var(--space-8) auto;
  max-width: 600px;
  z-index: var(--z-modal);
  animation: slideUp var(--transition-base) ease-out;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--text-2xl);
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: var(--text-2xl);
  cursor: pointer;
  color: var(--text-tertiary);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================
   11. TABLES - CLEAN DATA DISPLAY
   ============================================ */
.table-container {
  overflow-x: auto;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--gray-200);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table td {
  padding: var(--space-4);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--gray-100);
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-secondary);
}

.table-striped tbody tr:nth-child(odd) {
  background: var(--gray-50);
}

/* ============================================
   12. BADGES & CHIPS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background: rgba(76, 175, 80, 0.1);
  color: var(--primary-700);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
}

.badge-info {
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
}

/* ============================================
   13. PROGRESS BARS
   ============================================ */
.progress {
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-500) 0%, var(--primary-600) 100%);
  transition: width var(--transition-base) ease-out;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================
   14. UTILITIES
   ============================================ */
/* Spacing */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-5 { margin-top: var(--space-5) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-5 { margin-bottom: var(--space-5) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--space-1) !important; }
.p-2 { padding: var(--space-2) !important; }
.p-3 { padding: var(--space-3) !important; }
.p-4 { padding: var(--space-4) !important; }
.p-5 { padding: var(--space-5) !important; }

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flexbox */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }
.gap-1 { gap: var(--space-1) !important; }
.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }

/* Text */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--error) !important; }
.text-warning { color: var(--warning) !important; }

/* Background */
.bg-primary { background: var(--primary-500) !important; }
.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--error) !important; }
.bg-warning { background: var(--warning) !important; }
.bg-light { background: var(--gray-100) !important; }
.bg-dark { background: var(--gray-800) !important; }

/* Borders */
.border { border: 1px solid var(--gray-300) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid var(--gray-300) !important; }
.border-bottom { border-bottom: 1px solid var(--gray-300) !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-circle { border-radius: 50% !important; }

/* Shadows */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Width & Height */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* ============================================
   15. ANIMATIONS
   ============================================ */
.fade-in {
  animation: fadeIn var(--transition-base);
}

.slide-up {
  animation: slideUp var(--transition-base);
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   16. RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  :root {
    --text-5xl: 2rem;
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
  }

  .container {
    padding: 0 var(--space-4);
  }

  .navbar-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    padding: var(--space-4);
  }

  .navbar-menu.show {
    display: flex;
  }

  .navbar-toggle {
    display: block;
  }

  .modal-dialog {
    margin: var(--space-4);
  }

  .squares-grid {
    gap: 1px;
    padding: 1px;
  }

  .square-number {
    font-size: var(--text-sm);
  }

  .table {
    font-size: var(--text-sm);
  }

  .btn {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-4);
  }
}

/* ============================================
   17. SPECIAL COMPONENTS
   ============================================ */
/* Token Display */
.token-display {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #7c2d12;
  border-radius: var(--radius-full);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.token-icon {
  width: 24px;
  height: 24px;
  animation: rotate 10s linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

/* Game Stats */
.game-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-card);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--primary-600);
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Score Display */
.score-display {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.quarter-score {
  background: var(--bg-card);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  text-align: center;
  border: 2px solid var(--gray-200);
  transition: all var(--transition-base);
}

.quarter-score.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
  transform: scale(1.05);
}

.quarter-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.score-numbers {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

/* Prize Pool Display */
.prize-pool {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
  color: var(--text-inverse);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: 0 10px 30px rgba(76, 175, 80, 0.3);
}

.prize-amount {
  font-size: var(--text-5xl);
  font-weight: 700;
  margin: var(--space-4) 0;
}

.prize-label {
  font-size: var(--text-lg);
  opacity: 0.9;
}

/* ============================================
   18. FOOTER
   ============================================ */
.footer {
  background: var(--bg-tertiary);
  margin-top: auto;
  padding: var(--space-8) 0;
  border-top: 1px solid var(--gray-200);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}

.footer-section h4 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.footer-links {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: var(--space-2);
}

.footer-links a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary-600);
}

.footer-bottom {
  padding-top: var(--space-6);
  border-top: 1px solid var(--gray-200);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* ============================================
   19. LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 0%,
    var(--gray-100) 50%,
    var(--gray-200) 100%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-2);
}

.skeleton-button {
  height: 44px;
  width: 120px;
}

.skeleton-card {
  height: 200px;
}

/* ============================================
   20. PRINT STYLES
   ============================================ */
@media print {
  body {
    color: black;
    background: white;
  }

  .navbar,
  .footer,
  .btn,
  .modal {
    display: none !important;
  }

  .container {
    max-width: 100%;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}

/* ============================================
   21. MOBILE RESPONSIVE ENHANCEMENTS
   ============================================ */

/* Tablet Breakpoint */
@media (max-width: 1024px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .game-board {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .game-board table {
    min-width: 600px;
  }
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
  /* Adjust font sizes for mobile */
  :root {
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
  }

  /* Mobile Navigation */
  .navbar {
    padding: var(--space-3) var(--space-4);
  }

  .nav-menu {
    position: fixed;
    left: -100%;
    top: 60px;
    flex-direction: column;
    background-color: var(--bg-card);
    width: 100%;
    text-align: center;
    transition: 0.3s;
    box-shadow: var(--shadow-xl);
    padding: var(--space-4) 0;
    z-index: 999;
  }

  .nav-menu.active {
    left: 0;
  }

  .nav-link {
    padding: var(--space-3) var(--space-4);
    display: block;
    width: 100%;
  }

  /* Hamburger Menu */
  .hamburger {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: var(--space-2);
  }

  .hamburger .bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: var(--radius-sm);
  }

  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Game Stats Grid */
  .game-stats {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .stat-card {
    padding: var(--space-3);
  }

  .stat-value {
    font-size: var(--text-xl);
  }

  /* Cards */
  .card {
    margin-bottom: var(--space-4);
  }

  .card-body {
    padding: var(--space-4);
  }

  /* Tables - Make scrollable */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 500px;
  }

  .table th,
  .table td {
    padding: var(--space-2);
    font-size: var(--text-sm);
  }

  /* Forms */
  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Buttons */
  .btn {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }

  .btn-group {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  /* Game Board */
  .squares-grid {
    font-size: var(--text-xs);
  }

  .square {
    padding: var(--space-1);
    min-height: 35px;
  }

  /* Modals */
  .modal-content {
    margin: var(--space-4);
    width: calc(100% - var(--space-8));
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Page spacing */
  .container {
    padding-top: var(--space-6);
    padding-bottom: var(--space-6);
  }

  /* Headers */
  h1 {
    font-size: var(--text-3xl);
  }

  h2 {
    font-size: var(--text-2xl);
  }

  h3 {
    font-size: var(--text-xl);
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .container {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  /* Single column layouts */
  .game-stats {
    grid-template-columns: 1fr;
  }

  .token-packages {
    grid-template-columns: 1fr;
  }

  /* Stack buttons vertically */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    width: 100%;
  }

  /* Form rows stack */
  .form-row {
    flex-direction: column;
  }

  .form-row .form-group {
    width: 100%;
  }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .btn,
  .nav-link,
  .square,
  .form-control,
  .dropdown-item {
    min-height: 44px;
  }

  /* Remove hover effects on touch */
  .btn:hover,
  .card:hover {
    transform: none;
  }
}

/* Landscape Mobile */
@media (max-width: 812px) and (orientation: landscape) {
  .navbar {
    padding: var(--space-2) var(--space-4);
  }

  .container {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
  }

  .game-board {
    max-height: 70vh;
    overflow: auto;
  }
}

/* Utility Classes */
.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }

  .desktop-only {
    display: none;
  }

  .mobile-hidden {
    display: none !important;
  }
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* High Resolution Displays */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
  .card,
  .btn,
  .form-control {
    border-width: 0.5px;
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}