/* Modern CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    zoom: 0.75;
}

/* CSS Custom Properties (Variables) */
:root {
    /* Light Theme Colors */
    --bg-primary-light: #ffffff;
    --bg-secondary-light: #f8fafc;
    --bg-tertiary-light: #f1f5f9;
    --text-primary-light: #1e293b;
    --text-secondary-light: #475569;
    --border-light: #e2e8f0;
    --accent-light: #3b82f6;
    --success-light: #10b981;
    --error-light: #ef4444;
    --warning-light: #f59e0b;
    
    /* Dark Theme Colors */
    --bg-primary-dark: #0f172a;
    --bg-secondary-dark: #1e293b;
    --bg-tertiary-dark: #334155;
    --text-primary-dark: #f8fafc;
    --text-secondary-dark: #cbd5e1;
    --border-dark: #475569;
    --accent-dark: #60a5fa;
    --success-dark: #34d399;
    --error-dark: #f87171;
    --warning-dark: #fbbf24;
    
    /* Shared Variables */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    --border-radius: 12px;
    --border-radius-sm: 6px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme Classes */
.theme-light {
    --bg-primary: var(--bg-primary-light);
    --bg-secondary: var(--bg-secondary-light);
    --bg-tertiary: var(--bg-tertiary-light);
    --text-primary: var(--text-primary-light);
    --text-secondary: var(--text-secondary-light);
    --border-color: var(--border-light);
    --accent-color: var(--accent-light);
    --success-color: var(--success-light);
    --error-color: var(--error-light);
    --warning-color: var(--warning-light);
}

.theme-dark {
    --bg-primary: var(--bg-primary-dark);
    --bg-secondary: var(--bg-secondary-dark);
    --bg-tertiary: var(--bg-tertiary-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --border-color: var(--border-dark);
    --accent-color: var(--accent-dark);
    --success-color: var(--success-dark);
    --error-color: var(--error-dark);
    --warning-color: var(--warning-dark);
}

/* Base Styles */
body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header Styles */
.header {
    background: rgba(var(--bg-secondary), 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.25rem;
}
.logo a {
    text-decoration: none;
}


.tagline {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--accent-color);
    color: white;
    transform: translateY(-1px);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.control-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.05);
}

/* Main Layout */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 120px);
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Keyboard Section */
.keyboard-section {
   
    border-radius: var(--border-radius-lg);
    padding: 2rem;

}

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

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.keyboard-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.control-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    min-width: 120px;
}

.size-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.size-control input[type="range"] {
    width: 80px;
}

/* Virtual Keyboard */
.keyboard-container {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--border-color);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transform-origin: center;
    transition: var(--transition-slow);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}

.key {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-tertiary));
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 40px;
    min-width: 40px;
    box-shadow: var(--shadow-sm);
}

.key:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--accent-color);
}

.key.active {
    background: var(--success-color);
    color: white;
    transform: translateY(-1px) scale(0.95);
    box-shadow: var(--shadow-lg);
    animation: keyPress 0.1s ease-out;
}

.key.failed {
    background: var(--error-color);
    color: white;
    animation: keyShake 0.5s ease-in-out;
}

.key.untested {
    opacity: 0.6;
}

/* Key size variants */
.key.space { min-width: 240px; }
.key.enter { min-width: 80px; }
.key.shift { min-width: 100px; }
.key.ctrl { min-width: 60px; }
.key.alt { min-width: 50px; }
.key.tab { min-width: 70px; }
.key.caps { min-width: 80px; }
.key.backspace { min-width: 80px; }

/* Animations */
@keyframes keyPress {
    0% { transform: translateY(-1px) scale(1); }
    50% { transform: translateY(-1px) scale(0.9); }
    100% { transform: translateY(-1px) scale(0.95); }
}

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

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

/* Keyboard Stats */
.keyboard-stats {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

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

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

.stat-value.green { color: var(--success-color); }
.stat-value.red { color: var(--error-color); }

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);

}

.sidebar-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Key History */
.key-history {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    background: var(--bg-primary);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.history-empty {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Multi-Key Display */
.multi-key-display {
    min-height: 80px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
}

.instruction {
    color: var(--text-secondary);
    font-style: italic;
}

.active-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.active-key {
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* Ghosting Results */
.ghosting-results {
    font-size: 0.875rem;
}

.ghosting-result {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-mono);
}

.ghosting-result.success {
    background: rgba(var(--success-color), 0.1);
    color: var(--success-color);
    border-left: 3px solid var(--success-color);
}

.ghosting-result.warning {
    background: rgba(var(--warning-color), 0.1);
    color: var(--warning-color);
    border-left: 3px solid var(--warning-color);
}

/* AI Insights */
.ai-insights {
    min-height: 120px;
}

.insight-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.insight-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.insight-text {
    font-size: 0.875rem;
    line-height: 1.5;
}

.insight-empty {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* System Info */
.system-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.privacy-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.privacy-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Export Section */
.export-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--accent-color) 85%, black);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    margin-top: 15px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}




/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-section p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.footer-section ul {
    list-style: none;
}

.footer-section li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.2s;
}

.footer-section li a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-bottom a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.footer-bottom a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}




/* Accessibility */
.high-contrast {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #333333;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #666666;
    --accent-color: #00ff00;
}

.large-keys .key {
    min-height: 60px;
    min-width: 60px;
    font-size: 1.125rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr 300px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        order: 1;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .main-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .keyboard-controls {
        justify-content: center;
    }
    
    .keyboard-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-item {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .analysis-grid,
    .games-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .export-section {
        flex-direction: column;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .keyboard-section {
        padding: 1rem;
    }
    
    .keyboard-container {
        padding: 1rem;
    }
    
    .key {
        min-height: 35px;
        min-width: 35px;
        font-size: 0.75rem;
    }
    
    .key.space { min-width: 180px; }
    .key.enter { min-width: 60px; }
    .key.shift { min-width: 80px; }
    .key.ctrl { min-width: 45px; }
    .key.alt { min-width: 40px; }
    .key.tab { min-width: 55px; }
    .key.caps { min-width: 60px; }
    .key.backspace { min-width: 60px; }
}

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .footer,
    .loading-overlay {
        display: none;
    }
    
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .keyboard-section {
        box-shadow: none;
        border: 2px solid #000;
    }
}








/* Language Switcher Styling */
.language-switcher-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 100%;
    margin: 2rem auto;
}

.language-switcher-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.language-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    font-size: 1rem;
}

.language-switcher-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.language-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}

.language-btn:hover {
    background: color-mix(in srgb, var(--bg-tertiary) 85%, white);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.language-btn.active {
    background: var(--success-color);
    color: white;
    font-weight: 600;
    border-color: var(--success-color);
    position: relative;
    padding-right: 2.5rem; /* Make space for the checkmark */
}

.language-btn.active:hover {
    background: color-mix(in srgb, var(--success-color) 85%, black);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.language-btn .flag-icon {
    margin-right: 0.5rem;
    font-size: 1.25rem;
}

.language-btn.active::after {
    content: '✓';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
}

/* Make sure footer does not overlap */
.main {
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .language-switcher-container {
        padding: 1rem;
        text-align: center;
    }

    .language-switcher-header {
        justify-content: center;
    }
    
    .language-label {
        margin-bottom: 0.5rem;
    }

    .language-switcher-grid {
        justify-content: center;
    }
}























/* New Content Section */
.content-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    margin-top: 2rem;
}

.content-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.content-section h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.content-section p,
.content-section ul,
.content-section li {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.content-section ul,
.content-section ol {
    padding-left: 20px;
    margin-bottom: 1rem;
}

.content-section hr {
    margin: 2rem 0;
    border-color: var(--border-color);
    opacity: 0.5;
}

.content-section code {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}









