/* 全体背景：冒険の夜空をイメージ */
body { 
    font-family: 'DotGothic16', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: #1a1a2e; 
    color: #e94560; 
    line-height: 1.6; 
    margin: 0;
    padding: 0;
}

/* メインコンテナ：石造りのギルドをイメージ */
.container { 
    max-width: 600px; 
    margin: 30px auto; 
    background: #16213e; 
    padding: 30px; 
    border-radius: 8px; 
    border: 4px solid #0f3460;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

h1 {
    text-align: center;
    color: #f9d342;
    text-shadow: 2px 2px #000;
    font-size: 2rem;
    margin-bottom: 30px;
}

h3 {
    color: #4ecca3;
    border-left: 4px solid #4ecca3;
    padding-left: 10px;
    margin-bottom: 15px;
}

.hidden { display: none; }

/* グリッドレイアウト */
.grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px; 
    margin-bottom: 30px; 
}

/* ボタン：コマンド選択風 */
button { 
    padding: 15px; 
    cursor: pointer; 
    border: 3px solid #0f3460; 
    border-radius: 4px; 
    background: #1a1a2e; 
    color: #fff;
    font-weight: bold;
    transition: all 0.2s;
    font-family: inherit;
}

button:hover:not(:disabled) {
    background: #0f3460;
    transform: translateY(-2px);
    border-color: #4ecca3;
}

/* --- 探索先別カラーバリエーション --- */

/* 草原 (Green) */
button.loc-grass { border-color: #2ecc71; color: #2ecc71; }
button.loc-grass:hover:not(:disabled) { background: #2ecc71; color: #1a1a2e; box-shadow: 0 0 10px #2ecc71; }
button.loc-grass.selected { background: #2ecc71; color: #1a1a2e; border-color: #fff; }

/* 洞窟 (Purple/Dark) */
button.loc-cave { border-color: #9b59b6; color: #9b59b6; }
button.loc-cave:hover:not(:disabled) { background: #9b59b6; color: #1a1a2e; box-shadow: 0 0 10px #9b59b6; }
button.loc-cave.selected { background: #9b59b6; color: #1a1a2e; border-color: #fff; }

/* 森 (Deep Green) */
button.loc-forest { border-color: #1abc9c; color: #1abc9c; }
button.loc-forest:hover:not(:disabled) { background: #1abc9c; color: #1a1a2e; box-shadow: 0 0 10px #1abc9c; }
button.loc-forest.selected { background: #1abc9c; color: #1a1a2e; border-color: #fff; }

/* 火山 (Red/Orange) */
button.loc-volcano { border-color: #e67e22; color: #e67e22; }
button.loc-volcano:hover:not(:disabled) { background: #e67e22; color: #1a1a2e; box-shadow: 0 0 10px #e67e22; }
button.loc-volcano.selected { background: #e67e22; color: #1a1a2e; border-color: #fff; }

/* 遺跡 (Gold/Yellow) */
button.loc-ruins { border-color: #f1c40f; color: #f1c40f; }
button.loc-ruins:hover:not(:disabled) { background: #f1c40f; color: #1a1a2e; box-shadow: 0 0 10px #f1c40f; }
button.loc-ruins.selected { background: #f1c40f; color: #1a1a2e; border-color: #fff; }

/* ------------------------------ */

/* 選択中のボタン */
button.selected { 
    background: #4ecca3; 
    color: #16213e; 
    border-color: #fff; 
    box-shadow: 0 0 15px rgba(78, 204, 163, 0.5);
}

button:disabled { 
    opacity: 0.3; 
    cursor: not-allowed; 
}

/* 開始ボタン */
#start-btn { 
    width: 100%; 
    font-size: 1.4rem; 
    background: #f9d342; 
    color: #16213e; 
    border: 4px solid #c29910;
    margin-top: 10px;
}

#start-btn:hover:not(:disabled) {
    background: #ffeb3b;
    box-shadow: 0 0 20px rgba(249, 211, 66, 0.4);
}

/* 中止ボタン */
.danger-btn { 
    background: #e94560; 
    color: white; 
    border: none; 
    width: 100%; 
    margin-top: 20px; 
}

/* 戻るボタン */
.return-btn {
    width: 100%;
    background: #4ecca3;
    color: #16213e;
    margin-top: 10px;
}

/* タイマー・プログレスバー */
.timer-container { 
    background: #0f3460; 
    border-radius: 4px; 
    height: 35px; 
    position: relative; 
    overflow: hidden; 
    margin: 25px 0; 
    border: 2px solid #4ecca3;
    z-index: 2;
}

#progress-bar { 
    background: linear-gradient(90deg, #4ecca3, #a2ffb6); 
    height: 100%; 
    width: 0%; 
    transition: width 0.5s; 
    box-shadow: 0 0 10px #4ecca3;
}

#time-left { 
    position: absolute; 
    width: 100%; 
    text-align: center; 
    top: 5px; 
    font-weight: bold; 
    color: #fff; 
    text-shadow: 1px 1px 2px #000;
}

.status-msg {
    color: #ccc;
    font-size: 0.9rem;
    text-align: center;
    position: relative;
    z-index: 2;
}

/* ログ画面 */
#log-container { 
    background: #000; 
    color: #00ff00; 
    padding: 15px; 
    height: 250px; 
    overflow-y: auto; 
    border: 2px solid #555;
    border-radius: 4px; 
    margin-bottom: 20px; 
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    box-shadow: inset 0 0 10px rgba(0,255,0,0.1);
}

#log-container div {
    margin-bottom: 5px;
    border-bottom: 1px dotted #222;
}

/* 所持アイテムセクションの改良 */
.inventory-section {
    margin-top: 20px;
}

#inventory {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 15px;
    background: #0f3460;
    border-radius: 8px;
    border: 2px solid #1a1a2e;
}

/* アイテム一つ一つのカード表示 */
.item-slot {
    background: #1a1a2e;
    border: 1px solid #4ecca3;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 0.85rem;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 50px;
}

.item-name {
    color: #f9d342;
    display: block;
    margin-bottom: 3px;
    font-weight: bold;
}

.item-count {
    color: #4ecca3;
    font-size: 0.9rem;
}

hr {
    border: none;
    border-top: 1px solid #0f3460;
    margin: 30px 0;
}

/* 画面揺れ演出 */
.effect-shake { animation: shake 0.5s; }
@keyframes shake { 0% {transform: translate(0,0)} 25% {transform: translate(5px,5px)} 50% {transform: translate(-5px,-5px)} 75% {transform: translate(5px,-5px)} 100% {transform: translate(0,0)} }

/* 探索画面の背景 */
#exploration-screen {
    position: relative;
    padding: 60px 20px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
    overflow: hidden;
    z-index: 1;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#exploration-screen::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

#current-loc-name {
    text-shadow: 2px 2px 4px #000;
    text-align: center;
    position: relative;
    z-index: 2;
    color: #fff;
}

.back-home-btn {
    text-decoration: none;
    background: #444;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9em;
    border: 1px solid #666;
}

/* 殿堂馬ボタンの基本（グレー） */
.hall-btn {
    padding: 8px 15px !important;
    font-size: 0.9em !important;
    background: #444 !important;
    color: #888 !important;
    border: 1px solid #666 !important;
    margin: 0 !important;
    cursor: default;
}

/* 条件達成時の金色アニメーション */
.hall-btn.active {
    background: linear-gradient(45deg, #ffd700, #ffec8b) !important;
    color: #1a1a2e !important;
    border: 1px solid #fff !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    font-weight: bold;
    cursor: pointer;
    animation: gold-glow 2s infinite alternate;
}

@keyframes gold-glow {
    from { box-shadow: 0 0 5px #ffd700; }
    to { box-shadow: 0 0 20px #fff700; }
}