/* Ver. 7.4 - Refined Academic UI */

:root {
    --ut-red: #800000;         /* 伝統の臙脂 */
    --text-main: #333333;
    --text-sub: #666666;
    --bg-paper: #fdfdfc;       /* 柔らかな紙色 */
    --bg-header: #f7f7f2;
    --border-light: #e0e0db;
    --accent-gold: #b8a078;    /* 控えめな金茶色 */
}

/* 全体設定 */
body {
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
    background-color: var(--bg-paper);
    color: var(--text-main);
    font-size: 17px;
    line-height: 1.7;
    margin: 0;
    padding: 40px 20px;
}

/* データ表示部分は明朝体を適用 */
.war-data, table, .subtitle, .organization {
    font-family: "BIZ UDPMincho", "Hiragino Mincho ProN", serif;
}

header {
    max-width: 1100px;
    margin: 0 auto 50px;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    color: var(--ut-red);
}

.header-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-sub);
    border-top: 1px solid var(--border-light);
    display: inline-block;
    padding-top: 10px;
    margin: 0;
}

.organization {
    font-size: 0.85rem;
    color: var(--accent-gold);
    letter-spacing: 0.15em;
    margin: 0;
}

#app {
    max-width: 1100px;
    margin: 0 auto;
}

/* 検索コントロール */
.search-controls {
    background: #fff;
    padding: 30px;
    border-bottom: 1px solid var(--border-light);
}

.search-group {
    margin-bottom: 30px;
}

#keywordSearch {
    width: 100%;
    border: none;
    border-bottom: 2px solid var(--border-light);
    padding: 12px 0;
    font-size: 1.3rem;
    outline: none;
    background: transparent;
    transition: border-color 0.3s;
}

#keywordSearch:focus {
    border-color: var(--ut-red);
}

.search-meta {
    margin-top: 12px;
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--text-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 表示設定：フラットで控えめなデザイン */
.display-settings {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f9f9f9;
}

.era-selector {
    display: flex;
    gap: 25px;
    font-size: 0.9rem;
    color: var(--text-sub);
}

.setting-label {
    font-weight: bold;
    color: var(--accent-gold);
    margin-right: 5px;
}

.era-selector label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.era-selector input[type="radio"] {
    accent-color: var(--ut-red);
}

#clearFilters {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-sub);
    padding: 6px 18px;
    font-size: 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

#clearFilters:hover {
    background: #f4f4f4;
    border-color: var(--text-sub);
}

/* フィルタエリア：3列×2行で固定 */
.filter-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px 40px;
    padding: 30px;
    background: #fff;
    border-bottom: 1px solid var(--border-light);
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    display: block;
}

.filter-group select {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: 8px 0;
    background: transparent;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
}

/* 結果情報 */
.results-info {
    margin-top: 40px;
    font-size: 0.9rem;
    color: var(--text-sub);
    text-align: right;
}

/* テーブルデザイン */
.table-wrapper {
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-header);
    color: var(--text-sub);
    font-size: 0.8rem;
    font-weight: bold;
    padding: 15px;
    text-align: left;
    border-top: 2px solid var(--ut-red);
    border-bottom: 1px solid var(--border-light);
}

td {
    padding: 20px 15px;
    border-bottom: 1px solid var(--border-light);
    font-size: 1.05rem;
}

/* 氏名列をやや強調 */
td:last-child {
    font-weight: 500;
}

tbody tr:hover {
    background-color: var(--bg-header);
}

/* ページネーション */
.pagination {
    margin: 60px 0;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.pagination button {
    border: none;
    background: transparent;
    color: var(--text-sub);
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.pagination button.active {
    color: var(--ut-red);
    font-weight: bold;
    border-bottom: 2px solid var(--ut-red);
}

/* フッター（右下署名） */
footer {
    max-width: 1100px;
    margin: 40px auto 80px;
    text-align: right;
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-sub);
    letter-spacing: 0.05em;
}

/* レスポンシブ対応 */
@media (min-width: 1200px) {
    .filter-controls { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 768px) {
    .filter-controls { grid-template-columns: repeat(2, 1fr); }
    .display-settings { flex-direction: column; gap: 20px; align-items: flex-start; }
}

/* --- 前略：Ver. 7.4 のスタイルを継承 --- */

/* 凡例リンクのスタイル */
.legend-link {
    font-size: 0.85rem;
    color: var(--text-sub);
    text-decoration: none;
    margin-top: 10px;
    transition: color 0.2s;
    border-bottom: 1px transparent;
}

.legend-link:hover {
    color: var(--ut-red);
    text-decoration: underline;
}

/* モーダル全体の背景（暗幕） */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    /* 修正ポイント：外枠自体をスクロール可能にする */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOSでのスクロールを滑らかに */
}

/* モーダルコンテンツの箱 */
.modal-content {
    background-color: var(--bg-paper);
    margin: 5% auto; /* 上下の余白を少し詰め、外枠のスクロールに任せる */
    padding: 40px;
    border: 1px solid var(--border-light);
    width: 80%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
    border-radius: 4px;
}

/* モバイル用の微調整 */
@media (max-width: 768px) {
    .modal-content {
        width: 90%;    /* 横幅を広げて可読性を確保 */
        padding: 30px 20px;
        margin: 20px auto; /* モバイルではマージンを固定値に */
    }
    .close-button {
        top: 5px;
        right: 15px;
    }
}

.close-button {
    position: absolute;
    right: 20px;
    top: 10px;
    color: var(--text-sub);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-content h2 {
    font-family: "BIZ UDPMincho", serif;
    color: var(--ut-red);
    border-bottom: 1px solid var(--ut-red);
    padding-bottom: 10px;
    margin-top: 0;
}

.modal-body dl {
    margin-top: 20px;
}

.modal-body dt {
    font-weight: bold;
    color: var(--accent-gold);
    margin-top: 20px;
    font-size: 0.9rem;
}

.modal-body dd {
    margin-left: 0;
    margin-top: 5px;
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.6;
}

/* --- 後略：レスポンシブ設定など --- */