/* CSS Custom Properties - Design System Variables */

:root {
  /* Color Palette - Primary */
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-200: #bae6fd;
  --primary-300: #7dd3fc;
  --primary-400: #38bdf8;
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --primary-800: #075985;
  --primary-900: #0c4a6e;

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

  /* Semantic Colors */
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-200: #a7f3d0;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-200: #fde68a;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;

  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-200: #fecaca;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --error-700: #b91c1c;

  --info-50: #eff6ff;
  --info-500: #3b82f6;
  --info-600: #2563eb;
  --info-700: #1d4ed8;

  /* Board Colors */
  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --board-highlight: #f7e98e;
  --board-move: #86efac;
  --board-capture: #fca5a5;
  --board-upgrade: #fbbf24;
  --board-wall: #6b7280;

  /* Typography Scale */
  --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 */

  /* Font Weights */
  --font-thin: 100;
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  --font-black: 900;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Spacing Scale */
  --space-0: 0;
  --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 */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  --space-32: 8rem;      /* 128px */

  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 0.125rem;  /* 2px */
  --radius-base: 0.25rem; /* 4px */
  --radius-md: 0.375rem;  /* 6px */
  --radius-lg: 0.5rem;    /* 8px */
  --radius-xl: 0.75rem;   /* 12px */
  --radius-2xl: 1rem;     /* 16px */
  --radius-3xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 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);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;

  /* 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;

  /* Layout Variables */
  --header-height: 4rem;      /* 64px */
  --sidebar-width: 14rem;     /* 224px */
  --sidebar-width-collapsed: 4rem; /* 64px */
  --content-max-width: 80rem; /* 1280px */

  /* Breakpoints (for reference in media queries) */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --neutral-50: #111827;
  --neutral-100: #1f2937;
  --neutral-200: #374151;
  --neutral-300: #4b5563;
  --neutral-400: #6b7280;
  --neutral-500: #9ca3af;
  --neutral-600: #d1d5db;
  --neutral-700: #e5e7eb;
  --neutral-800: #f3f4f6;
  --neutral-900: #f9fafb;

  /* Adjust board colors for dark theme */
  --board-light: #d4af8c;
  --board-dark: #8b6f47;
  --board-highlight: #f7e98e;
  --board-move: #22c55e;
  --board-capture: #ef4444;
  --board-upgrade: #f59e0b;
  --board-wall: #4b5563;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }
}
/* Modern CSS Reset */

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

/* Remove default margin */
* {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set core root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

html {
  height: 100%;
}

/* Set core body defaults */
body {
  min-height: 100%;
  text-rendering: optimizeSpeed;
  line-height: 1.5;
  font-family: 'EB Garamond', 'Garamond', 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
   scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* Typography System */

/* Font Face Declarations */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;600;700&display=swap');

/* Base Typography */
body {
  font-family: 'EB Garamond', 'Garamond', 'Times New Roman', serif;
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--neutral-900);
  background-color: var(--neutral-50);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--neutral-900);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
}

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

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

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

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

h6 {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

/* Paragraphs */
p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}

/* Links */
a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

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

/* Code */
code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.875em;
  background-color: var(--neutral-100);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--neutral-800);
}

pre {
  background-color: var(--neutral-100);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--primary-500);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--neutral-700);
}

/* Small text */
small {
  font-size: var(--text-sm);
  color: var(--neutral-600);
}

/* Strong and emphasis */
strong, b {
  font-weight: var(--font-semibold);
}

em, i {
  font-style: italic;
}

/* Utility Classes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.font-thin { font-weight: var(--font-thin); }
.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }
.font-black { font-weight: var(--font-black); }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.leading-none { line-height: var(--leading-none); }
.leading-tight { line-height: var(--leading-tight); }
.leading-snug { line-height: var(--leading-snug); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }
.leading-loose { line-height: var(--leading-loose); }

/* Color utilities */
.text-primary { color: var(--primary-600); }
.text-success { color: var(--success-600); }
.text-warning { color: var(--warning-600); }
.text-error { color: var(--error-600); }
.text-info { color: var(--info-600); }
.text-neutral-500 { color: var(--neutral-500); }
.text-neutral-600 { color: var(--neutral-600); }
.text-neutral-700 { color: var(--neutral-700); }
.text-neutral-800 { color: var(--neutral-800); }
.text-neutral-900 { color: var(--neutral-900); }
/* Game Layout - Main responsive layout for chess games */

.game-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  background-color: transparent;
}

/* Sidebar */
.game-sidebar {
  width: var(--sidebar-width);
  background-color: var(--neutral-100);
  border-right: 0.0625rem solid var(--neutral-200);
  padding: var(--space-3);
  overflow-y: auto;
  transition: transform var(--transition-base);
  z-index: var(--z-sticky);
}

.game-sidebar.collapsed {
  transform: translateX(-100%);
}

/* Main game area */
.game-main {
  background: none;
  flex: 1;
  display: block;
  min-width: 0; /* Prevents flex item from overflowing */
}

/* Board section */
.board-section {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  background: none;
  min-height: calc(100vh - var(--header-height));
}

.board-container {
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

/* Game controls */
.game-controls {
  padding: var(--space-6);
  background-color: var(--neutral-100);
  border-top: 0.0625rem solid var(--neutral-200);
}

/* Mobile Layout */
@media (max-width: 768px) {
  .game-layout {
    flex-direction: column;
  }
  
  .game-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: translateX(-100%);
    z-index: var(--z-modal);
    background-color: var(--neutral-50);
    border-right: none;
    border-bottom: 0.0625rem solid var(--neutral-200);
  }
  
  .game-sidebar.open {
    transform: translateX(0);
  }
  
  .game-main {
    width: 100%;
  }
  
  .board-section {
    padding: var(--space-3) var(--space-4);
    position: sticky;
    top: var(--header-height);
  }
  
  .game-controls {
    padding: var(--space-4);
  }
}

/* Tablet Layout */
@media (min-width: 769px) and (max-width: 1024px) {
  .game-sidebar {
    width: 16rem; /* 256px */
  }
  
  .board-section {
    padding: var(--space-3) var(--space-4);
  }
}

/* Large Desktop */
@media (min-width: 1280px) {
  .game-layout {
    max-width: var(--content-max-width);
    margin: 0 auto;
  }
  
  .board-section {
    padding: var(--space-4) var(--space-8);
  }
}
/* Header Component - Modern navigation header */

.app-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  background-color: var(--neutral-50);
  border-bottom: 1px solid var(--neutral-200);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

/* Page-specific header content */
.page-header-content {
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  background: linear-gradient(135deg, var(--neutral-50, #f9fafb) 0%, var(--neutral-100, #f3f4f6) 100%);
  border-bottom: 1px solid #e5e7eb;
  border-bottom: 1px solid var(--neutral-200, #e5e7eb);
  padding: 1.5rem 1.5rem;
  padding: var(--space-6, 1.5rem) var(--space-6, 1.5rem);
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 1.5rem;
  gap: var(--space-6, 1.5rem);
  max-width: 80rem;
  max-width: var(--content-max-width, 80rem);
  margin: 0 auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.page-header-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-600), var(--primary-500));
  opacity: 0.8;
}

.page-header-content:empty {
  display: none;
}

/* Page header components */
.page-header-title {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  color: var(--neutral-900, #111827);
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.page-header-subtitle {
  font-size: 1rem;
  color: #4b5563;
  color: var(--neutral-600, #4b5563);
  margin: 0;
  margin-top: 0.5rem;
  margin-top: var(--space-2, 0.5rem);
  font-weight: 500;
  line-height: 1.4;
}

.page-header-tabs {
  display: flex;
  gap: 0.25rem;
  gap: var(--space-1, 0.25rem);
  align-items: center;
  background-color: #e5e7eb;
  background-color: var(--neutral-200, #e5e7eb);
  padding: 0.25rem;
  padding: var(--space-1, 0.25rem);
  border-radius: 0.5rem;
  border-radius: var(--radius-lg, 0.5rem);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  height: fit-content;
}

.page-header-tab {
  padding: 0.75rem 1rem;
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  background-color: transparent;
  color: #374151;
  color: var(--neutral-700, #374151);
  text-decoration: none;
  border-radius: 0.375rem;
  border-radius: var(--radius-md, 0.375rem);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  white-space: nowrap;
  position: relative;
}

.page-header-tab:hover {
  background-color: #d1d5db;
  background-color: var(--neutral-300, #d1d5db);
  color: #111827;
  color: var(--neutral-900, #111827);
  text-decoration: none;
  transform: translateY(-1px);
}

.page-header-tab.active {
  background-color: white;
  color: #0369a1;
  color: var(--primary-700, #0369a1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.page-header-actions {
  display: flex;
  gap: 0.75rem;
  gap: var(--space-3, 0.75rem);
  align-items: center;
  flex-wrap: nowrap;
  flex: 1;
}

/* Button styles for page header actions */
.page-header-actions .btn-primary,
.page-header-actions .btn-secondary,
.page-header-actions .btn-danger {
  padding: 0.75rem 1.25rem;
  padding: var(--space-3, 0.75rem) var(--space-5, 1.25rem);
  border-radius: 0.375rem;
  border-radius: var(--radius-md, 0.375rem);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  gap: var(--space-2, 0.5rem);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Action buttons bar - similar to tabs but for action buttons */
.page-header-actions-bar {
  display: flex;
  gap: 0.5rem;
  gap: var(--space-2, 0.5rem);
  align-items: center;
  background-color: #f3f4f6;
  background-color: var(--neutral-100, #f3f4f6);
  padding: 0.5rem;
  padding: var(--space-2, 0.5rem);
  border-radius: 0.5rem;
  border-radius: var(--radius-lg, 0.5rem);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  height: fit-content;
  border: 1px solid #e5e7eb;
  border: 1px solid var(--neutral-200, #e5e7eb);
}

/* Action button styles */
.page-header-action-btn {
  padding: 0.5rem 1rem;
  padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
  background-color: transparent;
  color: #374151;
  color: var(--neutral-700, #374151);
  text-decoration: none;
  border-radius: 0.375rem;
  border-radius: var(--radius-md, 0.375rem);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
}

.page-header-action-btn:hover {
  background-color: #f9fafb;
  background-color: var(--neutral-50, #f9fafb);
  color: #111827;
  color: var(--neutral-900, #111827);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-header-action-btn-primary {
  background-color: #0284c7;
  background-color: var(--primary-600, #0284c7);
  color: white;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3);
}

.page-header-action-btn-primary:hover {
  background-color: #0369a1;
  background-color: var(--primary-700, #0369a1);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(2, 132, 199, 0.4);
}

.page-header-action-btn-secondary {
  background-color: #6b7280;
  background-color: var(--neutral-500, #6b7280);
  color: white;
  box-shadow: 0 1px 3px rgba(107, 114, 128, 0.3);
}

.page-header-action-btn-secondary:hover {
  background-color: #4b5563;
  background-color: var(--neutral-600, #4b5563);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(107, 114, 128, 0.4);
}

.page-header-actions .btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  background: linear-gradient(135deg, var(--primary-600, #0284c7), var(--primary-700, #0369a1));
  color: white;
}

.page-header-actions .btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  background: linear-gradient(135deg, var(--primary-700, #0369a1), var(--primary-800, #075985));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.page-header-actions .btn-secondary {
  background: linear-gradient(135deg, #4b5563, #374151);
  background: linear-gradient(135deg, var(--neutral-600, #4b5563), var(--neutral-700, #374151));
  color: white;
}

.page-header-actions .btn-secondary:hover {
  background: linear-gradient(135deg, #374151, #1f2937);
  background: linear-gradient(135deg, var(--neutral-700, #374151), var(--neutral-800, #1f2937));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.page-header-actions .btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
}

.page-header-actions .btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.page-header-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
  justify-content: center;
  height: 100%;
}

/* Responsive page header */
@media (max-width: 768px) {
  .page-header-content {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-4);
    min-height: auto;
  }
  
  .page-header-title {
    font-size: 1.5rem;
    text-align: center;
  }
  
  .page-header-subtitle {
    text-align: center;
    font-size: 0.9rem;
  }
  
  .page-header-tabs {
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-1);
  }
  
  .page-header-tab {
    padding: var(--space-2) var(--space-3);
    font-size: 0.8rem;
  }
  
  .page-header-actions {
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .page-header-actions .btn-primary,
  .page-header-actions .btn-secondary,
  .page-header-actions .btn-danger {
    padding: var(--space-2) var(--space-4);
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .page-header-content {
    padding: var(--space-3) var(--space-3);
  }
  
  .page-header-title {
    font-size: 1.25rem;
  }
  
  .page-header-tabs {
    flex-direction: column;
    gap: var(--space-1);
  }
  
  .page-header-tab {
    width: 100%;
    text-align: center;
  }
  
  .page-header-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .page-header-actions .btn-primary,
  .page-header-actions .btn-secondary,
  .page-header-actions .btn-danger {
    width: 100%;
    justify-content: center;
  }
}

/* Responsive header buttons */
@media (max-width: 768px) {
  .header-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    margin-left: 0.25rem;
  }
  
  .header-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .header-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-left: 0;
  }
  
  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }
  
  .header-btn {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }
}

/* Special styling for board editor buttons */
.page-header-actions button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

/* Icon styling for buttons */
.page-header-actions .rotate-icon,
.page-header-actions .history-icon,
.page-header-actions .resign-icon {
  font-size: 1rem;
  margin-right: var(--space-1);
}

.app-header-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  min-height: var(--header-height);
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* App Title */
.app-title {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--neutral-900);
}

.app-title-link {
  color: var(--neutral-900);
  text-decoration: none;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-title-link:hover {
  color: var(--primary-600);
  text-decoration: none;
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.user-info {
  color: var(--neutral-600);
  font-size: var(--text-sm);
  padding-right: var(--space-3);
  border-right: 1px solid var(--neutral-300);
  font-weight: var(--font-medium);
}

/* Header Links */
.header-link {
  color: var(--neutral-700);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
  position: relative;
}

.header-link:hover {
  background-color: var(--neutral-100);
  color: var(--primary-600);
  text-decoration: none;
}

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

.header-link.logout {
  color: var(--error-600);
}

.header-link.logout:hover {
  background-color: var(--error-50);
  color: var(--error-700);
}

.header-link.admin-link {
  color: var(--success-600);
  font-weight: var(--font-semibold);
}

.header-link.admin-link:hover {
  background-color: var(--success-50);
}

/* Header button styles */
.header-btn {
  padding: 0.5rem 1rem;
  padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
  border-radius: 0.375rem;
  border-radius: var(--radius-md, 0.375rem);
  font-size: 0.875rem;
  font-size: var(--text-sm, 0.875rem);
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  gap: var(--space-1, 0.25rem);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-left: 0.5rem;
  margin-left: var(--space-2, 0.5rem);
}

.header-btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  background: linear-gradient(135deg, var(--primary-600, #0284c7), var(--primary-700, #0369a1));
  color: white;
}

.header-btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  background: linear-gradient(135deg, var(--primary-700, #0369a1), var(--primary-800, #075985));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: white;
}

.header-btn-secondary {
  background: linear-gradient(135deg, #4b5563, #374151);
  background: linear-gradient(135deg, var(--neutral-600, #4b5563), var(--neutral-700, #374151));
  color: white;
}

.header-btn-secondary:hover {
  background: linear-gradient(135deg, #374151, #1f2937);
  background: linear-gradient(135deg, var(--neutral-700, #374151), var(--neutral-800, #1f2937));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: white;
}

/* Subtle navigation button style */
.header-btn-nav {
  background: transparent;
  background: var(--neutral-100, #f3f4f6);
  color: #374151;
  color: var(--neutral-700, #374151);
  border: 1px solid #e5e7eb;
  border: 1px solid var(--neutral-200, #e5e7eb);
  box-shadow: none;
}

.header-btn-nav:hover {
  background: #f9fafb;
  background: var(--neutral-50, #f9fafb);
  color: #111827;
  color: var(--neutral-900, #111827);
  border-color: #d1d5db;
  border-color: var(--neutral-300, #d1d5db);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

/* Admin button style */
.header-btn-admin {
  background: linear-gradient(135deg, #059669, #047857);
  background: linear-gradient(135deg, var(--success-600, #059669), var(--success-700, #047857));
  color: white;
}

.header-btn-admin:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  background: linear-gradient(135deg, var(--success-700, #047857), var(--success-800, #065f46));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
  text-decoration: none;
  color: white;
}

/* User info button style */
.header-btn-user {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  background: linear-gradient(135deg, var(--primary-50, #f0f9ff), var(--primary-100, #e0f2fe));
  color: #0369a1;
  color: var(--primary-700, #0369a1);
  border: 1px solid #bae6fd;
  border: 1px solid var(--primary-200, #bae6fd);
  cursor: default;
  font-weight: 500;
}

.header-btn-user:hover {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  background: linear-gradient(135deg, var(--primary-100, #e0f2fe), var(--primary-200, #bae6fd));
  color: #075985;
  color: var(--primary-800, #075985);
  transform: none;
  box-shadow: 0 2px 4px rgba(3, 105, 161, 0.1);
  text-decoration: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--neutral-700);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
  background-color: var(--neutral-100);
  color: var(--primary-600);
}

.mobile-menu-toggle:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Hamburger Icon */
.hamburger {
  width: 24px;
  height: 24px;
  position: relative;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  border-radius: 1px;
  transition: all var(--transition-fast);
  position: absolute;
}

.hamburger span:nth-child(1) {
  top: 6px;
}

.hamburger span:nth-child(2) {
  top: 12px;
}

.hamburger span:nth-child(3) {
  top: 18px;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

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

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Layout */
@media (max-width: 768px) {
  .app-header-inner {
    padding: 0 var(--space-4);
  }
  
  .app-title {
    font-size: var(--text-xl);
  }
  
  .header-actions {
    gap: var(--space-2);
  }
  
  .user-info {
    display: none;
  }
  
  .header-link {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .header-link.logout {
    display: block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }
}

/* Tablet Layout */
@media (min-width: 769px) and (max-width: 1024px) {
  .app-header-inner {
    padding: 0 var(--space-5);
  }
  
  .header-actions {
    gap: var(--space-3);
  }
  
  .header-link {
    padding: var(--space-2);
    font-size: var(--text-sm);
  }
}
/* Game Sidebar Component */

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.sidebar-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--neutral-900);
  margin: 0;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--neutral-600);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-close:hover {
  background-color: var(--neutral-200);
  color: var(--neutral-900);
}

/* Game Status Card */
.game-status-card {
  background-color: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.game-status-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--neutral-700);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.turn-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--neutral-900);
}

.turn-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.turn-player-details {
  font-size: var(--text-sm);
  color: var(--neutral-600);
}

.turn-player-details .player-name {
  font-weight: var(--font-medium);
  color: var(--neutral-800);
}

.turn-player-details .player-email {
  font-size: var(--text-xs);
  color: var(--neutral-500);
}

.turn-color {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--neutral-300);
}

.turn-color.white {
  background-color: #ffffff;
  border-color: var(--neutral-400);
}

.turn-color.black {
  background-color: var(--neutral-800);
}

.turn-color.red {
  background-color: #dc2626;
}

.turn-color.blue {
  background-color: #2563eb;
}

/* Pulsing gold border effect for user's turn */
.game-status-card.user-turn {
  animation: pulse-gold 2s ease-in-out infinite;
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
}

@keyframes pulse-gold {
  0% {
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
    border-color: #fbbf24;
  }
  50% {
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.6);
    border-color: #f59e0b;
  }
  100% {
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
    border-color: #fbbf24;
  }
}

/* Player Info Cards */
.player-info-card {
  background-color: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}

.player-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.player-color {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-medium);
  color: var(--neutral-900);
}

.player-color-indicator {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--neutral-300);
}

.player-color-indicator.white {
  background-color: #ffffff;
  border-color: var(--neutral-400);
}

.player-color-indicator.black {
  background-color: var(--neutral-800);
}

.player-color-indicator.red {
  background-color: #dc2626;
}

.player-color-indicator.blue {
  background-color: #2563eb;
}

.player-name {
  font-size: var(--text-sm);
  color: var(--neutral-600);
}

.ai-badge {
  background-color: var(--primary-100);
  color: var(--primary-700);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Game Results */
.game-results {
  background-color: var(--success-50);
  border: 1px solid var(--success-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}

.game-results.completed {
  background-color: var(--success-50);
  border-color: var(--success-200);
}

.game-results h3 {
  color: var(--success-700);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
  text-align: center;
}

.results-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.result-category {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.result-category.winners {
  background-color: var(--success-100);
  border: 1px solid var(--success-200);
}

.result-category.losers {
  background-color: var(--error-100);
  border: 1px solid var(--error-200);
}

.result-category.draws {
  background-color: var(--warning-100);
  border: 1px solid var(--warning-200);
}

.result-category.resignation {
  background-color: var(--neutral-100);
  border: 1px solid var(--neutral-300);
}

.result-category-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.result-category.winners .result-category-title {
  color: var(--success-700);
}

.result-category.losers .result-category-title {
  color: var(--error-700);
}

.result-category.draws .result-category-title {
  color: var(--warning-700);
}

.result-category.resignation .result-category-title {
  color: var(--neutral-700);
}

.result-player {
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--neutral-700);
}

/* Game Controls */
.game-controls-section {
  background-color: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

.control-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background-color: var(--primary-600);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  width: 100%;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.control-btn:hover {
  background-color: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.control-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Fullscreen Mode Button */
.fullscreen-mode-btn {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  width: 100%;
  justify-content: center;
  font-weight: var(--font-semibold);
}

.fullscreen-mode-btn:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.fullscreen-mode-btn.active {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.fullscreen-mode-btn.active:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.fullscreen-mode-btn.active .fullscreen-mode-text::after {
  content: " (Active)";
  font-weight: normal;
  opacity: 0.8;
}

/* Toggle UI Button (appears in fullscreen mode) */
.toggle-ui-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all var(--transition-fast);
}

.toggle-ui-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toggle-ui-btn:active {
  transform: translateY(0);
}

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

.control-btn:last-child {
  margin-bottom: 0;
}

.rotate-icon {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
}

/* Instructions */
.instructions-section {
  background-color: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

.instructions-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--neutral-900);
  margin-bottom: var(--space-3);
}

.instructions-text {
  font-size: var(--text-sm);
  color: var(--neutral-600);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
}

.instructions-text:last-child {
  margin-bottom: 0;
}

.instruction-examples {
  margin-top: var(--space-4);
}

.example-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

.example-label {
  color: var(--neutral-700);
  font-weight: var(--font-medium);
}

.example-square {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--neutral-300);
  flex-shrink: 0;
}

.example-square.light {
  background-color: var(--board-light);
}

.example-square.dark {
  background-color: var(--board-dark);
}

.example-square.wall {
  background-color: var(--board-wall);
}

.example-square.upgrade {
  background-color: var(--board-upgrade);
}

.example-square.movable {
  background-color: var(--board-move);
}

/* Mobile Layout */
/* Move History Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.history-modal {
  width: 800px;
  max-width: 90vw;
}

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

.modal-header h2 {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--neutral-900);
}

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

.modal-close:hover {
  background: var(--neutral-200);
  color: var(--neutral-700);
}

.modal-body {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.modal-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--neutral-200);
  background: var(--neutral-50);
  display: flex;
  justify-content: flex-end;
}

.history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--neutral-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--neutral-200);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.navigation-controls {
  display: flex;
  gap: var(--space-2);
}

.move-counter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.move-counter label {
  font-weight: var(--font-medium);
  color: var(--neutral-700);
}

.move-input {
  width: 60px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: var(--text-sm);
}

.move-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
}

.history-info {
  font-weight: var(--font-medium);
  color: var(--neutral-700);
  font-size: var(--text-sm);
}



.btn-secondary {
  background: var(--neutral-600);
  color: white;
  border-color: var(--neutral-600);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--neutral-700);
  border-color: var(--neutral-700);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--neutral-600);
  border-color: var(--neutral-300);
}

.btn-outline:hover:not(:disabled) {
  background: var(--neutral-100);
  border-color: var(--neutral-400);
}

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

@media (max-width: 768px) {
  .game-sidebar {
    padding: var(--space-4);
    gap: var(--space-4);
  }
  
  .sidebar-close {
    display: block;
  }
  
  .game-status-card,
  .player-info-card,
  .game-results,
  .game-controls-section,
  .instructions-section {
    padding: var(--space-3);
  }
  
  .control-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }
  
  .history-modal {
    width: 95vw;
    max-height: 95vh;
  }
  
  .history-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .navigation-controls {
    justify-content: center;
  }
  
  .move-counter {
    justify-content: center;
  }
  
  .history-info {
    text-align: center;
  }
  

}
/* Enhanced Board Component - Modern chess board styling */

.chess-board, #board {
  position: relative;
  border: 0.1875rem solid var(--neutral-300);
  border-radius: var(--radius-lg);
  margin: 0 auto;
  aspect-ratio: var(--board-aspect-ratio, 1);
  display: grid;
  grid-template-rows: repeat(var(--board-height, 8), 1fr);
  grid-template-columns: repeat(var(--board-width, 8), 1fr);
  gap: 0;
  line-height: 0;
  font-size: 0;
  box-sizing: border-box;
  box-shadow: var(--shadow-lg);
  background-color: var(--neutral-100);
  overflow: hidden;
  transition: transform var(--transition-base);
  transform-origin: center center;
  --rotation-degrees: 0deg;
  
  /* Responsive sizing with minimal margins */
  /* On desktop: account for sidebar + minimal margins */
  width: min(calc(100vw - 15rem), calc(100vh - 5rem) * var(--board-aspect-ratio, 1));
  height: min(calc(100vh - 5rem), calc(100vw - 15rem) / var(--board-aspect-ratio, 1));
  
  /* Ensure minimum size for very small screens */
  min-width: 12.5rem;
  min-height: 12.5rem;
}

/* Board Squares */
.square {
  border: 0.125rem solid var(--neutral-300);
  position: relative;
  display: block;
  cursor: pointer;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  transition: all var(--transition-fast);
}

/* Square Colors - Modern chess board theme */
.square.light {
  background-color: var(--board-light);
}

.square.dark {
  background-color: var(--board-dark);
}

/* Square States */
.square:hover {
  box-shadow: inset 0 0 0 0.005rem var(--primary-400);
  z-index: 1;
}

/*.chess-board:not(.fullscreen) .square.movable {*/
.chess-board .square.movable {  
  background-color: var(--board-move);
  animation: moveHighlight 2s ease-in-out infinite;
  box-shadow: 0 0 0 0.005rem var(--success-400);
}

.chess-board .square.killable {
/*.chess-board:not(.fullscreen) .square.killable {*/
  background-color: var(--board-capture);
  animation: captureHighlight 2s ease-in-out infinite;
  box-shadow: 0 0 0 0.005rem var(--error-400);
}


.square.selected {
  background-color: var(--primary-200);
  box-shadow: inset 0 0 0 0.01rem var(--primary-600);
  z-index: 2;
}

/* Special Square Types */
.square.wall {
  background-image: url(/greenish-wall.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 0.125rem solid var(--neutral-600);
  cursor: not-allowed;
}

.square.upgrade {
  background: linear-gradient(135deg, var(--board-upgrade) 0%, #fbbf24 50%, var(--board-upgrade) 100%);
  position: relative;
}

/* .square.upgrade::after {
  content: '★';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--neutral-800);
  font-size: 0.75rem;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
} */

/* Upgrade square combinations */
.square.upgrade.movable {
  background: linear-gradient(135deg, var(--board-upgrade) 0%, #fbbf24 50%, var(--board-upgrade) 100%);
  animation: upgradeMoveHighlight 2s ease-in-out infinite;
  box-shadow: 0 0 0 0.005rem var(--warning-400);
}

.square.upgrade.killable {
  background: linear-gradient(135deg, var(--board-upgrade) 0%, #fbbf24 50%, var(--board-upgrade) 100%);
  animation: upgradeCaptureHighlight 2s ease-in-out infinite;
  box-shadow: 0 0 0 0.005rem var(--error-400);
}

/* Castling indicator */
.square.castling {
  background: linear-gradient(135deg, var(--info-400) 0%, var(--info-500) 50%, var(--info-400) 100%);
  box-shadow: 0 0 0 0.01rem var(--warning-400);
  animation: castlingGlow 2s ease-in-out infinite alternate;
}

/* Last move indicators */
.square.last-move-from {
  position: relative;
  animation: lastMoveFrom 3s ease-in-out infinite;
}

.square.last-move-to {
  position: relative;
  animation: lastMoveTo 3s ease-in-out infinite;
}

/* Piece positioning */
.chess-board .piece, #board .piece {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  height: 85%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  display: block;
  transition: transform var(--transition-base);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* First move indicator */
.piece[data-first-move="true"]::after {
  content: '';
  position: absolute;
  top: -0.175rem;
  right: -0.175rem;
  width: 0.025rem;
  height: 0.025rem;
  background-color: var(--success-500);
  border: 0.025rem solid var(--success-700);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

/* Animations */
@keyframes moveHighlight {
  0%, 100% {
    box-shadow: 0 0 0 0.005rem var(--success-400);
  }
  50% {
    box-shadow: 0 0 0 0.002rem var(--success-500);
  }
}

@keyframes captureHighlight {
  0%, 100% {
    box-shadow: 0 0 0 0.005rem var(--error-400);
  }
  50% {
    box-shadow: 0 0 0 0.002rem var(--error-500);
  }
}

@keyframes upgradeMoveHighlight {
  0%, 100% {
    box-shadow: 0 0 0 0.005rem var(--warning-400);
  }
  50% {
    box-shadow: 0 0 0 0.002rem var(--warning-500);
  }
}

@keyframes upgradeCaptureHighlight {
  0%, 100% {
    box-shadow: 0 0 0 0.005rem var(--error-400);
  }
  50% {
    box-shadow: 0 0 0 0.002rem var(--error-500);
  }
}

@keyframes castlingGlow {
  0% {
    box-shadow: 0 0 0 0.01rem var(--warning-400);
  }
  100% {
    box-shadow: 0 0 0 0.003rem var(--warning-500);
  }
}

@keyframes lastMoveFrom {
  0%, 100% {
    box-shadow: inset 0 0 0 0.005rem var(--neutral-400);
  }
  50% {
    box-shadow: inset 0 0 0 0.002rem var(--neutral-500);
  }
}

@keyframes lastMoveTo {
  0%, 100% {
    box-shadow: inset 0 0 0 0.01rem var(--neutral-400);
  }
  50% {
    box-shadow: inset 0 0 0 0.003rem var(--neutral-500);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .chess-board, #board {
    /* On mobile: full width minus margins, sidebar is overlay */
    width: min(90vw, calc(90vh * var(--board-aspect-ratio, 1)));
    height: min(90vh, calc(90vw / var(--board-aspect-ratio, 1)));
    border-width: 0.125rem;
    border-radius: var(--radius-md);
  }
  
  
  .piece[data-first-move="true"]::after {
    width: 0.05rem;
    height: 0.05rem;
    top: -0.025rem;
    right: -0.025rem;
  }
}

@media (max-width: 480px) {
  .chess-board, #board {
    /* On very small screens: use more of the available space */
    width: min(95vw, calc(95vh * var(--board-aspect-ratio, 1)));
    height: min(95vh, calc(95vw / var(--board-aspect-ratio, 1)));
    border-width: 0.0625rem;
  }
  
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .square.light {
    background-color: #ffffff;
  }
  
  .square.dark {
    background-color: #000000;
  }
  
  .square.movable {
    background-color: #00ff00;
  }
  
  .square.killable {
    background-color: #ff0000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .square.movable,
  .square.killable,
  .square.upgrade.movable,
  .square.upgrade.killable,
  .square.castling,
  .square.last-move-from,
  .square.last-move-to {
    animation: none;
  }
  
  
  
  
  /* Fullscreen overrides for reduced motion - removed conflicting rule */
  
  
  body.fullscreen-mode .chess-board.fullscreen .square.selected {
    box-shadow: inset 0 0 0 1px var(--primary-600) !important;
    background-color: var(--primary-200) !important;
  }
}






/* Last-move effects - moved up so killable can override */
/* Last-move rules moved up to proper cascade order */

/* Movable squares on hover - override base hover effect */
/*body.fullscreen-mode .chess-board.fullscreen .square.movable:hover {
  background-color: #8b0000 !important;
  box-shadow: 0 0 0 2px #22c55e !important;
  z-index: 15 !important;
}

 Killable squares on hover - override base hover effect 
body.fullscreen-mode .chess-board.fullscreen .square.killable:hover {
  background-color: #fca5a5 !important;
  box-shadow: 0 0 0 2px# 8b0000 !important;
  z-index: 15 !important;
}
*/

/* Fullscreen animation keyframes using fixed px units */
/* Old animations removed - using new smaller ones */


/* Removed conflicting killable override rule */


@keyframes lastMoveFromFullscreen {
  0%, 100% {
    opacity: 0.8;
    filter: drop-shadow(0 0 2px #6b7280) brightness(1.2);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 4px #9ca3af) brightness(1.4);
  }
}

@keyframes lastMoveToFullscreen {
  0%, 100% {
    opacity: 0.8;
    filter: drop-shadow(0 0 2px #6b7280) brightness(1.2);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 4px #9ca3af) brightness(1.4);
  }
}

@keyframes movableFlash {
  0%, 100% {
    filter: drop-shadow(0 0 1px #daa520) brightness(1.1);
  }
  50% {
    filter: drop-shadow(0 0 2px #ffd700) brightness(1.2);
  }
}

@keyframes killableFlash {
  0%, 100% {
    filter: drop-shadow(0 0 1px #ef4444) brightness(1.1);
  }
  50% {
    filter: drop-shadow(0 0 2px #dc2626) brightness(1.2);
  }
}

@keyframes lastMoveFlash {
  0%, 100% {
    opacity: 0.8;
    filter: drop-shadow(0 0 2px #6b7280) brightness(1.2);
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 4px #9ca3af) brightness(1.4);
  }
}

/* Removed conflicting override rule */


/* Clean fullscreen overrides - no duplicates - MOVED TO MEDIA QUERY */

/* Killable rule moved to media query */

/*body.fullscreen-mode .chess-board.fullscreen .square.selected {
  background-color: var(--primary-200) !important;
  z-index: 2 !important;
  box-shadow: inset 0 0 0 4px var(--primary-600) !important;
}*/
/*
body.fullscreen-mode .chess-board.fullscreen .square.upgrade.movable {
  animation: upgradeMoveHighlightFullscreen 2s ease-in-out infinite !important;
  background: linear-gradient(135deg, var(--board-upgrade) 0%, #fbbf24 50%, var(--board-upgrade) 100%) !important;
  box-shadow: 0 0 0 0.1px var(--warning-400) !important;
}

body.fullscreen-mode .chess-board.fullscreen .square.upgrade.killable {
  animation: upgradeCaptureHighlightFullscreen 2s ease-in-out infinite !important;
  background: linear-gradient(135deg, var(--board-upgrade) 0%, #fbbf24 50%, var(--board-upgrade) 100%) !important;
  box-shadow: 0 0 0 0.1px var(--error-400) !important;
}

body.fullscreen-mode .chess-board.fullscreen .square.castling {
  animation: castlingGlowFullscreen 2s ease-in-out infinite alternate !important;
  background: linear-gradient(135deg, var(--info-400) 0%, var(--info-500) 50%, var(--info-400) 100%) !important;
  box-shadow: 0 0 0 0.1px var(--warning-400) !important;
}*/

/* Last-move rules moved up to proper cascade order */

/*body.fullscreen-mode .chess-board.fullscreen .square.selected {
  background-color: var(--primary-200) !important;
  z-index: 2 !important;
  box-shadow: inset 0 0 0 2px var(--primary-600) !important;
}

*/
/* Last-move rules moved up to proper cascade order */


/* Board Modal Styles - For displaying boards in modals and previews */

/* Modal Board Container */
.modal-board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-4);
  background: var(--neutral-100);
  border-radius: var(--radius-md);
  min-height: 300px;
}

/* Modal Board - Non-interactive display board */
.modal-board {
  display: grid;
  border: 2px solid #2d5016;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  background: #2d5016;
  gap: 1px;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--board-aspect-ratio, 1);
}

/* Modal Board Squares */
.modal-board .square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  margin: 0;
  padding: 0;
  cursor: default; /* Non-interactive */
  transition: none; /* No hover effects */
  min-height: 30px;
  min-width: 30px;
}

/* Remove all interactive styles */
.modal-board .square:hover {
  transform: none;
  box-shadow: none;
  z-index: auto;
}

.modal-board .square:active {
  transform: none;
}

/* Green field square colors - matching game display */
.modal-board .square.light {
  background-color: #9acd32; /* Leaf green */
}

.modal-board .square.dark {
  background-color: #6b8e23; /* Olive green */
}

/* Special square types for modal */
.modal-board .square.wall {
  background-image: url(/greenish-wall.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 2px solid #2f1b14;
}

.modal-board .square.light.upgrade {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4a 50%, #ffd700 100%);
}

.modal-board .square.dark.upgrade {
  background: linear-gradient(135deg, #daa520 0%, #ffed4a 50%, #daa520 100%);
}

/* Modal Board Pieces - Use existing piece system */
.modal-board .piece {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background-size: 50%;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none; /* Non-interactive */
  user-select: none;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Remove all piece interaction styles */
.modal-board .piece:hover {
  transform: translate(-50%, -50%);
  box-shadow: none;
  z-index: 10;
}

.modal-board .piece:active {
  transform: translate(-50%, -50%);
}

/* Remove first move indicators for modal display */
.modal-board .piece[data-first-move="true"]::after {
  display: none;
}

/* Modal Board Grid Layout */
.modal-board {
  grid-template-columns: repeat(var(--board-width, 8), 1fr);
  grid-template-rows: repeat(var(--board-height, 8), 1fr);
}

/* Responsive sizing for modal boards */
@media (max-width: 768px) {
  .modal-board-container {
    padding: var(--space-2);
    min-height: 250px;
  }
  
  .modal-board .piece {
    background-size: 45%;
  }
  
  .modal-board .square {
    min-height: 25px;
    min-width: 25px;
  }
}

@media (max-width: 480px) {
  .modal-board-container {
    padding: var(--space-1);
    min-height: 200px;
  }
  
  .modal-board .piece {
    background-size: 40%;
  }
  
  .modal-board .square {
    min-height: 20px;
    min-width: 20px;
  }
}

/* History Modal Specific Styles */
.history-modal .modal-board-container {
  min-height: 400px;
}

.history-modal .modal-board {
  max-width: 500px;
  max-height: 500px;
}

/* Board Preview Specific Styles (for board creation flow) */
.board-preview .modal-board-container {
  min-height: 200px;
  max-height: 300px;
}

.board-preview .modal-board {
  max-width: 300px;
  max-height: 300px;
}

.board-preview .modal-board .piece {
  background-size: 45%;
}

.board-preview .modal-board .square {
  min-height: 20px;
  min-width: 20px;
}
/* Button Components - Modern button system */

/* Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

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

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

/* Button Variants */
.btn-primary {
  background-color: var(--primary-600);
  color: white;
  border-color: var(--primary-600);
}

.btn-primary:hover {
  background-color: var(--primary-700);
  border-color: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--neutral-100);
  color: var(--neutral-700);
  border-color: var(--neutral-300);
}

.btn-secondary:hover {
  background-color: var(--neutral-200);
  border-color: var(--neutral-400);
  color: var(--neutral-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary-600);
  border-color: var(--primary-600);
}

.btn-outline:hover {
  background-color: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background-color: transparent;
  color: var(--neutral-600);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-800);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--error-600);
  color: white;
  border-color: var(--error-600);
}

.btn-danger:hover {
  background-color: var(--error-700);
  border-color: var(--error-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background-color: var(--success-600);
  color: white;
  border-color: var(--success-600);
}

.btn-success:hover {
  background-color: var(--success-700);
  border-color: var(--success-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-warning {
  background-color: var(--warning-600);
  color: white;
  border-color: var(--warning-600);
}

.btn-warning:hover {
  background-color: var(--warning-700);
  border-color: var(--warning-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
}

.btn-xl {
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-lg);
}

/* Button Shapes */
.btn-square {
  border-radius: var(--radius-md);
  aspect-ratio: 1;
  padding: var(--space-3);
}

.btn-circle {
  border-radius: var(--radius-full);
  aspect-ratio: 1;
  padding: var(--space-3);
}

/* Button States */
.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Icon Buttons */
.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background-color: transparent;
  color: var(--neutral-600);
  border: 1px solid transparent;
  box-shadow: none;
}

.btn-icon:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-800);
  transform: none;
  box-shadow: none;
}

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

/* Button Groups */
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn-group .btn {
  border-radius: 0;
  border-right-width: 0;
  box-shadow: none;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  border-right-width: 1px;
}

.btn-group .btn:hover {
  transform: none;
  box-shadow: none;
}

/* Floating Action Button */
.btn-fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background-color: var(--primary-600);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-fixed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
}

.btn-fab:hover {
  background-color: var(--primary-700);
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }
  
  .btn-lg {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }
  
  .btn-xl {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-base);
  }
  
  .btn-fab {
    width: 48px;
    height: 48px;
    bottom: var(--space-4);
    right: var(--space-4);
    font-size: var(--text-lg);
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .btn {
    border-width: 2px;
  }
  
  .btn-primary {
    background-color: #000000;
    border-color: #000000;
    color: #ffffff;
  }
  
  .btn-secondary {
    background-color: #ffffff;
    border-color: #000000;
    color: #000000;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  .btn-loading::after {
    animation: none;
  }
}
/* Leaderboard Page Styles */
.leaderboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: none;
  min-height: 100vh;
  color: #374151;
  position: relative;
}

/* Chessboard background */
html, body {
  background: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url(/chessboard-screen.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
}

/* Hide chessboard background on board editor and game show pages */
body.boards-editor::before,
body.boards-show::before,
body.games-show::before {
  display: none !important;
}

/* Set black background on board editor and game show pages */
body.boards-editor,
body.boards-show,
body.games-show {
  background: #000000 !important;
}

/* .leaderboard-header styles moved to application.css for consistency */

.header-content {
  flex: 1;
}

.leaderboard-title {
  font-size: 3rem;
  font-weight: 700;
  color: #2d3748;
  margin: 0 0 0.5rem 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.leaderboard-subtitle {
  font-size: 1.25rem;
  color: #718096;
  margin: 0;
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.leaderboard-content {
  background: #f7fafc;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  overflow: hidden;
  color: #2d3748;
  border: 2px solid #6b8e23;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.1s ease;
  border: 1px solid #9acd32;
  margin-bottom: 1rem;
  position: relative;
}

.leaderboard-item:hover {
  transform: translateX(4px);
  border-color: #ffd700;
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.rank-badge {
  background: #e2e8f0;
  color: #4a5568;
  font-weight: bold;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-right: 1rem;
  min-width: 40px;
  text-align: center;
}

.rank-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #64748b;
}

.rank-medal {
  font-size: 1.25rem;
  margin-top: 0.25rem;
}

.rank-1 .rank-badge {
  background: #ffd700;
  color: #744210;
}

.rank-2 .rank-badge {
  background: #c0c0c0;
  color: #4a5568;
}

.rank-3 .rank-badge {
  background: #cd7f32;
  color: white;
}

.player-details {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-badge {
  background: #805ad5;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.ai-badge {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.you-badge {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: white;
}

.player-stats {
  font-size: 0.875rem;
  color: #718096;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-label {
  font-weight: 500;
}

.stat-value {
  font-weight: 600;
  color: #374151;
}

.stat-separator {
  color: #d1d5db;
}

.player-rating {
  font-weight: bold;
  color: #2d3748;
  font-size: 1.125rem;
}

.current-rank {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.25rem;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #64748b;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.5rem 0;
}

.empty-state p {
  font-size: 1rem;
  margin: 0 0 2rem 0;
}

.leaderboard-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  justify-content: center;
}

.leaderboard-btn-primary {
  background: #6b8e23;
  color: white;
  border-color: #9acd32;
}

.leaderboard-btn-primary:hover {
  background: #9acd32;
  border-color: #ffd700;
  transform: translateY(-2px);
}

.leaderboard-btn-secondary {
  background: #6b7280;
  color: white;
}

.leaderboard-btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

.leaderboard-btn-outline-primary {
  background: transparent;
  color: #6b8e23;
  border: 2px solid #6b8e23;
}

.leaderboard-btn-outline-primary:hover {
  background: #6b8e23;
  color: white;
  border-color: #ffd700;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .leaderboard-container {
    padding: 1rem 0.5rem;
  }

  .leaderboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }

  .leaderboard-title {
    font-size: 2rem;
  }

  .header-actions {
    justify-content: stretch;
  }

  .leaderboard-btn {
    flex: 1;
  }

  .leaderboard-item {
    padding: 1rem 1.5rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .rank-badge {
    flex-direction: row;
    justify-content: center;
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  .player-details {
    text-align: center;
  }

  .player-rating {
    text-align: center;
  }

  .player-stats {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .leaderboard-title {
    font-size: 1.75rem;
  }

  .leaderboard-item {
    padding: 1rem;
  }

  .player-name {
    font-size: 1.1rem;
  }

  .header-actions {
    flex-direction: column;
  }
}
/* Ratings Dashboard Page Styles */
.ratings-dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: none;
  min-height: 100vh;
  color: #374151;
  position: relative;
}

/* Chessboard background */
html, body {
  background: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url(/chessboard-screen.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
}

/* Hide chessboard background on board editor and game show pages */
body.boards-editor::before,
body.boards-show::before,
body.games-show::before {
  display: none !important;
}

/* Set black background on board editor and game show pages */
body.boards-editor,
body.boards-show,
body.games-show {
  background: #000000 !important;
}

/* Header styles now handled by page-header-content in header.css */

.ratings-dashboard-content {
  background: #f7fafc;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  overflow: hidden;
  color: #2d3748;
  border: 2px solid #6b8e23;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0;
}

.rating-card {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.main-card {
  grid-row: span 2;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

.card-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: white;
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #1e293b;
}

.rank-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.card-content {
  flex: 1;
  width: 100%;
}

.rating-display {
  margin-bottom: 1.5rem;
}

.rating-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

.stat-value {
  font-weight: 600;
  font-size: 1rem;
}

.top-players-card,
.rating-history-card {
  background: white;
  padding: 1.5rem;
  border-left: 1px solid #f1f5f9;
}

.top-players-card {
  border-bottom: 1px solid #f1f5f9;
}

.view-all-link {
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.view-all-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.top-players-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.top-player-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease;
}

.top-player-item:hover {
  background: #f8fafc;
}

.player-rank {
  font-size: 1.25rem;
  font-weight: 600;
  min-width: 2rem;
  text-align: center;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-badge {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.you-badge {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: white;
}

.player-stats {
  font-size: 0.8rem;
  color: #64748b;
}

.player-rating {
  font-weight: 600;
}

.rating-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rating-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 0.5rem;
}

.rating-date {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 500;
}

.rating-change {
  font-weight: 600;
  font-size: 0.9rem;
}

.rating-change.positive {
  color: #10b981;
}

.rating-change.negative {
  color: #ef4444;
}

.empty-history {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
}

.empty-history p {
  margin: 0 0 0.5rem 0;
  font-weight: 500;
}

.empty-history small {
  font-size: 0.8rem;
  opacity: 0.8;
}

.ratings-dashboard-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  justify-content: center;
}

.ratings-dashboard-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ratings-dashboard-btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.ratings-dashboard-btn-outline-primary {
  background: transparent;
  color: #3b82f6;
  border: 2px solid #3b82f6;
}

.ratings-dashboard-btn-outline-primary:hover {
  background: #3b82f6;
  color: white;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .ratings-dashboard-container {
    padding: 1rem 0.5rem;
  }

  .ratings-dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }

  .ratings-dashboard-title {
    font-size: 2rem;
  }

  .header-actions {
    justify-content: stretch;
  }

  .ratings-dashboard-btn {
    flex: 1;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .main-card {
    grid-row: span 1;
  }

  .rating-card {
    padding: 1.5rem;
  }

  .top-players-card,
  .rating-history-card {
    padding: 1rem;
  }

  .top-player-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    text-align: center;
  }

  .player-rank {
    align-self: center;
  }
}

@media (max-width: 480px) {
  .ratings-dashboard-title {
    font-size: 1.75rem;
  }

  .header-actions {
    flex-direction: column;
  }
}
/* Game History Page Styles */
.game-history-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: none;
  min-height: 100vh;
  color: #374151;
  position: relative;
}

/* Chessboard background */
html, body {
  background: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url(/chessboard-screen.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
}

/* Hide chessboard background on board editor and game show pages */
body.boards-editor::before,
body.boards-show::before,
body.games-show::before {
  display: none !important;
}

/* Set black background on board editor and game show pages */
body.boards-editor,
body.boards-show,
body.games-show {
  background: #000000 !important;
}

/* .game-history-header styles moved to application.css for consistency */

.header-content {
  flex: 1;
}

.game-history-title {
  font-size: 3rem;
  font-weight: 700;
  color: #2d3748;
  margin: 0 0 0.5rem 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.game-history-subtitle {
  font-size: 1.25rem;
  color: #718096;
  margin: 0;
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.game-history-content {
  background: #f7fafc;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  overflow: hidden;
  color: #2d3748;
  border: 2px solid #6b8e23;
}

.games-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-radius: 0.75rem;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 0.25rem;
}

.games-list {
  display: flex;
  flex-direction: column;
}

.game-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.2s ease;
}

.game-history-item:hover {
  background: #f8fafc;
}

.game-history-item:last-child {
  border-bottom: none;
}

.game-info {
  flex: 1;
  min-width: 0;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.game-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-result {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.result-win {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.result-loss {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.result-draw {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
}

.result-unknown {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.game-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #64748b;
}

.game-separator {
  color: #d1d5db;
}

.game-players {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.player-side {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.player-side--white {
  background: #f3f4f6;
  color: #374151;
}

.player-side--black {
  background: #1f2937;
  color: white;
}

.player-side--red {
  background: #fef2f2;
  color: #dc2626;
}

.player-side--blue {
  background: #eff6ff;
  color: #2563eb;
}

.player-side--green {
  background: #f0fdf4;
  color: #16a34a;
}

.player-side--orange {
  background: #fff7ed;
  color: #ea580c;
}

.player-side--purple {
  background: #faf5ff;
  color: #9333ea;
}

.player-side--yellow {
  background: #fefce8;
  color: #ca8a04;
}

.player-name {
  font-weight: 500;
  color: #374151;
}

.game-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #64748b;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.5rem 0;
}

.empty-state p {
  font-size: 1rem;
  margin: 0 0 2rem 0;
}

.game-history-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  justify-content: center;
}

.game-history-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.game-history-btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.game-history-btn-secondary {
  background: #6b7280;
  color: white;
}

.game-history-btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

.game-history-btn-outline-primary {
  background: transparent;
  color: #3b82f6;
  border: 2px solid #3b82f6;
}

.game-history-btn-outline-primary:hover {
  background: #3b82f6;
  color: white;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-history-container {
    padding: 1rem 0.5rem;
  }

  .game-history-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }

  .game-history-title {
    font-size: 2rem;
  }

  .header-actions {
    justify-content: stretch;
  }

  .game-history-btn {
    flex: 1;
  }

  .games-stats {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .game-history-item {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem 1.5rem;
  }

  .game-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .game-actions {
    justify-content: stretch;
  }

  .game-players {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .game-history-title {
    font-size: 1.75rem;
  }

  .game-history-item {
    padding: 1rem;
  }

  .games-stats {
    padding: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .header-actions {
    flex-direction: column;
  }
}
/* Style Template Switcher */
.style-switcher {
  margin: 20px 0;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #333;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.style-switcher h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #333;
  text-align: center;
}

.style-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.style-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.style-btn.active {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 2px solid #333;
  font-weight: bold;
}

/* Default Style (Current) */
.style-btn.default {
  background: linear-gradient(135deg, #9acd32, #6b8e23);
  color: white;
}

.style-btn.default:hover {
  background: linear-gradient(135deg, #8fbc8f, #556b2f);
}

/* Modern Style */
.style-btn.modern {
  background: linear-gradient(135deg, #4a90e2, #357abd);
  color: white;
}

.style-btn.modern:hover {
  background: linear-gradient(135deg, #357abd, #2c5aa0);
}

/* Classic Style */
.style-btn.classic {
  background: linear-gradient(135deg, #d4af37, #b8860b);
  color: white;
}

.style-btn.classic:hover {
  background: linear-gradient(135deg, #b8860b, #8b6914);
}

/* Cyber 8-bit Style */
.style-btn.cyber {
  background: linear-gradient(135deg, #00ff00, #00cc00);
  color: black;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 5px #00ff00;
}

.style-btn.cyber:hover {
  background: linear-gradient(135deg, #00cc00, #009900);
  box-shadow: 0 0 10px #00ff00;
}

/* Kindle Minimal Style */
.style-btn.kindle {
  background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
  color: #333;
  border: 1px solid #ccc;
}

.style-btn.kindle:hover {
  background: linear-gradient(135deg, #e0e0e0, #d0d0d0);
  border: 1px solid #999;
}

/* Sith Dark Style */
.style-btn.sith {
  background: linear-gradient(135deg, #2a2a2a, #000000);
  color: #dc143c;
  text-shadow: 0 0 3px #dc143c;
}

.style-btn.sith:hover {
  background: linear-gradient(135deg, #000000, #1a1a1a);
  box-shadow: 0 0 10px #dc143c;
}

/* Style Template 1: Default (Green Field) */
.style-default {
  /* This is your current styling - no changes needed */
}

.style-default .square.light {
  background-image: url(/light-green-grass.webp) !important;
  background-size: 400% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 1px solid #2d5a2d !important;
}

.style-default .square.dark {
  background-image: url(/dark-green-grass.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 1px solid #1a3d1a !important;
}

.style-default .square.wall {
  background-image: url(/greenish-wall.webp) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 3px solid #2f1b14 !important;
}

.style-default .square.light.upgrade {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important; /* Gold to cream gradient */
  border: 1px solid #2d5a2d !important;
}

.style-default .square.dark.upgrade {
  background: linear-gradient(135deg, #daa520 0%, #fff8dc 50%, #daa520 100%) !important; /* Darker gold to cream gradient */
  border: 1px solid #1a3d1a !important;
}

/* Upgrade squares that are also killable - preserve upgrade background */
.style-default .square.light.upgrade.killable {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important; /* Preserve gold upgrade background */
  animation: metallicRedShadow 3s ease-in-out infinite !important;
}

.style-default .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #daa520 0%, #fff8dc 50%, #daa520 100%) !important; /* Preserve gold upgrade background */
  animation: metallicRedShadow 3s ease-in-out infinite !important;
}

/* Upgrade squares that are also movable - preserve upgrade background */
.style-default .square.light.upgrade.movable {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important; /* Gold to cream gradient */
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-default .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #daa520 0%, #fff8dc 50%, #daa520 100%) !important; /* Darker gold to cream gradient */
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-default .square.light.movable {
  background-color: #9acd32 !important; /* Clean leaf green - no grass texture */
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-default .square.dark.movable {
  background-color: #6b8e23 !important; /* Clean olive green - no grass texture */
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-default .square.light.movable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-default .square.dark.movable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}


.style-default .square.light.killable {
  background-color: #8b0000 !important; /* Clean royal crimson - no grass texture */
  animation: metallicRedShadow 3s ease-in-out infinite !important;
}

.style-default .square.dark.killable {
  background-color: #8b0000 !important; /* Clean royal crimson - no grass texture */
  animation: metallicRedShadow 3s ease-in-out infinite !important;
}

.style-default .square.light.killable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-default .square.dark.killable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

/* Style Template 2: Modern Blue */
.style-modern .square.light {
  background-color: #e3f2fd !important; /* Light blue */
}

.style-modern .square.dark {
  background-color: #1976d2 !important; /* Dark blue */
}

.style-modern .square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 3px solid #212121 !important;
}

.style-modern .square.light.upgrade {
  background: linear-gradient(135deg, #ff9800 0%, #ffb74d 50%, #ff9800 100%); /* Orange gradient */
}

.style-modern .square.dark.upgrade {
  background: linear-gradient(135deg, #f57c00 0%, #ffb74d 50%, #f57c00 100%); /* Darker orange gradient */
}

/* Upgrade squares that are also killable - preserve upgrade background */
.style-modern .square.light.upgrade.killable {
  background: linear-gradient(135deg, #ff9800 0%, #ffb74d 50%, #ff9800 100%) !important; /* Preserve orange upgrade background */
  animation: metallicRedShadow 3s ease-in-out infinite !important;
}

.style-modern .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #f57c00 0%, #ffb74d 50%, #f57c00 100%) !important; /* Preserve orange upgrade background */
  animation: metallicRedShadow 3s ease-in-out infinite !important;
}

/* Upgrade squares that are also movable - preserve upgrade background */
.style-modern .square.light.upgrade.movable {
  background: linear-gradient(135deg, #ff9800 0%, #ffb74d 50%, #ff9800 100%) !important; /* Orange gradient */
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-modern .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #f57c00 0%, #ffb74d 50%, #f57c00 100%) !important; /* Darker orange gradient */
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-modern .square.light.movable {
  background-color: #e3f2fd !important;
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-modern .square.dark.movable {
  background-color: #1976d2 !important;
  animation: metallicGoldenShadow 3s ease-in-out infinite !important;
}

.style-modern .square.light.movable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-modern .square.dark.movable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-modern .square.light.killable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-modern .square.dark.killable:hover {
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-modern #board {
  border: 10px solid #1976d2; /* Blue border */
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(25, 118, 210, 0.3);
}

@keyframes flashPink {
  0% {
    box-shadow: inset 0 0 0 3px #e91e63, 0 0 0 0 rgba(233, 30, 99, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #e91e63, 0 0 0 5px rgba(233, 30, 99, 0.6);
  }
  100% {
    box-shadow: inset 0 0 0 3px #e91e63, 0 0 0 0 rgba(233, 30, 99, 0);
  }
}

/* Style Template 3: Classic Gold */
.style-classic .square.light {
  background-color: #f5f5dc !important; /* Beige */
}

.style-classic .square.dark {
  background-color: #8b4513 !important; /* Saddle brown */
}

.style-classic .square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 3px solid #2f1b14 !important;
}

.style-classic .square.light.upgrade {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%); /* Gold to cream gradient */
}

.style-classic .square.dark.upgrade {
  background: linear-gradient(135deg, #daa520 0%, #fff8dc 50%, #daa520 100%); /* Darker gold to cream gradient */
}

/* Upgrade squares that are also killable - preserve upgrade background */
.style-classic .square.light.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for killable */
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-classic .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for killable */
  animation: flashCrimson 2s ease-in-out infinite !important;
}

/* Upgrade squares that are also movable - preserve upgrade background */
.style-classic .square.light.upgrade.movable {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important; /* Gold to cream gradient */
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for movable */
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-classic .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #daa520 0%, #fff8dc 50%, #daa520 100%) !important; /* Darker gold to cream gradient */
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for movable */
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-classic .square.light.movable {
  background-color: #f5f5dc !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border */
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-classic .square.dark.movable {
  background-color: #8b4513 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border */
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-classic .square.light.movable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 15px rgba(220, 20, 60, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-classic .square.dark.movable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 15px rgba(220, 20, 60, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-classic .square.light.killable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 15px rgba(220, 20, 60, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-classic .square.dark.killable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 15px rgba(220, 20, 60, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-classic #board {
  border: 10px solid #8b4513; /* Brown border */
  border-radius: 0; /* Square corners for classic look */
  box-shadow: 0 8px 24px rgba(139, 69, 19, 0.3);
}

@keyframes flashCrimson {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #dc143c, 0 0 0 0 rgba(220, 20, 60, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #dc143c, 0 0 0 6px rgba(220, 20, 60, 0.4);
  }
}

/* Style Template 4: Cyber 8-bit */
.style-cyber .square.light {
  background: linear-gradient(135deg, #ff0080 0%, #ff40a0 50%, #ff0080 100%) !important; /* Hot pink neon */
  border: 2px solid #ff40a0 !important;
  box-shadow: 0 0 15px rgba(255, 0, 128, 0.6), inset 0 0 20px rgba(255, 0, 128, 0.3) !important;
  position: relative !important;
}

.style-cyber .square.light::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%) !important;
  animation: neonScan 3s linear infinite !important;
}

.style-cyber .square.dark {
  background: linear-gradient(135deg, #00ffff 0%, #40ffff 50%, #00ffff 100%) !important; /* Cyan neon */
  border: 2px solid #40ffff !important;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.3) !important;
  position: relative !important;
}

.style-cyber .square.dark::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%) !important;
  animation: neonScan 3s linear infinite !important;
}

.style-cyber .square.wall {
  background-image: url(/blue-brick-wall.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 3px solid #00ffff !important; /* Cyan border */
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.8), inset 0 0 20px rgba(0, 255, 255, 0.2) !important;
  filter: hue-rotate(180deg) saturate(1.5) brightness(1.2) !important; /* Make it more cyberpunk */
}

.style-cyber .square.light.upgrade {
  background: linear-gradient(135deg, #ffff00 0%, #ffff40 50%, #ffff00 100%) !important; /* Yellow neon */
  border: 2px solid #ffff40 !important;
  box-shadow: 0 0 20px rgba(255, 255, 0, 0.8), inset 0 0 20px rgba(255, 255, 0, 0.3) !important;
  animation: neonPulse 2s ease-in-out infinite !important;
}

.style-cyber .square.dark.upgrade {
  background: linear-gradient(135deg, #ff8000 0%, #ffa040 50%, #ff8000 100%) !important; /* Orange neon */
  border: 2px solid #ffa040 !important;
  box-shadow: 0 0 20px rgba(255, 128, 0, 0.8), inset 0 0 20px rgba(255, 128, 0, 0.3) !important;
  animation: neonPulse 2s ease-in-out infinite !important;
}

/* Upgrade squares that are also killable - preserve upgrade background */
.style-cyber .square.light.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  border: 2px solid #ff0000 !important;
  box-shadow: 0 0 20px rgba(139, 0, 0, 0.8), inset 0 0 20px rgba(139, 0, 0, 0.3), inset 0 0 0 3px #ff0000, 0 0 25px rgba(255, 0, 0, 0.8) !important;
  animation: neonFlashRed 1s ease-in-out infinite !important;
}

.style-cyber .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  border: 2px solid #ff0000 !important;
  box-shadow: 0 0 20px rgba(139, 0, 0, 0.8), inset 0 0 20px rgba(139, 0, 0, 0.3), inset 0 0 0 3px #ff0000, 0 0 25px rgba(255, 0, 0, 0.8) !important;
  animation: neonFlashRed 1s ease-in-out infinite !important;
}

/* Upgrade squares that are also movable - preserve upgrade background */
.style-cyber .square.light.upgrade.movable {
  background: linear-gradient(135deg, #ffff00 0%, #ffff40 50%, #ffff00 100%) !important; /* Yellow neon */
  border: 2px solid #ffff40 !important;
  box-shadow: 0 0 20px rgba(255, 255, 0, 0.8), inset 0 0 20px rgba(255, 255, 0, 0.3), inset 0 0 0 3px #00ff00, 0 0 25px rgba(0, 255, 0, 0.8) !important;
  animation: neonFlash 1s ease-in-out infinite !important;
}

.style-cyber .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #ff8000 0%, #ffa040 50%, #ff8000 100%) !important; /* Orange neon */
  border: 2px solid #ffa040 !important;
  box-shadow: 0 0 20px rgba(255, 128, 0, 0.8), inset 0 0 20px rgba(255, 128, 0, 0.3), inset 0 0 0 3px #00ff00, 0 0 25px rgba(0, 255, 0, 0.8) !important;
  animation: neonFlash 1s ease-in-out infinite !important;
}

.style-cyber .square.light.movable {
  background: linear-gradient(135deg, #ff0080 0%, #ff40a0 50%, #ff0080 100%) !important;
  box-shadow: inset 0 0 0 3px #00ff00, 0 0 25px rgba(0, 255, 0, 0.8) !important; /* Green neon border */
  animation: neonFlash 1s ease-in-out infinite !important;
}

.style-cyber .square.dark.movable {
  background: linear-gradient(135deg, #00ffff 0%, #40ffff 50%, #00ffff 100%) !important;
  box-shadow: inset 0 0 0 3px #00ff00, 0 0 25px rgba(0, 255, 0, 0.8) !important; /* Green neon border */
  animation: neonFlash 1s ease-in-out infinite !important;
}

.style-cyber .square.light.killable {
  background: linear-gradient(135deg, #ff0080 0%, #ff40a0 50%, #ff0080 100%) !important;
  box-shadow: inset 0 0 0 3px #ff0000, 0 0 25px rgba(255, 0, 0, 0.8) !important; /* Red neon border */
  animation: neonFlashRed 1s ease-in-out infinite !important;
}

.style-cyber .square.dark.killable {
  background: linear-gradient(135deg, #00ffff 0%, #40ffff 50%, #00ffff 100%) !important;
  box-shadow: inset 0 0 0 3px #ff0000, 0 0 25px rgba(255, 0, 0, 0.8) !important; /* Red neon border */
  animation: neonFlashRed 1s ease-in-out infinite !important;
}

.style-cyber .square.light.movable:hover {
  box-shadow: inset 0 0 0 4px #00ff00, 0 0 35px rgba(0, 255, 0, 1) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-cyber .square.dark.movable:hover {
  box-shadow: inset 0 0 0 4px #00ff00, 0 0 35px rgba(0, 255, 0, 1) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-cyber .square.light.killable:hover {
  box-shadow: inset 0 0 0 4px #ff0000, 0 0 35px rgba(255, 0, 0, 1) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-cyber .square.dark.killable:hover {
  box-shadow: inset 0 0 0 4px #ff0000, 0 0 35px rgba(255, 0, 0, 1) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-cyber #board {
  border: 10px solid transparent !important;
  border-radius: 0 !important; /* Sharp corners for cyberpunk */
  background: linear-gradient(45deg, #000000, #1a0033, #000000) !important; /* Dark cyber background */
  box-shadow: 
    0 0 50px rgba(255, 0, 128, 0.4),
    0 0 50px rgba(0, 255, 255, 0.4),
    inset 0 0 50px rgba(0, 0, 0, 0.8) !important;
  position: relative !important;
}

.style-cyber #board::before {
  content: '' !important;
  position: absolute !important;
  top: -10px !important;
  left: -10px !important;
  right: -10px !important;
  bottom: -10px !important;
  background: linear-gradient(45deg, #ff0080, #00ffff, #ffff00, #ff0080) !important;
  background-size: 400% 400% !important;
  animation: borderGlow 4s ease infinite !important;
  z-index: -1 !important;
  border-radius: 0 !important;
}

.style-cyber .piece {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6)) !important;
  transition: all 0.3s ease !important;
}

.style-cyber .piece:hover {
  filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.9)) !important;
  transform: scale(1.05) !important;
}

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

@keyframes neonPulse {
  0%, 100% { 
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.8), inset 0 0 20px rgba(255, 255, 0, 0.3);
  }
  50% { 
    box-shadow: 0 0 30px rgba(255, 255, 0, 1), inset 0 0 30px rgba(255, 255, 0, 0.5);
  }
}

@keyframes neonFlash {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #00ff00, 0 0 25px rgba(0, 255, 0, 0.8);
  }
  50% {
    box-shadow: inset 0 0 0 3px #00ff00, 0 0 35px rgba(0, 255, 0, 1);
  }
}

@keyframes neonFlashRed {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #ff0000, 0 0 25px rgba(255, 0, 0, 0.8);
  }
  50% {
    box-shadow: inset 0 0 0 3px #ff0000, 0 0 35px rgba(255, 0, 0, 1);
  }
}

@keyframes borderGlow {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 50%; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0% 100%; }
}

@keyframes flashYellow {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #ffff00, 0 0 0 0 rgba(255, 255, 0, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #ffff00, 0 0 0 8px rgba(255, 255, 0, 0.8);
  }
}

@keyframes flashGreen {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #00ff00, 0 0 0 0 rgba(0, 255, 0, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #00ff00, 0 0 0 5px rgba(0, 255, 0, 0.6);
  }
}

@keyframes flashRed {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #ff0000, 0 0 0 0 rgba(255, 0, 0, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #ff0000, 0 0 0 5px rgba(255, 0, 0, 0.6);
  }
}

/* Style Template 5: Kindle Minimal */
.style-kindle .square.light {
  background-color: #f8f8f8 !important; /* Very light gray */
  border: 1px solid #e0e0e0 !important;
}

.style-kindle .square.dark {
  background-color: #d0d0d0 !important; /* Light gray */
  border: 1px solid #c0c0c0 !important;
}

.style-kindle .square.wall {
  background-image: url(/whitish-brick-wall.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 2px solid #a0a0a0 !important; /* Medium gray border */
  filter: grayscale(100%) contrast(80%) !important; /* Desaturate for minimal look */
}

.style-kindle .square.light.upgrade {
  background: linear-gradient(135deg, #e8e8e8 0%, #f0f0f0 50%, #e8e8e8 100%) !important; /* Subtle gray gradient */
  border: 1px solid #d0d0d0 !important;
}

.style-kindle .square.dark.upgrade {
  background: linear-gradient(135deg, #c8c8c8 0%, #d8d8d8 50%, #c8c8c8 100%) !important; /* Subtle gray gradient */
  border: 1px solid #b8b8b8 !important;
}

/* Upgrade squares that are also killable - preserve upgrade background */
.style-kindle .square.light.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  border: 1px solid #d0d0d0 !important;
  box-shadow: inset 0 0 0 2px #ff0000 !important; /* Red border for killable */
  animation: flashRed 2s ease-in-out infinite !important;
}

.style-kindle .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  border: 1px solid #b8b8b8 !important;
  box-shadow: inset 0 0 0 2px #ff0000 !important; /* Red border for killable */
  animation: flashRed 2s ease-in-out infinite !important;
}

/* Upgrade squares that are also movable - preserve upgrade background */
.style-kindle .square.light.upgrade.movable {
  background: linear-gradient(135deg, #e8e8e8 0%, #f0f0f0 50%, #e8e8e8 100%) !important; /* Subtle gray gradient */
  border: 1px solid #d0d0d0 !important;
  box-shadow: inset 0 0 0 2px #808080 !important; /* Gray border for movable */
  animation: flashGray 2s ease-in-out infinite !important;
}

.style-kindle .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #c8c8c8 0%, #d8d8d8 50%, #c8c8c8 100%) !important; /* Subtle gray gradient */
  border: 1px solid #b8b8b8 !important;
  box-shadow: inset 0 0 0 2px #808080 !important; /* Gray border for movable */
  animation: flashGray 2s ease-in-out infinite !important;
}

.style-kindle .square.light.movable {
  background-color: #f8f8f8 !important;
  box-shadow: inset 0 0 0 2px #808080 !important; /* Gray border */
  animation: flashGray 2s ease-in-out infinite !important;
}

.style-kindle .square.dark.movable {
  background-color: #d0d0d0 !important;
  box-shadow: inset 0 0 0 2px #808080 !important; /* Gray border */
  animation: flashGray 2s ease-in-out infinite !important;
}

.style-kindle #board {
  border: 6px solid #808080 !important; /* Gray border */
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  background: #ffffff !important;
}

.style-kindle .piece {
  filter: grayscale(30%) contrast(90%) !important; /* Slightly desaturate pieces */
}

.style-kindle .square.light.upgrade {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important; /* Gold to cream gradient */
  border: 1px solid #d0d0d0 !important;
}

.style-kindle .square.dark.upgrade {
  background: linear-gradient(135deg, #daa520 0%, #fff8dc 50%, #daa520 100%) !important; /* Darker gold to cream gradient */
  border: 1px solid #b8b8b8 !important;
}

.style-kindle .square.light.movable:hover {
  box-shadow: inset 0 0 0 3px #808080, 0 0 8px rgba(128, 128, 128, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-kindle .square.dark.movable:hover {
  box-shadow: inset 0 0 0 3px #808080, 0 0 8px rgba(128, 128, 128, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-kindle .square.light.killable:hover {
  box-shadow: inset 0 0 0 3px #808080, 0 0 8px rgba(128, 128, 128, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-kindle .square.dark.killable:hover {
  box-shadow: inset 0 0 0 3px #808080, 0 0 8px rgba(128, 128, 128, 0.6) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

@keyframes flashGray {
  0%, 100% {
    box-shadow: inset 0 0 0 2px #808080, 0 0 0 0 rgba(128, 128, 128, 0);
  }
  50% {
    box-shadow: inset 0 0 0 2px #808080, 0 0 0 4px rgba(128, 128, 128, 0.3);
  }
}

/* Style Template 6: Sith Dark */
.style-sith .square.light {
  background-color: #2a2a2a !important; /* Dark gray */
  border: 1px solid #404040 !important;
}

.style-sith .square.dark {
  background-color: #1a1a1a !important; /* Lighter black - was #000000 */
  border: 1px solid #1a1a1a !important;
}

.style-sith .square.wall {
  background-image: url(/red-brick-wall.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 3px solid #8b0000 !important; /* Dark red border */
  filter: brightness(0.7) contrast(120%) !important; /* Darken and increase contrast */
}

.style-sith .square.light.upgrade {
  background: linear-gradient(135deg, #8b0000 0%, #dc143c 50%, #8b0000 100%) !important; /* Dark red to crimson */
  border: 1px solid #404040 !important;
}

.style-sith .square.dark.upgrade {
  background: linear-gradient(135deg, #660000 0%, #8b0000 50%, #660000 100%) !important; /* Darker red */
  border: 1px solid #1a1a1a !important;
}

/* Upgrade squares that are also killable - preserve upgrade background */
.style-sith .square.light.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  border: 1px solid #404040 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for killable */
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-sith .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #8b0000 0%, #a00000 50%, #8b0000 100%) !important; /* Metallic red gradient */
  border: 1px solid #1a1a1a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for killable */
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

/* Upgrade squares that are also movable - preserve upgrade background */
.style-sith .square.light.upgrade.movable {
  background: linear-gradient(135deg, #8b0000 0%, #dc143c 50%, #8b0000 100%) !important; /* Dark red to crimson */
  border: 1px solid #404040 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for movable */
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-sith .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #660000 0%, #8b0000 50%, #660000 100%) !important; /* Darker red */
  border: 1px solid #1a1a1a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border for movable */
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-sith .square.light.movable {
  background-color: #2a2a2a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border */
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-sith .square.dark.movable {
  background-color: #000000 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important; /* Crimson border */
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-sith #board {
  border: 10px solid #8b0000 !important; /* Dark red border */
  border-radius: 8px !important;
  box-shadow: 0 0 30px rgba(139, 0, 0, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.8) !important;
  background: #000000 !important;
}

.style-sith .piece {
  filter: brightness(0.8) contrast(120%) !important; /* Darken pieces slightly */
}

.style-sith .piece.white {
  filter: brightness(0.9) contrast(110%) !important; /* Keep white pieces visible */
}

.style-sith .square.light.movable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 20px rgba(220, 20, 60, 0.8) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-sith .square.dark.movable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 20px rgba(220, 20, 60, 0.8) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-sith .square.light.killable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 20px rgba(220, 20, 60, 0.8) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

.style-sith .square.dark.killable:hover {
  box-shadow: inset 0 0 0 4px #dc143c, 0 0 20px rgba(220, 20, 60, 0.8) !important;
  transform: scale(1.05) !important;
  transition: all 0.2s ease !important;
}

/* Ensure example squares show the current theme */
body.style-default .example-square.wall {
  background-image: url(/greenish-wall.webp) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

body.style-default .example-square.light.upgrade {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important;
}

body.style-default .example-square.light.movable {
  background-image: url(/light-green-grass.webp) !important;
  background-size: 400% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-shadow: inset 0 0 0 3px gold !important;
}

body.style-default .example-square.light.killable {
  background-image: url(/light-green-grass.webp) !important;
  background-size: 400% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-shadow: inset 0 0 0 3px #ff0000 !important;
}

body.style-default .example-square.dark.movable {
  background-image: url(/dark-green-grass.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-shadow: inset 0 0 0 3px gold !important;
}

/* Modern Blue theme examples */
body.style-modern .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

body.style-modern .example-square.light.upgrade {
  background: linear-gradient(135deg, #ff9800 0%, #ffb74d 50%, #ff9800 100%) !important;
}

body.style-modern .example-square.light.movable {
  background-color: #e3f2fd !important;
  box-shadow: inset 0 0 0 3px #e91e63 !important;
}

body.style-modern .example-square.light.killable {
  background-color: #e3f2fd !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-modern .example-square.dark.movable {
  background-color: #1976d2 !important;
  box-shadow: inset 0 0 0 3px #e91e63 !important;
}

body.style-modern .example-square.dark.killable {
  background-color: #1976d2 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

/* Classic Gold theme examples */
body.style-classic .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

body.style-classic .example-square.light.upgrade {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important;
}

body.style-classic .example-square.light.movable {
  background-color: #f5f5dc !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-classic .example-square.light.killable {
  background-color: #f5f5dc !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-classic .example-square.dark.movable {
  background-color: #8b4513 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-classic .example-square.dark.killable {
  background-color: #8b4513 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

/* Neon Synthwave theme examples */
body.style-cyber .example-square.wall {
  background-image: url(/blue-brick-wall.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: hue-rotate(180deg) saturate(1.5) brightness(1.2) !important;
}

body.style-cyber .example-square.light.upgrade {
  background: linear-gradient(135deg, #ffff00 0%, #ffff40 50%, #ffff00 100%) !important;
}

body.style-cyber .example-square.light.movable {
  background: linear-gradient(135deg, #ff0080 0%, #ff40a0 50%, #ff0080 100%) !important;
  box-shadow: inset 0 0 0 3px #00ff00 !important;
}

body.style-cyber .example-square.light.killable {
  background: linear-gradient(135deg, #ff0080 0%, #ff40a0 50%, #ff0080 100%) !important;
  box-shadow: inset 0 0 0 3px #ff0000 !important;
}

body.style-cyber .example-square.dark.movable {
  background: linear-gradient(135deg, #00ffff 0%, #40ffff 50%, #00ffff 100%) !important;
  box-shadow: inset 0 0 0 3px #00ff00 !important;
}

body.style-cyber .example-square.dark.killable {
  background: linear-gradient(135deg, #00ffff 0%, #40ffff 50%, #00ffff 100%) !important;
  box-shadow: inset 0 0 0 3px #ff0000 !important;
}

/* Kindle Minimal theme examples */
body.style-kindle .example-square.wall {
  background-image: url(/whitish-brick-wall.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: grayscale(100%) contrast(80%) !important;
}

body.style-kindle .example-square.light.upgrade {
  background: linear-gradient(135deg, #ffd700 0%, #fff8dc 50%, #ffd700 100%) !important;
}

body.style-kindle .example-square.light.movable {
  background-color: #f8f8f8 !important;
  box-shadow: inset 0 0 0 2px #808080 !important;
}

body.style-kindle .example-square.light.killable {
  background-color: #f8f8f8 !important;
  box-shadow: inset 0 0 0 2px #808080 !important;
}

body.style-kindle .example-square.dark.movable {
  background-color: #d0d0d0 !important;
  box-shadow: inset 0 0 0 2px #808080 !important;
}

body.style-kindle .example-square.dark.killable {
  background-color: #d0d0d0 !important;
  box-shadow: inset 0 0 0 2px #808080 !important;
}

/* Sith Dark theme examples */
body.style-sith .example-square.wall {
  background-image: url(/red-brick-wall.jpg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: brightness(0.7) contrast(120%) !important;
}

body.style-sith .example-square.light.upgrade {
  background: linear-gradient(135deg, #8b0000 0%, #dc143c 50%, #8b0000 100%) !important;
}

body.style-sith .example-square.light.movable {
  background-color: #2a2a2a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-sith .example-square.light.killable {
  background-color: #2a2a2a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-sith .example-square.dark.movable {
  background-color: #000000 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-sith .example-square.dark.killable {
  background-color: #000000 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

/* Metallic box shadow keyframe animations for style templates */
@keyframes metallicGoldenShadow {
  0% {
    box-shadow: 0 0 0 1px #ffd700, 0 0 0 0 rgba(255, 215, 0, 0);
  }
  25% {
    box-shadow: 0 0 0 2px #ffed4a, 0 0 5px rgba(255, 237, 74, 0.8), 0 0 0 1px #ffd700;
  }
  50% {
    box-shadow: 0 0 0 4px #ffd700, 0 0 10px rgba(255, 215, 0, 0.6), 0 0 0 2px #ffffff;
  }
  75% {
    box-shadow: 0 0 0 2px #ffed4a, 0 0 5px rgba(255, 237, 74, 0.8), 0 0 0 1px #ffd700;
  }
  100% {
    box-shadow: 0 0 0 1px #ffd700, 0 0 0 0 rgba(255, 215, 0, 0);
  }
}

@keyframes metallicRedShadow {
  0% {
    box-shadow: 0 0 0 1px #8b0000, 0 0 0 0 rgba(139, 0, 0, 0);
  }
  25% {
    box-shadow: 0 0 0 2px #a00000, 0 0 5px rgba(160, 0, 0, 0.8), 0 0 0 1px #8b0000;
  }
  50% {
    box-shadow: 0 0 0 4px #8b0000, 0 0 10px rgba(139, 0, 0, 0.6), 0 0 0 2px #ffffff;
  }
  75% {
    box-shadow: 0 0 0 2px #a00000, 0 0 5px rgba(160, 0, 0, 0.8), 0 0 0 1px #8b0000;
  }
  100% {
    box-shadow: 0 0 0 1px #8b0000, 0 0 0 0 rgba(139, 0, 0, 0);
  }
}
/* Global piece styles */
/* line 4, app/assets/stylesheets/pieces.scss */
.piece {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

/* First move indicator - green circle for pieces that can castle or use en passant */
/* line 18, app/assets/stylesheets/pieces.scss */
.piece[data-first-move="true"]::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 3px;
  height: 3px;
  background-color: gold;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

/* Ensure squares have relative positioning for absolute piece positioning */
/* line 32, app/assets/stylesheets/pieces.scss */
.square {
  position: relative;
}

/* line 36, app/assets/stylesheets/pieces.scss */
.piece-picker-button {
  height: 10px;
  width: 10px;
}

/* line 40, app/assets/stylesheets/pieces.scss */
.piece-wall {
  background-image: url(/greenish-wall.webp);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 3px solid #2f1b14;
}

/* White pieces */
/* line 49, app/assets/stylesheets/pieces.scss */
.side-white.piece-pawn {
  background-image: url(/assets/chesspieces/wikipedia/wP-09373ac39d2473495bc05fe3470a2dc429aecc5d97c667240b7afb9954a44711.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 55, app/assets/stylesheets/pieces.scss */
.side-white.piece-knight {
  background-image: url(/assets/chesspieces/wikipedia/wN-46f39235c72f14519564a22be72e47d9a8377a95966a7dc063b5e4ba98f87075.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 61, app/assets/stylesheets/pieces.scss */
.side-white.piece-bishop {
  background-image: url(/assets/chesspieces/wikipedia/wB-83642647beef9fa4d3b96908c1d4478e9af1b75f5303e699cf85a21cb73f8d35.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 67, app/assets/stylesheets/pieces.scss */
.side-white.piece-rook {
  background-image: url(/assets/chesspieces/wikipedia/wR-c02bcdc3ee39a9b8e3d814020e580376727ebc32b6a63cb0d3b6d331abb1dec5.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 73, app/assets/stylesheets/pieces.scss */
.side-white.piece-queen {
  background-image: url(/assets/chesspieces/wikipedia/wQ-dbc00c011151ac3ff4f4254e54b1871cfa8656bcba2f1717ec27252f84168cdb.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 79, app/assets/stylesheets/pieces.scss */
.side-white.piece-king {
  background-image: url(/assets/chesspieces/wikipedia/wK-45473e3a10b4963da67ef3229280081e1a2435fd7b179a2e5a61fc5f2802c6fa.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* Black pieces */
/* line 86, app/assets/stylesheets/pieces.scss */
.side-black.piece-pawn {
  background-image: url(/assets/chesspieces/wikipedia/bP-40fcf6ebf2cb5cc87eee8f4eb769c07b6ee8c06dbdb03cfe53b9608753f72ba8.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 92, app/assets/stylesheets/pieces.scss */
.side-black.piece-knight {
  background-image: url(/assets/chesspieces/wikipedia/bN-38ca6725f9916bc245a03e43c9717e9a2b510389ef035966be9363c555c69ba0.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 98, app/assets/stylesheets/pieces.scss */
.side-black.piece-bishop {
  background-image: url(/assets/chesspieces/wikipedia/bB-f9b542cfae73418a67bc5c18d5b5872ca6f2492ff004a5f02eddf021b14832a7.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 104, app/assets/stylesheets/pieces.scss */
.side-black.piece-rook {
  background-image: url(/assets/chesspieces/wikipedia/bR-0a4f2157fa0f1b2e444e14c9c643dd50b8bbbcaeb045b80b9b1a0fed83664ae2.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 110, app/assets/stylesheets/pieces.scss */
.side-black.piece-queen {
  background-image: url(/assets/chesspieces/wikipedia/bQ-16588c25395aaeeaba10b5b7a29bca6e4063358b9ea490d7a4e7b3b7f2527367.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 116, app/assets/stylesheets/pieces.scss */
.side-black.piece-king {
  background-image: url(/assets/chesspieces/wikipedia/bK-26987c2d0d4f4a07894aee5cf77742e17c3ad37d6edc034ec40fd05b0fdd00fa.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* Red pieces */
/* line 123, app/assets/stylesheets/pieces.scss */
.side-red.piece-pawn {
  background-image: url(/assets/chesspieces/red/red_pawn-d70f0aacd8f0eec8e626bd11676a2f973af2279a053c3d34824175eeba8e4142.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 129, app/assets/stylesheets/pieces.scss */
.side-red.piece-knight {
  background-image: url(/assets/chesspieces/red/red_knight-c4928c72715be6672b0363661eb28f3a91503262a1bda0ef9fcdb6210b46b8dd.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 135, app/assets/stylesheets/pieces.scss */
.side-red.piece-bishop {
  background-image: url(/assets/chesspieces/red/red_bishop-b90568d15d1c6db07e14ae45d236154a1f21d8424a6d91ee36cbb24cfb24aec7.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 141, app/assets/stylesheets/pieces.scss */
.side-red.piece-rook {
  background-image: url(/assets/chesspieces/red/red_rook-5ab3542943041261c30099ff2a81bec39d1c17fff5692cd17ad4448fe8f5e21d.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 147, app/assets/stylesheets/pieces.scss */
.side-red.piece-queen {
  background-image: url(/assets/chesspieces/red/red_queen-1f0d085d95ca2abc13da760b1ded745ff4f5a3f8e19d9e7273942380ace0c46e.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 153, app/assets/stylesheets/pieces.scss */
.side-red.piece-king {
  background-image: url(/assets/chesspieces/red/red_king-d5c54525214294320d62dd1cab850a5c48f2ca21001c144374e7027a8fabc06f.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* Blue pieces */
/* line 160, app/assets/stylesheets/pieces.scss */
.side-blue.piece-pawn {
  background-image: url(/assets/chesspieces/blue/blue_pawn-7a6ed1f0d3f1e286ecf41d0c11dc95228d373173bc2ab7d6219660a12018753a.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 166, app/assets/stylesheets/pieces.scss */
.side-blue.piece-knight {
  background-image: url(/assets/chesspieces/blue/blue_knight-c521cf26e3b83d7cf0a5c4dc8cd9de6184b0174979cdd4cbd703bd7533e57c6c.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 172, app/assets/stylesheets/pieces.scss */
.side-blue.piece-bishop {
  background-image: url(/assets/chesspieces/blue/blue_bishop-9df8777d71ccc66f61807f5c03253daa3297b6111882ea7738fad224b2b34e62.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 178, app/assets/stylesheets/pieces.scss */
.side-blue.piece-rook {
  background-image: url(/assets/chesspieces/blue/blue_rook-8b288e5a5d48436ddcb8bcfa9e18839a171a1057ed848ed3d058438ac500b657.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 184, app/assets/stylesheets/pieces.scss */
.side-blue.piece-queen {
  background-image: url(/assets/chesspieces/blue/blue_queen-f549d0f60753dea7a88303386772563acca2167ee57cf0141a9679658204821a.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 190, app/assets/stylesheets/pieces.scss */
.side-blue.piece-king {
  background-image: url(/assets/chesspieces/blue/blue_king-c6b10966197fce20ea19772f1623556827c00c72da4431eda321e60e7d99c283.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* Green pieces */
/* line 197, app/assets/stylesheets/pieces.scss */
.side-green.piece-pawn {
  background-image: url(/assets/chesspieces/green/green_pawn-6cdc79c0ccb2db2915b4c63b1d4c4834daee555ea7641adf47ef05a2b0966e4e.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 203, app/assets/stylesheets/pieces.scss */
.side-green.piece-knight {
  background-image: url(/assets/chesspieces/green/green_knight-c64f83da7d13e50ad21235d36c24e1b40e1400bb9603c53c58695c6d24609c51.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 209, app/assets/stylesheets/pieces.scss */
.side-green.piece-bishop {
  background-image: url(/assets/chesspieces/green/green_bishop-1b1c84b7d2550e84a0dd17ef5d2b9599dea7560aa182d9cf21354e08fec20388.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 215, app/assets/stylesheets/pieces.scss */
.side-green.piece-rook {
  background-image: url(/assets/chesspieces/green/green_rook-198c11ff30a002a94c8e1ce45e9f04c424f5ed345795d7c3e94cc29f396f24e1.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 221, app/assets/stylesheets/pieces.scss */
.side-green.piece-queen {
  background-image: url(/assets/chesspieces/green/green_queen-25c565af22995ff60f059694a63166299ce2518330b0023ec8850c12275505e8.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 227, app/assets/stylesheets/pieces.scss */
.side-green.piece-king {
  background-image: url(/assets/chesspieces/green/green_king-f1015de8ff459659d2fac22029111c98ca6a429ce11f1587f150f2ed44231fdb.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* Orange pieces */
/* line 234, app/assets/stylesheets/pieces.scss */
.side-orange.piece-pawn {
  background-image: url(/assets/chesspieces/orange/orange_pawn-42180df373ff6d61765f039dad2636db41a6de8bb15a5d9907ea25470d6d9dc2.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 240, app/assets/stylesheets/pieces.scss */
.side-orange.piece-knight {
  background-image: url(/assets/chesspieces/orange/orange_knight-881f68bc1d4400626c1fc2066a50105f917158d0bd38b2f0b7970a518d79cbc9.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 246, app/assets/stylesheets/pieces.scss */
.side-orange.piece-bishop {
  background-image: url(/assets/chesspieces/orange/orange_bishop-6746b8105a5ec71b3d376c834e70be22b6aea0a753e0bcb72473d84ddc72fa41.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 252, app/assets/stylesheets/pieces.scss */
.side-orange.piece-rook {
  background-image: url(/assets/chesspieces/orange/orange_rook-e54fa0eeda5327e151ecfaab76379ac62def39ef034fe67ae88c46546a798cb9.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 258, app/assets/stylesheets/pieces.scss */
.side-orange.piece-queen {
  background-image: url(/assets/chesspieces/orange/orange_queen-0e26a1d00994fe5596565129f3953f560988f35f8c1d99d3b03bf521bf102afe.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 264, app/assets/stylesheets/pieces.scss */
.side-orange.piece-king {
  background-image: url(/assets/chesspieces/orange/orange_king-4ec081220580c3a1407d2713e14b0752fbd667d398c2d49e429c8f895b95df90.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* Purple pieces */
/* line 271, app/assets/stylesheets/pieces.scss */
.side-purple.piece-pawn {
  background-image: url(/assets/chesspieces/purple/purple_pawn-b9a4fa6cefde398b379882b2035fcca010e37efe6a90306baa5fe8db28175b64.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 277, app/assets/stylesheets/pieces.scss */
.side-purple.piece-knight {
  background-image: url(/assets/chesspieces/purple/purple_knight-9c6c00320eec0dba7235af86589ffdb6c65a48240e042e7a00cbf808a26ffb9b.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 283, app/assets/stylesheets/pieces.scss */
.side-purple.piece-bishop {
  background-image: url(/assets/chesspieces/purple/purple_bishop-ab5beffb06fc9f37d107d6fb9e06e972b7830491d2fef09508ef0c16a92581d8.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 289, app/assets/stylesheets/pieces.scss */
.side-purple.piece-rook {
  background-image: url(/assets/chesspieces/purple/purple_rook-2cf1ead6490f381f6879aba5176d9a386844bc2923d62944d47b3f0776b8aba5.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 295, app/assets/stylesheets/pieces.scss */
.side-purple.piece-queen {
  background-image: url(/assets/chesspieces/purple/purple_queen-f93fc6af23bf4af4636851eb3987d643f133c0f0747c9cbab92f4a3ccd7d92ad.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 301, app/assets/stylesheets/pieces.scss */
.side-purple.piece-king {
  background-image: url(/assets/chesspieces/purple/purple_king-8bc2c90eed6de0e0c26086ee9d542367d6c7aac9c2d78ed5e7ee384e5c01cacf.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* Yellow pieces */
/* line 308, app/assets/stylesheets/pieces.scss */
.side-yellow.piece-pawn {
  background-image: url(/assets/chesspieces/yellow/yellow_pawn-c55b8bb21342b8fb75e01e7e9297424ed116a43ec438f9280f87b4054cbd8c5e.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 314, app/assets/stylesheets/pieces.scss */
.side-yellow.piece-knight {
  background-image: url(/assets/chesspieces/yellow/yellow_knight-1b28c8e0d852ae497b4fac52918530d64524cf6d43782bef98a6e112c46548ac.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 320, app/assets/stylesheets/pieces.scss */
.side-yellow.piece-bishop {
  background-image: url(/assets/chesspieces/yellow/yellow_bishop-1d74aa5930fe8df260d3b071ce0404d91b5ce7e49499baa96defd77c105ebb6a.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 326, app/assets/stylesheets/pieces.scss */
.side-yellow.piece-rook {
  background-image: url(/assets/chesspieces/yellow/yellow_rook-a77cca6cac2a697e55f6ee2923fba27bcb932b8fea3e7b30c7f2883f0a14f648.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 332, app/assets/stylesheets/pieces.scss */
.side-yellow.piece-queen {
  background-image: url(/assets/chesspieces/yellow/yellow_queen-6023b54482353defb80f1bfc55d83e4ad854e45078c5c7066b7471e684a38eab.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}

/* line 338, app/assets/stylesheets/pieces.scss */
.side-yellow.piece-king {
  background-image: url(/assets/chesspieces/yellow/yellow_king-18c5ab67dda9cc0558e4e5227e60df1750465a30b225c554b24c41c5a2d2aacf.png);
  background-size: 50px 50px;
  background-repeat: no-repeat;
}
/* Game-specific styles - Modern overrides */

/* Ensure game layout works properly */
.game-layout {
  min-height: calc(100vh - var(--header-height));
}

/* Hide old sidebar styles */
#left-sidebar {
  display: none !important;
}

/* Override main content margin for new layout */
#main-content.with-sidebar {
  margin-left: 0;
  padding: 0;
}

/* Ensure board container is properly styled */
.board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  .game-layout {
    flex-direction: column;
  }
  
  .game-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: translateX(-100%);
    z-index: var(--z-modal);
    background-color: var(--neutral-50);
    border-right: none;
    border-bottom: 1px solid var(--neutral-200);
  }
  
  .game-sidebar.open {
    transform: translateX(0);
  }
  
  .game-main {
    width: 100%;
  }
}

/* Legacy support for any remaining old classes */
.instruction-examples {
  margin: var(--space-4) 0;
  padding: var(--space-3);
  background-color: var(--neutral-100);
  border-radius: var(--radius-lg);
}

.example-item {
  display: flex;
  align-items: center;
  margin: var(--space-2) 0;
  gap: var(--space-3);
}

.example-label {
  font-weight: var(--font-medium);
  min-width: 120px;
  color: var(--neutral-700);
}

.example-square {
  width: 20px;
  height: 20px;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.example-square.light {
  background-color: var(--board-light);
}

.example-square.dark {
  background-color: var(--board-dark);
}

.example-square.wall {
  background-color: var(--board-wall);
}

.example-square.upgrade {
  background-color: var(--board-upgrade);
}

.example-square.movable {
  background-color: var(--board-move);
}

.example-desc {
  color: var(--neutral-600);
  font-size: var(--text-sm);
}

/* Board loading and error states */
.board-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  min-height: 300px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--neutral-200);
  border-top: 4px solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-4);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.board-loading p {
  color: var(--neutral-600);
  font-size: var(--text-lg);
  margin: 0;
}

.board-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  min-height: 300px;
  text-align: center;
}

.board-error p {
  color: var(--error-600);
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
}
/* Games List Styles */

.games-list {
  margin-top: 20px;
}

.game-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: box-shadow 0.2s;
}

.game-card:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.game-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.2em;
}

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

.btn-play, .btn-delete, .btn-primary {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  display: inline-block;
}

.btn-primary {
  background-color: #007bff;
  color: white;
  margin-bottom: 20px;
}

.btn-primary:hover {
  background-color: #0056b3;
  text-decoration: none;
  color: white;
}

.btn-play {
  background-color: #28a745;
  color: white;
}

.btn-play:hover {
  background-color: #1e7e34;
  text-decoration: none;
  color: white;
}

.btn-delete {
  background-color: #dc3545;
  color: white;
}

.btn-delete:hover {
  background-color: #c82333;
  text-decoration: none;
  color: white;
}

.game-info {
  line-height: 1.5;
}

.game-info p {
  margin: 8px 0;
  color: #666;
}

.game-info strong {
  color: #333;
}

.players ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.players li {
  margin: 4px 0;
  color: #666;
}

.no-games {
  text-align: center;
  padding: 40px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  color: #666;
}

.no-games p {
  margin-bottom: 16px;
  font-size: 1.1em;
}

/* Responsive design */
@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .game-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .btn-play, .btn-delete {
    flex: 1;
    text-align: center;
  }
}
/* Board show page styles */

.board-show-container {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.board-show-container h2 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #333;
}

.board-show-container p {
  margin-bottom: 12px;
  line-height: 1.4;
  color: #666;
}

.board-show-container a {
  color: #007bff;
  text-decoration: none;
}

.board-show-container a:hover {
  text-decoration: underline;
}

/* Import modal styles for board editor */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background-color: #fefefe;
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 60%;
  max-width: 500px;
  border-radius: 8px;
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

.modal-content textarea {
  width: 100%;
  height: 200px;
  margin-bottom: 16px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: monospace;
}

.modal-content button {
  background-color: #007bff;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.modal-content button:hover {
  background-color: #0056b3;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
}
/* Game pages specific styling - overrides chessboard background */
/* Only target actual game pages, NOT the welcome page */

/* Hide chessboard background on game pages */
body.games-show::before,
body.games-index::before,
body.games-new::before {
  display: none !important;
}

/* Set black background on game pages */
body.games-show,
body.games-index,
body.games-new {
  background: #000000 !important;
}

/* Hide chessboard background on board editor pages */
body.boards-editor::before,
body.boards-show::before {
  display: none !important;
}

/* Set black background on board editor pages */
body.boards-editor,
body.boards-show {
  background: #000000 !important;
}

/* Explicitly preserve chessboard background on welcome page */
body.games-welcome::before {
  display: block !important;
}

body.games-welcome {
  background: transparent !important;
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS) file within this directory, lib/assets/stylesheets, or vendor/assets/stylesheets
 * can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *



















 */

/* Sidebar link styles */
.sidebar-links {
  margin-bottom: 20px;
}

.sidebar-link {
  display: block;
  padding: 8px 12px;
  margin-bottom: 8px;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}

.user-rating {
  text-align: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 15px;
}

/* Reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; }

.container {
  display: flex;
  min-height: 100vh;
}

/* App header styles moved to components/_header.css */

:root {
  --header-height: 64px;
  --sidebar-width: 240px;
}

body {
  padding-top: var(--header-height);
  background: #fafafa;
}

/* Utility class for pages that need flush headers */
body.flush-header {
  padding-top: 0;
  background: none;
  margin: 0;
  min-height: 100vh;
}

/* Gold hero styling for flush-header pages */
body.flush-header .page-header,
body.flush-header .leaderboard-header,
body.flush-header .ratings-dashboard-header,
body.flush-header .game-history-header {
  background: linear-gradient(135deg, #daa520 0%, #ffd700 25%, #fff8dc 50%, #ffd700 75%, #daa520 100%);
  color: black;
  border-radius: 1rem;
  padding: 3rem 2rem;
  margin: 2rem auto 3rem auto;
  max-width: 90vw;
  width: 100%;
  text-align: center;
  box-shadow: 0 0.5rem 2rem rgba(218, 165, 32, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Header content styling for consistent layout */
body.flush-header .header-content {
  flex: 1;
  text-align: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

/* Header actions styling for consistent button layout */
body.flush-header .header-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0;
  width: 100%;
}

/* Sophisticated typography for hero titles */
body.flush-header .page-header h1,
body.flush-header .leaderboard-title,
body.flush-header .ratings-dashboard-title,
body.flush-header .game-history-title {
  font-family: 'EB Garamond', 'Garamond', 'Times New Roman', serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  margin: 0 0 1rem 0;
  text-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* Sophisticated typography for hero subtitles */
body.flush-header .leaderboard-subtitle,
body.flush-header .ratings-dashboard-subtitle,
body.flush-header .game-history-subtitle {
  font-family: 'EB Garamond', 'Garamond', 'Times New Roman', serif;
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  font-weight: 400;
  margin: 0 0 1.5rem 0;
  opacity: 0.85;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* Enhanced button styling in heroes */
body.flush-header .page-header .btn-primary,
body.flush-header .leaderboard-btn,
body.flush-header .ratings-dashboard-btn,
body.flush-header .game-history-btn {
  font-family: 'EB Garamond', 'Garamond', 'Times New Roman', serif;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  font-size: clamp(0.75rem, 1.5vw, 0.875rem);
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
}

/* Hero header actions styling - moved up for consistency */

/* Responsive typography */
@media (max-width: 48rem) {
  body.flush-header .page-header,
  body.flush-header .leaderboard-header,
  body.flush-header .ratings-dashboard-header,
  body.flush-header .game-history-header {
    padding: 2rem 1.5rem;
    margin: 1.5rem auto 2rem auto;
    max-width: 95vw;
  }
  
  body.flush-header .header-actions {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }
  
  body.flush-header .page-header .btn-primary,
  body.flush-header .leaderboard-btn,
  body.flush-header .ratings-dashboard-btn,
  body.flush-header .game-history-btn {
    width: 100%;
    max-width: 20rem;
  }
}

.app-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  min-height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-title {
  margin: 0;
  font-size: 1.8em;
  color: #333;
  font-weight: bold;
}

.app-title-link {
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease;
}

.app-title-link:hover {
  color: #007bff;
  text-decoration: none;
}

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

.user-info {
  color: #555;
  font-size: 0.9em;
  padding-right: 8px;
  border-right: 1px solid #ddd;
}

.header-link {
  color: #007bff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.header-link:hover {
  background-color: #f8f9fa;
  text-decoration: none;
}

.header-link.logout {
  color: #dc3545;
}

.header-link.logout:hover {
  background-color: #f8d7da;
}

.header-link.admin-link {
  color: #28a745;
  font-weight: bold;
}

.header-link.admin-link:hover {
  background-color: #d4edda;
  color: #155724;
}

.main-content {
  flex: 1;
  padding: 20px;
}

.sidebar h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.2em;
}

.logout-button {
  display: inline-block;
  padding: 10px 15px;
  background-color: #e74c3c;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}

.logout-button:hover {
  background-color: #c0392b;
}

/* Main content base styles */
#main-content {
  min-height: calc(100vh - var(--header-height));
}

/* Game Controls */
.game-controls {
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.control-btn:hover {
  background: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.control-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.rotate-icon {
  font-size: 16px;
  font-weight: bold;
}

/* Board rotation styles */
#board {
  transition: transform 0.3s ease;
  transform-origin: center center;
  position: relative;
  --rotation-degrees: 0deg; /* Default rotation value */
}

/* Instructions styling */
kbd {
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  color: #3c4043;
  display: inline-block;
  font-size: 0.85em;
  font-weight: 500;
  line-height: 1;
  padding: 2px 4px;
  white-space: nowrap;
}

/*# sourceMappingURL=application.css-ac7eb0a0cfd2f233aeb8fd0e205046a8fc73169900694c39ec69c0dad50ab4ed.map */
