/* TypeHero - Advanced Design System */

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

:root {
    /* Sophisticated Dark Theme */
    --bg-primary: #0a0e1a;
    --bg-secondary: #141925;
    --bg-tertiary: #1e2433;
    
    /* Accent Colors - Neon Cyberpunk */
    --accent-primary: #00d4ff;
    --accent-secondary: #ff006e;
    --accent-tertiary: #ffb700;
    --accent-success: #00ff88;
    --accent-error: #ff3366;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a8b2d1;
    --text-dim: #64748b;
    
    /* Gradients */
    --gradient-hero: linear-gradient(135deg, #00d4ff 0%, #7b2ff7 50%, #ff006e 100%);
    --gradient-dark: linear-gradient(180deg, #0a0e1a 0%, #141925 100%);
    --gradient-glow: linear-gradient(135deg, rgba(0,212,255,0.1) 0%, rgba(123,47,247,0.1) 50%, rgba(255,0,110,0.1) 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-secondary);
    overflow-x: hidden;
    position: relative;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0,212,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,0,110,0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(123,47,247,0.1) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes backgroundShift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-20px, -20px) scale(1.1); }
    66% { transform: translate(20px, -10px) scale(0.95); }
}

/* Navbar with Glass Effect */
.navbar {
    background: rgba(20, 25, 37, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar:hover {
    background: rgba(20, 25, 37, 0.85);
    border-bottom-color: rgba(0, 212, 255, 0.3);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(30deg); }
}

.hero-icon {
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(0,212,255,0.5));
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px rgba(0,212,255,0.8));
    }
}

.nav-pills {
    display: flex;
    gap: 0.75rem;
}

.nav-pill {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: var(--text-secondary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-pill::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--gradient-hero);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.nav-pill:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

.nav-pill:hover::before {
    width: 300px;
    height: 300px;
}

.nav-pill.active {
    background: var(--gradient-hero);
    color: var(--text-primary);
    border: none;
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Hero Stats Bar - Futuristic Cards */
.hero-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-item {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
    transition: left 0.8s ease;
}

.stat-item:hover::before {
    left: 100%;
}

.stat-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.2);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

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

/* Mode Selection - Modern Cards */
.mode-selector {
    margin-bottom: 3rem;
}

.mode-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.mode-card {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-glow);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.mode-card:hover::before {
    opacity: 1;
}

.mode-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent-primary);
    box-shadow: 
        0 20px 40px rgba(0, 212, 255, 0.3),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
}

.mode-card.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 0, 110, 0.1));
    border-color: var(--accent-primary);
    transform: scale(1.05);
    box-shadow: 
        0 20px 40px rgba(0, 212, 255, 0.4),
        inset 0 0 30px rgba(0, 212, 255, 0.2);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px currentColor);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.mode-card .mode-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: none;
    -webkit-text-fill-color: var(--text-primary);
    text-transform: none;
    letter-spacing: normal;
}

.mode-desc {
    font-size: 0.875rem;
    color: var(--text-dim);
}

/* Typing Arena - Sleek Design */
.typing-arena {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 2rem;
    min-height: 450px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
}

.typing-arena::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.05) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

.typing-arena.active {
    border-color: var(--accent-primary);
    box-shadow: 
        0 0 50px rgba(0, 212, 255, 0.3),
        inset 0 0 50px rgba(0, 212, 255, 0.05);
}

.typing-arena.paused {
    filter: blur(2px);
    opacity: 0.5;
}

.arena-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.timer-display {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.live-stats {
    display: flex;
    gap: 2rem;
}

.live-stat {
    text-align: center;
}

.live-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.live-stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Words Display - No Input Bar */
#wordsDisplay {
    font-size: 1.875rem;
    line-height: 2.5;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    color: var(--text-dim);
    margin-bottom: 2rem;
    min-height: 250px;
    position: relative;
    z-index: 1;
}

.word {
    display: inline-block;
    margin: 0 0.4em;
    position: relative;
}

.letter {
    display: inline-block;
    transition: all 0.15s ease;
    position: relative;
}

.letter.correct {
    color: var(--accent-success);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.letter.incorrect {
    color: var(--accent-error);
    background: rgba(255, 51, 102, 0.2);
    border-radius: 0.25rem;
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
}

.letter.extra {
    color: var(--accent-error);
    opacity: 0.7;
}

.word.current {
    position: relative;
}

.word.current::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
    animation: borderGlow 1s ease-in-out infinite;
}

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

.word.completed {
    opacity: 0.4;
}

/* Typing Cursor */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1.5em;
    background: var(--accent-primary);
    margin: 0 2px;
    animation: blink 1s infinite;
    box-shadow: 0 0 10px var(--accent-primary);
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Power-ups - Futuristic Buttons */
.powerups {
    display: flex;
    gap: 1rem;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.powerup-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--text-secondary);
    border-radius: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.powerup-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--gradient-hero);
    opacity: 0.3;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.powerup-btn:hover::before {
    width: 300px;
    height: 300px;
}

.powerup-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.3);
}

/* Caps Lock Warning */
.caps-lock-warning {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--accent-error);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    animation: warningPulse 1s infinite;
    z-index: 10;
}

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

/* Results Modal - Glassmorphism */
.results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.results-modal.show {
    opacity: 1;
    pointer-events: all;
}

.results-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 3rem;
    border-radius: 2rem;
    text-align: center;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 212, 255, 0.3);
}

.results-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-item {
    background: var(--bg-primary);
    border: 1px solid rgba(0, 212, 255, 0.1);
    padding: 1.5rem;
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.2);
}

.result-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.result-value.points {
    color: var(--accent-success);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.try-again-btn {
    padding: 1.25rem 3rem;
    background: var(--gradient-hero);
    border: none;
    color: white;
    border-radius: 1rem;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.try-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 212, 255, 0.4);
}

/* Achievement Notifications */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: -400px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--accent-tertiary);
    color: var(--text-primary);
    padding: 1.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 40px rgba(255, 183, 0, 0.3);
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 10000;
}

.achievement-notification.show {
    right: 20px;
}

.achievement-notification .achievement-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(255, 183, 0, 0.5));
}

.achievement-notification .achievement-title {
    font-size: 0.875rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.achievement-notification .achievement-name {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--accent-tertiary);
}

.achievement-notification .achievement-points {
    font-size: 1rem;
    color: var(--accent-success);
}