@charset "UTF-8";
/* ============================================================
   report.new.css — 追加スタイル
   report.base.css / theme-classic.css はそのまま読み込み、
   ここでは期間指定欄・路線マップ・比較で増えた要素だけを定義する。
   ============================================================ */

/* ===== 集計期間の指定欄 =====
   エリア検索欄の「上」に置く。スマホでの視認性を考えて1枚のカードにする。 */
.period-bar{
  flex: 1 1 100%;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 14px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1.5px solid var(--hair-dark);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.period-bar .era-label{flex: 0 0 auto;}
.period-bar .filter-select{flex: 0 1 auto; max-width: 100%;}
.period-bar .filter-select:disabled{opacity: .6; cursor: progress;}
/* 開始月〜終了月の2つの選択欄と、直近3・6・12か月のショートカット */
.period-bar .period-month{flex: 0 1 220px; width: 220px;}
.period-bar .period-sep{font-size: 16px; font-weight: 700; color: var(--sub);}
.period-bar .period-quick{margin-left: auto;}
.period-bar .period-quick button{padding: 7px 14px; font-size: 13px;}
/* 比較の追加欄: 開始月〜終了月 */
.cmp-add-row .cmp-add-sel--pid{flex: 1 1 0;}
.cmp-add-tilde{font-size: 16px;}
.period-note{
  font-family: 'Noto Sans JP',system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size: 13px; line-height: 1.6;
  color: var(--muted);
}
.period-note:empty{display: none;}
.period-note.warn{color: var(--bad); font-weight: 700;}

@media (max-width:720px){
  .period-bar{
    /* ビュー切替タイルと同じく画面端まで届く一枚の帯にする */
    flex: 0 0 auto;
    width: calc(100% + var(--rep-pad) * 2);
    margin-inline: calc(-1 * var(--rep-pad));
    padding: 12px var(--rep-pad);
    border-radius: 0;
    border-inline: none;
    box-shadow: none;
  }
  .period-bar .era-label{font-size: 14px; letter-spacing: .02em; flex: 1 1 100%;}
  .period-bar .filter-select, .period-bar .period-month{flex: 1 1 0; width: auto; min-width: 0; text-align: left;}
  .period-bar .period-quick{flex: 1 1 100%; margin-left: 0; display: flex;}
  .period-bar .period-quick button{flex: 1 1 0; padding: 8px 4px;}
  .period-note{flex: 1 1 100%;}
  .cmp-add-row .cmp-add-sel--pid{flex: 1 1 0;}
  .cmp-add-tilde{display: inline;}
}

/* ===== 上部タブ(路線／地図／ランキング／比較) =====
   スマホのタイルはタブの数(路線の無い期間は3つ)で等分する */
@media (max-width:720px){
  .view-tabs{grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);}
}

/* ===== 路線マップ =====
   上部の「路線で見る」タブで、地図カードの中に詳細／簡易マップと排他で表示する。 */
.line-map{display: none;}
.map-card.lines .map-frame,
.map-card.lines .simple-map,
.map-card.lines .legend,
.map-card.lines .region-chips{display: none;}
.map-card.lines .line-map{display: block;}

.line-pick{display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;}
.line-pick .filter-select{flex: 1 1 auto; min-width: 0; max-width: 100%;}
.line-pick .line-view-seg{flex: 0 0 auto;}
/* スマホ以外は「路線を選ぶ」と表示切替を横一列に並べる
   (プルダウンは長い路線名でも折り返さず、残り幅に収めて縮める) */
@media (min-width:721px){
  .line-pick{flex-wrap: nowrap;}
  .line-pick .filter-select{flex: 0 1 460px; width: 460px;}
  .line-pick .line-view-seg{margin-left: auto;}
}

/* --- 見せ方A: 横型の路線図(駅看板風) ---
   上から「値 / 円 / 駅名(縦書き) / 件数」。路線の線は円の中心の高さに引く。 */
.line-diag{--lc: var(--accent);}
.ld-scroll{
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 0 8px;
  margin: 0 -4px;
}
.ld-inner{position: relative; display: flex; align-items: flex-start; width: max-content; min-width: 100%; padding: 0 10px;}
/* 線は先頭駅の中心〜末尾駅の中心まで(左右の余白 10px + 駅幅の半分 27px) */
.ld-rail{
  position: absolute; left: 37px; right: 37px;
  top: 44px; height: 8px; margin-top: -4px;
  border-radius: 4px;
  background: var(--lc);
}
.ld-st{
  position: relative;
  flex: 0 0 54px;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 0 6px;
  background: none; border: none;
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  transition: background .14s ease;
}
.ld-st:hover:not(:disabled){background: color-mix(in srgb, var(--accent) 8%, transparent);}
.ld-st:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -2px;}
.ld-st:disabled{cursor: default;}
.ld-st__val{
  height: 22px; line-height: 22px;
  font-size: 12px; font-weight: 700; color: var(--ink-strong);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ld-st__dotwrap{height: 44px; display: flex; align-items: center; justify-content: center;}
.ld-st__dot{
  position: relative; z-index: 1;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1.5px var(--lc), 0 1px 3px rgba(13,60,66,.25);
  transition: transform .14s ease, box-shadow .14s ease;
}
.ld-st:hover:not(:disabled) .ld-st__dot{transform: scale(1.12);}
.ld-st__name{
  writing-mode: vertical-rl;
  text-orientation: upright;
  margin-top: 8px;
  font-size: 14px; font-weight: 700; line-height: 1;
  letter-spacing: .06em;
  color: var(--ink-strong);
}
.ld-st__n{margin-top: 8px; font-size: 11px; color: var(--muted); white-space: nowrap;}
.ld-st.is-empty .ld-st__dot{box-shadow: 0 0 0 1.5px var(--hair-dark);}
.ld-st.is-empty .ld-st__name{color: var(--muted); font-weight: 500;}
.ld-st.sel{background: color-mix(in srgb, var(--accent) 12%, transparent);}
.ld-st.sel .ld-st__dot{box-shadow: 0 0 0 3px var(--accent-d), 0 0 0 7px color-mix(in srgb, var(--accent) 25%, transparent);}
.ld-st.sel .ld-st__name{color: var(--accent-d);}

/* 凡例(路線図・グラフ共通) */
.ld-legend{
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  margin-top: 10px;
  font-size: 12px; color: var(--sub);
}
.ld-legend__ramp{display: inline-flex; align-items: center; gap: 6px;}
.ld-legend__bar{display: inline-flex; border-radius: 3px; overflow: hidden;}
.ld-legend__bar i{display: block; width: 14px; height: 10px;}

/* --- 路線網 --- */
.ln-chips{display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;}
.ln-chips button{
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px;
  border: 1px solid var(--hair-dark); border-radius: 999px;
  background: var(--surface);
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.ln-chips button i{width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;}
.ln-chips button:hover{border-color: var(--accent); color: var(--accent-d);}
.ln-chips button.on{border: 2px solid #147d7d; padding: 0 11px; color: #147d7d;}
.ln-chips button:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px;}
/* 路線網は全幅(約1100px)前提の図。狭い画面では縮めすぎず横スクロールで見せる */
.line-net{width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;}
.ln-svg{display: block; width: 100%; min-width: 760px; height: auto; margin: 0 auto; font-family: 'Noto Sans JP', system-ui, sans-serif;}
.ln-svg circle[role="button"]:focus-visible{outline: none; stroke: #147d7d; stroke-width: 3;}
/* 路線網: 地図アプリ風の台紙(淡いティールの面＋方眼)。押せることが伝わるようにする */
.ln-stage{position: relative;}
.line-net{
  border: 1px solid var(--hair); border-radius: 14px;
  background-color: #eef6f6;
  background-image:
    linear-gradient(rgba(20,125,125,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,125,125,.07) 1px, transparent 1px);
  background-size: 28px 28px;
  background-attachment: local;   /* スマホの拡大表示で、方眼も図と一緒にスクロールさせる */
}
/* 左上の「駅を押すと詳細が出ます」。図の操作の邪魔をしないよう押しても反応しない */
.ln-hint{
  position: absolute; z-index: 2; left: 12px; top: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; padding: 6px 12px 6px 10px;
  border-radius: 999px; background: #ffffff;
  box-shadow: 0 2px 8px rgba(13,60,66,.18);
  font-size: 13px; font-weight: 700; color: #147d7d;
  pointer-events: none;
}
.ln-hint svg{flex-shrink: 0;}
/* 淡い線(ほかの路線)はマウスを載せると濃くなる */
.ln-svg .ln-rail__line{transition: opacity .15s ease;}
.ln-svg .ln-rail:not(.is-sel):hover .ln-rail__line{opacity: .75;}
/* 押せる駅はマウスを載せると大きくなる。選んだ路線の駅には影 */
.ln-svg .ln-st{transform-box: fill-box; transform-origin: center; transition: transform .15s ease;}
.ln-svg .ln-st:hover,
.ln-svg .ln-st:focus-visible{transform: scale(1.5);}
.ln-svg .ln-st--sel{filter: drop-shadow(0 1px 1.5px rgba(13,60,66,.35));}
@media (prefers-reduced-motion: reduce){
  .ln-svg .ln-rail__line, .ln-svg .ln-st{transition: none;}
}

/* 路線マップ表示中は、PCでも地図を全幅にして詳細(KPI・グラフ)を下に回す(1列) */
.rep-main.mode-lines{grid-template-columns: 1fr;}
@media (min-width:1121px){
  /* 全幅になったぶん、詳細のグラフは3列で並べる */
  .rep-main.mode-lines .charts{grid-template-columns: repeat(3, minmax(0, 1fr));}
  /* 路線網は図の実寸(1130px)まで広げる */
  .rep-main.mode-lines .ln-svg{max-width: 1130px;}
}

/* --- 沿線グラフ --- */
.lc-scroll{overflow-x: auto; -webkit-overflow-scrolling: touch;}
.lp-svg{display: block; font-family: 'Noto Sans JP', system-ui, sans-serif;}
.lp-svg rect[role="button"]:hover{fill: color-mix(in srgb, var(--accent) 8%, transparent);}
.lp-svg rect[role="button"]:focus-visible{outline: none; fill: color-mix(in srgb, var(--accent) 14%, transparent);}

/* --- 表 --- */
.lt-scroll{overflow-x: auto; -webkit-overflow-scrolling: touch;}
.lt{
  width: 100%; min-width: 520px;
  border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--hair); border-radius: var(--radius-s);
  font-size: 14px;
}
.lt caption{caption-side: top; text-align: left; font-size: 13px; font-weight: 700; color: var(--sub); padding: 0 0 8px;}
.lt th, .lt td{padding: 7px 10px; border-bottom: 1px solid var(--hair); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums;}
.lt thead th{background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--ink-strong);}
.lt th.st, .lt td.st{text-align: left;}
.lt td{font-family: 'Oswald', 'Noto Sans JP', sans-serif; font-size: 15px; color: var(--ink);}
.lt td.st{font-family: 'Noto Sans JP', system-ui, sans-serif; font-size: 14px; font-weight: 700; color: var(--ink-strong);}
.lt td small{font-family: 'Noto Sans JP', sans-serif; font-size: 11px; margin-left: 2px;}
.lt td.dark{color: #ffffff;}
.lt tbody tr:last-child td{border-bottom: none;}
.lt tbody tr[role="button"]{cursor: pointer;}
.lt tbody tr[role="button"]:hover td.st{color: #147d7d;}
.lt tbody tr:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px;}
.lt tr.is-empty td, .lt tr.is-empty td.st{color: var(--sub); font-weight: 400;}
.lt tr.sel td{border-top: 2px solid #147d7d; border-bottom: 2px solid #147d7d;}
.lt tr.sel td:first-child{border-left: 2px solid #147d7d; color: #147d7d;}
.lt tr.sel td:last-child{border-right: 2px solid #147d7d;}
/* セルの中身: 札(Max/Min)は左端、数値は右端にそろえる */
.lt-cell{display: flex; align-items: center; justify-content: flex-end; gap: 6px;}
.lt-cell .lt-tag{margin: 0 auto 0 0; vertical-align: 0;}
.lt-cell .lt-tag + .lt-tag{margin-left: 0;}
/* 最下行: 路線平均 */
.lt tfoot th, .lt tfoot td{background: var(--surface-2); border-top: 2px solid var(--hair-dark); border-bottom: none; color: var(--ink-strong); font-weight: 700;}
.lt tfoot th.st{font-family: 'Noto Sans JP', system-ui, sans-serif; font-size: 14px;}
/* Max・Min・参考値の札。濃い色のセルでは白地に反転 */
.lt-tag{
  display: inline-flex; align-items: center;
  height: 16px; padding: 0 6px; margin-left: 6px; vertical-align: 2px;
  border-radius: 999px;
  font-family: 'Noto Sans JP', sans-serif; font-size: 11px; font-weight: 700;
  background: #147d7d; color: #ffffff;
}
.lt-tag.on-dark{background: #ffffff; color: #147d7d;}
/* 「参考値」の札は目立たせない */
.lt td.st .lt-tag, .ld-legend .lt-tag{background: transparent; color: var(--sub); border: 1px solid #b7c6c6; font-weight: 400; margin-left: 8px;}
.ld-legend .lt-tag{margin-left: 0;}
.ld-legend .lt-tag.is-mm{background: #147d7d; color: #ffffff; border-color: #147d7d; font-weight: 700;}
.lt-legend-bar{border: 1px solid var(--hair);}
.lt-legend-bar i{width: 16px;}

@media (max-width:720px){
  .lt th, .lt td{padding: 6px 8px;}
  .lt td{font-size: 14px;}
  .lt td.st{font-size: 13px;}
}

/* 注記(仮データである旨など) */
.line-note{
  font-size: 12px; line-height: 1.7; color: var(--sub);
  margin: 14px 0 0;
}


/* ===== 比較の対象切替(エリア / 駅 / 路線) ===== */
.cmp-kind{
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--hair-dark);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 16px;
}
.cmp-kind button{
  padding: 9px 18px;
  font-family: 'Noto Sans JP',system-ui,-apple-system,"Segoe UI",sans-serif;
  font-size: 15px; font-weight: 700;
  color: var(--sub);
  background: transparent; border: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.cmp-kind button + button{border-left: 1px solid var(--hair);}
.cmp-kind button:hover{color: var(--accent-d);}
.cmp-kind button.on{background: var(--accent); color: #fff;}
.cmp-kind button:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px;}
@media (max-width:720px){
  /* スマホは枠いっぱいに3つ並べ、文字は画面幅に合わせて伸縮させて 320px でもはみ出さないようにする */
  .cmp-kind{display: flex; max-width: 100%;}
  .cmp-kind button{flex: 1 1 auto; min-width: 0; padding: 9px 12px; font-size: clamp(13px, 4.2vw, 15px);}
}

/* ===== 「対象 × 時期」の組み合わせ比較 ===== */
/* チップ: 対象名のあとに時期を小さく添える。名前の部分を押すと編集できる */
.cmp-chip-period{font-size: 13px; font-weight: 500; color: var(--sub);}
/* ×ボタン用の .cmp-chip button(21pxの丸)が効かないよう、詳細度を上げて打ち消す */
.cmp-chip{max-width: 100%;}
.cmp-chip .cmp-chip__edit{
  display: inline-flex; align-items: center; gap: 8px;
  flex-wrap: wrap; row-gap: 0; min-width: 0;
  width: auto; height: auto; border-radius: 4px;
  line-height: 1.4; text-align: left;
  padding: 0; border: none; background: transparent;
  font: inherit; color: inherit; cursor: pointer;
}
.cmp-chip .cmp-chip__edit:hover{background: transparent; color: var(--accent-d);}
.cmp-chip-period{white-space: nowrap;}
.cmp-chip__edit:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 4px;}
.cmp-chip.is-editing{border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);}
.cmp-add-row.is-editing{border-style: solid; border-color: var(--accent);}
.cmp-add-cancel{
  flex: 0 0 auto; border: none; background: transparent;
  padding: 8px 10px; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--sub);
  cursor: pointer; white-space: nowrap;
}
.cmp-add-cancel:hover{color: var(--accent-d);}
/* 「比較して見る」では項目ごとに時期を選ぶので、上部の集計期間は隠す(選んだ値は保持) */
.explore-bar.hide-period .period-bar{display: none;}

/* 追加欄: [対象] × [時期] [＋ 追加] を1行に並べ、淡い枠でひとまとまりに見せる */
.cmp-add-row{
  flex-basis: 100%;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 10px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 5%, #ffffff);
}
/* select は選択肢の文字幅まで広がろうとするので、width を 0 基準にして枠の幅に収める */
.cmp-add-row .cmp-add-sel{width: 0; max-width: none; min-width: 0; margin: 0; text-overflow: ellipsis;}
.cmp-add-row .cmp-add-sel--line{flex: 2 1 0;}
.cmp-add-row .cmp-add-sel--key{flex: 3 1 0;}
.cmp-add-row .cmp-add-sel--pid{flex: 2 1 0;}
.cmp-add-x{flex: 0 0 auto; font-size: 18px; font-weight: 700; color: var(--accent-d);}
.cmp-add-row .cmp-add-btn{flex: 0 0 auto; white-space: nowrap;}
@media (max-width:720px){
  /* スマホは縦積み: 路線 → 対象 → 開始月〜終了月 → 追加 の順に1列で並べ、画面幅からはみ出さない */
  .cmp-add-row{flex-wrap: wrap; gap: 8px; min-width: 0;}
  .cmp-add-row .cmp-add-sel--line,
  .cmp-add-row .cmp-add-sel--key{flex: 1 1 100%; width: 100%;}
  .cmp-add-x{display: none;}
  .cmp-add-row .cmp-add-sel--pid{flex: 1 1 0; width: 0;}
  .cmp-add-tilde{display: inline; flex: 0 0 auto;}
  .cmp-add-row .cmp-add-btn{flex: 1 1 100%;}
}
.cmp-add-btn{
  border: none;
  border-radius: 999px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background .15s ease;
}
.cmp-add-btn:hover{background: var(--accent-d);}
.cmp-add-btn:disabled{background: var(--hair-dark); color: var(--surface); cursor: default;}
.cmp-add-btn:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px;}

/* 期間が未配置だったときの注意書き */
.cmp-warn{
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--bad);
  border-radius: var(--radius-s);
  background: #fdecea;
  color: #b3261e;
  font-size: 14px; line-height: 1.7;
}

.cmp-dot{display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: middle;}

/* ===== 比較表(行=指標 / 列=項目) =====
   見出しは対象名の下に時期を小さく添える。選択中の指標の行を淡く強調する。 */
.cmp-table--items tr:first-child th small{display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--sub);}
.cmp-table--items tr.on th,
.cmp-table--items tr.on td{background: color-mix(in srgb, var(--accent) 9%, var(--surface));}
.cmp-table--items tr.on th:first-child{color: var(--ink-strong); font-weight: 700;}

/* 差の列 */
.cmp-table .cmp-delta-head{white-space: nowrap;}
.cmp-table td.cmp-delta{font-weight: 700; color: var(--accent-d);}

/* ===== 比較の横棒(選択中の指標のみ) ===== */
.cmp-bars-card{border-top: 1px solid var(--hair); padding-top: 16px;}
.cmp-bars-title{margin: 0 0 12px; font-size: 16px; font-weight: 700; color: var(--ink-strong);}
.cmp-bars{list-style: none; margin: 0; padding: 0; display: grid; gap: 12px;}
.cmp-bars li{display: grid; grid-template-columns: minmax(0, 220px) 1fr auto; align-items: center; column-gap: 14px;}
.cb-name{font-size: 15px; font-weight: 700; color: var(--ink-strong); line-height: 1.4;}
.cb-name small{display: block; margin-left: 17px; font-size: 12px; font-weight: 500; color: var(--sub);}
.cb-bar{height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden;}
.cb-bar i{display: block; height: 100%; border-radius: 6px;}
.cb-val{min-width: 7em; font-family: 'Oswald','Noto Sans JP',sans-serif; font-size: 19px; font-weight: 600; color: var(--ink-strong); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;}
@media (max-width:720px){
  .cmp-bars li{grid-template-columns: 1fr auto; grid-template-areas: "name val" "bar bar"; row-gap: 6px;}
  .cb-name{grid-area: name;}
  .cb-bar{grid-area: bar;}
  .cb-val{grid-area: val; min-width: 0; font-size: 17px;}
}

/* ===== 路線マップのスマホ版(720px以下) =====
   ・「エリアで見る／路線で見る」で、スマホからも路線マップに入れるようにする
   ・4つの見せ方を横スクロールのない形にする
     路線図=駅を縦に並べる / 沿線グラフ=横棒 / 表=選んでいる指標と件数の2列 / 路線網=選んだ路線に寄せる
   ・駅を選ぶと、詳細欄へ飛ばずに下からシートを出す
   PC(721px以上)の見た目は変えない。スマホ専用の部品は PC では出さない。 */
.map-style-tabs .ms-sp{display: none;}
.line-select__bar, .line-select__sub{display: none;}
@media (min-width:721px){
  /* PC は select がそのまま横一列に並ぶ(今までどおり) */
  .line-select{display: contents;}
}
.ld-vlist, .lp-bars, .ld-legend--sp, .lt-sort, .lt-spnote, .ln-zoom, .st-sheet{display: none;}

@media (max-width:720px){
  /* --- エリアで見る／路線で見る --- */
  .map-style-tabs{
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    padding: 4px; margin-bottom: 16px;
    border: 1px solid var(--hair-dark); border-radius: 999px;
    background: var(--surface);
  }
  /* 路線データの無い期間は「エリア」1択になるので出さない */
  .map-style-tabs:not(:has(button[data-style="lines"])){display: none;}
  .map-style-tabs button[data-style="geo"]{display: none;}
  .map-style-tabs button{
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 8px;
    border: none; border-radius: 999px; background: transparent;
    font-size: 15px; color: var(--sub);
  }
  .map-style-tabs button.on,
  .map-style-tabs button.on-sp{background: #147d7d; color: #ffffff;}
  .map-style-tabs .ms-pc{display: none;}
  .map-style-tabs .ms-sp{display: inline;}

  /* --- 路線を選ぶ(路線色の帯＋データのある駅数) --- */
  .line-pick{display: block;}
  .line-pick > .era-label{display: block; margin-bottom: 6px; font-size: 13px;}
  .line-select{
    position: relative; display: flex; align-items: center;
    min-height: 56px;
    border: 1.5px solid var(--hair-dark); border-radius: 12px;
    background: var(--surface);
  }
  .line-select:focus-within{border-color: var(--accent);}
  .line-select__bar{
    display: block; position: absolute; left: 14px; top: 50%;
    width: 6px; height: 28px; margin-top: -14px;
    border-radius: 3px; background: var(--lc); pointer-events: none;
  }
  .line-pick .line-select .filter-select{
    flex: 1 1 auto; width: 100%; max-width: none; min-height: 54px;
    padding-left: 30px; border: none; border-radius: 12px;
    background-color: transparent;
  }
  .line-select__sub{display: block; margin: 6px 2px 0; font-size: 12px; color: var(--sub);}

  /* --- 見せ方の切替: 4等分。路線図 → 沿線グラフ → 表 → 路線網 の順 --- */
  .line-pick .line-view-seg{
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px;
    width: 100%; margin-top: 14px; padding: 3px;
    border: none; border-radius: 10px; background: var(--surface-2);
  }
  .line-view-seg button{min-height: 40px; padding: 0 2px; border-radius: 8px; font-size: 13px;}
  .line-view-seg button.on{background: #ffffff; color: #147d7d; box-shadow: 0 1px 3px rgba(13,60,66,.18);}
  .line-view-seg button[data-view="diagram"]{order: 1;}
  .line-view-seg button[data-view="profile"]{order: 2;}
  .line-view-seg button[data-view="table"]{order: 3;}
  .line-view-seg button[data-view="network"]{order: 4;}

  /* --- 路線図: 駅を縦に並べる --- */
  .line-diag .ld-scroll{display: none;}
  .ld-vlist{display: block; padding-top: 6px; border-top: 1px solid var(--hair);}
  .ld-row{
    position: relative; display: flex; align-items: center; gap: 10px;
    width: 100%; min-height: 56px; padding: 0 6px 0 0;
    border: none; border-radius: 10px; background: none;
    font-family: inherit; text-align: left; color: var(--ink);
  }
  button.ld-row:hover{background: color-mix(in srgb, var(--accent) 6%, transparent);}
  .ld-row:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px;}
  .ld-row.sel{background: #e8f6f6;}
  .ld-row__rail{position: absolute; left: 19px; top: 0; bottom: 0; width: 6px; background: var(--lc);}
  .ld-row.is-first .ld-row__rail{top: 50%;}
  .ld-row.is-last .ld-row__rail{bottom: 50%;}
  .ld-row__dotwrap{position: relative; z-index: 1; flex: 0 0 44px; display: flex; align-items: center; justify-content: center;}
  .ld-row__dot{
    display: block; border-radius: 50%;
    background: #ffffff; border: 3px solid #ffffff;
    box-shadow: 0 0 0 1.5px var(--lc), 0 1px 3px rgba(13,60,66,.25);
  }
  .ld-row.is-empty .ld-row__dot{border: none; box-shadow: 0 0 0 2px #b7c6c6;}
  .ld-row.sel .ld-row__dot{box-shadow: 0 0 0 3px #147d7d, 0 1px 3px rgba(13,60,66,.25);}
  .ld-row__name{flex: 1 1 auto; min-width: 0; font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--ink-strong);}
  .ld-row.is-empty .ld-row__name{font-size: 15px; font-weight: 400; color: var(--sub);}
  .ld-row.sel .ld-row__name{color: #147d7d;}
  .ld-row__val{
    font-family: 'Oswald','Noto Sans JP',sans-serif; font-size: 18px; font-weight: 600;
    color: var(--ink-strong); white-space: nowrap; font-variant-numeric: tabular-nums;
  }
  .ld-row__val small{margin-left: 3px; font-family: 'Noto Sans JP',sans-serif; font-size: 12px; font-weight: 400; color: var(--sub);}
  .ld-row__n{min-width: 30px; font-size: 12px; text-align: right; white-space: nowrap; color: var(--sub);}
  .ld-row__go{display: flex; color: #9fb0b0;}
  .ld-row.sel .ld-row__go{color: #147d7d;}
  .ld-row__none{margin-right: 22px; font-size: 12px; color: var(--sub);}

  /* --- 沿線グラフ: 横棒を路線の順に並べる --- */
  .line-profile .lc-scroll, .ld-legend--pc{display: none;}
  .ld-legend--sp{display: flex;}
  .lp-bars{display: block; padding-top: 10px; border-top: 1px solid var(--hair);}
  /* 列幅は px で固定(button と div で文字サイズが違っても縦の線がずれないように) */
  .lp-bars__head, .lp-row{display: grid; grid-template-columns: 78px minmax(0, 1fr) 40px; align-items: center; font-size: 13px;}
  .lp-bars__head{margin-bottom: 4px; font-size: 11px; font-weight: 700; color: var(--sub);}
  .lp-bars__head > span:last-child{text-align: right;}
  .lp-bars__axis{position: relative; height: 34px;}
  .lp-bars__axis span{position: absolute; bottom: 0; transform: translateX(-50%); font-weight: 400; white-space: nowrap;}
  .lp-bars__axis span.is-first{transform: none;}
  .lp-bars__axis span.is-last{transform: translateX(-100%);}
  .lp-bars__axis em{position: absolute; top: 0; transform: translateX(-50%); font-style: normal; white-space: nowrap; color: #424242;}
  .lp-row{
    width: 100%; min-height: 36px; padding: 0;
    border: none; background: none;
    font-family: inherit; text-align: left; color: var(--ink);
  }
  button.lp-row:hover .lp-row__name{color: #147d7d;}
  .lp-row:focus-visible{outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -2px;}
  .lp-row.sel{background: #e8f6f6;}
  .lp-row__name{padding-right: 8px; font-size: 13px; font-weight: 700; line-height: 1.25; text-align: right; color: var(--ink-strong); overflow-wrap: anywhere;}
  .lp-row.is-empty .lp-row__name{font-weight: 400; color: var(--sub);}
  .lp-row.sel .lp-row__name{color: #147d7d;}
  .lp-row__track{position: relative; align-self: stretch; min-height: 36px;}
  .lp-bars__grid{position: absolute; inset: 0;}
  .lp-bars__grid i{position: absolute; top: 0; bottom: 0; width: 1px; background: var(--hair);}
  .lp-bars__grid b{position: absolute; top: 0; bottom: 0; z-index: 1; border-left: 2px dashed #424242;}
  .lp-row__bar{position: absolute; left: 0; top: 50%; height: 18px; margin-top: -9px; border-radius: 0 4px 4px 0;}
  .lp-row__bar.is-ref{opacity: .45;}
  .lp-row__val,
  .lp-row__none{
    position: absolute; z-index: 2; top: 50%; transform: translateY(-50%);
    padding: 0 3px; border-radius: 3px; background: #ffffff; white-space: nowrap;
  }
  .lp-row__val{font-family: 'Oswald','Noto Sans JP',sans-serif; font-size: 13px; font-weight: 600; color: var(--ink-strong);}
  .lp-row__none{left: 6px; font-size: 11px; color: var(--sub);}
  .lp-row__n{font-size: 12px; text-align: right; color: var(--sub);}

  /* --- 表: 選んでいる指標と件数の2列にしぼり、並び順を選べるようにする --- */
  .lt-sort{display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px;}
  .lt-sort .era-label{font-size: 13px;}
  .lt-sort .sm-seg button{padding: 8px 14px; font-size: 13px;}
  .lt{min-width: 0;}
  .lt th.lt-k:not(.lt-cur):not(.lt-n),
  .lt td.lt-k:not(.lt-cur):not(.lt-n){display: none;}
  .lt-spnote{display: block;}

  /* --- 路線網: 路線はプルダウンで選ぶ。図は駅名が読める倍率で描き、枠の中でスクロール --- */
  /* 路線は上の「路線を選ぶ」で選ぶので、路線ボタン(横スクロール)は出さない */
  .ln-chips{display: none;}
  /* 拡大表示: 高さを画面の6割(最大480px)にした枠の中で上下左右にスクロール */
  .line-net.is-pan{height: min(62vh, 480px); overflow: auto;}   /* 枠と台紙は共通の .line-net の指定を使う */
  .line-net.is-pan .ln-svg{min-width: 0; max-width: none; margin: 0;}
  /* 全体表示: 画面幅に収める */
  .line-net.is-fit .ln-svg{min-width: 0;}
  .ln-zoom-row{display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px;}
  .ln-zoom-hint{font-size: 12px; color: var(--sub); flex: 1 1 160px;}
  /* ＋／−ボタン(地図の拡大縮小と同じ見た目)。ピンチは touch-action で横スクロールと両立させる */
  .ln-zoom-ctl{display: flex; gap: 6px; margin-left: auto;}
  .ln-zoom-btn{
    width: 40px; height: 40px;
    border: 1px solid var(--hair-dark); border-radius: 50%; background: var(--surface);
    font-size: 18px; font-weight: 700; color: var(--ink-strong); line-height: 1;
  }
  .line-net.is-pan{touch-action: pan-x pan-y;}
  .ln-zoom{
    display: inline-flex; align-items: center;
    min-height: 40px; padding: 0 16px;
    border: 1px solid var(--hair-dark); border-radius: 999px; background: var(--surface);
    font-size: 14px; font-weight: 700; color: var(--ink-strong);
  }

  /* --- 駅を選んだとき: 下からのシート --- */
  .st-sheet{
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    max-height: 80vh; overflow-y: auto; overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 20px 20px 0 0; background: #ffffff;
    box-shadow: 0 -8px 28px rgba(13,60,66,.22);
    font-family: 'Noto Sans JP',system-ui,sans-serif; color: var(--ink);
  }
  .st-sheet[hidden]{display: none;}
  .st-sheet__handle{display: block; width: 40px; height: 4px; margin: 10px auto 0; border-radius: 999px; background: #d9d9d4;}
  .st-sheet__head{display: flex; align-items: center; gap: 10px; padding: 8px 6px 10px 18px;}
  .st-sheet__bar{flex: 0 0 6px; height: 34px; border-radius: 3px; background: var(--lc);}
  .st-sheet__titles{flex: 1 1 auto; min-width: 0;}
  .st-sheet__title{margin: 0; font-size: 20px; font-weight: 700; line-height: 1.4; color: var(--ink-strong); outline: none;}
  .st-sheet__sub{margin: 0; font-size: 12px; line-height: 1.5; color: var(--sub);}
  .st-sheet__close{
    flex: 0 0 48px; display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border: none; background: none; color: var(--ink-strong);
  }
  .st-sheet__body{padding: 0 16px 18px;}
  .st-sheet__kpis{display: grid; grid-template-columns: 1fr 1fr; gap: 8px;}
  .st-kpi{padding: 10px 12px; border-radius: 10px; background: var(--surface-2);}
  .st-kpi.is-cur{background: #e8f6f6;}
  .st-kpi p{margin: 0;}
  .st-kpi__label{font-size: 12px; font-weight: 700; color: var(--sub);}
  .st-kpi__val{margin-top: 2px !important; white-space: nowrap;}
  .st-kpi__val strong{font-family: 'Oswald','Noto Sans JP',sans-serif; font-size: 20px; font-weight: 600; color: var(--ink-strong);}
  .st-kpi.is-cur .st-kpi__val strong{font-size: 24px; color: #147d7d;}
  .st-kpi__val small{margin-left: 2px; font-size: 12px; color: var(--sub);}
  .st-kpi__note{font-size: 11px; color: var(--sub);}
  .st-sheet__more{
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 50px; margin-top: 12px;
    border: none; border-radius: 999px; background: #147d7d;
    font-size: 15px; font-weight: 700; color: #ffffff;
  }
  .st-sheet__nav{display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px;}
  .st-sheet__step{
    display: flex; align-items: center; gap: 4px;
    min-height: 44px; padding: 0 12px;
    border: 1px solid var(--hair-dark); border-radius: 10px; background: #ffffff;
    font-size: 14px; font-weight: 700; color: var(--ink-strong);
  }
  .st-sheet__step.is-next{justify-content: flex-end;}
  .st-sheet__step svg{flex-shrink: 0; color: var(--sub);}
  .st-sheet__step:disabled{font-size: 12px; font-weight: 400; color: var(--sub); cursor: default;}
}

/* ===== 読み込み中の表示 ===== */
/* 回るしるし */
@keyframes nzSpin{to{transform: rotate(360deg);}}
@keyframes nzShimmer{from{background-position: 100% 0;} to{background-position: -100% 0;}}
@keyframes nzFade{from{opacity: .25;} to{opacity: 1;}}
@keyframes nzPulse{50%{opacity: .6;}}
.nz-spin,
.empty-state.is-loading::before,
.cmp-add-btn.is-loading::before{
  content: ''; display: inline-block; flex-shrink: 0;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  animation: nzSpin .8s linear infinite;
}
/* 起動前: HTMLに置いた表示(起動すると消える)。下にタブと地図の形を淡く出す */
.rep-loading{display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 0 32px;}
.rep-loading__msg{display: inline-flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; font-weight: 700; color: var(--sub);}
.rep-loading__sk{width: 100%; display: grid; gap: 14px;}
.rep-loading__sk span{
  display: block; height: 72px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-2) 25%, #ffffff 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: nzShimmer 1.4s ease-in-out infinite;
}
.rep-loading__sk span + span{height: 360px;}
/* 比較の初回読み込み */
.empty-state.is-loading{display: flex; align-items: center; justify-content: center; gap: 10px;}
/* 比較の追加ボタン(まだ読んでいない期間を追加するとき) */
.cmp-add-btn.is-loading{display: inline-flex; align-items: center; gap: 8px;}
.cmp-add-btn.is-loading::before{width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #ffffff;}
/* 期間の切替中: 表示中の内容を薄くし、上に「読み込み中」を重ねる */
.rep-main.is-busy{position: relative;}
.rep-main.is-busy > *{opacity: .4; pointer-events: none; transition: opacity .15s ease;}
.rep-main.is-busy::after{
  content: 'データを読み込み中…';
  position: absolute; z-index: 5; top: 48px; left: 50%; transform: translateX(-50%);
  padding: 10px 22px; border-radius: 999px;
  background: #ffffff; box-shadow: var(--card-shadow);
  font-size: 15px; font-weight: 700; color: var(--accent-d);
  animation: nzPulse 1.2s ease-in-out infinite;
}
/* タブ・路線・表示方法の切替: 中身を短くフェードインさせ、切り替わったことを伝える */
.view-panel.on,
.line-map > :not(.line-pick){animation: nzFade .2s ease-out;}
@media (prefers-reduced-motion: reduce){
  .nz-spin, .empty-state.is-loading::before, .cmp-add-btn.is-loading::before,
  .rep-loading__sk span, .rep-main.is-busy::after,
  .view-panel.on, .line-map > :not(.line-pick){animation: none;}
}