body {
    font-family: sans-serif;
    background-color: #f4f4f9;
    color: #333;
    display: flex;
    justify-content: center;
    padding: 20px;
}

#main-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 1000px; /* テーブルが見やすいように幅を広げました */
    width: 100%;
}

#home-screen h1 {
    font-size: 3em;
    color: #2c3e50;
    text-align: center;
    margin-bottom: 20px;
}

.home-controls button {
    display: block;
    width: 300px;
    margin: 15px auto;
    padding: 15px;
    font-size: 1.2em;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.home-controls button:hover {
    background-color: #2980b9;
}

h2 {
    color: #34495e;
    border-bottom: 2px solid #34495e;
    padding-bottom: 5px;
    margin-top: 25px;
}




/* チュートリアルでハイライトする要素の基本スタイル */
.tutorial-highlight {
    position: relative;
    z-index: 1001; /* オーバーレイより手前に表示 */
    pointer-events: auto; /* ★ ハイライトされた要素のクリックを有効にする */
}

/* チュートリアル中はテーブルのしましまをなくす */
.tutorial-highlight table tr:nth-child(even) {
    background-color: #fff;
}

/* チュートリアル中は不要なボタンを隠す */
.tutorial-highlight .cancel-scout-button {
    display: none;
}

/* 先月の記録エリア */
#last-month-log {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
}
#log-content {
    white-space: pre-wrap; /* 長い行でも折り返す */
    font-size: 0.9em;
}

#stats p {
    font-size: 1.1em;
    margin: 5px 0;
}

#gold {
    color: gold;
    font-weight: bold;
}

.controls button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap; /* ボタンが改行されないように */
}

.controls button:hover:not(:disabled) {
    background-color: #2980b9;
}

.controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#action-controls {
    display: flex;
    flex-wrap: wrap;
}


/* --- テーブルのスタイル --- */
#adventurer-list table, #candidate-table, #quest-candidate-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
}

#adventurer-list th, #adventurer-list td, 
#candidate-table th, #candidate-table td,
#quest-candidate-table th, #quest-candidate-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

#adventurer-list th, #candidate-table th, #quest-candidate-table th {
    background-color: #34495e;
    color: white;
}

#adventurer-list tr:nth-child(even), 
#quest-candidate-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* 候補者リストは全行に背景色を適用 */
#candidate-table tr {
    background-color: #f2f2f2;
}

/* --- アバター表示のスタイル --- */
.adventurer-summary {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar-container {
    position: relative;
    width: 64px; /* アバター画像の基本サイズ */
    height: 64px;
    flex-shrink: 0; /* コンテナが縮まないようにする */
    overflow: hidden; /* このコンテナからはみ出した部分を非表示にする */
    border: 1px solid #ccc; /* 枠線を追加 */
    border-radius: 4px; /* 枠の角を少し丸くする */
}

.avatar-part {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* 横幅をコンテナに合わせる */
    height: auto; /* 縦横比を維持 */
    /* 画像がぼやけないようにする設定 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: pixelated;
}

/* 待機中でない冒険者の行 */
#adventurer-list tr.in-quest {
    background-color: #e6e6fa; /* 薄紫 */
    opacity: 0.8;
}

/* 派遣不可な冒険者の行 */
#quest-candidate-table tr.ineligible-adventurer {
    background-color: #fdd; 
    opacity: 0.7;
}

.rank-G { background-color: #808080; } /* Silver/Grey */
.rank-F { background-color: #f39c12; } /* Orange */
.rank-E { background-color: #2ecc71; } /* Emerald Green */
.rank-D { background-color: #3498db; } /* Peter River Blue */
.rank-C { background-color: #e74c3c; } /* Alizarin Red */
.rank-B { background-color: #8e44ad; } /* Wisteria Purple */
.rank-A { background-color: #e67e22; } /* Carrot Orange */
.rank-S { background-color: #f1c40f; } /* Sunflower Yellow */


/* --- クエストリストのスタイル --- */
#quests {
    margin-top: 20px;
}

.quest-item {
    border: 1px solid #ddd;
    padding: 15px;
    margin-top: 10px;
    border-radius: 5px;
    background-color: #ecf0f1;
}

.quest-item p {
    margin: 5px 0;
}

.quest-item button {
    background-color: #27ae60;
}
.quest-item button:hover:not(:disabled) {
    background-color: #229954;
}

/* --- 経験値バーのスタイル --- */
.exp-bar-container {
    width: 80px; /* 少し縮小 */
    height: 8px;
    background-color: #ccc;
    border-radius: 4px;
    margin: 3px auto 0;
    overflow: hidden;
}

.exp-bar {
    height: 100%;
    background-color: #3498db; /* EXPの色 */
    transition: width 0.3s;
}

/* キャンセルボタンのスタイル（リスト内のボタン） */
#adventurer-list button {
    background-color: #e74c3c;
    padding: 5px 8px;
    font-size: 0.8em;
}
#adventurer-list button:hover {
    background-color: #c0392b;
}

/* 名前変更・カラー変更ボタンの共通スタイル */
#adventurer-list button:not(.retire-button) {
    background-color: #3498db;
}
/* --- クエスト詳細画面のスタイル --- */
.quest-info, .promotion-info {
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 15px;
    background-color: #f9f9f9;
}

#dispatch-button {
    background-color: #3498db;
    margin-top: 10px;
}

#expected-success-rate {
    font-weight: bold;
}


/* ★★★ 追加: 昇級試験の「受験者を派遣」ボタンの色を紫に変更する ★★★ */
.promotion-dispatch-button {
    background-color: #9b59b6 !important; /* 紫色 */
}

.promotion-dispatch-button:hover:not(:disabled) {
    background-color: #8e44ad !important; /* ホバー時の濃い紫色 */
}

/* --- チュートリアル用のスタイル --- */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: flex-end; /* ★ 右寄せに変更 */
    align-items: center;
    padding-right: 5%; /* ★ 画面の右端から少し離す */
}

#tutorial-message-box {
    background-color: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
    pointer-events: auto; /* ★ メッセージボックスはクリックできるようにする */
    position: relative; /* z-indexを有効にする */
    z-index: 1003; /* オーバーレイやハイライトよりさらに手前に表示 */
}

#tutorial-text {
    font-size: 1.2em;
    margin-bottom: 15px;
}

#tutorial-next-button {
    background-color: #27ae60;
    color: white;
}

/* --- モーダルとカラーパレットのスタイル --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* チュートリアルより手前に */
}

.modal-content {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
}

h3 {
    margin-top: 0;
    color: #34495e;
}

/* --- カラーピッカーのスタイル --- */
.color-picker-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

#adv-color-picker {
    width: 60px;
    height: 40px;
    border: none;
    padding: 0;
    cursor: pointer;
}

.color-picker-confirm-button {
    background-color: #27ae60;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

.color-box:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    border-color: #fff;
}

/* --- セーブ/ロードモーダル専用スタイル --- */
#save-load-slots {
    display: grid;
    grid-template-columns: 1fr; /* 1列表示 */
    gap: 15px;
    margin-top: 20px;
}

.save-slot {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    transition: box-shadow 0.2s;
}

.save-slot:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.save-slot p {
    margin: 2px 0;
    font-size: 0.9em;
    color: #555;
}

.save-slot p strong {
    font-size: 1.2em;
    color: #34495e;
}

.save-slot button {
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    transition: background-color 0.2s;
    min-width: 100px; /* ボタン幅を統一 */
    text-align: center;
}

.save-slot button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.7;
}

/* セーブボタンのスタイル */
.save-slot button[onclick^="saveGame"] {
    background-color: #3498db; /* 青系 */
}
.save-slot button[onclick^="saveGame"]:hover:not(:disabled) {
    background-color: #2980b9;
}

/* ロードボタンのスタイル */
.save-slot button[onclick^="loadGame"] {
    background-color: #2ecc71; /* 緑系 */
}
.save-slot button[onclick^="loadGame"]:hover:not(:disabled) {
    background-color: #27ae60;
}

/* --- Next Monthボタンのスタイル調整 --- */
.next-month-button {
    padding: 10px 20px;
    font-weight: bold;
    background-color: #e67e22; /* オレンジ系に変更 */
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.next-month-button:hover {
    background-color: #d35400;
}
