@import url('https://fonts.googleapis.com/css2?family=Special+Elite&display=swap');

/* --- タイトル画面のスタイル --- */
#title-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background-color: #1a1a1a;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 400; /* 最も手前に表示 */
}

.title-content h1 {
    font-size: 5em;
    color: #e63946;
    margin: 0;
    text-shadow: 2px 2px 5px #000;
}

.subtitle {
    font-size: 1.2em;
    color: #a5a5a5;
    margin-top: 0;
    margin-bottom: 40px;
}

.title-buttons button {
    font-family: 'Special Elite', monospace;
    font-size: 1.5em;
    padding: 15px 30px;
    margin: 10px;
    cursor: pointer;
    border: 1px solid #7a7a7a;
    transition: background-color 0.2s, color 0.2s;
}

#start-game-button {
    background-color: #e63946;
    color: #fff;
}
#start-game-button:hover {
    background-color: #c32f3b;
}

.info-button {
    background-color: #4a4a4a;
    color: #c5c5c5;
}
.info-button:hover {
    background-color: #5a5a5a;
}

/* --- 遊び方画面のスタイル --- */
#how-to-play-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80%;
    background-color: rgba(20, 20, 20, 0.95);
    padding: 25px;
    border: 2px solid #aaa;
    z-index: 500;
    display: flex;
    flex-direction: column;
}

#how-to-play-screen h2 {
    color: #eee;
    margin-top: 0;
    text-align: center;
}
/* ... (以降、遊び方モーダルの詳細スタイル。避弾ノ道とほぼ同じでOK) ... */
.rules-content { overflow-y: auto; text-align: left; line-height: 1.6; }
.rules-content h3 { color: #e63946; margin-top: 15px; border-bottom: 1px solid #e63946; padding-bottom: 5px; }
.rules-content ul, .rules-content ol { padding-left: 20px; }
.rules-content li { margin-bottom: 10px; }
#close-how-to-play-button { margin-top: 20px; background-color: #4a4a4a; color: #c5c5c5; padding: 10px 20px; border: 1px solid #7a7a7a; cursor: pointer; font-size: 1em; align-self: center; font-family: 'Special Elite', monospace;}

body {
    background-color: #1a1a1a;
    color: #c5c5c5;
    font-family: 'Special Elite', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

#game-container {
    width: 90%;
    max-width: 600px;
    border: 2px solid #5a5a5a;
    background-color: #2a2a2a;
    padding: 20px;
    box-shadow: 0 0 15px rgba(0,0,0,0.7);
}

header h1 {
    text-align: center;
    color: #e63946;
    margin-top: 0;
}

/* ★★★ stats-containerのレイアウトをGridに変更 ★★★ */
#stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2つの等幅カラムを作成 */
    gap: 10px 20px; /* 縦10px, 横20px の間隔 */
    margin-bottom: 20px;
    border-top: 1px solid #5a5a5a;
    border-bottom: 1px solid #5a5a5a;
    padding: 15px;
}

/* ★★★ 各ステータス項目のスタイルを調整 ★★★ */
.stat-item {
    display: flex;
    align-items: center;
    gap: 8px; /* ラベルとバー/数値の間のスペース */
}

#food-bar {
    background-color: #8f5d23; /* 茶色 */
}
#water-bar {
    background-color: #3498db; /* 青色 */
}

/* ★★★ バーのスタイルを調整 ★★★ */
.bar-container {
    flex-grow: 1; /* 利用可能なスペースを埋めるように伸長 */
    width: auto; /* 固定幅を解除 */
    height: 15px;
    background-color: #1a1a1a;
    border: 1px solid #5a5a5a;
}

.bar {
    height: 100%;
    background-color: #e63946;
    transition: width 0.3s ease;
}

#situation-display {
    min-height: 100px;
    padding: 15px;
    border: 1px dashed #5a5a5a;
    margin-bottom: 20px;
    font-size: 1.2em;
    line-height: 1.6;
}

#choices-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-btn {
    width: 100%;
    padding: 15px;
    font-family: 'Special Elite', monospace;
    font-size: 1.1em;
    background-color: #4a4a4a;
    color: #c5c5c5;
    border: 1px solid #7a7a7a;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s;
}

.choice-btn:hover:not(:disabled) {
    background-color: #5a5a5a;
    color: #fff;
}

.choice-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#memo-display {
    margin-top: 20px;
    padding: 10px;
    background-color: #333;
    border-left: 3px solid #e63946;
    font-style: italic;
}

#game-over-screen {
    text-align: center;
}
#game-over-screen h2 {
    color: #e63946;
    font-size: 3em;
}
#game-over-screen p {
    font-size: 1.5em;
}
#restart-button, .lobby-button {
    font-family: 'Special Elite', monospace;
    font-size: 1.2em;
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid #7a7a7a;
    text-decoration: none;
    display: inline-block;
    margin: 10px;
}
#restart-button {
    background-color: #e63946;
    color: #fff;
}
.lobby-button {
    background-color: #4a4a4a;
    color: #c5c5c5;
}

.hidden {
    display: none !important;
}

#next-turn-container {
    display: flex;
    justify-content: flex-end; /* ボタンを右寄せにする */
    margin-top: 15px;
}

#next-turn-button {
    font-family: 'Special Elite', monospace;
    font-size: 1.2em;
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid #7a7a7a;
    background-color: #3498db; /* 目立つ色に */
    color: #fff;
    transition: background-color 0.2s;
}

#next-turn-button:hover {
    background-color: #2980b9;
}

/* --- デバッグ用UIのスタイル --- */
#debug-container {
    margin-top: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#debug-toggle-button {
    font-family: 'Special Elite', monospace;
    font-size: 0.9em;
    padding: 5px 10px;
    cursor: pointer;
    border: 1px solid #5a5a5a;
    background-color: #333;
    color: #aaa;
}

#debug-json-output {
    width: 100%;
    max-height: 200px;
    overflow: auto; /* 長い場合はスクロール */
    background-color: #111;
    border: 1px solid #444;
    padding: 10px;
    margin-top: 10px;
    text-align: left;
    white-space: pre-wrap; /* 自動で折り返す */
    font-size: 0.8em;
    color: #9e9; /* 見やすい緑色に */
}

/* --- エラー・リトライボタンのスタイル --- */
#error-container {
    margin-top: 15px;
    text-align: center;
}

#retry-button {
    font-family: 'Special Elite', monospace;
    font-size: 1em;
    padding: 8px 15px;
    cursor: pointer;
    border: 1px solid #7a7a7a;
    background-color: #ffc107; /* 警告色 (黄色) */
    color: #111;
    transition: background-color 0.2s;
}

#retry-button:hover {
    background-color: #e0a800;
}