/* e-typing お題予報 専用CSS */
/* ---------- ツールバー ---------- */
.forecast-toolbar {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
}
.forecast-toolbar .lang-switcher .lang-label {
    font-weight: bold;
    margin-right: 0.5rem;
}
.forecast-tabs .nav-link {
    padding: 0.4rem 1.2rem;
    color: #495057;
    background: #f8f9fa;
    margin-left: 4px;
}
.forecast-tabs .nav-link.active {
    background: #007bff;
    color: #fff;
}
.date-form input[type="date"] { width: 180px; }

/* ===================================================================
 *  指定週(小)/来週・再来週(大) のメインカード
 * =================================================================== */
.forecast-main {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1.4fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 992px) {
    .forecast-main { grid-template-columns: 1fr; }
}

.forecast-card-wrap.large-card .forecast-card { transform: scale(1.0); }
.forecast-card-wrap.large-card .determined-thema { font-size: 1.9rem; }
.forecast-card-wrap.large-card .card-header { font-size: 1.05rem; }
.forecast-card-wrap.large-card { box-shadow: 0 4px 14px rgba(0,123,255,0.15); border-radius: .25rem; }

.forecast-card-wrap.small-card .forecast-card { opacity: 0.95; }
.forecast-card-wrap.small-card .determined-thema { font-size: 1.3rem; }
.forecast-card-wrap.small-card .card-header { font-size: 0.95rem; }

.forecast-card { height: 100%; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.forecast-card.determined .card-header { background: #d4edda; }
.forecast-card.predicted  .card-header { background: #fff3cd; }
.forecast-card .card-header { font-weight: bold; }

.determined-badge {
    display: inline-block;
    background: #28a745;
    color: #fff;
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.determined-thema {
    font-weight: bold;
    color: #155724;
    text-align: center;
    padding: 1rem 0;
}

/* ---------- 候補リスト ---------- */
.candidate-list { display: flex; flex-direction: column; gap: 0.5rem; }
.candidate-row {
    display: grid;
    grid-template-columns: 24px 1fr 100px 60px;
    grid-template-rows: auto auto;
    grid-template-areas:
        "rank thema bar pct"
        ".    reason reason reason";
    align-items: center;
    column-gap: 8px;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.candidate-list.compact .candidate-row { padding: 0.25rem 0.5rem; }
.candidate-rank {
    grid-area: rank;
    font-weight: bold;
    color: #6c757d;
    text-align: center;
}
.candidate-thema { grid-area: thema; font-weight: bold; }
.candidate-bar-wrap {
    grid-area: bar;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}
.candidate-bar {
    height: 100%;
    background: linear-gradient(90deg,#17a2b8,#007bff);
}
.candidate-pct { grid-area: pct; text-align: right; color: #007bff; font-weight: bold; }
.candidate-reason { grid-area: reason; padding-left: 24px; }

/* ===================================================================
 *  拡張予報 (再々来週〜1年先)
 * =================================================================== */
.extended-forecast .month-label {
    background: #f1f3f5;
    padding: 0.4rem 0.7rem;
    border-left: 4px solid #007bff;
    margin: 0.6rem 0 0.3rem;
    font-weight: bold;
}
.extended-table { margin-bottom: 0; }
.extended-row {
    cursor: pointer;
    transition: background 0.15s;
}
.extended-row:hover { background: #eaf5ff; }
.extended-row.determined { background: #f0fbf3; }
.extended-row.predicted  { background: #fffaf0; }
.extended-row .ext-date    { width: 35%; font-weight: 500; }
.extended-row .ext-no      { font-size: 0.85rem; }
.extended-row .ext-top-thema { width: 35%; font-weight: bold; color: #212529; }
.extended-row .ext-top-pct  { width: 20%; color: #007bff; font-weight: bold; text-align: right; }
.extended-row .ext-toggle   { width: 10%; text-align: center; color: #6c757d; }
.extended-row.is-open .toggle-icon { transform: rotate(180deg); display: inline-block; }
.toggle-icon { display: inline-block; transition: transform 0.2s; }
.extended-detail-row td { background: #fafbfc; padding: 0.5rem 1rem; }

/* ---------- 過去同時期マトリクス (年×4列) ---------- */
.past-matrix-wrap { overflow-x: auto; }
.past-year-matrix { table-layout: fixed; min-width: 720px; margin-bottom: 0; }
.past-year-matrix thead th {
    background: #343a40;
    color: #fff;
    text-align: center;
    font-weight: normal;
    font-size: 0.85rem;
}
.past-year-matrix th.col-year {
    width: 70px;
    background: #495057;
}
.past-year-matrix tbody th.col-year {
    background: #f1f3f5;
    color: #212529;
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
    font-size: 0.9rem;
}
.past-year-matrix td.past-cell {
    vertical-align: middle;
    padding: 0.3rem 0.4rem;
    border-left: 1px solid #e9ecef;
    background: #fff;
}
.past-year-matrix td.past-cell.no-data {
    background: #fafafa;
    color: #adb5bd;
    text-align: center;
}
.past-cell-date { font-size: 0.7rem; color: #6c757d; line-height: 1.2; }
.past-cell-thema {
    font-weight: bold;
    font-size: 0.85rem;
    line-height: 1.3;
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 2px;
    display: inline-block;
    word-break: break-all;
}

/* ---------- お題別 出題回数グラフ (動的高さ) ---------- */
.thema-count-chart-wrap {
    width: 100%;
    /* height は JS で項目数に応じて設定 (Math.max(400, items*24)px) */
    position: relative;
}
.thema-count-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ---------- 履歴グリッド (forecastHistory.html) ---------- */
.history-grid-wrap { overflow-x: auto; }
.history-grid { table-layout: fixed; }
.history-grid th { background: #343a40; color: #fff; text-align: center; }
.history-grid .history-year-col { width: 70px; text-align: center; }
.history-grid td { vertical-align: top; padding: 0.2rem; min-width: 110px; }
.month-cell { display: flex; flex-direction: column; gap: 2px; }
.week-chip {
    display: flex;
    flex-direction: column;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.7rem;
    line-height: 1.1;
    cursor: default;
    color: #212529;
}
.week-chip .chip-day  { font-size: 0.65rem; color: #6c757d; }
.week-chip .chip-thema{ font-weight: bold; }

/* 凡例 (forecastHistory.html / 動的生成) */
.legend-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.legend-bar .legend-label { font-weight: bold; margin-right: 4px; }
.legend-item {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    color: #212529;
}
