/*!
 * TypeVortex Game Styles
 * Built on: 2025-08-15T23:35:57.818Z
 * Mode: development
 * 
 * This file is auto-generated. Do not edit directly.
 * Edit source files in /src/styles/ instead.
 */

/* ./design-system.css */
/* TypeVortex Design System - CSS Custom Properties */

:root {
  /* === COLOR PALETTE === */
  
  /* Primary Colors */
  --color-primary: #4caf50;
  --color-primary-dark: #45a049;
  --color-primary-light: #66bb6a;
  --color-primary-alpha: rgba(76, 175, 80, 0.1);
  
  /* Secondary Colors */
  --color-secondary: #2196f3;
  --color-secondary-dark: #1976d2;
  --color-secondary-light: #42a5f5;
  --color-secondary-alpha: rgba(33, 150, 243, 0.1);
  
  /* Accent Colors */
  --color-accent: #ff9800;
  --color-accent-dark: #f57c00;
  --color-accent-light: #ffb74d;
  
  /* Status Colors */
  --color-success: #4caf50;
  --color-warning: #ff9800;
  --color-error: #f44336;
  --color-info: #2196f3;
  
  /* Neutral Colors (Light Theme) */
  --color-background: #ffffff;
  --color-surface: #f5f5f5;
  --color-surface-elevated: #ffffff;
  --color-border: rgba(0, 0, 0, 0.12);
  --color-border-focus: rgba(76, 175, 80, 0.5);
  --color-text-primary: #333333;
  --color-text-secondary: #666666;
  --color-text-disabled: #999999;
  --color-text-inverse: #ffffff;
  
  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.15);
  
  /* === TYPOGRAPHY === */
  
  /* Font Families */
  --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                        'Helvetica Neue', Arial, sans-serif;
  --font-family-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 
                      'Source Code Pro', monospace;
  
  /* Font Sizes */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  
  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* === SPACING === */
  
  /* Spacing Scale (based on 8px grid) */
  --spacing-0: 0;
  --spacing-1: 0.25rem;  /* 4px */
  --spacing-2: 0.5rem;   /* 8px */
  --spacing-3: 0.75rem;  /* 12px */
  --spacing-4: 1rem;     /* 16px */
  --spacing-5: 1.25rem;  /* 20px */
  --spacing-6: 1.5rem;   /* 24px */
  --spacing-8: 2rem;     /* 32px */
  --spacing-10: 2.5rem;  /* 40px */
  --spacing-12: 3rem;    /* 48px */
  --spacing-16: 4rem;    /* 64px */
  --spacing-20: 5rem;    /* 80px */
  
  /* === LAYOUT === */
  
  /* Border Radius */
  --border-radius-sm: 0.125rem;  /* 2px */
  --border-radius-md: 0.25rem;   /* 4px */
  --border-radius-lg: 0.375rem;  /* 6px */
  --border-radius-xl: 0.5rem;    /* 8px */
  --border-radius-2xl: 0.75rem;  /* 12px */
  --border-radius-full: 50%;
  
  /* Border Widths */
  --border-width-thin: 1px;
  --border-width-medium: 2px;
  --border-width-thick: 3px;
  
  /* Container Sizes */
  --container-xs: 20rem;    /* 320px */
  --container-sm: 24rem;    /* 384px */
  --container-md: 28rem;    /* 448px */
  --container-lg: 32rem;    /* 512px */
  --container-xl: 36rem;    /* 576px */
  --container-2xl: 42rem;   /* 672px */
  
  /* === GAME-SPECIFIC VARIABLES === */
  
  /* Matrix Colors */
  --matrix-cell-size: 2.5rem;
  --matrix-cell-gap: 1px;
  --matrix-cell-bg: var(--color-surface);
  --matrix-cell-border: var(--color-border);
  --matrix-cell-current: var(--color-primary);
  --matrix-cell-visited: var(--color-primary-alpha);
  --matrix-cell-valid: var(--color-secondary-alpha);
  --matrix-cell-obstacle: var(--color-error);
  --matrix-cell-trail: var(--color-accent);
  
  /* Animation Durations */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
  --duration-slower: 500ms;
  
  /* Animation Easing */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Z-Index Scale */
  --z-index-dropdown: 1000;
  --z-index-sticky: 1020;
  --z-index-fixed: 1030;
  --z-index-modal-backdrop: 1040;
  --z-index-modal: 1050;
  --z-index-popover: 1060;
  --z-index-tooltip: 1070;
  --z-index-toast: 1080;
  
  /* === RESPONSIVE BREAKPOINTS === */
  
  /* Breakpoint Variables (for use in media queries) */
  --breakpoint-xs: 20rem;    /* 320px */
  --breakpoint-sm: 30rem;    /* 480px */
  --breakpoint-md: 48rem;    /* 768px */
  --breakpoint-lg: 64rem;    /* 1024px */
  --breakpoint-xl: 80rem;    /* 1280px */
  --breakpoint-2xl: 96rem;   /* 1536px */
}

/* === DARK THEME OVERRIDES === */

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme Colors */
    --color-background: #1a1a1a;
    --color-surface: #2d2d2d;
    --color-surface-elevated: #3d3d3d;
    --color-border: rgba(255, 255, 255, 0.12);
    --color-border-focus: rgba(76, 175, 80, 0.6);
    --color-text-primary: #ffffff;
    --color-text-secondary: #cccccc;
    --color-text-disabled: #888888;
    --color-text-inverse: #000000;
    
    /* Adjusted Matrix Colors for Dark Theme */
    --matrix-cell-bg: var(--color-surface);
    --matrix-cell-border: var(--color-border);
    --matrix-cell-visited: rgba(76, 175, 80, 0.2);
    --matrix-cell-valid: rgba(33, 150, 243, 0.2);
    
    /* Enhanced Shadows for Dark Theme */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.5);
  }
}

/* === HIGH CONTRAST MODE === */

@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --color-border-focus: var(--color-primary);
    --matrix-cell-border: #000000;
    --matrix-cell-current: #000000;
    --matrix-cell-visited: rgba(0, 0, 0, 0.1);
    --matrix-cell-valid: rgba(0, 0, 0, 0.2);
  }
}

/* === REDUCED MOTION === */

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0.01ms;
    --duration-normal: 0.01ms;
    --duration-slow: 0.01ms;
    --duration-slower: 0.01ms;
  }
}

/* === UTILITY CLASSES FOR DESIGN SYSTEM === */

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-disabled { color: var(--color-text-disabled); }
.text-inverse { color: var(--color-text-inverse); }

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-surface { background-color: var(--color-surface); }
.bg-surface-elevated { background-color: var(--color-surface-elevated); }

.border-primary { border-color: var(--color-primary); }
.border-secondary { border-color: var(--color-secondary); }
.border-default { border-color: var(--color-border); }
.border-focus { border-color: var(--color-border-focus); }

.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.font-mono { font-family: var(--font-family-mono); }
.font-primary { font-family: var(--font-family-primary); }

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

.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-md { border-radius: var(--border-radius-md); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-xl { border-radius: var(--border-radius-xl); }
.rounded-2xl { border-radius: var(--border-radius-2xl); }
.rounded-full { border-radius: var(--border-radius-full); }

/* Essential Utility Classes */
.hidden { display: none !important; }
.active { display: block !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ./optimized-animations.css */
/* Optimized animations with hardware acceleration */

/* Enable hardware acceleration for better performance */
.matrix-cell,
.combo-indicator,
.feedback-overlay,
.game-header {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Matrix cell animations with GPU optimization */
.matrix-cell {
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s ease-out,
                border-color 0.2s ease-out,
                box-shadow 0.15s ease-out;
}

.matrix-cell:hover {
    transform: scale(1.05) translateZ(0);
}

.matrix-cell.current {
    transform: scale(1.1) translateZ(0);
    animation: current-pulse 2s infinite ease-in-out;
}

@keyframes current-pulse {
    0%, 100% { 
        transform: scale(1.1) translateZ(0);
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.6);
    }
    50% { 
        transform: scale(1.15) translateZ(0);
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.8);
    }
}

/* Valid move indicators with staggered animation */
.matrix-cell.valid-move {
    animation: valid-move-indicator 1.5s infinite ease-in-out;
}

@keyframes valid-move-indicator {
    0%, 100% { 
        background-color: rgba(33, 150, 243, 0.1);
        border-color: rgba(33, 150, 243, 0.3);
    }
    50% { 
        background-color: rgba(33, 150, 243, 0.2);
        border-color: rgba(33, 150, 243, 0.5);
    }
}

/* Trail animation with fade effect */
.matrix-cell.trail {
    animation: trail-fade 3s ease-out forwards;
    background: linear-gradient(45deg, 
        rgba(255, 193, 7, calc(0.3 - var(--trail-index, 0) * 0.05)),
        rgba(255, 152, 0, calc(0.2 - var(--trail-index, 0) * 0.04))
    );
}

@keyframes trail-fade {
    0% { opacity: 0.8; transform: scale(1.02) translateZ(0); }
    100% { opacity: 0.3; transform: scale(1) translateZ(0); }
}

/* Error shake animation - optimized */
.error-shake {
    animation: error-shake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes error-shake {
    10%, 90% { transform: translateX(-1px) translateZ(0); }
    20%, 80% { transform: translateX(2px) translateZ(0); }
    30%, 50%, 70% { transform: translateX(-3px) translateZ(0); }
    40%, 60% { transform: translateX(3px) translateZ(0); }
    0%, 100% { transform: translateX(0) translateZ(0); }
}

/* Combo indicator animations */
.combo-indicator {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-indicator.active {
    transform: scale(1.1) translateZ(0);
    animation: combo-pulse 0.5s ease-out;
}

@keyframes combo-pulse {
    0% { transform: scale(1) translateZ(0); }
    50% { transform: scale(1.2) translateZ(0); }
    100% { transform: scale(1.1) translateZ(0); }
}

/* Loading animations */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(76, 175, 80, 0.1);
    border-top: 3px solid #4caf50;
    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
}

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

/* Fade transitions for screen changes */
.screen-transition {
    opacity: 0;
    transform: translateY(20px) translateZ(0);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.screen-transition.active {
    opacity: 1;
    transform: translateY(0) translateZ(0);
}

/* Feedback overlay animations */
.feedback-overlay {
    pointer-events: none;
    z-index: 1000;
}

.feedback-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px) translateZ(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

.feedback-message.show {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) translateZ(0);
}

.feedback-success {
    background: rgba(76, 175, 80, 0.9);
    color: white;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.feedback-error {
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.feedback-info {
    background: rgba(33, 150, 243, 0.9);
    color: white;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

/* Performance-optimized hover effects */
.btn-primary, .btn-secondary {
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.btn-primary:hover, .btn-secondary:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:active, .btn-secondary:active {
    transform: translateY(0) translateZ(0);
}

/* Ripple effect for buttons */
.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) translateZ(0);
    transition: width 0.6s ease-out, height 0.6s ease-out;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Optimized scrollbar styling */
.matrix-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.matrix-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.matrix-container::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.3);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.matrix-container::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.5);
}

/* Modal animations */
.modal {
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease-out, backdrop-filter 0.3s ease-out;
}

.modal.hidden {
    opacity: 0;
    backdrop-filter: blur(0);
    pointer-events: none;
}

.modal-content {
    transform: scale(0.7) translateZ(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1) translateZ(0);
}

/* Responsive animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .matrix-cell.current {
        box-shadow: 0 0 0 3px #4caf50;
        animation: none;
    }
    
    .matrix-cell.valid-move {
        border: 2px solid #2196f3;
        animation: none;
    }
    
    .matrix-cell.trail {
        border: 1px dashed #ff9800;
        background: transparent;
        animation: none;
    }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
    .feedback-message {
        backdrop-filter: blur(12px);
    }
    
    .matrix-cell {
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .matrix-cell:hover {
        border-color: rgba(255, 255, 255, 0.2);
    }
}

/* GPU-accelerated transforms for large matrices */
.matrix-large .matrix-cell {
    contain: layout style paint;
    transform: translateZ(0);
}

/* Virtual scrolling optimizations */
.virtual-scroll-container {
    overflow: auto;
    will-change: scroll-position;
    -webkit-overflow-scrolling: touch;
}

.virtual-scroll-item {
    position: absolute;
    will-change: transform;
    contain: strict;
}

/* Performance monitoring indicators (dev mode) */
.perf-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    z-index: 9999;
    font-family: monospace;
}

.perf-indicator.good { border-left: 3px solid #4caf50; }
.perf-indicator.warning { border-left: 3px solid #ff9800; }
.perf-indicator.bad { border-left: 3px solid #f44336; }

/* ./components/base.css */
/* Base Styles - Core reset and typography */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: var(--color-text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#app {
    width: 100%;
    max-width: 1200px;
    padding: var(--spacing-1);
    transition: max-width var(--duration-normal) var(--ease-out);
}

/* Dynamic width adjustment for larger boards */
#app.large-board {
    max-width: 95vw;
}

/* Typography Scale */
.text-hero { 
    font-size: clamp(2.5rem, 8vw, 4rem); 
    font-weight: var(--font-weight-bold); 
    text-shadow: 0 0 10px rgba(103, 126, 234, 0.5), 0 0 20px rgba(103, 126, 234, 0.3), 0 0 30px rgba(103, 126, 234, 0.1);
}

.text-xl { 
    font-size: clamp(1.5rem, 4vw, 2rem); 
    font-weight: var(--font-weight-semibold); 
}

.text-lg { 
    font-size: var(--font-size-xl); 
    font-weight: var(--font-weight-medium); 
}

.text-base { 
    font-size: var(--font-size-base); 
    font-weight: var(--font-weight-normal); 
}

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

h1 {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    font-weight: var(--font-weight-bold);
    text-shadow: 0 0 10px rgba(103, 126, 234, 0.5), 0 0 20px rgba(103, 126, 234, 0.3), 0 0 30px rgba(103, 126, 234, 0.1);
    margin-bottom: var(--spacing-2);
}

header {
    text-align: center;
    margin-bottom: var(--spacing-1);
    position: relative;
}

/* Hide header banner during gameplay */
#game-screen.active ~ header,
#game-screen.active + header {
    display: none;
}

body:has(#game-screen.active) header {
    display: none;
}

/* ./components/screens.css */
/* Screen Layout Components */

.screen {
    display: none;
    animation: fadeIn var(--duration-normal) var(--ease-out);
    height: 100vh;
    overflow: hidden;
}

.screen.active {
    display: block;
}

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

.menu-container, 
.lobby-container, 
.game-container {
    background: var(--color-surface);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-1);
    box-shadow: var(--shadow-md);
    border: var(--border-width-thin) solid var(--color-border);
    position: relative;
    overflow: hidden;
    height: calc(100vh - 4px);
}

/* Specific layout adjustments for different containers */
.menu-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
}

#game-screen .game-container,
.screen.active .game-container {
    padding: 0 !important;
    height: calc(100vh - 2px) !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.menu-container::before, 
.lobby-container::before, 
.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.menu-container h2, 
.lobby-container h2 {
    margin-bottom: var(--spacing-5);
    font-size: var(--font-size-3xl);
}

.menu-container p {
    margin-bottom: var(--spacing-8);
    font-size: var(--font-size-lg);
    opacity: 0.9;
}

/* ./components/forms.css */
/* Form Components and Input Styling */

/* Player Name Input */
#playerName {
    width: 100%;
    padding: var(--spacing-6);
    font-size: var(--font-size-lg);
    font-family: var(--font-family-primary);
    border: var(--border-width-medium) solid transparent;
    border-radius: var(--border-radius-xl);
    background: rgba(255,255,255,0.9);
    color: #333;
    margin-bottom: var(--spacing-6);
    transition: all var(--duration-normal) var(--ease-out);
}

#playerName:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-alpha);
    background: rgba(255,255,255,0.95);
}

#playerName.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.1);
    background: rgba(248, 113, 113, 0.05);
}

/* Error Messages */
.name-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-top: calc(var(--spacing-4) * -1);
    margin-bottom: var(--spacing-4);
    text-align: center;
    background: rgba(248, 113, 113, 0.1);
    border: var(--border-width-thin) solid rgba(248, 113, 113, 0.3);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-2) var(--spacing-4);
    animation: errorSlideIn var(--duration-normal) var(--ease-out);
}

.lobby-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-align: center;
    background: rgba(248, 113, 113, 0.1);
    border: var(--border-width-thin) solid rgba(248, 113, 113, 0.3);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-6);
    animation: errorSlideIn var(--duration-normal) var(--ease-out);
}

@keyframes errorSlideIn {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Board Size Selector */
.board-size-selector {
    margin: var(--spacing-2) 0;
    text-align: center;
}

.size-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

.size-option {
    cursor: pointer;
    position: relative;
    display: block;
}

.size-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.size-label {
    display: block;
    padding: var(--spacing-6);
    background: var(--color-surface);
    border: var(--border-width-medium) solid var(--color-border);
    border-radius: var(--border-radius-xl);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    transition: all var(--duration-normal) var(--ease-out);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.size-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s var(--ease-out);
}

.size-option:hover .size-label::before {
    transform: translateX(100%);
}

.size-option:hover .size-label {
    border-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.size-option input[type="radio"]:checked + .size-label {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
    box-shadow: var(--shadow-lg);
    transform: scale(1.05);
}

.size-label small {
    font-size: var(--font-size-xs);
    opacity: 0.8;
    font-weight: var(--font-weight-normal);
}

/* ./components/game-options.css */
/* Game Options and Settings */

.game-options {
    margin: var(--spacing-2) 0;
    text-align: center;
}

.game-options h3 {
    margin-bottom: var(--spacing-4);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

.option-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-4);
    padding: var(--spacing-6);
    background: var(--color-surface);
    border: var(--border-width-medium) solid var(--color-border);
    border-radius: var(--border-radius-xl);
    transition: 
        background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
    backdrop-filter: blur(10px);
}

.option-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.option-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    transition: background var(--duration-normal) var(--ease-out);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--color-text-primary);
    border-radius: 50%;
    transition: all var(--duration-normal) var(--ease-out);
    box-shadow: var(--shadow-sm);
}

.option-toggle input[type="checkbox"]:checked + .toggle-slider {
    background: var(--color-primary);
}

.option-toggle input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: var(--color-text-inverse);
}

.option-label {
    flex: 1;
    text-align: left;
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-base);
}

/* Game Options Display */
.game-options-display {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-4);
}

.option-indicator {
    background: var(--color-primary-alpha);
    border: var(--border-width-thin) solid var(--color-primary);
    border-radius: var(--border-radius-full);
    padding: var(--spacing-1) var(--spacing-3);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ./components/buttons.css */
/* Button Components */

.btn {
    padding: var(--spacing-4) var(--spacing-8);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--border-radius-xl);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-primary);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    box-shadow: var(--shadow-md);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s var(--ease-out);
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn:disabled {
    background: var(--color-text-disabled);
    color: var(--color-text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled::before {
    display: none;
}

/* Button Variants */
.btn-secondary {
    background: var(--color-secondary);
}

.btn-secondary:hover {
    background: var(--color-secondary-dark);
}

.btn-info {
    background: var(--color-info);
}

.btn-info:hover {
    background: #1976d2;
}

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

.btn-success:hover {
    background: var(--color-success);
    filter: brightness(1.1);
}

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

.btn-warning:hover {
    background: var(--color-warning);
    filter: brightness(1.1);
}

.btn-error {
    background: var(--color-error);
}

.btn-error:hover {
    background: var(--color-error);
    filter: brightness(1.1);
}

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

.btn-outline:hover {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

/* Button Sizes */
.btn-sm {
    padding: var(--spacing-2) var(--spacing-4);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--spacing-6) var(--spacing-12);
    font-size: var(--font-size-xl);
}

.btn-xl {
    padding: var(--spacing-8) var(--spacing-16);
    font-size: var(--font-size-2xl);
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: var(--spacing-4);
    flex-wrap: wrap;
    justify-content: center;
}

.btn-group .btn {
    flex: 1;
    min-width: 120px;
}

/* Special Game Buttons */
.play-btn, .multiplayer-btn {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    font-size: var(--font-size-xl);
    padding: var(--spacing-6) var(--spacing-12);
    box-shadow: var(--shadow-lg);
}

.play-btn:hover, .multiplayer-btn:hover {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    box-shadow: var(--shadow-xl);
}

.quit-btn {
    background: var(--color-error);
    position: absolute;
    top: var(--spacing-4);
    right: var(--spacing-4);
    padding: var(--spacing-2) var(--spacing-4);
    font-size: var(--font-size-sm);
    z-index: var(--z-index-sticky);
}

.back-btn {
    background: var(--color-text-secondary);
    color: var(--color-text-inverse);
}

.back-btn:hover {
    background: var(--color-text-primary);
}

/* Enhanced Tooltips */
[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    white-space: nowrap;
    z-index: var(--z-index-tooltip);
    pointer-events: none;
    margin-bottom: var(--spacing-2);
    opacity: 0;
    animation: tooltip-fade-in 0.2s ease-out forwards;
    max-width: 300px;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: var(--z-index-tooltip);
    pointer-events: none;
    margin-bottom: calc(var(--spacing-2) - 6px);
    opacity: 0;
    animation: tooltip-fade-in 0.2s ease-out forwards;
}

@keyframes tooltip-fade-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Tooltip positioning for elements near edges */
.menu-container [title]:hover::after {
    max-width: 250px;
}

.size-option[title]:hover::after,
.option-toggle[title]:hover::after {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: var(--spacing-2);
}

.size-option[title]:hover::before,
.option-toggle[title]:hover::before {
    bottom: auto;
    top: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(0, 0, 0, 0.9);
    margin-bottom: 0;
    margin-top: calc(var(--spacing-2) - 6px);
}

/* Responsive tooltip adjustments */
@media (max-width: 768px) {
    [title]:hover::after {
        max-width: 200px;
        font-size: var(--font-size-xs);
        padding: var(--spacing-1) var(--spacing-2);
    }
    
    [title]:hover::before {
        border-width: 4px;
    }
}

/* ./components/matrix.css */
/* Matrix Game Board Styles */

.game-matrix {
    display: grid;
    gap: var(--matrix-cell-gap);
    margin: 0 auto;
    padding: var(--spacing-1);
    background: var(--color-surface-elevated);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: var(--border-width-thin) solid var(--color-border);
    /* Matrix will be sized to fit all tiles in viewport */
    width: fit-content;
    height: fit-content;
    transition: all var(--duration-normal) var(--ease-out);
    /* Ensure matrix scales to fit available space */
    contain: layout style;
    /* Center the matrix in the viewport */
    position: relative;
    z-index: 1;
}

.matrix-cell {
    width: var(--matrix-cell-size);
    height: var(--matrix-cell-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--matrix-cell-bg);
    border: var(--border-width-thin) solid var(--matrix-cell-border);
    border-radius: var(--border-radius-md);
    font-family: var(--font-family-mono);
    font-weight: var(--font-weight-bold);
    font-size: 1.2rem;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
    overflow: visible;
    z-index: 1;
}

/* Goal tiles - subtle border styling only */
.matrix-cell.goal-tile {
    border: 3px solid #00ff88 !important;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3) !important;
    background-color: rgba(0, 255, 136, 0.05) !important;
}

/* Explicitly prevent any pseudo-element content on goal tiles */
.matrix-cell.goal-tile::before,
.matrix-cell.goal-tile::after {
    content: none !important;
    display: none !important;
}

/* Bounty targets - subtle border styling only */
.matrix-cell.bounty-target {
    border: 3px solid #ffd700 !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4) !important;
    background-color: rgba(255, 215, 0, 0.05) !important;
}

/* Explicitly prevent any pseudo-element content on bounty targets */
.matrix-cell.bounty-target::before,
.matrix-cell.bounty-target::after {
    content: none !important;
    display: none !important;
}

.matrix-cell:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
    z-index: 1;
}

/* Cell States */
.matrix-cell.current {
    background: #00ff00 !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5) !important;
    color: #000000 !important;
    animation: pulse 2s infinite;
    z-index: 10;
}

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

.matrix-cell.visited {
    background: var(--matrix-cell-visited);
    border-color: var(--color-primary-light);
    color: var(--color-text-secondary);
}

/* Ensure current position always overrides visited styling */
.matrix-cell.current.visited {
    background: #00ff00 !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5) !important;
    color: #000000 !important;
    animation: pulse 2s infinite !important;
}

.matrix-cell.valid-move {
    background: var(--matrix-cell-valid);
    border-color: var(--color-secondary);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 5px var(--color-secondary-alpha); }
    to { box-shadow: 0 0 15px var(--color-secondary); }
}

.matrix-cell.trail {
    background: var(--matrix-cell-trail);
    border-color: var(--color-accent);
    opacity: calc(1 - var(--trail-index, 0) * 0.2);
    animation: trailFade 3s ease-out forwards;
}







.matrix-cell.obstacle {
    background: linear-gradient(135deg, #333333 0%, #1a1a1a 100%) !important;
    border: var(--border-width-medium) solid #666666 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 8px rgba(255, 255, 255, 0.1) !important;
    color: #999999 !important;
    cursor: not-allowed !important;
    position: relative;
    opacity: 0.8;
}

.matrix-cell.obstacle::before {
    content: '🚧';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8em;
    z-index: 1;
}

.matrix-cell.obstacle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255, 215, 0, 0.1) 2px,
        rgba(255, 215, 0, 0.1) 4px
    );
    pointer-events: none;
}

.matrix-cell.out-of-bounds {
    background: rgba(0, 0, 0, 0.1);
    border: var(--border-width-thin) dashed rgba(255, 255, 255, 0.1);
    cursor: default;
}

/* Ensure current position always overrides obstacle styling */
.matrix-cell.current.obstacle {
    background: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5) !important;
    border: var(--border-width-medium) solid #00ff00 !important;
    cursor: default !important;
    opacity: 1 !important;
}

.matrix-cell.current.obstacle::after {
    display: none !important;
}


/* Ensure current position styling overrides goal tile styling */
.matrix-cell.current.goal-tile {
    background: #00ff00 !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5) !important;
    animation: pulse 2s infinite !important;
}

/* Ensure current position styling overrides bounty target styling */
.matrix-cell.current.bounty-target {
    background: #00ff00 !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5) !important;
    animation: pulse 2s infinite !important;
}

@keyframes trailFade {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Error Animation */
.error-shake {
    animation: errorShake 0.3s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Responsive Matrix Sizing */
@media (max-width: 768px) {
    .game-matrix {
        --matrix-cell-size: 2rem;
        gap: 1px;
        padding: var(--spacing-2);
    }
    
    .matrix-cell {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .game-matrix {
        --matrix-cell-size: 1.5rem;
    }
    
    .matrix-cell {
        font-size: 0.8rem;
    }
}

/* FORCE CURRENT CELL STYLING - HIGHEST PRIORITY */
.matrix-cell.current,
.matrix-cell.current.visited,
.matrix-cell.current.goal-tile,
.matrix-cell.current.bounty-target,
.matrix-cell.current.obstacle,
.matrix-cell.current.valid-move,
.matrix-cell.current.trail {
    background: #00ff00 !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5) !important;
    color: #000000 !important;
    animation: pulse 2s infinite !important;
    z-index: 10 !important;
}

/* ./components/game-ui.css */
/* Game UI Components - HUD, Stats, and Game Interface */

/* Game Stats Display */
.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-surface);
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-1);
    box-shadow: var(--shadow-xs);
    border: var(--border-width-thin) solid var(--color-border);
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    gap: var(--spacing-2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-1);
    min-width: 80px;
}

.stat-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    font-family: var(--font-family-mono);
}

/* Player Info */
.player-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    background: var(--color-surface);
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-1);
    border: var(--border-width-thin) solid var(--color-border);
}

.player-name {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.board-size-display {
    background: var(--color-primary-alpha);
    color: var(--color-primary);
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family-mono);
}

/* Valid Keys Display */
.valid-keys {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    flex: 1;
}

.valid-keys-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    color: var(--color-text-secondary);
}

.key-display {
    display: flex;
    gap: var(--spacing-1);
    flex-wrap: wrap;
    max-width: 300px;
    overflow: hidden;
}

.key, .key-hint {
    padding: var(--spacing-1) var(--spacing-2);
    background: var(--color-surface-elevated);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family-mono);
    text-transform: uppercase;
    color: var(--color-text-primary);
    min-width: 28px;
    text-align: center;
    transition: all var(--duration-fast) var(--ease-out);
}

.key:hover, .key-hint:hover {
    background: var(--color-primary-alpha);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: scale(1.1);
}

/* Combo Indicator */
.combo-indicator {
    display: none !important;
}

.combo-label {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.combo-count {
    font-size: var(--font-size-lg);
    font-family: var(--font-family-mono);
}

/* Connection Status */
#connection-status {
    padding: var(--spacing-2) var(--spacing-4);
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    background: var(--color-surface);
    border: var(--border-width-thin) solid var(--color-border);
    backdrop-filter: blur(10px);
    transition: all var(--duration-normal) var(--ease-out);
}

#connection-status.connected {
    background: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-text-inverse);
}

#connection-status.disconnected {
    background: var(--color-error);
    border-color: var(--color-error);
    color: var(--color-text-inverse);
}

/* Room Display */
.room-display {
    background: var(--color-surface);
    padding: var(--spacing-3) var(--spacing-4);
    border-radius: var(--border-radius-lg);
    border: var(--border-width-thin) solid var(--color-border);
    margin-bottom: var(--spacing-4);
    text-align: center;
}

.room-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-1);
}

.room-name {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    font-family: var(--font-family-mono);
}

/* Instructions Toggle */
.instructions-section {
    margin-bottom: var(--spacing-6);
}

.instructions-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    cursor: pointer;
    padding: var(--spacing-3);
    border-radius: var(--border-radius-lg);
    transition: background var(--duration-fast) var(--ease-out);
}

.instructions-header:hover {
    background: var(--color-surface);
}

.instructions-toggle {
    font-size: var(--font-size-lg);
    transition: transform var(--duration-fast) var(--ease-out);
}

.instructions-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height var(--duration-normal) var(--ease-out);
}

.instructions-content.collapsed {
    max-height: 0;
}

.instructions-text {
    padding: var(--spacing-4);
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    margin-top: var(--spacing-2);
    line-height: var(--line-height-relaxed);
}

/* Tight Game Layout */
.game-header {
    margin-bottom: var(--spacing-1) !important;
    display: none; /* Hidden by default */
    /* Define header height variable for layout calculations */
    --game-header-height: auto;
}

/* Show game header when game is active */
.game-header.active {
    display: block;
    /* Calculate and set actual header height */
    height: fit-content;
}

.header-top-row,
.header-bottom-row {
    margin-bottom: var(--spacing-1) !important;
    padding: var(--spacing-1) !important;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-2);
}

.header-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-2);
}

.stats {
    display: flex;
    gap: var(--spacing-3);
    font-size: var(--font-size-sm);
}

.stats span {
    white-space: nowrap;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.quit-btn {
    padding: var(--spacing-1) var(--spacing-2) !important;
    font-size: var(--font-size-sm) !important;
}

.game-options-display {
    display: flex;
    gap: var(--spacing-1);
    flex-wrap: wrap;
}

.option-indicator {
    font-size: var(--font-size-xs);
    padding: var(--spacing-1);
    border-radius: var(--border-radius-sm);
    background: var(--color-surface);
}

.matrix-viewport-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100%;
    height: 100%;
    min-height: 0; /* Allow flex child to shrink below content size */
}

/* Responsive Game UI */
@media (max-width: 768px) {
    .game-stats {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stat-item {
        flex-direction: row;
        justify-content: space-between;
        min-width: auto;
    }
    
    .valid-keys {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-2);
    }
    
    .key-display {
        max-width: none;
        justify-content: center;
    }
}

/* ./components/modals.css */
/* Modal Components */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-index-modal);
    backdrop-filter: blur(5px);
    animation: modalFadeIn var(--duration-normal) var(--ease-out);
}

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

.modal-content {
    background: var(--color-surface-elevated);
    padding: var(--spacing-10);
    border-radius: var(--border-radius-2xl);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    border: var(--border-width-thin) solid var(--color-border);
    position: relative;
    animation: modalSlideIn var(--duration-normal) var(--ease-out);
}

@keyframes modalSlideIn {
    from { 
        opacity: 0; 
        transform: scale(0.9) translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.modal-content h2 {
    margin-bottom: var(--spacing-5);
    font-size: var(--font-size-3xl);
    color: var(--color-text-primary);
}

.modal-content p {
    margin-bottom: var(--spacing-4);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
}

/* Game Over Modal */
.final-stats {
    background: var(--color-surface);
    padding: var(--spacing-5);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-5);
    border: var(--border-width-thin) solid var(--color-border);
}

.final-stats p {
    margin: var(--spacing-2) 0;
    font-size: var(--font-size-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.final-stats .stat-label {
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

.final-stats .stat-value {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-bold);
    font-family: var(--font-family-mono);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-4);
    justify-content: center;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Close Button */
.modal-close {
    position: absolute;
    top: var(--spacing-4);
    right: var(--spacing-4);
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: var(--spacing-2);
    border-radius: var(--border-radius-md);
    transition: all var(--duration-fast) var(--ease-out);
}

.modal-close:hover {
    color: var(--color-text-primary);
    background: var(--color-surface);
    transform: scale(1.1);
}

/* Loading Modal */
.loading-modal .modal-content {
    padding: var(--spacing-8);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: var(--spacing-4) auto;
}

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

.loading-text {
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    margin-top: var(--spacing-4);
}

/* Error Modal */
.error-modal .modal-content {
    border-left: 4px solid var(--color-error);
}

.error-modal h2 {
    color: var(--color-error);
}

.error-icon {
    font-size: var(--font-size-4xl);
    color: var(--color-error);
    margin-bottom: var(--spacing-4);
}

/* Success Modal */
.success-modal .modal-content {
    border-left: 4px solid var(--color-success);
}

.success-modal h2 {
    color: var(--color-success);
}

.success-icon {
    font-size: var(--font-size-4xl);
    color: var(--color-success);
    margin-bottom: var(--spacing-4);
}

/* Responsive Modal */
@media (max-width: 480px) {
    .modal-content {
        padding: var(--spacing-6);
        margin: var(--spacing-4);
        width: calc(100% - 2 * var(--spacing-4));
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
}

/* ./components/feedback.css */
/* Feedback and Notification Components */

/* Visual Feedback System */
.feedback-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-index-toast);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-2);
}

.feedback-message {
    padding: var(--spacing-4) var(--spacing-6);
    background: var(--color-surface-elevated);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    border: var(--border-width-thin) solid var(--color-border);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-primary);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-2);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-20px);
    transition: all var(--duration-normal) var(--ease-out);
}

.feedback-message.success {
    color: var(--color-success) !important;
    border-color: rgba(74, 222, 128, 0.3) !important;
    background: rgba(74, 222, 128, 0.1) !important;
    font-weight: var(--font-weight-bold) !important;
}

.feedback-message.error {
    color: var(--color-error);
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.1);
}

.feedback-message.warning {
    color: var(--color-warning);
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.1);
}

.feedback-message.info {
    color: var(--color-info);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
}

.feedback-message.combo {
    color: var(--color-accent);
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.1);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

@keyframes feedbackSlide {
    0% { 
        opacity: 0; 
        transform: translateY(-70%) scale(0.8); 
    }
    20% { 
        opacity: 1; 
        transform: translateY(-50%) scale(1.1); 
    }
    25% { 
        transform: translateY(-50%) scale(1); 
    }
    80% { 
        opacity: 1; 
        transform: translateY(-50%) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translateY(-30%) scale(0.9); 
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--spacing-6);
    right: var(--spacing-6);
    z-index: var(--z-index-toast);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    pointer-events: none;
}

.toast {
    background: var(--color-surface-elevated);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-4) var(--spacing-5);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastSlideIn var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

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

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-primary);
}

.toast.success::before {
    background: var(--color-success);
}

.toast.error::before {
    background: var(--color-error);
}

.toast.warning::before {
    background: var(--color-warning);
}

.toast.info::before {
    background: var(--color-info);
}

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

.toast-title {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: var(--spacing-1);
    border-radius: var(--border-radius-sm);
    transition: all var(--duration-fast) var(--ease-out);
}

.toast-close:hover {
    color: var(--color-text-primary);
    background: var(--color-surface);
}

.toast-message {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

/* Progress Indicators */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--color-surface);
    border-radius: var(--border-radius-full);
    overflow: hidden;
    margin-top: var(--spacing-3);
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--border-radius-full);
    transition: width var(--duration-normal) var(--ease-out);
    animation: progressShimmer 2s infinite;
}

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

.progress-fill {
    background: linear-gradient(
        90deg,
        var(--color-primary) 25%,
        var(--color-primary-light) 50%,
        var(--color-primary) 75%
    );
    background-size: 200% 100%;
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    padding: var(--spacing-1) var(--spacing-3);
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-indicator.online {
    background: rgba(74, 222, 128, 0.1);
    color: var(--color-success);
    border: var(--border-width-thin) solid rgba(74, 222, 128, 0.3);
}

.status-indicator.offline {
    background: rgba(248, 113, 113, 0.1);
    color: var(--color-error);
    border: var(--border-width-thin) solid rgba(248, 113, 113, 0.3);
}

.status-indicator.pending {
    background: rgba(251, 191, 36, 0.1);
    color: var(--color-warning);
    border: var(--border-width-thin) solid rgba(251, 191, 36, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: statusPulse 2s infinite;
}

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

/* Responsive Feedback */
@media (max-width: 768px) {
    .toast-container {
        top: var(--spacing-4);
        right: var(--spacing-4);
        left: var(--spacing-4);
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
    
    .feedback-message {
        padding: var(--spacing-3) var(--spacing-4);
        font-size: var(--font-size-sm);
    }
}

/* ./components/responsive.css */
/* Responsive Design System */

/* Container Queries (when supported) */
@supports (container-type: inline-size) {
    .game-container {
        container-type: inline-size;
    }
    
    @container (max-width: 768px) {
        .game-stats {
            flex-direction: column;
        }
    }
}

/* Mobile-First Responsive Breakpoints */

/* Extra Small Devices (phones, 320px and up) */
@media (max-width: 480px) {
    :root {
        --matrix-cell-size: 1.8rem;
        --spacing-scale: 0.8;
    }
    
    body {
        padding: var(--spacing-2);
    }
    
    #app {
        padding: var(--spacing-3);
    }
    
    .menu-container,
    .lobby-container {
        padding: var(--spacing-6);
        height: calc(100vh - 24px);
    }
    
    #game-screen .game-container,
    .screen.active .game-container {
        padding: 0 !important;
        height: calc(100vh - 2px) !important;
    }
    
    h1 {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }
    
    .text-hero {
        font-size: clamp(2rem, 7vw, 3rem);
    }
    
    .btn {
        padding: var(--spacing-3) var(--spacing-6);
        font-size: var(--font-size-base);
    }
    
    .btn-lg {
        padding: var(--spacing-4) var(--spacing-8);
        font-size: var(--font-size-lg);
    }
    
    .game-matrix {
        padding: var(--spacing-2);
        gap: 1px;
    }
    
    .matrix-cell {
        font-size: 0.9rem;
    }
    
    .size-options {
        grid-template-columns: 1fr;
        gap: var(--spacing-3);
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: var(--spacing-6);
        margin: var(--spacing-3);
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
    .size-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat-item {
        min-width: 100px;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
    .game-container {
        gap: var(--spacing-5);
    }
    
    .game-stats {
        flex-wrap: nowrap;
    }
    
    .valid-keys {
        flex-direction: row;
    }
    
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199px) {
    #app {
        max-width: 1000px;
    }
    
    .menu-container,
    .lobby-container {
        padding: var(--spacing-10);
    }
    
    #game-screen .game-container,
    .screen.active .game-container {
        padding: 0 !important;
        height: calc(100vh - 2px) !important;
    }
    
    .options-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    #app {
        max-width: 1200px;
    }
    
    .menu-container,
    .lobby-container {
        padding: var(--spacing-12);
    }
    
    #game-screen .game-container,
    .screen.active .game-container {
        padding: 0 !important;
        height: calc(100vh - 2px) !important;
    }
    
    .matrix-cell {
        font-size: 1.3rem;
    }
    
    .game-matrix {
        --matrix-cell-size: 3rem;
    }
}

/* Ultra-wide Displays (1440px and up) */
@media (min-width: 1440px) {
    #app {
        max-width: 1400px;
    }
    
    .game-matrix {
        --matrix-cell-size: 3.5rem;
    }
    
    .matrix-cell {
        font-size: 1.4rem;
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 600px) {
    .menu-container,
    .lobby-container {
        padding: var(--spacing-4);
        height: calc(100vh - 16px);
    }
    
    #game-screen .game-container,
    .screen.active .game-container {
        padding: 0 !important;
        height: calc(100vh - 2px) !important;
        gap: var(--spacing-3);
    }
    
    header {
        margin-bottom: var(--spacing-4);
    }
    
    h1 {
        margin-bottom: var(--spacing-1);
    }
    
    .game-stats {
        padding: var(--spacing-3);
    }
    
    .game-matrix {
        --matrix-cell-size: 2.2rem;
        padding: var(--spacing-2);
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .menu-container,
    .lobby-container,
    .game-container {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .btn,
    .modal,
    .feedback-overlay,
    .toast-container {
        display: none !important;
    }
    
    .game-matrix {
        page-break-inside: avoid;
    }
}

/* High DPI Displays */
@media (min-resolution: 2dppx) {
    .matrix-cell {
        border-width: 0.5px;
    }
    
    .btn {
        border-width: 0.5px;
    }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .matrix-cell.current {
        animation: none;
    }
    
    .matrix-cell.bounty-target {
        animation: none;
    }
    
    .matrix-cell.valid-move {
        animation: none;
    }
}

/* Increased Contrast Preferences */
@media (prefers-contrast: high) {
    .matrix-cell {
        border-width: var(--border-width-medium);
        border-color: #000;
    }
    
    .btn {
        border: var(--border-width-medium) solid;
    }
    
    .modal-content {
        border: var(--border-width-thick) solid #000;
    }
}

/* Dark Color Scheme Preference Override */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background: var(--color-surface-elevated);
    }
    
    .final-stats {
        background: var(--color-surface);
    }
}

/* Focus Visibility for Keyboard Navigation */
@media (prefers-reduced-motion: no-preference) {
    .btn:focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 2px;
        animation: focusPulse 1s ease-in-out infinite;
    }
    
    @keyframes focusPulse {
        0%, 100% { outline-color: var(--color-primary); }
        50% { outline-color: var(--color-primary-light); }
    }
}
