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

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --error: #ef4444;
    --border: #2a2a2a;
    --hover: #2d2d2d;
    --transition: all 0.15s ease;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 1rem 2rem;;
    gap: 2rem;
}

.header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

#wpmDisplay {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 120px;
    text-align: center;
    box-shadow: var(--shadow);
}

#programmingLanguage {
    position: relative;
    width: 200px;
    user-select: none;
}

#selected {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

#selected::after {
    content: '▼';
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

#selected:hover {
    background: var(--hover);
    border-color: var(--accent);
}

#selected.active::after {
    transform: rotate(180deg);
}

#options {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 100;
    overflow: hidden;
}

#options.show {
    display: block;
    animation: fadeIn 0.15s ease;
}

.option {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.option:last-child {
    border-bottom: none;
}

.option:hover {
    background: var(--hover);
    color: var(--accent);
}

.option.selected {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

#textContainer {
    font-size: 1.4rem;
    max-width: 900px;
    width: 100%;
    line-height: 2;
    white-space: pre-wrap;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    position: relative;
    min-height: 200px;
    align-items: center;
    justify-content: center;
}

#textContainer:empty::before {
    content: 'Loading text...';
    color: var(--text-secondary);
    font-style: italic;
}

.line {
    display: block;
    margin-bottom: 0.3rem;
}

.correct {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border-radius: 2px;
}

.incorrect {
    color: var(--error);
    background: rgba(239, 68, 68, 0.15);
    border-radius: 2px;
}

.current {
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 2px;
    animation: pulse 1s infinite;
}

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

#inputField {
    opacity: 0;
    position: absolute;
    pointer-events: none;
    z-index: -1;
}

#hintsBox {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: absolute;
    display: none;
    max-height: 200px;
    overflow-y: auto;
    min-width: 200px;
}

.hint {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hint:last-child {
    border-bottom: none;
}

.hint:hover {
    background: var(--hover);
}

.hint.active {
    background: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

.btn:hover {
    background: var(--hover);
    border-color: var(--accent);
    transform: translateY(-1px);
}

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

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

.btn-primary:hover {
    background: var(--accent);
    filter: brightness(1.1);
    border-color: var(--accent);
}

.btn::before {
    content: '+';
    font-size: 1.1rem;
}

.btn-primary::before {
    content: '↻';
    font-size: 1.1rem;
}

/* Focus indicators */
body:focus-within #textContainer {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    body {
    padding: 1rem;
    gap: 1.5rem;
    }

    .header {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    }

    #wpmDisplay,
    #programmingLanguage {
    width: 100%;
    }

    #textContainer {
    font-size: 1.2rem;
    padding: 1.5rem;
    }

    .button-group {
    flex-direction: column;
    width: 100%;
    }

    .btn {
    justify-content: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
    opacity: 0;
    transform: translateY(-10px);
    }
    to {
    opacity: 1;
    transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
    opacity: 0;
    transform: translateY(20px);
    }
    to {
    opacity: 1;
    transform: translateY(0);
    }
}

body > * {
    animation: slideIn 0.3s ease;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

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