/* Pro Typing Test Stylesheet */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #0f172a;
    --bg-panel: #1e293b;
    --border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s ease;
}

[data-theme="light"] {
    --bg: #f8fafc;
    --bg-panel: #ffffff;
    --border: rgba(15, 23, 42, 0.08);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.05);
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding-top: 70px;
    min-height: 100vh;
}

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

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.75rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Dashboard counters */
.dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-val {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selection controls bar */
.controls-bar {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.btn-group {
    display: flex;
    gap: 0.75rem;
}

.btn-toggle {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.btn-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.select-typing {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* Typing Arena */
.typing-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    box-shadow: var(--shadow);
    position: relative;
    margin-bottom: 2rem;
}

.text-passage {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 1.35rem;
    line-height: 1.8;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    word-break: break-word;
    user-select: none;
    max-height: 180px;
    overflow-y: hidden;
    position: relative;
}

/* Character Highlights */
.char {
    position: relative;
}

.char-correct {
    color: #22c55e;
}

.char-incorrect {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border-radius: 2px;
}

.char-current {
    color: var(--text-main);
    border-bottom: 2px solid var(--primary);
    animation: cursor-blink 0.8s infinite;
}

@keyframes cursor-blink {
    50% { border-color: transparent; }
}

/* Hidden input that captures keystrokes */
.hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    z-index: -100;
}

.focus-notice {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.focus-notice.active {
    opacity: 1;
    pointer-events: auto;
}

/* Stats Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
}

.stat-item-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-item-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.btn-restart {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-restart:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}
