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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'Open Sans', sans-serif;
    color: #fff;
}

.hidden { display: none !important; }

/* --- Start screen --- */
.sendmessage {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 26, 46, 0.97);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.sendmessage h1 { font-size: 32px; margin-bottom: 6px; }
.subtitle { color: #aaa; margin-bottom: 20px; font-size: 15px; }
.difficulty-buttons { display: flex; gap: 12px; }
.difficulty-buttons button {
    padding: 14px 32px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Open Sans', sans-serif;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}
.difficulty-buttons button:hover,
.difficulty-buttons button:active { background: rgba(255,255,255,0.18); }

/* --- Game area --- */
#game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    height: 100%;
}

#stats-bar {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}
.stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.stat-value {
    font-size: 28px;
    font-weight: bold;
}
#wpm-display { color: #4ade80; }
#accuracy-display { color: #60a5fa; }
#timer-display { color: #fbbf24; }
#score-display { color: #f472b6; }

/* --- Text display --- */
#text-container {
    width: 100%;
    max-width: 700px;
    min-height: 140px;
    max-height: 200px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    overflow: hidden;
    line-height: 1.8;
    position: relative;
}

#text-display {
    font-family: 'Fira Mono', monospace;
    font-size: 20px;
    letter-spacing: 0.5px;
    word-wrap: break-word;
    user-select: none;
}

#text-display .char {
    transition: color 0.05s;
}
#text-display .char.correct { color: #4ade80; }
#text-display .char.incorrect { color: #ef4444; background: rgba(239,68,68,0.15); border-radius: 2px; }
#text-display .char.current { border-bottom: 2px solid #fbbf24; }
#text-display .char.pending { color: rgba(255,255,255,0.35); }

/* --- Input --- */
#input-field {
    width: 100%;
    max-width: 700px;
    padding: 14px 20px;
    font-size: 20px;
    font-family: 'Fira Mono', monospace;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}
#input-field:focus {
    border-color: #4ade80;
}

#keyboard-hint {
    margin-top: 12px;
    color: #666;
    font-size: 13px;
}

/* --- Game over --- */
#game-over-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 26, 46, 0.94);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    cursor: pointer;
}
.game-over-text {
    font-size: 36px;
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(251,191,36,0.4);
}
.game-over-stats {
    font-size: 18px;
    color: #e0e0e0;
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.8;
}
.game-over-score {
    font-size: 22px;
    color: #4ade80;
    font-weight: bold;
    margin-bottom: 20px;
}
.game-over-hint {
    font-size: 15px;
    color: #aaa;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@media (max-width: 500px) {
    #text-display { font-size: 16px; }
    #input-field { font-size: 16px; }
    .stat-value { font-size: 22px; }
    #text-container { padding: 14px 16px; }
    .difficulty-buttons button { padding: 12px 22px; font-size: 16px; }
}
