:root {
    --bg-color: #050505;
    --panel-bg: rgba(20, 20, 20, 0.7);
    --accent-color: #00ffaa;
    --text-primary: #e0e0e0;
    --text-dim: #666;
    --error-color: #ff3366;
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --glow: 0 0 20px rgba(0, 255, 170, 0.3);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-display);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Effects */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.05;
    pointer-events: none;
    z-index: 10;
}

.glow-sphere {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 255, 170, 0.1) 0%, transparent 70%);
    filter: blur(80px);
    pointer-events: none;
    z-index: -1;
    animation: pulse 8s infinite alternate;
}

@keyframes pulse {
    from { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    to { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

/* Layout */
.app-container {
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 60px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-dim);
}

.logo span {
    color: var(--accent-color);
    text-shadow: var(--glow);
}

.session-stats {
    display: flex;
    gap: 40px;
}

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

.stat-item .label {
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 2px;
}

.stat-item .value {
    font-size: 1.8rem;
    font-weight: 300;
    font-family: var(--font-mono);
}

/* Game Area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.category-badges {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

.badge {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.badge.active {
    background: var(--accent-color);
    color: var(--bg-color);
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

.words-wrapper {
    position: relative;
}

.word-display {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    line-height: 1.5;
    height: 120px;
    overflow: hidden;
    color: var(--text-dim);
    user-select: none;
    mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
}

.word {
    display: inline-block;
    margin-right: 15px;
    white-space: nowrap;
    transition: transform 0.2s ease;
}

.word.current {
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent-color);
}

.char.correct {
    color: var(--accent-color);
}

.char.incorrect {
    color: var(--error-color);
    background: rgba(255, 51, 102, 0.1);
}

#type-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: default;
}

/* Footer */
.main-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.shortcuts {
    display: flex;
    gap: 20px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.4s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #111;
    padding: 60px;
    border-radius: 32px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    letter-spacing: -1px;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 50px;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-box .val {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-color);
    font-family: var(--font-mono);
}

.stat-box .lbl {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.primary-btn {
    background: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 16px 40px;
    border-radius: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow);
}
