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

  /* App background theme (default: golf – crisp white + green) */
  --app-bg: #ffffff;
  --app-bg-raised: #f8fafc;
  --app-border: #9acd32;
  --app-text: #111827;
  --app-text-muted: #4b5563;
  --surface: #ffffff;
  --surface-raised: #f8fafc;
  --border: #9acd32;
  --text: #111827;
  --text-muted: #6b7280;

  /* 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;
  }
}
/* Background theme overrides. Default (golf) is in variables.css :root. */

/* Golf – crisp white + green border (dashboard look), explicit so it can be re-selected */
[data-background-theme="golf"] {
  --app-bg: #ffffff;
  --app-bg-raised: #f8fafc;
  --app-border: #9acd32;
  --app-text: #111827;
  --app-text-muted: #4b5563;
  --surface: #ffffff;
  --surface-raised: #f8fafc;
  --border: #9acd32;
  --text: #111827;
  --text-muted: #6b7280;
}

/* Dark golf – dark green-gray with green accent */
[data-background-theme="dark-golf"] {
  --app-bg: #1a2e1a;
  --app-bg-raised: #243824;
  --app-border: #9acd32;
  --app-text: #e8f0e8;
  --app-text-muted: #9ca39c;
  --surface: #1a2e1a;
  --surface-raised: #243824;
  --border: #9acd32;
  --text: #e8f0e8;
  --text-muted: #9ca39c;
}

/* Sith – dramatic black, off-white and dark red */
[data-background-theme="sith"] {
  --app-bg: #0d0d0d;
  --app-bg-raised: #1a1a1a;
  --app-border: #5c1010;
  --app-text: #f0eeeb;
  --app-text-muted: #9a9590;
  --surface: #0d0d0d;
  --surface-raised: #1a1a1a;
  --border: #5c1010;
  --text: #f0eeeb;
  --text-muted: #9a9590;
}

/* Eggplant – lobby-style dark purple */
[data-background-theme="eggplant"] {
  --app-bg: #1a1a2e;
  --app-bg-raised: #24243e;
  --app-border: #2d2d4a;
  --app-text: #e8e8e8;
  --app-text-muted: #9ca3af;
  --surface: #1a1a2e;
  --surface-raised: #24243e;
  --border: #2d2d4a;
  --text: #e8e8e8;
  --text-muted: #888;
}

/* Slate – dark gray */
[data-background-theme="slate"] {
  --app-bg: #1f2937;
  --app-bg-raised: #374151;
  --app-border: #4b5563;
  --app-text: #f3f4f6;
  --app-text-muted: #9ca3af;
  --surface: #1f2937;
  --surface-raised: #374151;
  --border: #4b5563;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
}

/* White – neutral gray/white (no green) */
[data-background-theme="white"] {
  --app-bg: #f9fafb;
  --app-bg-raised: #f3f4f6;
  --app-border: #e5e7eb;
  --app-text: #111827;
  --app-text-muted: #4b5563;
  --surface: #f9fafb;
  --surface-raised: #f3f4f6;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
}

/* Cream – warm off-white */
[data-background-theme="cream"] {
  --app-bg: #faf6f0;
  --app-bg-raised: #f5ede0;
  --app-border: #e8dfd0;
  --app-text: #292524;
  --app-text-muted: #57534e;
  --surface: #faf6f0;
  --surface-raised: #f5ede0;
  --border: #e8dfd0;
  --text: #292524;
  --text-muted: #57534e;
}

/* Sky – light blue-gray */
[data-background-theme="sky"] {
  --app-bg: #eef4fc;
  --app-bg-raised: #e0eef9;
  --app-border: #bdd9f2;
  --app-text: #1e3a5f;
  --app-text-muted: #4b6b8a;
  --surface: #eef4fc;
  --surface-raised: #e0eef9;
  --border: #bdd9f2;
  --text: #1e3a5f;
  --text-muted: #4b6b8a;
}

/* Sage – muted green-gray */
[data-background-theme="sage"] {
  --app-bg: #f0f2ed;
  --app-bg-raised: #e4e8dc;
  --app-border: #c8d0bc;
  --app-text: #2d3325;
  --app-text-muted: #5c6352;
  --surface: #f0f2ed;
  --surface-raised: #e4e8dc;
  --border: #c8d0bc;
  --text: #2d3325;
  --text-muted: #5c6352;
}
/* 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 — position: fixed; JS sets top + height to match actual header */
.game-sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height); /* CSS fallback; JS overrides with measured header height */
  width: var(--sidebar-width);
  background-color: var(--app-bg-raised);
  border-right: 0.0625rem solid var(--app-border);
  padding: var(--space-3);
  overflow-y: auto;
  transition: transform var(--transition-base);
  z-index: var(--z-sticky);
}

.game-sidebar:hover {
  z-index: calc(var(--z-fixed) + 1000);
}

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

/* Main game area — offset by sidebar width since sidebar is no longer in flow */
.game-main {
  background: none;
  flex: 1;
  display: block;
  min-width: 0;
  margin-left: var(--sidebar-width);
}

/* 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(--surface-raised);
  border-top: 0.0625rem solid var(--border);
}

/* Mobile Layout */
@media (max-width: 768px) {
  .game-layout {
    flex-direction: column;
  }

  .game-sidebar {
    top: var(--header-height);
    height: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: translateX(-100%);
    z-index: var(--z-modal);
    background-color: var(--app-bg);
    border-right: none;
    border-bottom: 0.0625rem solid var(--app-border);
  }

  .game-sidebar.open {
    transform: translateX(0);
  }

  .game-main {
    width: 100%;
    margin-left: 0;
  }

  .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;
  }

  .game-main {
    margin-left: 16rem;
  }

  .board-section {
    padding: var(--space-3) var(--space-4);
  }
}

/* Large Desktop */
@media (min-width: 1280px) {
  .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(--app-bg);
  border-bottom: 1px solid var(--app-border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  color: var(--app-text);
}

.page-header-shell {
  background: linear-gradient(135deg, var(--app-bg) 0%, var(--app-bg-raised) 100%);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: var(--header-height);
  z-index: 1090;
  overflow: hidden;
  color: var(--app-text);
}

.page-header-content {
  padding: 1.5rem 1.5rem;
  padding: var(--space-6, 1.5rem) var(--space-6, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  gap: var(--space-6, 1.5rem);
  max-width: 80rem;
  max-width: var(--content-max-width, 80rem);
  margin: 0 auto;
}

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

.page-header-subtitle {
  font-size: 1rem;
  color: var(--app-text-muted);
  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: var(--app-bg-raised);
  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: var(--app-text-muted);
  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: var(--app-border);
  color: var(--app-text);
  text-decoration: none;
  transform: translateY(-1px);
}

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

.page-header-tab-beta {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff !important;
  font-weight: 700;
}
.page-header-tab-beta:hover {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #fff !important;
}
.page-header-tab-beta.active {
  background: linear-gradient(135deg, #b45309, #92400e) !important;
  color: #fff !important;
}

.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;
  }
  
  .app-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;
  }
  
  .app-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(--app-text);
}

.app-title-link {
  color: var(--app-text);
  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 */
.app-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(--app-bg-raised);
  color: var(--app-text);
  border: 1px solid var(--app-border);
  box-shadow: none;
}

.header-btn-nav:hover {
  background: var(--app-bg);
  color: var(--app-text);
  border-color: var(--app-border);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

/* Gold “my turn” highlight on Games when user has games waiting */
.header-btn-nav--my-turn {
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.35);
  color: #b45309;
}
.header-btn-nav--my-turn:hover {
  border-color: #b45309;
  box-shadow: 0 0 0 2px rgba(180, 83, 9, 0.4);
  color: #92400e;
  text-decoration: none;
}

/* Bug report button */
.header-btn-bug {
  font-size: 12px;
  padding: 4px 10px;
  opacity: 0.7;
}
.header-btn-bug:hover {
  opacity: 1;
}

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

/* Beta button style */
.header-btn-beta {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-color: #d97706;
}
.header-btn-beta:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(217, 119, 6, 0.35);
  text-decoration: none;
}

/* 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);
  }
  
  .app-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);
  }
  
  .app-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(--app-text);
  margin: 0;
}

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

.sidebar-close:hover {
  background-color: var(--surface-raised);
  color: var(--app-text);
}

/* Game Status Card */
.game-status-card {
  background-color: var(--app-bg);
  border: 1px solid var(--app-border);
  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(--text-muted);
  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(--text);
}

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

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

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

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

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

.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(--surface-raised);
  border: 1px solid var(--border);
  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(--text);
}

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

.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(--text-muted);
}

.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(--surface-raised);
  border: 1px solid var(--border);
  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(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

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

.instructions-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  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(--text);
  font-weight: var(--font-medium);
}

.example-square {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  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: var(--surface);
  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(--border);
  background: var(--surface-raised);
}

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

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

.modal-close:hover {
  background: var(--surface-raised);
  color: var(--text);
}

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

.modal-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--surface-raised);
  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(--surface-raised);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  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(--text);
}

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

.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(--text);
  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(--text);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: var(--border);
}

.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;
  }
  

}
@charset "UTF-8";
/* Enhanced Board Component - Modern chess board styling */
/* line 3, app/assets/stylesheets/board-modern.scss */
.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 (unquote so Sass does not parse CSS min/calc) */
  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 */
/* line 34, app/assets/stylesheets/board-modern.scss */
.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 */
/* line 48, app/assets/stylesheets/board-modern.scss */
.square.light {
  background-color: var(--board-light);
}

/* line 52, app/assets/stylesheets/board-modern.scss */
.square.dark {
  background-color: var(--board-dark);
}

/* Square States */
/* line 57, app/assets/stylesheets/board-modern.scss */
.square:hover {
  box-shadow: inset 0 0 0 0.005rem var(--primary-400);
  z-index: 1;
}

/*.chess-board:not(.fullscreen) .square.movable {*/
/* line 63, app/assets/stylesheets/board-modern.scss */
.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);
}

/* line 69, app/assets/stylesheets/board-modern.scss */
.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);
}

/* line 77, app/assets/stylesheets/board-modern.scss */
.square.selected {
  background-color: var(--primary-200);
  box-shadow: inset 0 0 0 0.01rem var(--primary-600);
  z-index: 2;
}

/* Special Square Types */
/* line 84, app/assets/stylesheets/board-modern.scss */
.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;
}

/* line 93, app/assets/stylesheets/board-modern.scss */
.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 */
/* line 111, app/assets/stylesheets/board-modern.scss */
.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);
}

/* line 117, app/assets/stylesheets/board-modern.scss */
.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 */
/* line 124, app/assets/stylesheets/board-modern.scss */
.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 */
/* line 131, app/assets/stylesheets/board-modern.scss */
.square.last-move-from {
  position: relative;
  animation: lastMoveFrom 3s ease-in-out infinite;
}

/* line 136, app/assets/stylesheets/board-modern.scss */
.square.last-move-to {
  position: relative;
  animation: lastMoveTo 3s ease-in-out infinite;
}

/* Piece positioning */
/* line 142, app/assets/stylesheets/board-modern.scss */
.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 */
/* line 159, app/assets/stylesheets/board-modern.scss */
.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) {
  /* line 239, app/assets/stylesheets/board-modern.scss */
  .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);
  }
  /* line 248, app/assets/stylesheets/board-modern.scss */
  .piece[data-first-move="true"]::after {
    width: 0.05rem;
    height: 0.05rem;
    top: -0.025rem;
    right: -0.025rem;
  }
}

@media (max-width: 480px) {
  /* line 257, app/assets/stylesheets/board-modern.scss */
  .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) {
  /* line 268, app/assets/stylesheets/board-modern.scss */
  .square.light {
    background-color: #ffffff;
  }
  /* line 272, app/assets/stylesheets/board-modern.scss */
  .square.dark {
    background-color: #000000;
  }
  /* line 276, app/assets/stylesheets/board-modern.scss */
  .square.movable {
    background-color: #00ff00;
  }
  /* line 280, app/assets/stylesheets/board-modern.scss */
  .square.killable {
    background-color: #ff0000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  /* line 287, app/assets/stylesheets/board-modern.scss */
  .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 */
  /* line 303, app/assets/stylesheets/board-modern.scss */
  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;
}

/* Game info block at top of history modal */
.history-modal-game-info {
  background: var(--surface-raised, #f1f5f9);
  border-radius: var(--radius-md, 8px);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border, #e2e8f0);
}
.history-modal-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem 1.5rem;
}
.history-modal-info-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.history-modal-info-row.history-modal-info-players {
  grid-column: 1 / -1;
}
.history-modal-info-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
}
.history-modal-info-value {
  font-size: 0.9rem;
  color: var(--text, #1e293b);
}
.history-modal-players-list {
  line-height: 1.5;
}
.history-modal-info-value.result-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  width: fit-content;
}
.history-modal-info-value.result-won { background: #dcfce7; color: #166534; }
.history-modal-info-value.result-lost { background: #fee2e2; color: #991b1b; }
.history-modal-info-value.result-resigned { background: #fef3c7; color: #92400e; }
.history-modal-info-value.result-draw { background: #e0f2fe; color: #0369a1; }
.history-modal-info-value.result-unknown { background: #f1f5f9; color: #64748b; }

/* History modal uses invitation-style miniboard (.inv-board-preview) */
.history-modal .history-board-thumbnail-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
}
.history-modal .history-board-thumbnail-wrap .inv-board-preview {
  flex-shrink: 0;
}

/* 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: var(--app-text);
  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: var(--app-text);
  margin: 0 0 0.5rem 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.leaderboard-subtitle {
  font-size: 1.25rem;
  color: var(--app-text-muted);
  margin: 0;
  font-weight: 500;
}

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

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

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

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

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

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

.rank-badge {
  background: var(--surface-raised);
  color: var(--text-muted);
  font-weight: bold;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-right: 1rem;
  min-width: 40px;
  text-align: center;
  border: 1px solid var(--border);
}

.rank-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
}

.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: var(--text);
  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: var(--text-muted);
}

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

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

.stat-value {
  font-weight: 600;
  color: var(--text);
}

.stat-separator {
  color: var(--border);
}

.player-rating {
  font-weight: bold;
  color: var(--text);
  font-size: 1.125rem;
}

.current-rank {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

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

.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

.empty-state p {
  font-size: 1rem;
  margin: 0 0 2rem 0;
  color: var(--text-muted);
}

.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: var(--app-text);
  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: var(--surface);
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  overflow: hidden;
  color: var(--text);
  border: 2px solid var(--border);
}

.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: var(--text);
}

.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: var(--surface);
  padding: 1.5rem;
  border-left: 1px solid var(--border);
}

.top-players-card {
  border-bottom: 1px solid var(--border);
}

.view-all-link {
  color: var(--border);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.view-all-link:hover {
  color: var(--text);
  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: var(--surface-raised);
}

.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: var(--app-text);
  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: var(--app-text);
  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: var(--app-text-muted);
  margin: 0;
  font-weight: 500;
}

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

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

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

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

.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: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  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 var(--border);
  transition: all 0.2s ease;
}

.game-history-item:hover {
  background: var(--surface-raised);
}

.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: var(--text);
  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: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.style-switcher h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: var(--text);
  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;
}

/* Aero (Frutiger Aero) Style */
.style-btn.aero {
  background: linear-gradient(180deg, #6dd8f0 0%, #29b6d4 50%, #0097b8 100%);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 80, 120, 0.5);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.style-btn.aero:hover {
  background: linear-gradient(180deg, #80e4f8 0%, #35c8e8 50%, #0aaad0 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), 0 0 10px rgba(0, 188, 212, 0.5);
}

/* Tron Style */
.style-btn.tron {
  background: linear-gradient(135deg, #001428, #000810);
  color: #00ffff;
  text-shadow: 0 0 8px #00ffff;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

.style-btn.tron:hover {
  background: linear-gradient(135deg, #002040, #001020);
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.7);
}

/* Safari Style */
.style-btn.safari {
  background: linear-gradient(135deg, #7a4e1a, #3a2008);
  color: #e2c06a;
}

.style-btn.safari:hover {
  background: linear-gradient(135deg, #8b5e28, #4a2e10);
  box-shadow: 0 0 8px rgba(226, 192, 106, 0.4);
}

/* UNSC (Halo Human Tech) Style */
.style-btn.unsc {
  background: linear-gradient(135deg, #4a5240, #252e1e);
  color: #ffa040;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

.style-btn.unsc:hover {
  background: linear-gradient(135deg, #3a4030, #1a2010);
  box-shadow: 0 0 8px rgba(255, 160, 64, 0.5);
}

/* Covenant (Halo Covenant Tech) Style */
.style-btn.covenant {
  background: linear-gradient(135deg, #2d1060, #10052e);
  color: #00e5ff;
  text-shadow: 0 0 6px #00e5ff;
}

.style-btn.covenant:hover {
  background: linear-gradient(135deg, #3d1880, #1a0a4e);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
}

/* Cafe Style */
.style-btn.cafe {
  background: linear-gradient(135deg, #6b3520, #2a1205);
  color: #d4a870;
}

.style-btn.cafe:hover {
  background: linear-gradient(135deg, #7a3e28, #3a1a08);
  box-shadow: 0 0 8px rgba(212, 168, 112, 0.4);
}

/* Baroque Style */
.style-btn.baroque {
  background: linear-gradient(135deg, #3d2618, #1a0e06);
  color: #c09010;
}

.style-btn.baroque:hover {
  background: linear-gradient(135deg, #4e3828, #2a1810);
  box-shadow: 0 0 8px rgba(192, 144, 16, 0.5);
}

/* Lannister Style */
.style-btn.lannister {
  background: linear-gradient(135deg, #8b0000, #3a0000);
  color: #d4af37;
  text-shadow: 0 0 4px rgba(212, 175, 55, 0.6);
}

.style-btn.lannister:hover {
  background: linear-gradient(135deg, #a00000, #500000);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* 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 .square.light.last-move-from,
.style-cyber .square.dark.last-move-from {
  box-shadow: inset 0 0 0 2px #c0c0c0, 0 0 8px rgba(192, 192, 192, 0.5) !important;
  animation: glitteryFromBorder 3s ease-in-out infinite !important;
}

.style-cyber .square.light.last-move-to,
.style-cyber .square.dark.last-move-to {
  box-shadow: inset 0 0 0 3px #e0d0ff, 0 0 12px rgba(200, 180, 255, 0.8) !important;
  animation: glitteryToBorder 3s ease-in-out infinite !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 neonFlashYellow {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #ffff00, 0 0 15px rgba(255, 255, 0, 0.7);
  }
  50% {
    box-shadow: inset 0 0 0 4px #ffff00, 0 0 28px rgba(255, 255, 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: #b8b8b8 !important; /* Light gray */
  border: 1px solid #a8a8a8 !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: #b8b8b8 !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: #b8b8b8 !important;
  box-shadow: inset 0 0 0 2px #808080 !important;
}

body.style-kindle .example-square.dark.killable {
  background-color: #b8b8b8 !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;
}

/* ============================================================ */
/* Style Template 7: UNSC (Halo Human Military Tech)           */
/* ============================================================ */
.style-unsc .square.light {
  background-color: #4a5240 !important; /* Military olive-gray */
  border: 1px solid #5a6450 !important;
}

.style-unsc .square.dark {
  background-color: #252e1e !important; /* Dark camo green */
  border: 1px solid #1a2215 !important;
}

.style-unsc .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 #1a2010 !important;
  filter: sepia(40%) brightness(0.5) contrast(130%) !important;
}

.style-unsc .square.light.upgrade {
  background: linear-gradient(135deg, #ff6b00 0%, #ffa040 50%, #ff6b00 100%) !important;
  border: 1px solid #5a6450 !important;
}

.style-unsc .square.dark.upgrade {
  background: linear-gradient(135deg, #cc5500 0%, #ff7820 50%, #cc5500 100%) !important;
  border: 1px solid #1a2215 !important;
}

.style-unsc .square.light.upgrade.killable {
  background: linear-gradient(135deg, #ff6b00 0%, #ffa040 50%, #ff6b00 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-unsc .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #cc5500 0%, #ff7820 50%, #cc5500 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-unsc .square.light.upgrade.movable {
  background: linear-gradient(135deg, #ff6b00 0%, #ffa040 50%, #ff6b00 100%) !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 2s ease-in-out infinite !important;
}

.style-unsc .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #cc5500 0%, #ff7820 50%, #cc5500 100%) !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 2s ease-in-out infinite !important;
}

.style-unsc .square.light.movable {
  background-color: #4a5240 !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 2s ease-in-out infinite !important;
}

.style-unsc .square.dark.movable {
  background-color: #252e1e !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 2s ease-in-out infinite !important;
}

.style-unsc .square.light.killable {
  background-color: #4a5240 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 2s ease-in-out infinite !important;
}

.style-unsc .square.dark.killable {
  background-color: #252e1e !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 2s ease-in-out infinite !important;
}

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

.style-unsc #board {
  border: 8px solid #3a4030 !important;
  border-radius: 0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(0, 0, 0, 0.4) !important;
  background: #1a2010 !important;
}

.style-unsc .piece {
  filter: brightness(0.85) contrast(115%) !important;
}

/* ============================================================ */
/* Style Template 8: Covenant (Halo Covenant Alien Tech)       */
/* ============================================================ */
.style-covenant .square.light {
  background: linear-gradient(135deg, #1e0848 0%, #4a20a8 38%, #3318a0 62%, #1e0848 100%) !important;
  border: 1px solid #3d1880 !important;
  box-shadow: inset 0 1px 3px rgba(120, 60, 255, 0.4), inset 0 -1px 2px rgba(0, 0, 0, 0.6) !important;
}

.style-covenant .square.dark {
  background: linear-gradient(135deg, #07011a 0%, #200858 38%, #130440 62%, #07011a 100%) !important;
  border: 1px solid #1a0a4e !important;
  box-shadow: inset 0 1px 2px rgba(80, 20, 180, 0.3), inset 0 -1px 2px rgba(0, 0, 0, 0.8) !important;
}

.style-covenant .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 #6a0dad !important;
  filter: hue-rotate(260deg) saturate(2) brightness(0.5) !important;
}

.style-covenant .square.light.upgrade {
  background: linear-gradient(135deg, #00e5ff 0%, #80d8ff 50%, #00e5ff 100%) !important;
  border: 1px solid #3d1880 !important;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.5) !important;
}

.style-covenant .square.dark.upgrade {
  background: linear-gradient(135deg, #0097a7 0%, #00bcd4 50%, #0097a7 100%) !important;
  border: 1px solid #1a0a4e !important;
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.5) !important;
}

.style-covenant .square.light.upgrade.killable {
  background: linear-gradient(135deg, #00e5ff 0%, #80d8ff 50%, #00e5ff 100%) !important;
  box-shadow: inset 0 0 0 3px #e040fb, 0 0 10px rgba(224, 64, 251, 0.6) !important;
  animation: flashPlasmaPink 1.5s ease-in-out infinite !important;
}

.style-covenant .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #0097a7 0%, #00bcd4 50%, #0097a7 100%) !important;
  box-shadow: inset 0 0 0 3px #e040fb, 0 0 10px rgba(224, 64, 251, 0.6) !important;
  animation: flashPlasmaPink 1.5s ease-in-out infinite !important;
}

.style-covenant .square.light.upgrade.movable {
  background: linear-gradient(135deg, #00e5ff 0%, #80d8ff 50%, #00e5ff 100%) !important;
  box-shadow: inset 0 0 0 3px #00e5ff, 0 0 10px rgba(0, 229, 255, 0.6) !important;
  animation: flashPlasma 1.5s ease-in-out infinite !important;
}

.style-covenant .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #0097a7 0%, #00bcd4 50%, #0097a7 100%) !important;
  box-shadow: inset 0 0 0 3px #00e5ff, 0 0 10px rgba(0, 229, 255, 0.6) !important;
  animation: flashPlasma 1.5s ease-in-out infinite !important;
}

.style-covenant .square.light.movable {
  background: linear-gradient(135deg, #1e0848 0%, #4a20a8 38%, #3318a0 62%, #1e0848 100%) !important;
  box-shadow: inset 0 0 0 3px #00e5ff !important;
  animation: flashPlasma 1.5s ease-in-out infinite !important;
}

.style-covenant .square.dark.movable {
  background: linear-gradient(135deg, #07011a 0%, #200858 38%, #130440 62%, #07011a 100%) !important;
  box-shadow: inset 0 0 0 3px #00e5ff !important;
  animation: flashPlasma 1.5s ease-in-out infinite !important;
}

.style-covenant .square.light.killable {
  background: linear-gradient(135deg, #1e0848 0%, #4a20a8 38%, #3318a0 62%, #1e0848 100%) !important;
  box-shadow: inset 0 0 0 3px #e040fb !important;
  animation: flashPlasmaPink 1.5s ease-in-out infinite !important;
}

.style-covenant .square.dark.killable {
  background: linear-gradient(135deg, #07011a 0%, #200858 38%, #130440 62%, #07011a 100%) !important;
  box-shadow: inset 0 0 0 3px #e040fb !important;
  animation: flashPlasmaPink 1.5s ease-in-out infinite !important;
}

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

.style-covenant .square.light.last-move-from,
.style-covenant .square.dark.last-move-from {
  box-shadow: inset 0 0 0 2px #c0c0c0, 0 0 8px rgba(192, 192, 192, 0.5) !important;
  animation: glitteryFromBorder 3s ease-in-out infinite !important;
}

.style-covenant .square.light.last-move-to,
.style-covenant .square.dark.last-move-to {
  box-shadow: inset 0 0 0 3px #e0d0ff, 0 0 12px rgba(200, 180, 255, 0.8) !important;
  animation: glitteryToBorder 3s ease-in-out infinite !important;
}

.style-covenant #board {
  border: 10px solid #6a0dad !important;
  border-radius: 8px !important;
  box-shadow: 0 0 30px rgba(106, 13, 173, 0.8), inset 0 0 20px rgba(0, 0, 0, 0.6) !important;
  background: #05010f !important;
}

.style-covenant .piece {
  filter: hue-rotate(260deg) brightness(0.9) !important;
}

/* ============================================================ */
/* Style Template 9: Cafe                                      */
/* ============================================================ */
.style-cafe .square.light {
  background-color: #c8976a !important; /* Warm latte */
  border: 1px solid #d8a87a !important;
}

.style-cafe .square.dark {
  background-color: #5c3018 !important; /* Espresso */
  border: 1px solid #4c2210 !important;
}

.style-cafe .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 #8b5e3c !important;
  filter: sepia(100%) hue-rotate(10deg) brightness(0.35) !important;
}

.style-cafe .square.light.upgrade {
  background: linear-gradient(135deg, #ff9900 0%, #ffcc00 50%, #ff9900 100%) !important;
  border: 1px solid #d8a87a !important;
}

.style-cafe .square.dark.upgrade {
  background: linear-gradient(135deg, #cc7a00 0%, #ffaa00 50%, #cc7a00 100%) !important;
  border: 1px solid #4c2210 !important;
}

.style-cafe .square.light.upgrade.killable {
  background: linear-gradient(135deg, #ff9900 0%, #ffcc00 50%, #ff9900 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-cafe .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #cc7a00 0%, #ffaa00 50%, #cc7a00 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-cafe .square.light.upgrade.movable {
  background: linear-gradient(135deg, #ff9900 0%, #ffcc00 50%, #ff9900 100%) !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-cafe .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #cc7a00 0%, #ffaa00 50%, #cc7a00 100%) !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-cafe .square.light.movable {
  background-color: #c8976a !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-cafe .square.dark.movable {
  background-color: #5c3018 !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-cafe .square.light.killable {
  background-color: #c8976a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-cafe .square.dark.killable {
  background-color: #5c3018 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

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

.style-cafe #board {
  border: 8px solid #7a4a28 !important;
  border-radius: 4px !important;
  box-shadow: 0 0 20px rgba(122, 74, 40, 0.5), inset 0 0 12px rgba(0, 0, 0, 0.5) !important;
  background: #2a1205 !important;
}

/* ============================================================ */
/* Example square overrides for new themes                     */
/* ============================================================ */

/* UNSC theme examples */
body.style-unsc .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: sepia(40%) brightness(0.5) contrast(130%) !important;
}

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

body.style-unsc .example-square.light.movable {
  background-color: #4a5240 !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
}

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

body.style-unsc .example-square.dark.movable {
  background-color: #252e1e !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
}

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

/* Covenant theme examples */
body.style-covenant .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: hue-rotate(260deg) saturate(2) brightness(0.5) !important;
}

body.style-covenant .example-square.light.upgrade {
  background: linear-gradient(135deg, #00e5ff 0%, #80d8ff 50%, #00e5ff 100%) !important;
}

body.style-covenant .example-square.light.movable {
  background-color: #2d1060 !important;
  box-shadow: inset 0 0 0 3px #00e5ff !important;
}

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

body.style-covenant .example-square.dark.movable {
  background-color: #10052e !important;
  box-shadow: inset 0 0 0 3px #00e5ff !important;
}

body.style-covenant .example-square.dark.killable {
  background-color: #10052e !important;
  box-shadow: inset 0 0 0 3px #e040fb !important;
}

/* Cafe theme examples */
body.style-cafe .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: sepia(100%) hue-rotate(10deg) brightness(0.35) !important;
}

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

body.style-cafe .example-square.light.movable {
  background-color: #c8976a !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
}

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

body.style-cafe .example-square.dark.movable {
  background-color: #5c3018 !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
}

body.style-cafe .example-square.dark.killable {
  background-color: #5c3018 !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);
  }
}

@keyframes flashAmber {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #ffa040, 0 0 0 0 rgba(255, 160, 64, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #ffa040, 0 0 8px rgba(255, 160, 64, 0.6);
  }
}

@keyframes flashPlasma {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #00e5ff, 0 0 0 0 rgba(0, 229, 255, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #00e5ff, 0 0 10px rgba(0, 229, 255, 0.7);
  }
}

@keyframes flashPlasmaPink {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #e040fb, 0 0 0 0 rgba(224, 64, 251, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #e040fb, 0 0 10px rgba(224, 64, 251, 0.7);
  }
}

@keyframes flashLcarsBlue {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #6699ff, 0 0 0 0 rgba(102, 153, 255, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #6699ff, 0 0 8px rgba(102, 153, 255, 0.6);
  }
}

@keyframes flashRedAlert {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #cc0000, 0 0 0 0 rgba(204, 0, 0, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #cc0000, 0 0 10px rgba(204, 0, 0, 0.7);
  }
}

@keyframes flashGoldLeaf {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #c09010, 0 0 0 0 rgba(192, 144, 16, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #e8c840, 0 0 8px rgba(192, 144, 16, 0.55);
  }
}

@keyframes flashLannisterGold {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #d4af37, 0 0 0 0 rgba(212, 175, 55, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #f0d060, 0 0 10px rgba(212, 175, 55, 0.65);
  }
}

/* ============================================================ */
/* Style Template 10: Baroque (Parchment & Walnut)             */
/* ============================================================ */
.style-baroque .square.light {
  background-color: #dfd0a0 !important; /* Warm parchment */
  border: 1px solid #cfc090 !important;
}

.style-baroque .square.dark {
  background-color: #3d2618 !important; /* Dark walnut */
  border: 1px solid #2e1c10 !important;
}

.style-baroque .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 #5c3a1e !important;
  filter: sepia(60%) brightness(0.5) contrast(115%) !important;
}

.style-baroque .square.light.upgrade {
  background: linear-gradient(135deg, #c09010 0%, #e8c840 50%, #c09010 100%) !important;
  border: 1px solid #cfc090 !important;
}

.style-baroque .square.dark.upgrade {
  background: linear-gradient(135deg, #a07808 0%, #c8a820 50%, #a07808 100%) !important;
  border: 1px solid #2e1c10 !important;
}

.style-baroque .square.light.upgrade.killable {
  background: linear-gradient(135deg, #c09010 0%, #e8c840 50%, #c09010 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-baroque .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #a07808 0%, #c8a820 50%, #a07808 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-baroque .square.light.upgrade.movable {
  background: linear-gradient(135deg, #c09010 0%, #e8c840 50%, #c09010 100%) !important;
  box-shadow: inset 0 0 0 3px #c09010 !important;
  animation: flashGoldLeaf 1.5s ease-in-out infinite !important;
}

.style-baroque .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #a07808 0%, #c8a820 50%, #a07808 100%) !important;
  box-shadow: inset 0 0 0 3px #c09010 !important;
  animation: flashGoldLeaf 1.5s ease-in-out infinite !important;
}

.style-baroque .square.light.movable {
  background-color: #dfd0a0 !important;
  box-shadow: inset 0 0 0 3px #c09010 !important;
  animation: flashGoldLeaf 1.5s ease-in-out infinite !important;
}

.style-baroque .square.dark.movable {
  background-color: #3d2618 !important;
  box-shadow: inset 0 0 0 3px #c09010 !important;
  animation: flashGoldLeaf 1.5s ease-in-out infinite !important;
}

.style-baroque .square.light.killable {
  background-color: #dfd0a0 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-baroque .square.dark.killable {
  background-color: #3d2618 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

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

.style-baroque #board {
  border: 8px solid #5c3a1e !important;
  border-radius: 4px !important;
  box-shadow: 0 0 18px rgba(92, 58, 30, 0.4), inset 0 0 12px rgba(0, 0, 0, 0.5) !important;
  background: #1e0e06 !important;
}

.style-baroque .piece {
  filter: sepia(10%) brightness(1.02) !important;
}

/* ============================================================ */
/* Style Template 11: Lannister (Gold & Crimson)               */
/* ============================================================ */
.style-lannister .square.light {
  background-color: #e8d898 !important; /* Pale gold */
  border: 1px solid #d8c880 !important;
}

.style-lannister .square.dark {
  background-color: #6b0000 !important; /* Deep crimson */
  border: 1px solid #550000 !important;
}

.style-lannister .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 #8b0000 !important;
  filter: sepia(80%) hue-rotate(330deg) brightness(0.45) contrast(130%) !important;
}

.style-lannister .square.light.upgrade {
  background: linear-gradient(135deg, #d4af37 0%, #fff0a0 50%, #d4af37 100%) !important;
  border: 1px solid #d8b840 !important;
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.5) !important;
}

.style-lannister .square.dark.upgrade {
  background: linear-gradient(135deg, #b89020 0%, #e0c060 50%, #b89020 100%) !important;
  border: 1px solid #550000 !important;
  box-shadow: 0 0 6px rgba(184, 144, 32, 0.5) !important;
}

.style-lannister .square.light.upgrade.killable {
  background: linear-gradient(135deg, #d4af37 0%, #fff0a0 50%, #d4af37 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-lannister .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #b89020 0%, #e0c060 50%, #b89020 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-lannister .square.light.upgrade.movable {
  background: linear-gradient(135deg, #d4af37 0%, #fff0a0 50%, #d4af37 100%) !important;
  box-shadow: inset 0 0 0 3px #d4af37 !important;
  animation: flashLannisterGold 1.5s ease-in-out infinite !important;
}

.style-lannister .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #b89020 0%, #e0c060 50%, #b89020 100%) !important;
  box-shadow: inset 0 0 0 3px #d4af37 !important;
  animation: flashLannisterGold 1.5s ease-in-out infinite !important;
}

.style-lannister .square.light.movable {
  background-color: #e8d898 !important;
  box-shadow: inset 0 0 0 3px #d4af37 !important;
  animation: flashLannisterGold 1.5s ease-in-out infinite !important;
}

.style-lannister .square.dark.movable {
  background-color: #6b0000 !important;
  box-shadow: inset 0 0 0 3px #d4af37 !important;
  animation: flashLannisterGold 1.5s ease-in-out infinite !important;
}

.style-lannister .square.light.killable {
  background-color: #e8d898 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-lannister .square.dark.killable {
  background-color: #6b0000 !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

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

.style-lannister #board {
  border: 10px solid #d4af37 !important;
  border-radius: 6px !important;
  box-shadow: 0 0 28px rgba(212, 175, 55, 0.7), inset 0 0 16px rgba(0, 0, 0, 0.6) !important;
  background: #1a0000 !important;
}

.style-lannister .piece {
  filter: brightness(0.9) contrast(110%) !important;
}

/* Baroque theme examples */
body.style-baroque .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: sepia(60%) brightness(0.5) contrast(115%) !important;
}

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

body.style-baroque .example-square.light.movable {
  background-color: #dfd0a0 !important;
  box-shadow: inset 0 0 0 3px #c09010 !important;
}

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

body.style-baroque .example-square.dark.movable {
  background-color: #3d2618 !important;
  box-shadow: inset 0 0 0 3px #c09010 !important;
}

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

/* Lannister theme examples */
body.style-lannister .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: sepia(80%) hue-rotate(330deg) brightness(0.45) contrast(130%) !important;
}

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

body.style-lannister .example-square.light.movable {
  background-color: #e8d898 !important;
  box-shadow: inset 0 0 0 3px #d4af37 !important;
}

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

body.style-lannister .example-square.dark.movable {
  background-color: #6b0000 !important;
  box-shadow: inset 0 0 0 3px #d4af37 !important;
}

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

@keyframes flashTronCyan {
  0%, 100% {
    box-shadow: inset 0 0 0 2px #00ffff, 0 0 0 0 rgba(0, 255, 255, 0);
  }
  50% {
    box-shadow: inset 0 0 0 2px #00ffff, 0 0 14px rgba(0, 255, 255, 0.8), 0 0 30px rgba(0, 255, 255, 0.3);
  }
}

@keyframes flashTronOrange {
  0%, 100% {
    box-shadow: inset 0 0 0 2px #ff6600, 0 0 0 0 rgba(255, 102, 0, 0);
  }
  50% {
    box-shadow: inset 0 0 0 2px #ff6600, 0 0 14px rgba(255, 102, 0, 0.8), 0 0 30px rgba(255, 102, 0, 0.3);
  }
}

/* ============================================================ */
/* Style Template 12: Tron                                     */
/* ============================================================ */
.style-tron .square.light {
  background-color: #001e3c !important;
  border: 1px solid #003366 !important;
  box-shadow: inset 0 0 6px rgba(0, 80, 160, 0.4) !important;
}

.style-tron .square.dark {
  background-color: #001830 !important;
  border: 1px solid #002040 !important;
  box-shadow: inset 0 0 4px rgba(0, 40, 80, 0.3) !important;
}

.style-tron .square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 2px solid #00ffff !important;
  filter: hue-rotate(180deg) saturate(3) brightness(0.25) contrast(150%) !important;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.4) !important;
}

.style-tron .square.light.upgrade {
  background: linear-gradient(135deg, #00e5ff 0%, #80ffff 50%, #00e5ff 100%) !important;
  border: 1px solid #00ffff !important;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.7) !important;
}

.style-tron .square.dark.upgrade {
  background: linear-gradient(135deg, #0097b2 0%, #00c8e0 50%, #0097b2 100%) !important;
  border: 1px solid #00c8e0 !important;
  box-shadow: 0 0 10px rgba(0, 200, 224, 0.6) !important;
}

.style-tron .square.light.upgrade.killable {
  background: linear-gradient(135deg, #00e5ff 0%, #80ffff 50%, #00e5ff 100%) !important;
  box-shadow: inset 0 0 0 2px #ff6600, 0 0 12px rgba(255, 102, 0, 0.6) !important;
  animation: flashTronOrange 1.2s ease-in-out infinite !important;
}

.style-tron .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #0097b2 0%, #00c8e0 50%, #0097b2 100%) !important;
  box-shadow: inset 0 0 0 2px #ff6600, 0 0 12px rgba(255, 102, 0, 0.6) !important;
  animation: flashTronOrange 1.2s ease-in-out infinite !important;
}

.style-tron .square.light.upgrade.movable {
  background: linear-gradient(135deg, #00e5ff 0%, #80ffff 50%, #00e5ff 100%) !important;
  box-shadow: inset 0 0 0 2px #00ffff, 0 0 12px rgba(0, 255, 255, 0.7) !important;
  animation: flashTronCyan 1.2s ease-in-out infinite !important;
}

.style-tron .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #0097b2 0%, #00c8e0 50%, #0097b2 100%) !important;
  box-shadow: inset 0 0 0 2px #00ffff, 0 0 12px rgba(0, 255, 255, 0.7) !important;
  animation: flashTronCyan 1.2s ease-in-out infinite !important;
}

.style-tron .square.light.movable {
  background-color: #001e3c !important;
  box-shadow: inset 0 0 0 2px #00ffff !important;
  animation: flashTronCyan 1.2s ease-in-out infinite !important;
}

.style-tron .square.dark.movable {
  background-color: #001830 !important;
  box-shadow: inset 0 0 0 2px #00ffff !important;
  animation: flashTronCyan 1.2s ease-in-out infinite !important;
}

.style-tron .square.light.killable {
  background-color: #001e3c !important;
  box-shadow: inset 0 0 0 2px #ff6600 !important;
  animation: flashTronOrange 1.2s ease-in-out infinite !important;
}

.style-tron .square.dark.killable {
  background-color: #001830 !important;
  box-shadow: inset 0 0 0 2px #ff6600 !important;
  animation: flashTronOrange 1.2s ease-in-out infinite !important;
}

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

.style-tron .square.light.last-move-from,
.style-tron .square.dark.last-move-from {
  box-shadow: inset 0 0 0 2px #c0c0c0, 0 0 8px rgba(192, 192, 192, 0.5) !important;
  animation: glitteryFromBorder 3s ease-in-out infinite !important;
}

.style-tron .square.light.last-move-to,
.style-tron .square.dark.last-move-to {
  box-shadow: inset 0 0 0 3px #e0d0ff, 0 0 12px rgba(200, 180, 255, 0.8) !important;
  animation: glitteryToBorder 3s ease-in-out infinite !important;
}

.style-tron #board {
  border: 3px solid #00ffff !important;
  border-radius: 0 !important;
  box-shadow: 0 0 40px rgba(0, 255, 255, 0.6), 0 0 80px rgba(0, 255, 255, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.9) !important;
  background: #000508 !important;
}

.style-tron .piece {
  filter: hue-rotate(180deg) brightness(1.1) saturate(1.3) !important;
}

/* ============================================================ */
/* Style Template 13: Safari                                   */
/* ============================================================ */
.style-safari .square.light {
  background-color: #e2c06a !important; /* Dry savanna gold */
  border: 1px solid #d0a850 !important;
}

.style-safari .square.dark {
  background-color: #7a4e1a !important; /* Rich earth */
  border: 1px solid #6a3e0e !important;
}

.style-safari .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 #5a3a10 !important;
  filter: sepia(80%) brightness(0.55) contrast(120%) !important;
}

.style-safari .square.light.upgrade {
  background: linear-gradient(135deg, #ff8c00 0%, #ffb300 50%, #ff8c00 100%) !important;
  border: 1px solid #d0a850 !important;
}

.style-safari .square.dark.upgrade {
  background: linear-gradient(135deg, #cc6600 0%, #e68000 50%, #cc6600 100%) !important;
  border: 1px solid #6a3e0e !important;
}

.style-safari .square.light.upgrade.killable {
  background: linear-gradient(135deg, #ff8c00 0%, #ffb300 50%, #ff8c00 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-safari .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #cc6600 0%, #e68000 50%, #cc6600 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-safari .square.light.upgrade.movable {
  background: linear-gradient(135deg, #ff8c00 0%, #ffb300 50%, #ff8c00 100%) !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-safari .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #cc6600 0%, #e68000 50%, #cc6600 100%) !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-safari .square.light.movable {
  background-color: #e2c06a !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-safari .square.dark.movable {
  background-color: #7a4e1a !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
  animation: flashAmber 1.5s ease-in-out infinite !important;
}

.style-safari .square.light.killable {
  background-color: #e2c06a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-safari .square.dark.killable {
  background-color: #7a4e1a !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

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

.style-safari #board {
  border: 8px solid #8b5e1a !important;
  border-radius: 4px !important;
  box-shadow: 0 0 20px rgba(139, 94, 26, 0.5), inset 0 0 12px rgba(0, 0, 0, 0.4) !important;
  background: #2e1a06 !important;
}

/* Tron theme examples */
body.style-tron .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: hue-rotate(180deg) saturate(3) brightness(0.25) contrast(150%) !important;
}

body.style-tron .example-square.light.upgrade {
  background: linear-gradient(135deg, #00e5ff 0%, #80ffff 50%, #00e5ff 100%) !important;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.6) !important;
}

body.style-tron .example-square.light.movable {
  background-color: #001e3c !important;
  box-shadow: inset 0 0 0 2px #00ffff, 0 0 8px rgba(0, 255, 255, 0.5) !important;
}

body.style-tron .example-square.light.killable {
  background-color: #001e3c !important;
  box-shadow: inset 0 0 0 2px #ff6600, 0 0 8px rgba(255, 102, 0, 0.5) !important;
}

body.style-tron .example-square.dark.movable {
  background-color: #001830 !important;
  box-shadow: inset 0 0 0 2px #00ffff, 0 0 8px rgba(0, 255, 255, 0.5) !important;
}

body.style-tron .example-square.dark.killable {
  background-color: #001830 !important;
  box-shadow: inset 0 0 0 2px #ff6600, 0 0 8px rgba(255, 102, 0, 0.5) !important;
}

/* Safari theme examples */
body.style-safari .example-square.wall {
  background-image: url(/brick-wall.avif) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  filter: sepia(80%) brightness(0.55) contrast(120%) !important;
}

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

body.style-safari .example-square.light.movable {
  background-color: #e2c06a !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
}

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

body.style-safari .example-square.dark.movable {
  background-color: #7a4e1a !important;
  box-shadow: inset 0 0 0 3px #ffa040 !important;
}

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

@keyframes flashAquaGlass {
  0%, 100% {
    box-shadow: inset 0 0 0 3px #00bcd4, 0 0 0 0 rgba(0, 188, 212, 0);
  }
  50% {
    box-shadow: inset 0 0 0 3px #00e5ff, 0 0 12px rgba(0, 188, 212, 0.65), 0 0 24px rgba(0, 229, 255, 0.2);
  }
}

/* ============================================================ */
/* Style Template 14: Aero (Frutiger Aero)                     */
/* ============================================================ */
.style-aero .square.light {
  background: linear-gradient(180deg, #e2f8fe 0%, #b0e4f4 40%, #88d0ee 60%, #c4eef8 100%) !important;
  border: 1px solid #70c8e8 !important;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.75), inset 0 -1px 2px rgba(0, 100, 160, 0.25) !important;
}

.style-aero .square.dark {
  background: linear-gradient(180deg, #42c4de 0%, #1a9ebe 40%, #0e7e9e 60%, #30b4d4 100%) !important;
  border: 1px solid #0e90b0 !important;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.35), inset 0 -1px 2px rgba(0, 50, 80, 0.4) !important;
}

.style-aero .square.wall {
  background-image: url(/ice-sheet.jpg) !important;
  background-size: 400% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 3px solid #00bcd4 !important;
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.5) !important;
}

.style-aero .square.light.upgrade {
  background: linear-gradient(135deg, #4cce68 0%, #a8e060 50%, #4cce68 100%) !important;
  border: 1px solid #70c8e8 !important;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.6), 0 0 6px rgba(76, 206, 104, 0.4) !important;
}

.style-aero .square.dark.upgrade {
  background: linear-gradient(135deg, #38b050 0%, #88d040 50%, #38b050 100%) !important;
  border: 1px solid #0e90b0 !important;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.4), 0 0 6px rgba(56, 176, 80, 0.4) !important;
}

.style-aero .square.light.upgrade.killable {
  background: linear-gradient(135deg, #4cce68 0%, #a8e060 50%, #4cce68 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-aero .square.dark.upgrade.killable {
  background: linear-gradient(135deg, #38b050 0%, #88d040 50%, #38b050 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-aero .square.light.upgrade.movable {
  background: linear-gradient(135deg, #4cce68 0%, #a8e060 50%, #4cce68 100%) !important;
  box-shadow: inset 0 0 0 3px #00bcd4 !important;
  animation: flashAquaGlass 1.5s ease-in-out infinite !important;
}

.style-aero .square.dark.upgrade.movable {
  background: linear-gradient(135deg, #38b050 0%, #88d040 50%, #38b050 100%) !important;
  box-shadow: inset 0 0 0 3px #00bcd4 !important;
  animation: flashAquaGlass 1.5s ease-in-out infinite !important;
}

.style-aero .square.light.movable {
  background: linear-gradient(180deg, #e2f8fe 0%, #b0e4f4 40%, #88d0ee 60%, #c4eef8 100%) !important;
  box-shadow: inset 0 0 0 3px #00bcd4, inset 0 2px 4px rgba(255, 255, 255, 0.75) !important;
  animation: flashAquaGlass 1.5s ease-in-out infinite !important;
}

.style-aero .square.dark.movable {
  background: linear-gradient(180deg, #42c4de 0%, #1a9ebe 40%, #0e7e9e 60%, #30b4d4 100%) !important;
  box-shadow: inset 0 0 0 3px #00bcd4, inset 0 2px 4px rgba(255, 255, 255, 0.35) !important;
  animation: flashAquaGlass 1.5s ease-in-out infinite !important;
}

.style-aero .square.light.killable {
  background: linear-gradient(180deg, #e2f8fe 0%, #b0e4f4 40%, #88d0ee 60%, #c4eef8 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

.style-aero .square.dark.killable {
  background: linear-gradient(180deg, #42c4de 0%, #1a9ebe 40%, #0e7e9e 60%, #30b4d4 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
  animation: flashCrimson 1.5s ease-in-out infinite !important;
}

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

.style-aero .square.light.last-move-from,
.style-aero .square.dark.last-move-from {
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.75), inset 0 0 0 2px #4cce68, 0 0 8px rgba(76, 206, 104, 0.6) !important;
  animation: flashAquaGlass 3s ease-in-out infinite !important;
}

.style-aero .square.light.last-move-to,
.style-aero .square.dark.last-move-to {
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.75), inset 0 0 0 3px #a8e060, 0 0 14px rgba(168, 224, 96, 0.8) !important;
  animation: flashAquaGlass 3s ease-in-out infinite !important;
}

.style-aero #board {
  border: 8px solid #00bcd4 !important;
  border-radius: 10px !important;
  box-shadow: 0 0 28px rgba(0, 188, 212, 0.55), 0 0 60px rgba(0, 188, 212, 0.15), inset 0 0 16px rgba(0, 0, 0, 0.3) !important;
  background: #0a4a5e !important;
}

.style-aero .piece {
  filter: brightness(1.05) saturate(1.1) !important;
}

/* Aero theme examples */
body.style-aero .example-square.wall {
  background-image: url(/ice-sheet.jpg) !important;
  background-size: 400% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.5) !important;
}

body.style-aero .example-square.light.upgrade {
  background: linear-gradient(135deg, #4cce68 0%, #a8e060 50%, #4cce68 100%) !important;
}

body.style-aero .example-square.light.movable {
  background: linear-gradient(180deg, #e2f8fe 0%, #b0e4f4 40%, #88d0ee 60%, #c4eef8 100%) !important;
  box-shadow: inset 0 0 0 3px #00bcd4 !important;
}

body.style-aero .example-square.light.killable {
  background: linear-gradient(180deg, #e2f8fe 0%, #b0e4f4 40%, #88d0ee 60%, #c4eef8 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}

body.style-aero .example-square.dark.movable {
  background: linear-gradient(180deg, #42c4de 0%, #1a9ebe 40%, #0e7e9e 60%, #30b4d4 100%) !important;
  box-shadow: inset 0 0 0 3px #00bcd4 !important;
}

body.style-aero .example-square.dark.killable {
  background: linear-gradient(180deg, #42c4de 0%, #1a9ebe 40%, #0e7e9e 60%, #30b4d4 100%) !important;
  box-shadow: inset 0 0 0 3px #dc143c !important;
}
/* ═══════════════════════════════════════════════════════════════════════════
   Social — Users, Profiles, Friends, Conversations, Global Chat
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Shared page container ──────────────────────────────────────────────── */
.users-page,
.users-page-dir,
.profile-page,
.conversations-page,
.thread-page,
.form-page {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* ── Directory (aligned with game_invitations / lobby UI) ────────────────── */
.users-page-dir .dir-section {
  margin-bottom: 0;
}

.users-page-dir .dir-toolbar {
  margin-bottom: 1.25rem;
}

.users-page-dir .dir-toolbar .dir-search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Directory content tabs: Visible players | Blocked */
.users-page-dir .dir-content-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border, #2d2d4a);
}

.users-page-dir .dir-content-tab {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted, #888);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.users-page-dir .dir-content-tab:hover {
  color: var(--text, #e8e8e8);
}

.users-page-dir .dir-content-tab.active {
  color: var(--accent, #4a9eff);
  border-bottom-color: var(--accent, #4a9eff);
}

.users-page-dir .dir-search-input {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}
.users-page-dir .dir-search-input::placeholder {
  color: var(--text-muted, #888);
}

.users-page-dir .dir-section-heading {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #aaa);
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.users-page-dir .dir-section-heading:not(:first-child) {
  margin-top: 1.5rem;
}

.users-page-dir .dir-user-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.users-page-dir .dir-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #2d2d4a);
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  transition: border-color 0.15s;
}

.users-page-dir .dir-user-card:hover {
  border-color: var(--accent, #4a9eff);
}

.users-page-dir .dir-user-card--pending {
  border-color: rgba(243, 156, 18, 0.5);
  background: rgba(243, 156, 18, 0.08);
}

.users-page-dir .dir-user-card-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.users-page-dir .dir-user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent, #4a9eff);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.users-page-dir .dir-user-card-main {
  min-width: 0;
}

.users-page-dir .dir-user-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text, #e8e8e8);
  text-decoration: none;
  display: block;
  margin-bottom: 0.2rem;
}

.users-page-dir .dir-user-name:hover {
  color: var(--accent, #4a9eff);
}

.users-page-dir .dir-user-meta {
  font-size: 0.8125rem;
  color: var(--text-muted, #888);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
}

.users-page-dir .dir-user-meta-sep {
  color: var(--border, #444);
  user-select: none;
}

.users-page-dir .dir-user-rating {
  font-weight: 600;
}

.users-page-dir .dir-user-rating.rating-beginner    { color: #94a3b8; }
.users-page-dir .dir-user-rating.rating-intermediate { color: #38bdf8; }
.users-page-dir .dir-user-rating.rating-advanced   { color: #4ade80; }
.users-page-dir .dir-user-rating.rating-expert     { color: #a78bfa; }
.users-page-dir .dir-user-rating.rating-master      { color: #fbbf24; }

.users-page-dir .dir-user-wld .wld-w { color: #22c55e; font-weight: 600; }
.users-page-dir .dir-user-wld .wld-l { color: #ef4444; font-weight: 600; }
.users-page-dir .dir-user-wld .wld-d { color: var(--text-muted, #888); font-weight: 600; }

.users-page-dir .dir-user-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.users-page-dir .dir-user-card-actions form.button_to {
  display: inline-block;
  margin: 0;
}

.users-page-dir .btn-dir-view {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border, #2d2d4a);
  color: var(--text-muted, #aaa);
  background: transparent;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.users-page-dir .btn-dir-view:hover {
  border-color: var(--accent, #4a9eff);
  color: var(--accent, #4a9eff);
}

.users-page-dir .btn-dir-add-friend {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  border-radius: 6px;
  background: var(--accent, #4a9eff);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.15s;
}

.users-page-dir .btn-dir-add-friend:hover {
  opacity: 0.9;
}

.users-page-dir .btn-dir-accept {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  border-radius: 6px;
  background: #22c55e;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.users-page-dir .btn-dir-decline {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted, #888);
  border: 1px solid var(--border, #2d2d4a);
  cursor: pointer;
}

.users-page-dir .dir-badge-pending {
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  font-style: italic;
}

.users-page-dir .dir-pagination {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.users-page-dir .dir-pagination-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}

.users-page-dir .dir-pagination-link {
  color: var(--accent, #4a9eff);
  text-decoration: none;
  font-size: 0.9rem;
}

.users-page-dir .dir-pagination-link:hover {
  text-decoration: underline;
}

.users-page-dir .dir-pagination-link.disabled {
  color: var(--text-muted, #888);
  cursor: default;
}

.users-page-dir .dir-pagination-link.dir-pagination-num.current {
  font-weight: 700;
  color: var(--text, #e8e8e8);
}

.users-page-dir .dir-per-page-inline select {
  margin: 0 0.25rem;
  padding: 0.2rem 0.4rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

/* ── Messages (conversations) — aligned with directory UI ────────────────── */
.conversations-page-dir .inv-section {
  padding: 1.25rem;
}

.conversations-page-dir .dir-section-heading {
  margin-top: 0;
}

.conversations-page-dir .conv-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conversations-page-dir .conv-card {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #2d2d4a);
  border-radius: 10px;
  color: inherit;
  transition: border-color 0.15s;
  position: relative;
}

/* Stretched link: whole card opens conversation; name link sits on top */
.conversations-page-dir .conv-card-link {
  position: absolute;
  inset: 0;
  z-index: 0;
  text-decoration: none;
  color: inherit;
}

.conversations-page-dir .conv-card-link:hover {
  color: inherit;
}

.conversations-page-dir .conv-card-link:focus {
  outline: none;
}

.conversations-page-dir .conv-card:has(.conv-card-link:focus-visible) {
  border-color: var(--accent, #4a9eff);
}

.conversations-page-dir .conv-card:hover {
  border-color: var(--accent, #4a9eff);
}

.conversations-page-dir .conv-card--unread {
  border-color: rgba(74, 158, 255, 0.4);
  background: rgba(74, 158, 255, 0.06);
}

.conversations-page-dir .conv-card--unread .conv-card-name {
  font-weight: 700;
}

/* Let clicks on avatar/preview/meta hit the stretched link */
.conversations-page-dir .conv-card-avatar,
.conversations-page-dir .conv-card-info,
.conversations-page-dir .conv-card-meta {
  pointer-events: none;
}

.conversations-page-dir .conv-card-avatar {
  grid-column: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent, #4a9eff);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conversations-page-dir .conv-card-name {
  grid-column: 2;
  position: relative;
  z-index: 1;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text, #e8e8e8);
  margin-bottom: 0.2rem;
}
.conversations-page-dir .conv-card-info {
  grid-column: 3;
  flex: 1;
  min-width: 0;
}
.conversations-page-dir .conv-card-preview {
  font-size: 0.83rem;
  color: var(--text-muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversations-page-dir .conv-card-meta {
  grid-column: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}
.conversations-page-dir .conv-card-time {
  font-size: 0.78rem;
  color: var(--text-muted, #888);
}

.conversations-page-dir .empty-state-large {
  color: var(--text-muted, #888);
}
.conversations-page-dir .empty-state-large a {
  color: var(--accent, #4a9eff);
}

/* ── Thread (conversation show) — compose contrast ────────────────────────── */
.thread-page-dir .thread-messages {
  background: var(--surface, #1a1a2e);
}

.thread-page-dir .thread-compose {
  background: var(--surface-raised, #24243e);
  border-top: 1px solid var(--border, #2d2d4a);
  padding: 0.75rem 1rem;
}

.thread-page-dir .compose-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.thread-page-dir .compose-input::placeholder {
  color: var(--text-muted, #888);
}

.thread-page-dir .message-theirs {
  background: var(--surface-raised, #24243e);
  color: var(--text, #e8e8e8);
  border: 1px solid var(--border, #2d2d4a);
}
.thread-page-dir .message-theirs .message-meta {
  color: var(--text-muted, #888);
}

/* ── Profile (user show) — aligned with directory UI ────────────────────── */
.profile-page-dir .inv-section {
  padding: 1.25rem;
}

.profile-page-dir .profile-card-dir {
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #2d2d4a);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.profile-page-dir .profile-avatar {
  background: var(--accent, #4a9eff);
}

.profile-page-dir .profile-name {
  color: var(--text, #e8e8e8);
}
.profile-page-dir .profile-meta,
.profile-page-dir .profile-email,
.profile-page-dir .profile-bio {
  color: var(--text-muted, #888);
}

.profile-page-dir .profile-stats-dir .stat-box {
  background: var(--surface-raised, #24243e);
  border: 1px solid var(--border, #2d2d4a);
  border-radius: 8px;
}
.profile-page-dir .profile-stats-dir .stat-value {
  color: var(--text, #e8e8e8);
}
.profile-page-dir .profile-stats-dir .stat-label {
  color: var(--text-muted, #888);
}
.profile-page-dir .profile-stats-dir .stat-win .stat-value { color: #22c55e; }
.profile-page-dir .profile-stats-dir .stat-loss .stat-value { color: #ef4444; }
.profile-page-dir .profile-stats-dir .stat-draw .stat-value { color: var(--text-muted, #888); }

.profile-page-dir .profile-section-title-dir {
  color: var(--text-muted, #aaa);
  border-bottom-color: var(--border, #2d2d4a);
}

.profile-page-dir .profile-section-dir .user-table {
  color: var(--text, #e8e8e8);
}
.profile-page-dir .profile-section-dir .user-table th {
  color: var(--text-muted, #888);
  border-bottom-color: var(--border, #2d2d4a);
}
.profile-page-dir .profile-section-dir .user-table td {
  border-bottom-color: var(--border, #2d2d4a);
}
.profile-page-dir .profile-section-dir .user-table .user-link {
  color: var(--accent, #4a9eff);
}
.profile-page-dir .profile-section-dir .empty-state {
  color: var(--text-muted, #888);
}

.profile-page-dir .btn-secondary {
  color: var(--text-muted, #aaa);
  border-color: var(--border, #2d2d4a);
}
.profile-page-dir .btn-secondary:hover {
  color: var(--accent, #4a9eff);
  border-color: var(--accent, #4a9eff);
}
.profile-page-dir .btn-primary { background: var(--accent, #4a9eff); color: #fff; }
.profile-page-dir .btn-success { background: #22c55e; color: #fff; }
.profile-page-dir .btn-danger  { background: transparent; color: #ef4444; border: 1px solid #ef4444; }
.profile-page-dir .badge-pending { color: var(--text-muted, #888); }

.profile-page-dir .profile-actions form.button_to {
  display: inline-block;
  margin: 0;
}

.profile-page-dir .profile-section-dir .result-badge {
  font-size: 0.78rem;
}
.profile-page-dir .profile-section-dir .result-win  { background: rgba(34, 197, 94, 0.25); color: #4ade80; }
.profile-page-dir .profile-section-dir .result-loss  { background: rgba(239, 68, 68, 0.25); color: #f87171; }
.profile-page-dir .profile-section-dir .result-draw  { background: rgba(255,255,255,0.08); color: var(--text-muted, #888); }

/* Profile/Settings tabs (own profile only) */
.profile-settings-tabs {
  margin-top: 0.5rem;
}
.profile-settings-tabs .page-header-tab {
  cursor: pointer;
  border: none;
  background: transparent;
  font: inherit;
}
.settings-panel-section {
  max-width: 36rem;
  margin-top: 1rem;
}
.settings-panel-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--app-text, var(--text, #111));
}
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface-raised, var(--app-bg-raised, #f3f4f6));
  border: 1px solid var(--border, var(--app-border, #e5e7eb));
  border-radius: 0.5rem;
}
.settings-label {
  font-weight: 500;
  color: var(--app-text, var(--text, #111));
}
.settings-actions {
  display: inline-flex;
  gap: 0.5rem;
}
.settings-tbd {
  font-size: 0.875rem;
  color: var(--app-text-muted, var(--text-muted, #6b7280));
  font-style: italic;
}

/* ── Nav badge ──────────────────────────────────────────────────────────── */
.nav-badge {
  display: inline-block;
  background: var(--error-500, #ef4444);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 0.4rem;
  min-width: 1.25rem;
  text-align: center;
  vertical-align: middle;
  line-height: 1.4;
  margin-left: 0.15rem;
}

.nav-badge-games {
  background: #d97706;
  color: #fff;
}
.nav-badge-friend {
  background: var(--primary-500, #0ea5e9);
  color: #fff;
}
.nav-badge-invites {
  background: #059669;
  color: #fff;
}

.nav-badge-private-invites {
  background: #059669;
  color: #fff;
}

.badge {
  display: inline-block;
  background: var(--primary-500, #0ea5e9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 0.45rem;
  min-width: 1.2rem;
  text-align: center;
  line-height: 1.5;
}

.badge-pending {
  font-size: 0.78rem;
  color: var(--neutral-500);
  font-style: italic;
}

/* ── Search bar ─────────────────────────────────────────────────────────── */
.users-search-bar {
  margin-bottom: 1.75rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm, 0.25rem);
  font-size: 0.95rem;
  min-width: 0;
}

.search-btn {
  white-space: nowrap;
}

/* ── Section headings ───────────────────────────────────────────────────── */
.users-section {
  margin-bottom: 2rem;
}

.users-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── User table ─────────────────────────────────────────────────────────── */
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.user-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  border-bottom: 2px solid var(--neutral-200);
  color: var(--neutral-500);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--neutral-100);
  vertical-align: middle;
}

.user-row:hover td {
  background: var(--neutral-50);
}

.user-name-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-avatar-initial {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary-500, #0ea5e9);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-link {
  color: var(--neutral-800);
  font-weight: 500;
  text-decoration: none;
}
.user-link:hover { text-decoration: underline; }

.user-rating-cell { font-weight: 600; color: var(--primary-700); }

.wld-w { color: var(--success-600); font-weight: 600; }
.wld-l { color: var(--error-600);   font-weight: 600; }
.wld-d { color: var(--neutral-500); font-weight: 600; }

.user-active-cell { color: var(--neutral-500); font-size: 0.85rem; }

.user-actions-cell {
  text-align: right;
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── Pending request cards ──────────────────────────────────────────────── */
.user-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-sm);
  background: var(--neutral-50);
}

.user-card--pending {
  border-color: var(--warning-200);
  background: var(--warning-50);
}

.user-card-name {
  font-weight: 600;
  color: var(--neutral-800);
  text-decoration: none;
}
.user-card-rating { font-size: 0.82rem; color: var(--neutral-500); margin-left: 0.5rem; }
.user-card-actions { display: flex; gap: 0.4rem; }

/* ── Profile page ───────────────────────────────────────────────────────── */
.profile-card {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg, 0.5rem);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--primary-500);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 1.3rem; font-weight: 700; margin: 0 0 0.25rem; }
.profile-meta { font-size: 0.85rem; color: var(--neutral-500); margin: 0 0 0.5rem; }
.profile-bio  { font-size: 0.93rem; color: var(--neutral-700); margin: 0; }

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
}

.profile-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-box {
  flex: 1;
  min-width: 4.5rem;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.stat-box .stat-value { font-size: 1.4rem; font-weight: 700; color: var(--neutral-800); }
.stat-box .stat-label { font-size: 0.72rem; color: var(--neutral-500); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.15rem; }
.stat-win  .stat-value { color: var(--success-600); }
.stat-loss .stat-value { color: var(--error-600); }
.stat-draw .stat-value { color: var(--neutral-500); }

.profile-section { margin-bottom: 2rem; }
.profile-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--neutral-200);
}

.result-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.result-win  { background: var(--success-100); color: var(--success-700); }
.result-loss { background: var(--error-100);   color: var(--error-700); }
.result-draw { background: var(--neutral-100); color: var(--neutral-600); }

/* ── Edit profile form ──────────────────────────────────────────────────── */
.profile-form {
  max-width: 540px;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.form-textarea { resize: vertical; font-family: inherit; }
.form-hint { font-size: 0.8rem; color: var(--neutral-500); margin-top: 0.25rem; }
.form-errors { background: var(--error-50); border: 1px solid var(--error-200); padding: 0.75rem; border-radius: var(--radius-sm); margin-bottom: 1rem; color: var(--error-700); font-size: 0.88rem; }
.form-actions { display: flex; gap: 0.6rem; margin-top: 1.5rem; }

/* ── Conversations inbox ─────────────────────────────────────────────────── */
.conversation-list { display: flex; flex-direction: column; }

.conversation-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--neutral-100);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.conversation-row:hover { background: var(--neutral-50); }
.conversation-row--unread { background: var(--primary-50); }
.conversation-row--unread .conv-name { font-weight: 700; }

.conv-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--primary-400);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 500; font-size: 0.95rem; color: var(--neutral-800); }
.conv-preview { font-size: 0.83rem; color: var(--neutral-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.conv-time { font-size: 0.78rem; color: var(--neutral-400); }

/* ── Thread view ────────────────────────────────────────────────────────── */
.thread-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 10rem);
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.message-bubble {
  max-width: 70%;
  padding: 0.55rem 0.85rem;
  border-radius: 1rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.message-mine {
  align-self: flex-end;
  background: var(--primary-500);
  color: #fff;
  border-bottom-right-radius: 0.2rem;
}

.message-theirs {
  align-self: flex-start;
  background: var(--neutral-100);
  color: var(--neutral-800);
  border-bottom-left-radius: 0.2rem;
}

.message-body { margin-bottom: 0.2rem; }
.message-meta { font-size: 0.72rem; opacity: 0.7; display: flex; gap: 0.4rem; }
.message-mine .message-meta { justify-content: flex-end; }

.thread-compose {
  border-top: 1px solid var(--neutral-200);
  padding: 0.75rem;
  background: #fff;
}

.compose-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.compose-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.93rem;
  resize: none;
  font-family: inherit;
  min-width: 0;
}

.compose-send { align-self: flex-end; }

/* ── Global Chat Panel ──────────────────────────────────────────────────── */
.global-chat-panel {
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-lg, 0.5rem);
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  max-height: 400px;
}

.global-chat-panel--floating {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 340px;
  z-index: var(--z-sticky, 1020);
  box-shadow: 0 18px 45px rgba(0,0,0,0.22);
}

.global-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  background: var(--neutral-800);
  color: #fff;
}

.global-chat-title { font-weight: 600; font-size: 0.9rem; }
.global-chat-toggle { background: none; border: none; color: #fff; cursor: pointer; font-size: 0.8rem; padding: 0; }

.global-chat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.global-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 180px;
}

.gc-message { font-size: 0.85rem; color: var(--neutral-700); line-height: 1.4; word-break: break-word; }
.gc-sender { font-weight: 600; color: var(--primary-700); }

.global-chat-compose {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem;
  border-top: 1px solid var(--neutral-100);
}

.compose-input-inline {
  flex: 1;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  min-width: 0;
}

.global-chat-signin { font-size: 0.83rem; color: var(--neutral-500); padding: 0.6rem; }

@media (max-width: 768px) {
  .global-chat-panel--floating {
    display: none;
  }
}

/* ── Empty states ───────────────────────────────────────────────────────── */
.empty-state { color: var(--neutral-400); font-size: 0.9rem; padding: 0.5rem 0; }

.empty-state-large {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--neutral-400);
}
.empty-state-large p { margin: 0.4rem 0; }

/* ── Back link ──────────────────────────────────────────────────────────── */
.back-link {
  font-size: 0.9rem;
  color: var(--primary-600);
  text-decoration: none;
  margin-right: 0.5rem;
}
.back-link:hover { text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  .profile-card { flex-direction: column; }
  .profile-actions { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .stat-box { min-width: 3.5rem; }
  .message-bubble { max-width: 90%; }
}
/* ── Game Lobby ──────────────────────────────────────────────────────────── */

.lobby-page,
.lobby-new-page {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

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

.lobby-title-area h1 { margin: 0; }
.lobby-subtitle { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.95rem; }

.lobby-create-btn { white-space: nowrap; }

.lobby-refresh-note {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Lobby empty state ───────────────────────────────────────────────────── */
.lobby-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.lobby-empty p { margin-bottom: 1rem; font-size: 1.05rem; }

/* ── Invitation Card ─────────────────────────────────────────────────────── */
.inv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  transition: border-color 0.15s;
}

.inv-card:hover { border-color: var(--border); }

.inv-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.inv-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.inv-card-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}
/* Identity = thumbnail + board name as one unit; hide duplicate name from thumbnail */
.inv-card-identity {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.inv-card-identity .inv-card-board-wrap .inv-card-board-name,
.inv-card-identity .inv-card-board-name-only {
  display: none;
}
.inv-card-board-name-primary {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text);
}
.inv-custom-title {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.3;
}
.inv-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.inv-meta-sep { color: var(--border); user-select: none; }
.inv-card-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.inv-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-raised, #24243e);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.inv-badge-private {
  background: rgba(142, 68, 173, 0.2);
  border-color: rgba(142, 68, 173, 0.5);
  color: #c39bd3;
}
.inv-badge-players {
  color: var(--border);
  border-color: rgba(74, 158, 255, 0.35);
}
.inv-badge-seats {
  color: #27ae60;
  border-color: rgba(39, 174, 96, 0.35);
}

.inv-card-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.inv-card-board-name-primary {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.inv-board-name { font-weight: 700; font-size: 1.05rem; }
.inv-custom-title { font-style: italic; color: var(--text-muted); font-size: 0.9rem; }

.inv-card-board-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.inv-card-board-preview {
  border: 2px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
}
.inv-card-board-preview .row { display: flex; flex-direction: row; margin: 0; padding: 0; }
.inv-card-board-preview .square {
  border: 1px solid rgba(0,0,0,0.25);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}
.inv-card-board-preview .square-dark  { background-color: #6b8e23; }
.inv-card-board-preview .square-light { background-color: #9acd32; }
.inv-card-board-preview .square-light.upgrade { background-color: rgb(0,102,0); }
.inv-card-board-preview .square-dark.upgrade  { background-color: rgb(51,204,51); }
.inv-card-board-preview .square.wall { border: none; }
.inv-card-board-preview .square.wall .piece { width: 100%; height: 100%; top: 0; left: 0; transform: none; background-size: cover; }
.inv-card-board-preview .square .piece {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80%; height: 80%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Board preview hover popout (game cards: larger ephemeral preview on hover) */
.board-preview-wrapper {
  position: relative;
  cursor: pointer;
}
.board-preview-popout {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0;
  background: transparent;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1200;
  transition: opacity 0.15s ease, visibility 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.board-preview-popout.board-preview-popout--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.popout-backdrop {
  position: fixed; inset: 0; z-index: 1199; background: rgba(0,0,0,0.35);
}
.board-preview-popout__scaled-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  flex-shrink: 0;
}
.board-preview-popout .inv-card-board-preview,
.board-preview-popout .inv-board-preview {
  overflow: visible;
  border: none;
  border-radius: 0;
  background: transparent;
}
.board-preview-popout .inv-board-preview {
  flex-shrink: 0;
}

.inv-card-board-name {
  font-weight: 700;
  font-size: 1.05rem;
}
.inv-card-board-name-only {
  font-weight: 700;
  font-size: 1.05rem;
}

.inv-time-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--surface-raised, rgba(0,0,0,0.15));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  margin-top: 0.25rem;
  width: 100%;
  box-sizing: border-box;
}
.inv-time-block-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}
.inv-time-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
}
.inv-time-k {
  color: var(--text-muted);
  font-size: 0.75rem;
}
.inv-time-item .inv-time-k::after {
  content: ':';
  margin-left: 0.05em;
}

/* ── Seats grid ──────────────────────────────────────────────────────────── */
.inv-seats-progress-wrap {
  height: 4px;
  background: var(--surface-raised, #24243e);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.inv-seats-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--border), #27ae60);
  border-radius: 2px;
  transition: width 0.25s ease;
}

.inv-seats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.inv-seat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-raised, #24243e);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
  min-width: 100px;
}

.inv-seat.open { border-style: dashed; }
.inv-seat.filled { opacity: 0.9; }

.inv-seat-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

.inv-seat-info { display: flex; flex-direction: column; line-height: 1.2; }
.inv-seat-side { font-weight: 600; }
.inv-seat-name { color: var(--text-muted); font-size: 0.78rem; }
.inv-seat-name.open { color: var(--border); font-style: italic; }

.btn-join-seat {
  margin-left: auto;
  background: var(--border);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-join-seat:hover { opacity: 0.85; }

.btn-take-side {
  margin-left: auto;
  background: transparent;
  color: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-take-side:hover { background: rgba(74,158,255,0.12); }
.btn-take-side.selected {
  background: var(--border);
  color: #fff;
}

.inv-join-action { display: flex; align-items: center; }

.btn-confirm-join {
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-confirm-join:hover { opacity: 0.85; }

/* ── Card footer ─────────────────────────────────────────────────────────── */
.inv-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.btn-cancel-inv,
.btn-leave-inv {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-cancel-inv:hover { color: #e74c3c; border-color: #e74c3c; }
.btn-leave-inv:hover  { color: #f39c12; border-color: #f39c12; }

/* ── Create Invitation form ──────────────────────────────────────────────── */
.lobby-new-header { margin-bottom: 1.5rem; }
.lobby-new-header h1 { margin: 0 0 0.25rem; }
.lobby-new-header p  { margin: 0 0 0.75rem; color: var(--text-muted); }
.back-link { font-size: 0.85rem; color: var(--border); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* Force light text throughout the invitation form so nothing is black-on-dark */
.inv-form,
.inv-form input,
.inv-form select,
.inv-form label,
.inv-form button,
.inv-form span,
.inv-form p {
  color: var(--text);
}

.inv-form { display: flex; flex-direction: column; gap: 1.5rem; }

.inv-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.inv-section h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.optional { font-size: 0.78rem; font-weight: 400; margin-left: 0.3rem; }

.inv-title-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
}

/* ── Board picker ────────────────────────────────────────────────────────── */
.inv-board-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.inv-board-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 200px;
}
.inv-board-search {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}
.inv-board-search::placeholder { color: var(--text-muted); }
.inv-board-filter-my {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.inv-board-filter-my input { margin: 0; }
.inv-board-sort {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.inv-board-sort label { font-size: 0.88rem; color: var(--text-muted); }
.inv-board-sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-size: 0.88rem;
}

.inv-player-count-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.inv-count-tab {
  background: var(--surface-raised, #24243e);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.inv-count-tab.active,
.inv-count-tab:hover { border-color: var(--border); background: var(--surface); }

.inv-count-badge {
  background: var(--border);
  border-radius: 10px;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
}

.inv-board-hint { color: var(--text-muted); font-size: 0.88rem; }

.inv-board-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.inv-board-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  background: var(--surface-raised, #24243e);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  padding: 0.65rem 1rem;
  min-width: 140px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.inv-board-card:hover { border-color: var(--border); }
.inv-board-card.selected,
.inv-board-card.active {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border);
}
.inv-board-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.inv-board-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.inv-board-card.active .inv-board-card-meta { color: var(--text-muted); }

.inv-board-pager {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.inv-board-page-btn {
  background: var(--surface-raised, #24243e);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.inv-board-page-btn:hover:not(:disabled) { border-color: var(--border); background: var(--surface); }
.inv-board-page-btn:disabled { opacity: 0.5; cursor: default; }

.inv-board-page-info { color: var(--text-muted); font-size: 0.85rem; }

.inv-board-btn {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.inv-board-btn:hover { border-color: var(--border); }
.inv-board-btn.selected,
.inv-board-btn.active { border-color: var(--border); background: var(--surface); color: var(--text); }

.inv-selected-board {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.btn-link {
  background: none;
  border: none;
  color: var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  margin-left: 0.4rem;
  text-decoration: underline;
}

/* ── Seat assignment rows ────────────────────────────────────────────────── */
.inv-seats-help { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 0.75rem; }

.inv-seat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.inv-seat-row:last-child { border-bottom: none; }

.inv-seat-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

.inv-seat-row-label { width: 60px; font-weight: 600; font-size: 0.9rem; }

.inv-seat-options { display: flex; gap: 0.35rem; }

.inv-seat-opt {
  background: var(--surface-raised, #24243e);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: inherit;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.inv-seat-opt.active { border-color: var(--border); background: var(--surface-raised); color: var(--border); }
.inv-seat-opt:hover:not(.active) { border-color: var(--border); }

/* ── Settings (visibility, rating, time) ───────────────────────────────────── */
#inv-settings-section .inv-settings-group {
  margin-bottom: 1.25rem;
}
#inv-settings-section .inv-settings-group:last-child { margin-bottom: 0; }
.inv-settings-subhead {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.5rem 0;
}
.inv-settings-label { font-size: 0.88rem; color: var(--text-muted); display: block; margin-bottom: 0.35rem; }
.inv-settings-hint { font-size: 0.8rem; color: var(--text-muted); margin: 0.35rem 0 0 0; }
.inv-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-size: 0.88rem;
  min-width: 200px;
}
.inv-rated-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.inv-rated-label input[type="checkbox"] { margin: 0; }

/* ── Time settings ───────────────────────────────────────────────────────── */
.inv-time-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.inv-time-row label { font-size: 0.88rem; color: var(--text-muted); min-width: 130px; }
.inv-clock-toggle { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; cursor: pointer; }

.time-input-inline,
.time-unit-select-inline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-size: 0.88rem;
}
.time-input-inline { width: 70px; }
.time-unit-select-inline option { background: var(--surface); color: var(--text); }

.inv-time-presets-label { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 0.4rem 0; }
.inv-time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.inv-time-preset-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.inv-time-preset-btn:hover {
  background: var(--surface-raised, #252540);
  border-color: var(--border);
}
.inv-time-preset-btn.active {
  background: var(--border);
  border-color: var(--border);
  color: #fff;
}

.inv-hot-picks-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0.25rem 0;
}
.inv-hot-picks-sub:first-of-type { margin-top: 0; }
.inv-hot-picks { margin-bottom: 0.5rem; }
.inv-hot-picks .inv-time-preset-btn { font-size: 0.8rem; padding: 0.28rem 0.6rem; }

/* ── Form actions ────────────────────────────────────────────────────────── */
.inv-form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap; }

/* ── Lobby sections ──────────────────────────────────────────────────────── */
.lobby-section { margin-bottom: 2rem; }
.lobby-section-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.lock-icon { font-style: normal; }

/* Reserved seat labels */
.inv-seat-name.reserved-me { color: var(--border); font-weight: 600; }
.inv-seat-name.reserved     { color: var(--text-muted); font-style: italic; }

/* ── Friend picker ───────────────────────────────────────────────────────── */
.inv-friend-picker {
  position: absolute;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0;
  min-width: 180px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  margin-top: 4px;
}
.inv-friend-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  padding: 0.45rem 0.9rem;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
}
.inv-friend-item:hover { background: var(--surface-raised); color: var(--border); }
.inv-picker-empty { color: var(--text-muted); font-size: 0.85rem; padding: 0.5rem 0.9rem; margin: 0; }
.inv-seat-clear-invite {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
}
.inv-seat-clear-invite:hover { color: #e74c3c; }
.inv-seat-options { position: relative; }

/* ── Board mini-preview ──────────────────────────────────────────────────── */
.inv-board-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.5rem 0;
}
.inv-board-preview {
  border: 2px solid var(--border);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.inv-board-preview .row {
  display: flex;
  flex-direction: row;
  margin: 0;
  padding: 0;
}
.inv-board-preview .square {
  border: 1px solid rgba(0,0,0,0.25);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.inv-board-preview .square-dark  { background-color: #6b8e23; }
.inv-board-preview .square-light { background-color: #9acd32; }
.inv-board-preview .square-light.upgrade { background-color: rgb(0,102,0); }
.inv-board-preview .square-dark.upgrade  { background-color: rgb(51,204,51); }
.inv-board-preview .square.wall  { border: none; }
.inv-board-preview .square.wall .piece  { width: 100%; height: 100%; top: 0; left: 0; transform: none; background-size: cover; }
.inv-board-preview .square .piece {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80%; height: 80%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

/* ── Board stats (invitation creation page) ──────────────────────── */
.inv-board-stats {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  font-size: 13px;
}
.inv-stats-loading { color: rgba(0,0,0,0.4); font-style: italic; }
.inv-stats-none { color: rgba(0,0,0,0.4); }
.inv-stats-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.inv-stats-total { font-weight: 600; color: #333; }
.inv-stats-skew-bar {
  display: flex; height: 20px; border-radius: 4px; overflow: hidden;
  border: 1px solid rgba(0,0,0,0.1); margin-bottom: 6px;
}
.inv-stats-bar-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; min-width: 0;
  transition: width 0.3s ease;
}
.inv-stats-bar-draw { background: #ccc; color: #555; }
.inv-stats-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #555; }
.inv-stats-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.inv-stats-dot-draw { background: #ccc; }
.inv-stats-multi { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.inv-stats-side-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border: 1px solid; border-radius: 12px;
  font-size: 12px; color: #444; background: rgba(255,255,255,0.6);
}
.inv-stats-chip-draw { border-color: #ccc; }

/* ── Board stats on lobby invitation cards ───────────────────────── */
.inv-card-stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 12px; color: #666;
}
.inv-card-stats-games { font-weight: 600; color: #444; margin-right: 2px; }
.inv-card-stats-side { display: inline-flex; align-items: center; gap: 3px; }
.inv-card-stats-draw { color: #888; }
.inv-card-stats-endings { font-size: 11px; color: #999; width: 100%; }
.inv-stats-endings { font-size: 11px; color: #888; margin-top: 4px; }
.inv-stats-fun { font-size: 11px; color: #666; margin-top: 4px; }

/* ── Guest CTA (board share page when not logged in) ─────────────────────── */
.inv-guest-cta {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--surface-raised, rgba(0,0,0,0.04));
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 8px;
  text-align: center;
}
.inv-guest-cta-message {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text, #333);
}
.inv-guest-cta-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.inv-clone-btn { cursor: not-allowed; opacity: 0.8; }
.inv-clone-btn-guest { margin-top: 0.5rem; }
.inv-share-board-btn { margin-top: 0.5rem; }

/* Board panel actions: How to play (gold) + Share board */
.inv-board-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  align-items: center;
}
.inv-how-to-play-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid #d97706;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.inv-how-to-play-btn:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(217, 119, 6, 0.35);
  text-decoration: none;
}
/* 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-9bf2286c59507adb7a6045c212a6b92a9defd7e9a5bbae30e82bb83216c43cb1.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-539d3d56e9e6486f9f326e6110f723b83c78a3a41bd468f7155ff124ccb0718b.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-c10edcf5ff649c7e89eb91e31a167c9b37c3febae9634caeec472abddaf89bb9.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-175ea2252a01052113dff85380e8237246448c762ae303ae2a348d971ba0800b.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-05cb6801d02f39363977f6d7ae9a40f605b2aa69866e9086868c08e1df17f875.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-4cdcdd4680a0d527891fb3c831f214de39eee19f43efa13d0c4c54ccd600ab09.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-a375ca340e6c5ad22245a9da1d2ba99e6d27013c6af06423ee1480fb92f17c49.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-bd7f71976cd28a7bc0479b551031cde53ede5b5e454d612222c2a184779dfd9a.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-670d669100cf7cfd08c2729d9bebb01b5a4e42dc376e6cb502afe4f05fb4a600.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-2f94d399fcd37abfa483e282c93aceddbd56780ea325b07fa66ad9a5ce6268f4.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-4071a8569386152a6286a5597ea79039c10f539808433247b3b7d98425f25712.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-c3addc101ab6f2165857fcd799a5ac728d78f6823d7004c1c7548cb62b84e05c.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-f43a674124376cbf0396ed6f3807019fed601be026df418dc8433c1af6dc846a.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-dcf7443f83fb9889a5e60e6e5488c0676a975d57f81b87310d606c87a77c5216.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-d67a4eda4e84f823ba4c353fd0cdefaff69c816f3f50659a663a558a8f5f47e5.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-dcf6c2df42372d1e36ac45e87b930abf9345d920f432f1c761fbfb92cb9a1744.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-b37c79211a9d9d51decffec8c32d520c79927b25a9adac2afae8fcdd3deb4ed3.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-c4ca02103400b4dd86f194a34047148aafa78959ef53970558e11e832f201a8d.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-d427454bfe9b4102550943b05466b7e725eae8eb4dc37fd027efa08a0b6fe729.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-7eb02c4bf89b0c47a6008e586c911f27dea53b4c1304dbed75dd7672aef0eae1.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-ab6b52517d82a508a23adabab4a799a2701051f6f08813e24e5e0910ff68afc9.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-ef5c38d7ab47e3d62455c998d69b7fa606c81d15d5ec69635d32267dccb1eb76.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-bbf097ae0143a36a904a544dea49032dfe03a803d83ba7fb2c93adb001962c5a.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-e997170701376d32f3d24e6e2bbc9d82d789cdd5210a9ff71d9541dfc5865983.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-a3c31ea3eec96bef5b1b675f6fd061fe390e25491ca3e57550667e36f15693c0.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-59c60e694eabecabba8421a01b36846f81689b5cc3389192850ddf3330366ef7.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-aa8c8980819fe30086902c905b821cd6c38bd1f2adc73aaa39f03532fbe848a8.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-8f9c85cd7df0ab115a0c1b918afdc841ae44172033ae274920e834889056508a.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-3d43022046c7296a6c7ebac3e45c4701fde60b7fdd833e2bd3ff5eec80064323.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-af46112bc46f1d8fe40f5e75fb19af80cc0ee468a35c5eca908f614ac404b6f7.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-710b2fadead5cbadc8fee1f446bf9d3fa6d08ba3570d2dde7125258157ca0af4.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-96d72be27783a583d98806b7fcb68a65a46fa686dcc1ba2d06f6ca60f3f13ac9.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-be1de9e31b1cde536f32c0d69438344286e279fad85fc0e679a028247bb60d74.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-ae942101a8b29600929cbecdf45f32e391b2f44a93db3a35054141433e118714.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-44ea8fe8fc499d51bb3bd62064dff7d85a15d0337bce1e1007c366e4b6c09f5c.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-73b272fa602a00d232e93e84b2575461a139374418f02f9c6480caa4d70dfe6e.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-248b403f64c7cb4fe0021e0b19795753fd7d45e9663c9d6d2f32cc8850618a66.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-0db8c52f86add7d80cc3eb497f606f79c807a3e1cdb6c85eb24028f5e5673268.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-203900d4772a0383637ac8a871093f3638d3260955c444880afdbcb17f6ad47f.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-cb867ef98e4f15386e24a0bbea4dbc8ce9263d464fb2578d1cdbaa852727cf21.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-b18303fa8a72d8a9fae2f307120aa30d1e13b290c6abaabf7ed6dbd359546dd9.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-7ee0ce90af30d9c121d93a806c123f01bf914c3599af82abd103587cdf57384a.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-f2443bb241a14d91a8b12a2e3588bfe71d85453143b81687fadbbd2295ebce2a.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-231b50e220ed23fce9c8a5e703772f201c23d323674682bcea2ba93ab78ab5e5.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-2ae618d32bffdf2937c930f699f413d4aa67c5a4568886d12196c10900549da2.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-e561812e49fa6c208bdb37ff4e3bee8e826a50db35c444f259cd0d9091f866c2.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-1620c721f708240e0b1ed5530a227a20b614932fa162a5a0c81fee7806fcb31a.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-abb0abe16961cb97975130888a4471adad34cc3a98c8fa3478a138ae7469478f.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(--app-bg);
    border-right: none;
    border-bottom: 1px solid var(--app-border);
  }
  
  .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(--surface-raised);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.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(--text);
}

.example-square {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border);
  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(--text-muted);
  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(--border);
  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(--text-muted);
  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);
}

/* ── Keyboard controls list ──────────────────────────────────────────── */

.controls-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: var(--space-3, 0.75rem);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-md);
}

.controls-list > :first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.controls-list > :last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Paired row — two equal cells side by side */
.control-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 0.0625rem solid var(--border);
}

.controls-list > .control-pair:first-child {
  border-top: none;
}

.control-pair .control-btn {
  width: 100%;
  height: 100%;
  border-top: none;
  border-radius: 0;
}

.control-pair .control-btn:first-child {
  border-right: 0.0625rem solid var(--border);
}

.kbd-group {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
  font-weight: var(--font-medium);
  background: var(--surface-raised);
  border: none;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition-fast);
  text-align: left;
  box-sizing: border-box;
}

.control-btn kbd {
  flex-shrink: 0;
  min-width: 1.5rem;
  text-align: center;
}

.control-btn > span {
  flex: 1;
}

.control-btn:hover {
  background: var(--surface);
}

.control-btn.active {
  background: var(--primary-600);
  color: white;
}

.control-btn--static {
  cursor: default;
  color: var(--text-muted);
}

.control-btn--static:hover {
  background: var(--surface-raised);
}

/* Pan arrow cluster */
.control-btn--pan {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  justify-content: center;
}

.pan-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 1.6rem;
  flex-shrink: 0;
}

.pan-arrows {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.pan-row {
  display: flex;
  gap: 1px;
}

.pan-arrow-btn {
  background: var(--surface-raised);
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background var(--transition-fast);
}

.pan-arrow-btn kbd {
  display: block;
  pointer-events: none;
  margin: 0;
  box-shadow: none;
  background: transparent;
  border: none;
  font-size: 0.75rem;
  padding: 0.1rem 0.3rem;
}

.pan-arrow-btn:hover {
  background: var(--surface);
}

/* ── Sidebar Quick Actions ────────────────────────────────────────────── */

.sidebar-quick-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-bottom: 0.0625rem solid var(--border);
}

.sidebar-quick-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-2);
  font-size: 0.75rem;
  font-weight: var(--font-medium);
  background: var(--surface-raised);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.sidebar-quick-btn:hover {
  background: var(--surface);
}

.sidebar-quick-btn.active {
  background: var(--primary-600);
  color: white;
}

/* ── Chat Sidebar ─────────────────────────────────────────────────────── */

.chat-sidebar {
  position: fixed;
  top: var(--header-height, 4rem); /* JS overrides this with actual header height */
  right: 0;
  width: var(--sidebar-width, 14rem);
  background-color: var(--app-bg-raised);
  border-left: 0.0625rem solid var(--app-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky, 1020);
  transition: transform var(--transition-base, 200ms ease-in-out);
  overflow: hidden;
  border-radius: 0 0 0 var(--radius-lg, 0.5rem);
}

.chat-sidebar:hover {
  z-index: calc(var(--z-fixed) + 1000);
}

.chat-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3, 0.75rem);
  border-bottom: 0.0625rem solid var(--border);
  flex-shrink: 0;
}

.chat-sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.chat-sidebar-title kbd.shortcut-hint {
  font-size: 0.7rem;
  opacity: 0.6;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.chat-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1;
  border-radius: var(--radius-base);
}

.chat-toggle-btn:hover {
  background: var(--surface-raised);
}

/* chat-body fills remaining vertical space */
.chat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
  gap: 0.4rem;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 2px;
}

.chat-message {
  font-size: 0.82rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  max-width: 92%;
  word-break: break-word;
  background: var(--surface-raised);
  border: 0.0625rem solid var(--border);
}

.chat-message-mine {
  align-self: flex-end;
  background: var(--primary-100);
  border-color: var(--primary-200, #bae6fd);
}

.chat-message-theirs {
  align-self: flex-start;
}

.chat-message-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.chat-sender {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.chat-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-body-text {
  line-height: 1.4;
}

.chat-input-row {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  border: 0.0625rem solid var(--border);
  border-radius: var(--radius-base);
  background: var(--surface);
  color: var(--text);
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary-400);
  box-shadow: 0 0 0 2px var(--primary-100);
}

.chat-send-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-completed-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* Mobile: hide chat sidebar (limited screen space) */
@media (max-width: 768px) {
  .chat-sidebar {
    display: none;
  }
}

/* ── Sidebar resize handles ───────────────────────────────────────────────── */

.sidebar-resize-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  cursor: move;
  z-index: 10;
  opacity: 0.35;
  transition: opacity 0.15s;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle:active {
  opacity: 0.85;
}

/* Corner grip dots — 3×3 dot grid rendered via radial-gradient */
.sidebar-resize-handle::after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle, var(--text-muted) 1.5px, transparent 1.5px);
  background-size: 5px 5px;
  background-repeat: repeat;
}

/* Left sidebar: handle sits in the upper-right corner */
.resize-top-right {
  top: 4px;
  right: 4px;
}

/* Chat sidebar: handle sits in the upper-left corner */
.resize-top-left {
  top: 4px;
  left: 4px;
}

/* ── Draw Offer Panel ─────────────────────────────────────────────────────── */

.draw-offer-panel {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: var(--surface-raised);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg, 0.5rem);
  padding: 0.75rem 1.25rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  min-width: 20rem;
  max-width: 90vw;
  text-align: center;
}

.draw-offer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}

.draw-offer-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.draw-offer-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.draw-action-btn {
  min-width: 6rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.875rem;
  border-radius: var(--radius-sm, 0.25rem);
  cursor: pointer;
  border: none;
  font-weight: 600;
}
/* Games List Styles */

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

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  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 var(--border);
}

.game-header h3 {
  margin: 0;
  color: var(--text);
  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: var(--text-muted);
}

.game-info strong {
  color: var(--text);
}

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

.players li {
  margin: 4px 0;
  color: var(--text-muted);
}

.no-games {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface-raised);
  border-radius: 8px;
  color: var(--text-muted);
}

.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 play / board pages, NOT the games list (index) or welcome */

/* Hide chessboard background on game show page only */
body.games-show::before {
  display: none !important;
}

/* Set black background on game show page only */
body.games-show {
  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: var(--app-text);
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.sidebar-link:hover {
  background-color: var(--surface-raised);
  color: var(--app-text);
  text-decoration: none;
}

.user-rating {
  text-align: center;
  padding: 10px;
  background: var(--surface-raised);
  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: 0;
  background: var(--app-bg);
}

/* 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: var(--app-text);
  font-weight: bold;
}

.app-title-link {
  color: var(--app-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

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

.user-info {
  color: var(--app-text-muted);
  font-size: 0.9em;
  padding-right: 8px;
  border-right: 1px solid var(--app-border);
}

.header-link {
  color: var(--app-text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.header-link:hover {
  background-color: var(--surface-raised);
  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));
  /* transparent so body/chessboard background shows through */
}

/* Game Controls */
.game-controls {
  margin: 20px 0;
  padding: 15px;
  background: var(--surface-raised);
  border-radius: 8px;
  border: 1px solid var(--border);
  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: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.1);
  color: var(--text);
  display: inline-block;
  font-size: 0.85em;
  font-weight: 500;
  line-height: 1;
  padding: 2px 4px;
  white-space: nowrap;
}

/* Flash notice / alert banners */
p.notice, p.alert {
  margin: 0;
  padding: 16px 24px;
  font-size: 1.05em;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid;
}

p.notice {
  background: #d1fae5;
  color: #065f46;
  border-color: #34d399;
}

p.alert {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: #f87171;
}

/* Practice game badge (shown in game header h1) */
.practice-game-badge {
  display: inline-block;
  font-size: 0.6em;
  font-weight: 600;
  font-family: sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #7c3aed;
  color: #fff;
  border-radius: 4px;
  padding: 2px 7px;
  vertical-align: middle;
  margin-left: 0.5em;
  line-height: 1.5;
}

/* Small note appended to the Cancel Game button */
.practice-no-rating-note {
  font-size: 0.72em;
  font-weight: 400;
  opacity: 0.8;
  margin-left: 0.25em;
}

/* Impersonation banner */
.impersonation-banner {
  background: #f97316;
  color: #fff;
  font-weight: 600;
  font-size: 0.95em;
  text-align: center;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 2px solid #ea580c;
}

.impersonation-stop-btn {
  background: #fff;
  color: #ea580c;
  border: 2px solid #fff;
  border-radius: 4px;
  padding: 4px 14px;
  font-weight: 700;
  font-size: 0.9em;
  cursor: pointer;
  transition: background 0.15s;
}

.impersonation-stop-btn:hover {
  background: #fef2f2;
}
