body {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Arial', sans-serif;
    background-color: #2c3e50; /* ダーク背景 */
    color: white;
    padding-top: 20px;
}

#game-container {
    width: 90%;
    max-width: 700px;
    padding: 30px;
    background-color: #34495e;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    text-align: center;
}

/* --- ステータスエリア --- */
#status-area {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
}

/* --- HPバー --- */
.health-bar-container {
    margin: 5px auto;
    width: 100%;
    height: 25px;
    background-color: #555;
    border: 1px solid #777;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.health-bar {
    height: 100%;
    background-color: #e74c3c; /* 敵のHPは赤 */
    width: 100%;
    transition: width 0.3s ease-out, background-color 0.3s;
}

.health-bar.player {
    background-color: #3498db; /* プレイヤーのHPは青 */
}

/* --- テキスト表示エリア --- */
#target-text {
    font-size: 2.2em;
    padding: 20px;
    min-height: 80px;
    border: 2px solid #555;
    border-radius: 8px;
    margin: 20px 0;
    line-height: 1.4;
    user-select: none;
}

/* --- 進捗バー --- */
#progress-container {
    width: 90%;
    height: 15px;
    background-color: #555;
    border-radius: 8px;
    margin: 15px auto;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background-color: #2ecc71; /* 緑 */
    transition: width 0.1s linear;
}

/* --- テキストハイライト --- */
.correct { color: #2ecc71; } /* 正しい文字 */
.current { background-color: yellow; color: black; padding: 2px 0; border-radius: 2px; } /* 次にタイプする文字 */
.incorrect { color: red; font-weight: bold; animation: shake 0.5s; } /* ミスした文字 */
.remaining { color: #95a5a6; } /* 未入力の文字 */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

#message-area {
    font-size: 1.2em;
    font-weight: bold;
    min-height: 30px;
    margin-bottom: 20px;
}

#wpm-display {
    font-size: 1.5em;
    color: #f1c40f;
}