/* --- 第12章：全体リセット・基本設定 --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    margin: 0; padding: 0; font-family: sans-serif;
    background-color: #333; color: #333; overflow-x: hidden; user-select: none;
}
.page-section { width: 100%; min-height: 100vh; position: relative; background-color: #333; }

/* --- ヘッダーバー（第11章：z-index管理） --- */
.header-nav, #quiz_header {
    display: flex; align-items: center; background-color: #222; color: #fff;
    padding: 0 10px; position: sticky; top: 0; z-index: 1000; height: 60px;
}
.btn_back, .btn_back_quiz { padding: 10px; cursor: pointer; }
.back-img { width: 30px; height: 30px; }
h1 { margin: 0 0 0 10px; font-size: 18px; flex: 1; }

/* --- トップ画面：科目グリッド --- */
#top_subject_grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; padding: 15px;
}
.subject-card {
    background-color: #f8f8f8; border-radius: 14px; padding: 15px 5px;
    display: flex; flex-direction: column; align-items: center; cursor: pointer;
}
.subject-card img { width: 64px; height: 64px; margin-bottom: 8px; }
.subject-card span { font-weight: bold; font-size: 14px; }
.empty-card { visibility: hidden; }

/* --- トップ画面：ボタン類 --- */
.horizontal-btn {
    display: flex; align-items: center; width: 92%; margin: 10px auto;
    background-color: #f8f8f8; border-radius: 14px; height: 130px; padding-left: 20px; cursor: pointer;
}
.horizontal-btn img { width: 100px; height: 100px; margin-right: 20px; }
.horizontal-btn span { font-size: 22px; font-weight: bold; }

.vertical-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 46%; margin: 10px 0 20px 15px; background-color: #f8f8f8; border-radius: 14px;
    height: 190px; cursor: pointer;
}
.vertical-btn img { width: 100px; height: 100px; margin-bottom: 10px; }
.vertical-btn span { font-size: 18px; font-weight: bold; }

/* --- ゲーム風表示枠（第10章・第11章） --- */
#top_dungeon_area {
    background-color: #444; margin: 15px; padding: 15px; border-radius: 12px; color: #fff;
}
#dungeon_header { display: flex; align-items: center; margin-bottom: 10px; }
.riro-icon { width: 100px; height: 100px; margin-right: 15px; }
#dungeon_name_display { font-size: 18px; font-weight: bold; }
#dungeon_gauge_container {
    width: 100%; height: 20px; background-color: #222; border-radius: 10px; overflow: hidden; margin: 10px 0;
}
#dungeon_gauge_bar { height: 100%; width: 0%; background-color: #4caf50; transition: width 0.3s; }
#dungeon_image_area { display: flex; justify-content: center; margin: 10px 0; }
#dungeon_image_area img { width: 376px; height: 120px; object-fit: contain; }
#dungeon_message_row { display: flex; align-items: center; height: 24px; font-size: 14px; }
#enemy_small_icon { width: 20px; height: 20px; margin-right: 5px; }

/* --- 科目ページ・単元一覧のリスト --- */
.unit-list-btn {
    width: 90%; background-color: #f8f8f8; border-radius: 12px; padding: 20px;
    margin: 15px auto; font-size: 18px; font-weight: bold; display: block; border: none; text-align: left;
}
.minor-unit-header {
    padding: 10px 15px; background-color: #555; color: #fff; margin-top: 20px; font-size: 16px;
}
.quiz-item-btn {
    width: 95%; background-color: #f8f8f8; border-bottom: 1px solid #ddd;
    padding: 15px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center;
}
.quiz-item-btn:last-child { border-radius: 0 0 12px 12px; }
.quiz-item-btn:first-of-type { border-radius: 12px 12px 0 0; }
.q-title { flex: 1; font-weight: bold; }
.q-rate { margin-left: 10px; color: #4a90e2; font-size: 14px; }

/* --- クイズ画面（第11章） --- */
#quiz_info_text { flex: 1; text-align: right; font-size: 12px; color: #ccc; margin-right: 10px; }
#quiz_question_area {
    background-color: #f8f8f8; margin: 20px 15px; padding: 30px 15px;
    border-radius: 12px; font-size: 20px; font-weight: bold; text-align: center; min-height: 120px;
}
.choice-btn {
    width: 85%; background-color: #f8f8f8; border-radius: 10px; padding: 15px;
    margin: 10px auto; font-size: 18px; font-weight: bold; display: block; border: none; cursor: pointer; position: relative;
}
#quiz_feedback_layer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 200px; z-index: 2000; pointer-events: none;
}
.wrong-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); border-radius: 10px; }

/* --- 分析ページ（第8章：棒グラフ仕様） --- */
#analysis_header_area { display: flex; align-items: center; background-color: #444; padding: 10px; }
.analysis-main-icon { width: 100px; height: 100px; margin-right: 15px; }
#analysis_subject_tabs { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.analysis-tab-btn { background: #eee; border: none; border-radius: 4px; padding: 5px 10px; font-weight: bold; font-size: 12px; }
.analysis-section-title { color: #fff; padding: 10px 15px; background: #222; margin-top: 10px; }
.analysis-item { background: #fff; margin: 10px; padding: 10px; border-radius: 8px; }
.bar-outer { width: 100%; background: #eee; height: 12px; border-radius: 6px; overflow: hidden; position: relative; margin-top: 5px; }
.bar-inner { height: 100%; background: #4a90e2; } /* 全科目統一色 */

/* --- シール・手帳（第9章） --- */
.reward-sub-header { display: flex; align-items: center; padding: 10px 15px; background-color: #444; color: #fff; }
.reward-header-icon { width: 100px; height: 100px; margin-right: 20px; }
.text-link-btn { font-size: 20px; font-weight: bold; text-decoration: underline; cursor: pointer; }
#seal_total_display { text-align: center; color: #fff; font-size: 18px; padding: 10px; }
#seal_grid_container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 15px; }
.seal-slot { width: 76px; height: 76px; background-color: #222; border-radius: 8px; position: relative; display: flex; align-items: center; justify-content: center; }
.seal-img { width: 76px; height: 76px; }
.new-label { position: absolute; top: 0; right: 0; background: red; color: white; font-size: 10px; padding: 2px 4px; border-radius: 4px; }
.history-item { background: #fff; margin: 10px; padding: 15px; border-radius: 10px; position: relative; }
.pager-area { display: flex; justify-content: center; gap: 20px; padding: 20px; }

/* --- モーダル（第11章：z-index管理） --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 3000;
}
.modal-content { background: #fff; padding: 25px; border-radius: 16px; text-align: center; width: 80%; }
.modal-buttons { display: flex; justify-content: space-around; margin-top: 20px; }
.modal-buttons button { padding: 10px 20px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer; }