:root {
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --bg-color: #ffffff;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --card-bg: #f9fafb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #3b82f6, #1d4ed8);
    --gradient-success: linear-gradient(135deg, #10b981, #059669);
}

[data-theme="dark"] {
    --bg-color: #111827;
    --text-color: #f9fafb;
    --border-color: #374151;
    --card-bg: #1f2937;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .navbar {
    background: linear-gradient(135deg, #1f2937 0%, #374151 50%, #4b5563 100%);
}

[data-theme="dark"] .nav-menu {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .nav-menu a {
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .nav-menu a:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .theme-btn {
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .nav-logo .logo-text {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .nav-menu .kids-link {
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container.with-sidebar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    align-items: start;
}

.container.full-width {
    display: block;
}

/* Header Styles */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    backdrop-filter: blur(20px);
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    overflow: hidden;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 110px;
    gap: 30px;
}

.nav-logo .logo-text-link {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 30px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-logo .logo-text {
    font-size: 28px;
    font-weight: 900;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    white-space: nowrap;
    text-transform: uppercase;
}

.nav-logo .logo-text-link:hover .logo-text {
    transform: scale(1.05);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.nav-logo h1 {
    color: var(--primary-color);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    gap: 8px;
    position: relative;
    z-index: 1001;
}

.nav-menu a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 30px;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
}

.nav-menu .kids-link {
    background: rgba(255, 107, 107, 0.9) !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 16px !important;
    padding: 14px 22px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5) !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    letter-spacing: 0.5px !important;
    backdrop-filter: blur(10px) !important;
    position: relative !important;
    z-index: 1002 !important;
}

.nav-menu .kids-link:hover {
    background: rgba(255, 107, 107, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    margin: 3px 0;
    transition: 0.3s;
}

/* Ad Spaces */
.ad-space {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 20px 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.header-ad {
    max-width: 1200px;
    margin: 20px auto;
    position: relative;
    z-index: 1;
}

.sidebar-ad {
    min-height: 250px;
    margin-bottom: 30px;
}

.result-ad {
    margin-top: 30px;
    min-height: 150px;
}

.ad-placeholder {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    padding: 30px 0;
}

.hero {
    text-align: center;
    padding: 50px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.25);
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.2) 0%, transparent 50%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

.hero h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 800;
    position: relative;
    z-index: 1;
    background: linear-gradient(45deg, #fff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.95;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
    line-height: 1.5;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    padding: 20px 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 120px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 24px rgba(0,0,0,0.1);
}

.stat-item:hover {
    transform: translateY(-8px) scale(1.05);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Test Container */
.test-container {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 24px;
    padding: 50px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.8);
    min-height: 750px;
    position: relative;
    overflow: visible;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.test-container:hover {
    box-shadow: 
        0 35px 70px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.user-input-section {
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 40px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.user-input-section.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.typing-test {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 30px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.typing-test.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results {
    position: relative;
    padding: 40px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(20px);
    margin-bottom: 60px;
    z-index: 10;
}

.results.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: slideUp 0.6s ease-out;
}

.results.active ~ .typing-test {
    display: none;
}

.test-container:has(.results.active) .typing-test {
    display: none;
}

.test-container:has(.results.active) {
    min-height: auto;
    height: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-input-section h2 {
    margin-bottom: 40px;
    color: #1e293b;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.input-group {
    margin-bottom: 35px;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #374151;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

#user-name {
    width: 100%;
    max-width: 400px;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1.1rem;
    background: linear-gradient(145deg, #ffffff 0%, #f9fafb 100%);
    color: #1f2937;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

#user-name:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

#user-name::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.setting-group {
    text-align: left;
    position: relative;
}

.setting-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #374151;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#test-duration, #difficulty-level {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1.1rem;
    background: linear-gradient(145deg, #ffffff 0%, #f9fafb 100%);
    color: #1f2937;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23667eea" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
}

#test-duration:focus, #difficulty-level:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

#test-duration:hover, #difficulty-level:hover {
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.difficulty-preview {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.difficulty-preview h4 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 1rem;
}

.difficulty-preview p {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin: 0;
}

.kids-link {
    background: var(--gradient-success);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Typing Test */
.test-header {
    flex-shrink: 0;
    padding: 25px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.timer {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    line-height: 1;
    margin-bottom: 5px;
}

.timer-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.live-stats {
    display: flex;
    gap: 20px;
}

.stat-box {
    text-align: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    margin-bottom: 3px;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

.text-display {
    flex: 1;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid rgba(102, 126, 234, 0.1);
    border-radius: 16px;
    padding: 30px;
    font-size: 1.3rem;
    line-height: 1.8;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #1f2937;
    user-select: none;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 300px;
    min-height: 250px;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

.text-display:hover {
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.text-display::-webkit-scrollbar {
    width: 6px;
}

.text-display::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
}

.text-display::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.text-display::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.text-display .newline {
    display: block;
    height: 2em;
    width: 100%;
}

.text-display .correct {
    color: #059669;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.1) 100%);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.text-display .incorrect {
    color: #dc2626;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
    animation: shake 0.3s ease-in-out;
}

.text-display .current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.4),
        0 0 0 2px rgba(102, 126, 234, 0.2);
    animation: pulse 1.5s infinite;
    transform: scale(1.05);
}

.char {
    padding: 2px 1px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.char.correct {
    color: #059669;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.1) 100%);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}

.char.incorrect {
    color: #dc2626;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
    animation: shake 0.3s ease-in-out;
}

.char.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.4),
        0 0 0 2px rgba(102, 126, 234, 0.2);
    animation: pulse 1.5s infinite;
    transform: scale(1.05);
}

.char.newline {
    display: none;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1.05);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.08);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.typing-input-container {
    flex-shrink: 0;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#typing-input {
    width: 100%;
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    background: rgba(102, 126, 234, 0.05);
    color: #1f2937;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    min-height: 80px;
    line-height: 1.6;
}

#typing-input:focus {
    background: rgba(102, 126, 234, 0.1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

#typing-input::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.test-controls {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    text-align: center;
}

/* Results */
.results-header {
    text-align: center;
    margin-bottom: 40px;
}

.results-header h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.results-subtitle {
    color: #6b7280;
    font-size: 1.1rem;
    font-weight: 500;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid rgba(102, 126, 234, 0.1);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 15px 30px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.stat-card.primary {
    background: var(--gradient-primary);
    color: white;
}

.stat-card.primary .stat-icon,
.stat-card.primary h3,
.stat-card.primary p {
    color: white;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 15px;
    display: block;
}

h3 {
    color: #007bff;
}

.results h3, .stat-card h3 {
    color: #FFD700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 800;
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    line-height: 1;
}

.stat-card p {
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1rem;
}

.stat-change {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--success-color);
    color: white;
    display: inline-block;
}

.performance-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.chart-container h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.chart-container canvas {
    max-height: 300px;
}

.performance-summary {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 120px;
    min-height: 200px;
    position: relative;
    z-index: 2;
}

.performance-summary h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.summary-table th,
.summary-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.summary-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--primary-color);
}

.summary-table td {
    color: var(--text-color);
}

.summary-table tr:hover {
    background: var(--bg-color);
}

.certificate-section {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
}

.certificate-section h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.result-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 100px;
    position: relative;
    z-index: 2;
}

/* Buttons */
.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-large {
    padding: 18px 40px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-primary, .btn-large {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    border: 2px solid transparent;
    box-shadow: 
        0 10px 30px rgba(102, 126, 234, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover, .btn-large:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 20px 40px rgba(102, 126, 234, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:active, .btn-large:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.btn-outline {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    color: #667eea;
    border: 2px solid #667eea;
    box-shadow: 
        0 8px 25px rgba(102, 126, 234, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.btn-outline:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 20px 40px rgba(102, 126, 234, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-outline:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.start-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 10px 30px rgba(102, 126, 234, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.start-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 20px 40px rgba(102, 126, 234, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.start-btn:hover::before {
    left: 100%;
}

.start-btn:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.btn-secondary {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    color: #667eea;
    border: 2px solid #667eea;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 20px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 15px 30px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover::before {
    left: 100%;
}

.btn-secondary:active {
    transform: translateY(-1px) scale(1.01);
    transition: all 0.1s ease;
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 80px 40px;
    background: var(--gradient-primary);
    border-radius: 16px;
    margin: 60px 0 120px 0;
    color: white;
    position: relative;
    z-index: 1;
    clear: both;
    width: 100%;
    box-sizing: border-box;
    min-height: 300px;
}

.cta-section h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: white;
}

.cta-section p {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
    margin-top: 30px;
}

.cta-buttons .btn-primary {
    background: white;
    color: var(--primary-color);
}

.cta-buttons .btn-secondary {
    border-color: white;
    color: white;
}

.cta-buttons .btn-secondary:hover {
    background: white;
    color: var(--primary-color);
}

/* Sidebar */
.sidebar {
    padding: 30px 0;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.tips-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    height: fit-content;
    box-shadow: var(--shadow);
}

.tips-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-icon {
    font-size: 1.5rem;
}

.tips-section ul {
    list-style: none;
    margin-bottom: 30px;
}

.tips-section li {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    padding-left: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transition: color 0.3s ease;
}

.tips-section li:hover {
    color: var(--primary-color);
}

.tips-section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    margin-top: 2px;
    flex-shrink: 0;
}

.tips-section li:last-child {
    border-bottom: none;
}

.tip-icon {
    color: var(--primary-color);
    margin-top: 2px;
    flex-shrink: 0;
}

/* Leaderboard */
.leaderboard {
    margin-top: 30px;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    font-weight: 700;
    color: var(--primary-color);
    min-width: 30px;
}

.leaderboard-name {
    flex: 1;
    margin-left: 15px;
    color: var(--text-color);
}

.leaderboard-score {
    font-weight: 600;
    color: var(--success-color);
}

.leaderboard-item.top-3 {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    border: none;
}

.leaderboard-item.top-3 .leaderboard-rank {
    background: var(--gradient-primary);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* Footer */
footer {
    background: var(--card-bg);
    padding: 60px 0 30px;
    margin-top: 120px;
    border-top: 1px solid var(--border-color);
    position: relative;
    clear: both;
    z-index: 0;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3, .footer-section h4 {
    margin-bottom: 25px;
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-section p,
.footer-section a {
    color: var(--secondary-color);
    text-decoration: none;
    line-height: 1.7;
    transition: color 0.3s ease;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section li {
    margin-bottom: 12px;
}

.footer-section a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.social-links a:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: var(--shadow-lg);
}

.footer-bottom {
    text-align: center;
    padding: 30px 20px 20px;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
}

.footer-bottom p {
    margin-bottom: 10px;
}

.footer-links-inline {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.footer-links-inline a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer-links-inline a:hover {
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .performance-charts {
        grid-template-columns: 1fr;
    }
    
    .container.with-sidebar {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar {
        order: -1;
        margin-bottom: 30px;
        min-height: auto;
    }
    
    .cta-section {
        margin: 40px 0 60px 0;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 15px;
    }
    
    .nav-menu {
        display: none;
    }
    
    .hamburger {
        display: flex;
    }
    
    .hero {
        padding: 60px 0;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero p {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .test-container {
        padding: 20px;
    }
    
    .test-info {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .live-stats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
    
    .performance-charts {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cta-section {
        padding: 40px 20px;
        margin: 30px 0;
    }
    
    .cta-section h2 {
        font-size: 1.8rem;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        max-width: 300px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    
    .footer-links-inline {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        gap: 15px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .test-container {
        padding: 15px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .btn-large {
        padding: 15px 30px;
        font-size: 1.1rem;
    }
    
    .live-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-box {
        padding: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card h3 {
        font-size: 2rem;
    }
    
    .cta-section {
        padding: 30px 15px;
    }
    
    .cta-section h2 {
        font-size: 1.5rem;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    .navbar, .sidebar, .cta-section, footer {
        display: none;
    }
    
    .container {
        max-width: none;
        padding: 0;
        grid-template-columns: 1fr;
    }
    
    .test-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --success-color: #006400;
        --error-color: #8B0000;
        --border-color: #000000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}