/* === CSS Custom Properties === */
:root {
    /* Colors */
    --primary-bg: #0a0b0f;
    --secondary-bg: #1a1d24;
    --surface-bg: #252a34;
    --surface-elevated: #2d3340;
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-tertiary: #f59e0b;
    --text-primary: #ffffff;
    --text-secondary: #b4bcd0;
    --text-muted: #6b7280;
    --border-color: #374151;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    --gradient-surface: linear-gradient(145deg, var(--surface-bg) 0%, var(--surface-elevated) 100%);
    --gradient-key: linear-gradient(145deg, #4a5568 0%, #2d3748 100%);
    --gradient-key-hover: linear-gradient(145deg, #5a6578 0%, #3d4758 100%);
    --gradient-key-active: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    --shadow-glow-secondary: 0 0 20px rgba(124, 58, 237, 0.3);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease-out;
    --transition-normal: 0.3s ease-out;
    --transition-slow: 0.5s ease-out;
    --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* === Global Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* === Background Elements === */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    top: 60%;
    right: 10%;
    animation-delay: -7s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, var(--accent-tertiary) 0%, transparent 70%);
    bottom: 20%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* === Loading Screen === */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

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

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

.loading-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* === Header === */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    background: rgba(10, 11, 15, 0.8);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-icon {
    font-size: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0;
}

.logo-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.header-controls {
    display: flex;
    gap: var(--space-sm);
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
    transform: translateY(-1px);
}

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

/* === Search Bar === */
.search-bar {
    position: sticky;
    top: 73px;
    z-index: 99;
    background: rgba(26, 29, 36, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.search-bar.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    margin-bottom: var(--space-md);
}

.search-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
}

#search-input {
    width: 100%;
    padding: var(--space-md) var(--space-xl) var(--space-md) 3rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.search-clear {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.search-clear:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
}

.search-filters {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--gradient-primary);
    color: var(--primary-bg);
    border-color: transparent;
}

/* === Main Content === */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

.keyboard-container {
    background: rgba(37, 42, 52, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.keyboard-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-primary);
    opacity: 0.5;
}

/* === Stats Bar === */
.stats-bar {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
    padding: var(--space-lg);
    background: var(--surface-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Keyboard Layout === */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-2xl);
}

.keyboard-row {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.key {
    background: var(--gradient-key);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom: 3px solid #1a202c;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    white-space: pre-line;
    position: relative;
    overflow: hidden;
}

.key::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--transition-slow);
}

.key:hover {
    background: var(--gradient-key-hover);
    transform: translateY(-2px);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-md);
}

.key:hover::before {
    left: 100%;
}

.key:active, .key.pressed {
    background: var(--gradient-key-active);
    transform: translateY(1px);
    border-bottom-width: 1px;
    box-shadow: none;
}

/* Special width keys */
.key-backspace { width: 105px; }
.key-tab { width: 80px; }
.key-backslash { width: 80px; }
.key-caps { width: 92.5px; }
.key-enter { width: 117.5px; }
.key-shift-left { width: 117.5px; }
.key-shift-right { width: 80px; }
.key-ctrl, .key-win, .key-alt, .key-fn { width: 67.5px; }
.key-space { width: 272.5px; font-size: 0.75em; }

/* Spacers */
.key-spacer { width: 25px; visibility: hidden; }
.key-spacer.small { width: 12.5px; }

.key-backspace, .key-caps, .key-enter, .key-shift-left, .key-shift-right {
    font-size: 0.75em;
    white-space: normal;
}

/* === Key Highlighting === */
.key.key-highlighted, .mouse-button.key-highlighted {
    background: var(--gradient-primary);
    color: var(--primary-bg);
    border-color: var(--accent-primary);
    border-bottom-color: #0099cc;
    transform: scale(1.05) translateY(-3px);
    box-shadow: var(--shadow-glow);
    z-index: 10;
    font-weight: 600;
}

.key.key-modifier-highlighted, .mouse-button.key-modifier-highlighted {
    background: linear-gradient(145deg, var(--accent-secondary) 0%, #5b21b6 100%);
    color: var(--text-primary);
    border-color: var(--accent-secondary);
    border-bottom-color: #5b21b6;
    transform: scale(1.02) translateY(-2px);
    box-shadow: var(--shadow-glow-secondary);
    z-index: 9;
    font-weight: 600;
}

/* === Mouse Representation === */
.mouse-representation-area {
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-color);
}

.mouse-representation-area h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mouse-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    background: var(--surface-bg);
    padding: var(--space-xl);
    border-radius: var(--radius-xl);
    width: fit-content;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.mouse-button {
    background: var(--gradient-key);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom: 3px solid #1a202c;
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 80px;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.mouse-button:hover {
    background: var(--gradient-key-hover);
    transform: translateY(-2px);
    border-bottom-width: 4px;
    box-shadow: var(--shadow-md);
}

.mouse-label {
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

.mouse-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* === Side Panel === */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: rgba(37, 42, 52, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform var(--transition-bounce);
    visibility: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.side-panel.active {
    transform: translateX(0);
    visibility: visible;
}

.side-panel-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(45, 51, 64, 0.8);
}

.side-panel-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.side-panel-controls {
    display: flex;
    gap: var(--space-sm);
}

.panel-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.panel-btn:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
}

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

.side-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-lg);
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.875rem;
    line-height: 1.6;
}

/* === Hotkey Entries === */
.hotkey-entry {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.hotkey-entry::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    transition: left var(--transition-slow);
}

.hotkey-entry:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    background: var(--surface-elevated);
    border-left-color: var(--accent-secondary);
}

.hotkey-entry:hover::before {
    left: 100%;
}

.hotkey-entry.active-hotkey-display {
    border-left-color: var(--accent-secondary);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-lg);
}

.hotkey-entry h3 {
    margin: 0 0 var(--space-sm) 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.hotkey-combo {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    word-break: break-word;
}

.key-token {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 500;
    color: var(--accent-primary);
    margin: 2px;
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.key-separator {
    color: var(--text-muted);
    margin: 0 var(--space-xs);
    display: inline-block;
}

.key-description {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
    margin-left: var(--space-sm);
    display: inline-block;
}

/* === Mobile Menu Toggle === */
.mobile-menu-toggle {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: var(--primary-bg);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xl);
    z-index: 999;
    transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-elevated);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    max-height: 60vh;
}

.help-section {
    margin-bottom: var(--space-xl);
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.shortcut-item kbd {
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent-primary);
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    padding: var(--space-sm) 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: var(--space-lg);
}

.help-section li::before {
    content: '•';
    color: var(--accent-primary);
    position: absolute;
    left: 0;
}

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--transition-normal);
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

/* === Overlay === */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-bg);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
    border: 2px solid var(--surface-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === Responsive Design === */
@media (max-width: 1200px) {
    .side-panel {
        width: 350px;
    }
}

@media (max-width: 900px) {
    .header-content {
        padding: var(--space-md);
    }
    
    .logo-text h1 {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: var(--space-lg) var(--space-md);
    }
    
    .keyboard-container {
        padding: var(--space-lg);
    }
    
    .stats-bar {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
    
    .key {
        min-width: 38px;
        height: 38px;
        font-size: 0.75rem;
        border-bottom-width: 2px;
    }
    
    .key:hover {
        border-bottom-width: 3px;
    }
    
    .key:active, .key.pressed {
        border-bottom-width: 1px;
    }
    
    /* Adjust special key widths for mobile */
    .key-backspace { width: 80px; }
    .key-tab { width: 60px; }
    .key-backslash { width: 60px; }
    .key-caps { width: 70px; }
    .key-enter { width: 90px; }
    .key-shift-left { width: 90px; }
    .key-shift-right { width: 60px; }
    .key-ctrl, .key-win, .key-alt, .key-fn { width: 50px; }
    .key-space { width: 200px; font-size: 0.65em; }
    
    .key-spacer { width: 18px; }
    .key-spacer.small { width: 9px; }
    
    .key-backspace, .key-caps, .key-enter, .key-shift-left, .key-shift-right {
        font-size: 0.65em;
    }
    
    .mouse-buttons {
        width: 100%;
        max-width: 300px;
        padding: var(--space-lg);
    }
    
    .mouse-button {
        min-width: 70px;
        padding: var(--space-md);
    }
    
    .side-panel {
        width: 100%;
        transform: translateY(100%);
    }
    
    .side-panel.active {
        transform: translateY(0);
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .search-bar {
        padding: var(--space-md);
    }
    
    .search-filters {
        gap: var(--space-xs);
    }
    
    .filter-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
    
    .keyboard-container {
        padding: var(--space-md);
    }
    
    .key {
        min-width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }
    
    /* Further adjust special key widths for small mobile */
    .key-backspace { width: 65px; }
    .key-tab { width: 50px; }
    .key-backslash { width: 50px; }
    .key-caps { width: 60px; }
    .key-enter { width: 75px; }
    .key-shift-left { width: 75px; }
    .key-shift-right { width: 50px; }
    .key-ctrl, .key-win, .key-alt, .key-fn { width: 42px; }
    .key-space { width: 160px; font-size: 0.6em; }
    
    .key-spacer { width: 15px; }
    .key-spacer.small { width: 8px; }
    
    .mouse-buttons {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .mouse-button {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
        margin: var(--space-md);
    }
    
    .toast-container {
        top: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
    }
    
    .toast {
        max-width: none;
    }
}

/* === Print Styles === */
@media print {
    .background-elements,
    .loading-screen,
    .app-header,
    .search-bar,
    .side-panel,
    .mobile-menu-toggle,
    .modal,
    .overlay,
    .toast-container {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .keyboard-container {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
    }
    
    .key {
        background: #f5f5f5;
        border: 1px solid #ccc;
        color: black;
    }
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .gradient-orb {
        animation: none;
    }
}

@media (prefers-color-scheme: light) {
    /* Light theme variables could be added here if needed */
}

/* === Focus Styles === */
.key:focus,
.control-btn:focus,
.panel-btn:focus,
.filter-btn:focus,
.mouse-button:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

#search-input:focus {
    outline: none; /* Custom focus style already applied */
}

/* === High Contrast Mode === */
@media (prefers-contrast: high) {
    :root {
        --border-color: #ffffff;
        --text-secondary: #ffffff;
        --text-muted: #cccccc;
    }
}

