body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 20px;
    box-sizing: border-box;
    background-color: #f4f4f9;
    color: #333;
}

h1 {
    color: #444;
}

/* 画面コンテナの基本スタイル */
.screen {
    width: 90%;
    max-width: 600px;
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
    box-sizing: border-box;
}

.hidden {
    display: none !important; /* 強制的に非表示 */
}

.settings-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    justify-content: center;
}
.settings-area label {
    font-weight: bold;
    white-space: nowrap;
    flex-basis: 45%;
    text-align: right;
}
.settings-area select,
.settings-area input[type="checkbox"] {
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
    flex-basis: 45%;
    text-align: left;
}
.settings-area p {
    margin: 0;
    white-space: nowrap;
    flex-basis: 100%;
    text-align: center;
}
.small-text {
    font-size: 0.8em;
    color: #666;
    margin-top: -10px;
}

/* ゲーム画面の情報表示バー */
.game-info-bar { /* クラス名を変更 */
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    background-color: #e9ecef; /* 少し背景色を追加 */
    border-radius: 5px;
}
.game-info-bar p { /* クラス名を変更 */
    margin: 0;
    font-size: 1.1em;
    font-weight: bold; /* 少し強調 */
}

#current-player {
    font-weight: bold;
    font-size: 1.3em; /* 少し大きく */
    color: #dc3545; /* プレイヤーカラー */
    padding: 5px 10px; /* パディングを追加 */
    border-radius: 5px;
    background-color: #ffe0e6; /* 背景色を追加 */
}
#time-left-display {
    font-weight: bold;
    color: #007bff;
    font-size: 1.3em; /* 少し大きく */
    padding: 5px 10px; /* パディングを追加 */
    border-radius: 5px;
    background-color: #e0f2ff; /* 背景色を追加 */
}


.display-area {
    text-align: center;
    margin-bottom: 20px;
}

#previous-word-display {
    font-size: 2.5em;
    font-weight: bold;
    color: #007bff;
    background-color: #fff;
    padding: 10px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 200px;
    text-align: center;
}

.input-area {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

#word-input {
    padding: 10px;
    font-size: 1em;
    border: 2px solid #ccc;
    border-radius: 5px;
    flex-grow: 1;
    max-width: 300px;
}

#word-input:focus {
    border-color: #007bff;
    outline: none;
}

button {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    color: white;
    transition: background-color 0.2s;
}

/* 無効化されたボタンのスタイル */
button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6; /* 透明度を下げて無効であることを強調 */
}


.action-button {
    background-color: #007bff;
    margin-top: 20px;
}
.action-button:hover:not(:disabled) { /* 無効化されている場合はホバー効果なし */
    background-color: #0056b3;
}

#submit-button {
    background-color: #28a745;
}

#submit-button:hover:not(:disabled) {
    background-color: #218838;
}

.control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

#reset-button {
    background-color: #6c757d;
}

#reset-button:hover:not(:disabled) {
    background-color: #5a6268;
}

#pass-button {
    background-color: #ffc107;
    color: #333;
}

#pass-button:hover:not(:disabled) {
    background-color: #e0a800;
}

/* 子音マッチボタンのスタイル */
#consonant-match-button {
    background-color: #17a2b8;
    color: white;
}

#consonant-match-button:hover:not(:disabled) {
    background-color: #138496;
}


#message-area {
    height: 30px; /* 少し高さを確保 */
    font-weight: bold;
    margin-bottom: 10px;
    padding: 5px 10px; /* パディングを追加 */
    border-radius: 5px;
    min-height: 20px; /* 少なくとも2行分の高さを確保 */
}

.error {
    color: #dc3545;
    background-color: #f8d7da; /* 薄い赤色の背景 */
    border: 1px solid #f5c6cb;
}

.game-over {
    color: #17a2b8;
    background-color: #d1ecf1; /* 薄い水色の背景 */
    border: 1px solid #bee5eb;
}

.info {
    color: #007bff;
    background-color: #e0f2ff; /* 薄い青色の背景 */
    border: 1px solid #b8daff;
}

.history-area {
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.history-area h2 {
    font-size: 1.2em;
    color: #444;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
}
#history-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
}
#history-list li {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#history-list li:first-child {
    font-weight: bold;
    color: #007bff;
}
#history-list li .player-id {
    font-weight: bold;
    margin-right: 10px;
    color: #333;
    flex-shrink: 0;
}