﻿:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --primary: #818cf8;
    --secondary: #c084fc;
    --accent: #22d3ee;
    --success: #34d399;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --danger: #fb7185;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', 'Hiragino Kaku Gothic ProN', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
}

#app {
    width: 90%;
    max-width: 440px;
    background: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.screen { display: none; }
.screen.active { 
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

h1 { 
    font-size: 2rem; 
    margin: 0; 
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.description {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.6;
}

.mode-section {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.2rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s;
}
.mode-section:hover { transform: translateY(-2px); }

.mode-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 0.8rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.btn:active { transform: scale(0.96); }

.btn-secondary { background: var(--secondary); }

.btn-outline { 
    background: transparent; 
    color: var(--text-dim); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    width: fit-content;
    align-self: center;
    border-radius: 2rem;
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-main); }

#stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.8rem 1.2rem;
    border-radius: 1rem;
}

#timer { font-family: 'Monaco', monospace; font-size: 1.2rem; }
#timer.warning { color: var(--danger); animation: pulse 1s infinite; }

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

#question-container {
    padding: 1.5rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.1), rgba(192, 132, 252, 0.1));
    border: 2px solid rgba(129, 140, 248, 0.2);
}

#jp-word {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-main);
    display: block;
}

#word-display {
    font-size: 2.2rem;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.15rem;
}

#hint-text {
    color: rgba(255, 255, 255, 0);
    transition: color 3s ease-in;
}

#typing-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(129, 140, 248, 0.3);
    border-radius: 1rem;
    padding: 1rem;
    font-size: 1.5rem;
    color: var(--accent);
    text-align: center;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Inter', sans-serif;
    display: block;
    margin: 0 auto;
}

#typing-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15);
}

.result-score { 
    font-size: 5rem; 
    font-weight: 900; 
    color: var(--accent); 
    text-shadow: 0 0 20px rgba(34, 211, 238, 0.3);
    margin: 0.5rem 0;
}

.congrats { 
    animation: rainbow 2s infinite, bounce 0.6s infinite;
    font-size: 2.2rem;
    font-weight: 900;
    display: block;
}

#high-score-display {
    font-size: 0.85rem;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    width: fit-content;
    margin: 0 auto;
}

#confetti-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 100;
}

@keyframes rainbow {
    0% { color: #f87171; }
    33% { color: #60a5fa; }
    66% { color: #4ade80; }
    100% { color: #f87171; }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}