/* 日本の鉄道史 ─ 共通スタイル
 * 見た目のモチーフ：発車標（LED）・駅名標・時刻表の罫線・方向幕 */
:root {
  --bg: #e9ebe8; --paper: #fbfaf6; --paper-2: #f3f2ec; --ink: #16181d; --ink-2: #4a505a; --ink-3: #7d838d;
  --line: #d3d6da; --line-2: #b9bdc3;
  --led-bg: #0a0c0f; --led-off: #1f1a12; --led: #ffab1a; --led-g: #62f07c; --led-r: #ff5a3c;
  --panel: #14171c; --panel-2: #1d2128; --panel-ink: #e8eaee; --panel-dim: #8b929c;
  --sea: #cad8e2; --land: #f4f2ea; --land-line: #c9c3b3; --ctx: #e2e0d8; --ctx-line: #cfcbbf;
  --accent: #0d5fbf; --warn: #c8352c;
  --r: 6px; --gut: 16px;
  --sans: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: "BIZ UDGothic", "Consolas", "Menlo", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013; --paper: #171a1f; --paper-2: #1d2127; --ink: #eceef1; --ink-2: #b3b9c2; --ink-3: #7b828c;
    --line: #2b3038; --line-2: #3b414b; --sea: #0f1820; --land: #1f242b; --land-line: #3a414b; --ctx: #191d22; --ctx-line: #2c3139;
    --accent: #5aa2ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013; --paper: #171a1f; --paper-2: #1d2127; --ink: #eceef1; --ink-2: #b3b9c2; --ink-3: #7b828c;
  --line: #2b3038; --line-2: #3b414b; --sea: #0f1820; --land: #1f242b; --land-line: #3a414b; --ctx: #191d22; --ctx-line: #2c3139;
  --accent: #5aa2ff; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.6; font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── ヘッダー：発車標の筐体 ── */
.hd { background: var(--panel); color: var(--panel-ink); border-bottom: 3px solid #000; box-shadow: inset 0 -1px 0 #2a2f37; position: relative; z-index: 5; }
.hd-in { display: flex; align-items: center; gap: 14px; padding: 8px var(--gut); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; background: #f1ecdc; display: grid; place-items: center; flex: none; box-shadow: inset 0 -9px 0 #1d3e8a, 0 0 0 2px #000; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-t b { font-size: 17px; letter-spacing: .06em; }
.brand-t small { color: var(--panel-dim); font-size: 11px; letter-spacing: .08em; }
.hd-sp { flex: 1; }
.hd-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.hd-nav a, .hd-btn { color: var(--panel-ink); text-decoration: none; font-size: 12px; padding: 5px 10px; border: 1px solid #39404a; border-radius: 4px; background: var(--panel-2); cursor: pointer; }
.hd-nav a:hover, .hd-btn:hover { border-color: #6a7380; }
.hd-nav a.on { background: #f1ecdc; color: #111; border-color: #f1ecdc; }

/* ── LED 表示（ドットマトリクス） ── */
.led { background: var(--led-bg); border-radius: 4px; padding: 6px 10px; box-shadow: inset 0 0 0 1px #000, inset 0 2px 8px rgba(0, 0, 0, .8), 0 0 0 3px #262b33; display: inline-flex; align-items: center; gap: 10px; }
.led canvas { display: block; image-rendering: pixelated; }
.led-lab { color: #7f6a45; font-size: 10px; letter-spacing: .1em; writing-mode: horizontal-tb; }

/* ── レイアウト ── */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr); height: calc(100vh - 58px - 150px); min-height: 460px; }
.mapwrap { position: relative; background: var(--sea); overflow: hidden; }
#map { width: 100%; height: 100%; display: block; cursor: grab; }
#map:active { cursor: grabbing; }
.side { background: var(--paper); border-left: 1px solid var(--line); overflow-y: auto; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .mapwrap { height: 62vh; min-height: 380px; }
  .side { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
}

/* 地図 */
.land { fill: var(--land); stroke: var(--land-line); stroke-width: .6; vector-effect: non-scaling-stroke; }
.ctx { fill: var(--ctx); stroke: var(--ctx-line); stroke-width: .5; vector-effect: non-scaling-stroke; }
.grat { fill: none; stroke: rgba(80, 110, 130, .12); stroke-width: .6; vector-effect: non-scaling-stroke; }
.sec-case { fill: none; stroke: var(--paper); stroke-linecap: round; stroke-linejoin: round; }
.sec { fill: none; stroke-linecap: round; stroke-linejoin: round; transition: stroke .3s; }
.sec.mini { stroke-linecap: butt; }
.sec.ghost { stroke: var(--ink-3) !important; opacity: .25; stroke-dasharray: 2 4; }
.sec.new { animation: grow 1.6s ease-out; }
@keyframes grow { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.plan { fill: none; stroke-linecap: round; }
.plan.building { stroke-dasharray: 7 5; animation: flow 1.2s linear infinite; opacity: .85; }
.plan.planned { stroke-dasharray: 2 5; opacity: .7; }
.plan.basic { stroke: var(--ink-2); stroke-dasharray: 2 5; opacity: .55; }
.sec.seibi { opacity: .75; stroke-linecap: round; }
@keyframes flow { to { stroke-dashoffset: -12; } }
.stn { fill: #fff; stroke: #1b1d22; cursor: pointer; }
.stn.big { fill: #fff; }
.stn:hover { fill: #ffe14a; }
.stn-lab { font-size: 11px; fill: var(--ink); paint-order: stroke; stroke: var(--land); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; font-weight: 600; }
.stn-lab.minor { font-size: 9.5px; font-weight: 400; fill: var(--ink-2); }
.ping { fill: none; stroke: var(--warn); stroke-width: 2; animation: ping 1.8s ease-out infinite; pointer-events: none; vector-effect: non-scaling-stroke; }
@keyframes ping { from { r: 3; opacity: 1; } to { r: 22; opacity: 0; } }
.map-ctl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-ctl button { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; font-size: 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.map-mode { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; max-width: calc(100% - 70px); }
.seg-btns { display: inline-flex; background: var(--paper); border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); flex-wrap: wrap; }
.seg-btns button { border: 0; background: none; padding: 5px 10px; font-size: 12px; cursor: pointer; border-right: 1px solid var(--line); }
.seg-btns button:last-child { border-right: 0; }
.seg-btns button.on { background: var(--ink); color: var(--paper); }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; background: var(--paper); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 9px; cursor: pointer; width: max-content; }
.legend { position: absolute; left: 10px; bottom: 10px; background: color-mix(in srgb, var(--paper) 92%, transparent); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 9px; font-size: 11px; max-width: min(360px, calc(100% - 20px)); }
.leg-t { border: 0; background: none; padding: 0; font-size: 11px; font-weight: 700; cursor: pointer; color: var(--ink-2); letter-spacing: .1em; }
.legend.min .leg-b { display: none; }
.legend .row { display: flex; flex-wrap: wrap; gap: 3px 10px; }
.legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.legend .ramp { height: 8px; width: 150px; border-radius: 2px; background: linear-gradient(90deg, #3b6fb6, #37a37a, #e9c12b, #e5752a, #c8243a); display: inline-block; vertical-align: middle; }

/* ── 駅名標のツールチップ ── */
.tip { position: absolute; pointer-events: none; z-index: 20; transform: translate(-50%, calc(-100% - 14px)); filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .25)); }
.ekimei { background: #fff; color: #111; border: 1px solid #aaa; border-radius: 3px; min-width: 210px; text-align: center; overflow: hidden; font-family: var(--sans); }
.ekimei .kanji { font-size: 22px; font-weight: 700; letter-spacing: .12em; padding: 6px 12px 0; line-height: 1.2; }
.ekimei .kana { font-size: 11px; letter-spacing: .15em; color: #333; }
.ekimei .bar { height: 7px; margin-top: 4px; }
.ekimei .nb { display: flex; justify-content: space-between; font-size: 10px; padding: 2px 6px 4px; color: #333; gap: 10px; }
.ekimei .meta { font-size: 10px; color: #555; padding: 0 8px 5px; border-top: 1px solid #eee; }

/* ── サイドパネル ── */
.sp-sec { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sp-h { font-size: 11px; letter-spacing: .14em; color: var(--ink-3); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.sp-h::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.board { background: var(--led-bg); border-radius: 6px; padding: 10px 12px; box-shadow: inset 0 0 0 1px #000, 0 0 0 3px #262b33; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; }
.board .bl { color: #9a8358; font-size: 11px; letter-spacing: .08em; }
.lines-list { display: flex; flex-direction: column; gap: 4px; }
.ll-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; text-decoration: none; color: inherit; padding: 3px 4px; border-radius: 4px; }
.ll-row:hover { background: var(--paper-2); }
.ll-row.off { opacity: .35; }
.ll-row i { width: 12px; height: 12px; border-radius: 2px; }
.ll-bar { grid-column: 2 / 4; height: 4px; background: var(--paper-2); border-radius: 2px; overflow: hidden; margin-top: -2px; }
.ll-bar b { display: block; height: 100%; }
.maku-list { display: flex; flex-wrap: wrap; gap: 5px; }
.maku { background: #111; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .12em; padding: 3px 9px; border-radius: 2px; border-bottom: 3px solid var(--mc, #888); box-shadow: inset 0 1px 0 #333; }
.cars-list { display: flex; flex-direction: column; gap: 6px; }
.car-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: center; font-size: 12px; }
.car-row svg { width: 130px; height: auto; display: block; }
.car-row small { color: var(--ink-3); display: block; line-height: 1.3; }
.fast { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 12.5px; }
.fast b { font-family: var(--mono); font-size: 14px; }
.fast small { grid-column: 1 / 3; color: var(--ink-3); margin-top: -3px; margin-bottom: 4px; }
.evs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ev { display: grid; grid-template-columns: 76px 1fr; gap: 8px; font-size: 12.5px; cursor: pointer; padding: 3px 4px; border-radius: 4px; }
.ev:hover { background: var(--paper-2); }
.ev .d { font-family: var(--mono); color: var(--ink-2); font-size: 11.5px; }
.ev.now { background: color-mix(in srgb, var(--led) 18%, transparent); }
.cat { display: inline-block; font-size: 10px; padding: 0 5px; border-radius: 2px; color: #fff; margin-right: 4px; vertical-align: 1px; letter-spacing: .05em; }

/* ── 年表（タイムライン） ── */
.tl { background: var(--panel); color: var(--panel-ink); height: 150px; display: grid; grid-template-columns: auto minmax(0, 1fr); border-top: 3px solid #000; }
.tl-ctl { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-right: 1px solid #2a2f37; justify-content: center; }
.tl-ctl .row { display: flex; gap: 6px; align-items: center; }
.tl-b { width: 34px; height: 30px; border-radius: 4px; border: 1px solid #39404a; background: var(--panel-2); color: var(--panel-ink); cursor: pointer; font-size: 13px; }
.tl-b.play { width: 46px; background: #f1ecdc; color: #111; border-color: #f1ecdc; font-weight: 700; }
.tl-ctl select, .tl-ctl input[type=date] { background: var(--panel-2); color: var(--panel-ink); border: 1px solid #39404a; border-radius: 4px; font: inherit; font-size: 12px; padding: 3px 5px; color-scheme: dark; }
#tl-svg { width: 100%; height: 100%; display: block; cursor: pointer; touch-action: none; }
.tl-era { font-size: 10px; fill: #8b929c; letter-spacing: .1em; }
.tl-ax text { font-size: 10px; fill: #8b929c; }
.tl-ax line { stroke: #2d333b; }
.tl-cur line { stroke: var(--led); stroke-width: 2; }
.tl-cur rect { fill: var(--led); }
.tl-cur text { font-size: 11px; fill: #111; font-weight: 700; font-family: var(--mono); }
@media (max-width: 700px) { .tl { grid-template-columns: 1fr; height: auto; } .tl-ctl { flex-direction: row; flex-wrap: wrap; border-right: 0; } #tl-svg { height: 120px; } }

/* ── 下のタブ ── */
.tabs { background: var(--paper); border-top: 1px solid var(--line); }
.tab-bar { display: flex; gap: 0; border-bottom: 2px solid var(--ink); padding: 0 var(--gut); overflow-x: auto; background: var(--paper-2); position: sticky; top: 0; z-index: 3; }
.tab-bar button { border: 0; background: none; padding: 10px 16px; cursor: pointer; font-weight: 700; letter-spacing: .08em; color: var(--ink-2); border-bottom: 4px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab-bar button.on { color: var(--ink); border-bottom-color: var(--ink); }
.tab-body { padding: 18px var(--gut) 40px; max-width: 1180px; margin: 0 auto; }
.tab-body h2 { font-size: 18px; letter-spacing: .08em; margin: 0 0 4px; }
.tab-body .sub { color: var(--ink-3); font-size: 12px; margin: 0 0 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.fchip { border: 1px solid var(--line-2); background: var(--paper); border-radius: 999px; padding: 3px 11px; font-size: 12px; cursor: pointer; }
.fchip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* 時刻表風の表 */
table.jk { border-collapse: collapse; width: 100%; font-size: 13px; background: var(--paper); }
table.jk th, table.jk td { border: 1px solid var(--line-2); padding: 4px 8px; text-align: left; vertical-align: top; }
table.jk thead th { background: var(--ink); color: var(--paper); font-weight: 700; letter-spacing: .08em; font-size: 12px; }
table.jk td.n { text-align: right; font-family: var(--mono); white-space: nowrap; }
table.jk tr:nth-child(even) td { background: var(--paper-2); }
table.jk tr.sel td { background: color-mix(in srgb, var(--led) 22%, var(--paper)); }
.tbl-wrap { overflow-x: auto; }
.chron td.d { white-space: nowrap; font-family: var(--mono); width: 92px; }
.chron td.t b { display: block; }
.chron td.t small { color: var(--ink-2); display: block; }
.srcmark { font-size: 10px; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 4px; margin-left: 6px; white-space: nowrap; }

/* 路線カード */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lcard { display: block; text-decoration: none; color: inherit; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.lcard:hover { border-color: var(--ink-2); }
.lcard .top { height: 8px; }
.lcard .body { padding: 10px 12px; }
.lcard b { font-size: 16px; letter-spacing: .06em; }
.lcard .meta { font-size: 12px; color: var(--ink-2); }
.lcard .strip { margin-top: 8px; }

/* 車両図鑑 */
.gantt { width: 100%; overflow-x: auto; }
.gantt svg { display: block; min-width: 820px; }
.gantt text { font-size: 11px; fill: var(--ink); }
.gantt .g-ax text { fill: var(--ink-3); font-size: 10px; }
.gantt .g-ax line { stroke: var(--line); }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 16px; }
.vcard { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; }
.vcard .hd2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.vcard b { font-size: 16px; }
.vcard .spec { font-size: 11.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 2px 12px; }
.vcard p { font-size: 12.5px; margin: 6px 0 0; }
.vcard .sil { background: linear-gradient(#dfe7ee, #eef2f5 70%, #b9b3a6 70%, #b9b3a6 74%, #8c867a 74%); border-radius: 4px; padding: 10px 6px 4px; margin: 6px 0; }
:root[data-theme="dark"] .vcard .sil { background: linear-gradient(#26303a, #2c3540 70%, #4c4a44 70%, #4c4a44 74%, #33322e 74%); }

/* 速さのグラフ */
.chart { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: var(--ink-2); }
.chart .ax line, .chart .ax path { stroke: var(--line-2); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .charts { grid-template-columns: 1fr; } }

.foot { padding: 20px var(--gut) 40px; color: var(--ink-3); font-size: 12px; text-align: center; background: var(--bg); }
.note { font-size: 12px; color: var(--ink-2); background: var(--paper-2); border-left: 4px solid var(--line-2); padding: 8px 12px; border-radius: 0 4px 4px 0; }
.kbd { font-family: var(--mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; font-size: 11px; }
/* 走る列車 */
.trains .tr { pointer-events: auto; cursor: help; }
.trains .tr-body { filter: drop-shadow(0 0 1.5px rgba(0,0,0,.55)); }
/* 検索窓（ヘッダー） */
.srch { position: relative; display: inline-flex; align-items: center; }
.srch input { width: 190px; background: var(--panel-2); color: var(--panel-ink); border: 1px solid #39404a; border-radius: 4px; padding: 5px 26px 5px 9px; font: inherit; font-size: 12.5px; }
.srch input:focus { outline: 2px solid #ffab1a; outline-offset: 0; width: 240px; }
.srch kbd { position: absolute; right: 7px; font-family: var(--mono); font-size: 10px; color: var(--panel-dim); border: 1px solid #39404a; border-radius: 3px; padding: 0 4px; pointer-events: none; }
.srch-res { position: absolute; top: calc(100% + 6px); right: 0; width: min(420px, 92vw); max-height: 70vh; overflow-y: auto; background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); z-index: 50; }
.srch-it { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 6px 10px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.srch-it b { font-size: 14px; }
.srch-it small { grid-column: 2; color: var(--ink-3); font-size: 11px; }
.srch-it.on, .srch-it:hover { background: color-mix(in srgb, #ffab1a 22%, var(--paper)); }
.srch-k { grid-row: 1 / 3; align-self: center; font-size: 10px; padding: 1px 6px; border-radius: 3px; color: #fff; background: #6b6f78; letter-spacing: .05em; min-width: 56px; text-align: center; }
.srch-k.k0 { background: #1c2e5a; } .srch-k.k1 { background: #2e8b57; } .srch-k.k2 { background: #b8763a; } .srch-k.k3 { background: #1f5fbf; } .srch-k.k4 { background: #1c8ad1; } .srch-k.k5 { background: #8a5bb0; } .srch-k.k6 { background: #c8352c; }
.srch-none { padding: 10px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 700px) { .srch input { width: 140px; } .srch input:focus { width: 170px; } }
/* 時間地図 */
.tmap .ring { fill: none; stroke: #ffab1a; stroke-opacity: .45; }
.tmap .ring-l { fill: #b8862a; text-anchor: middle; font-family: var(--mono); }
.tmap .tl { stroke-linecap: round; }
.tmap .ts { fill: #fff; stroke: #1b1d22; }
.tmap .tsl { fill: var(--ink); font-weight: 700; paint-order: stroke; stroke: var(--paper); stroke-linejoin: round; font-family: var(--mono), var(--sans); }
body.timeview .mapwrap { background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--sea) 70%, #fff) 0, var(--sea) 70%); }
.tm-card { position: absolute; right: 54px; top: 10px; width: 232px; background: color-mix(in srgb, var(--paper) 94%, transparent); border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px; font-size: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.tm-h { font: inherit; font-weight: 700; letter-spacing: .1em; margin-bottom: 4px; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; width: 100%; text-align: left; }
.tm-card.min .tm-b { display: none; }
.tm-card.min { width: auto; }
.tm-h small { font-weight: 400; color: var(--ink-3); }
.tm-r { display: grid; grid-template-columns: 74px 1fr 38px; gap: 6px; align-items: center; line-height: 1.4; font-size: 11.5px; }
.tm-r b { font-family: var(--mono); text-align: right; }
.tm-bar { position: relative; height: 6px; background: var(--paper-2); border-radius: 3px; }
.tm-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #ffab1a; border-radius: 3px; }
.tm-bar i.was { width: 2px; background: #1d1f24; border-radius: 0; top: -2px; bottom: -2px; }
.tm-note { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.4; }
@media (max-width: 700px) { .tm-card { right: 50px; width: 200px; font-size: 11px; } }

/* ================================================================
   スマホ：年表を画面の下に固定、地図を画面に収める、地図の設定は折りたたむ
   ================================================================ */
#tl-svg { touch-action: none; -webkit-user-select: none; user-select: none; }
.mm-tg, .srch-tg { display: none; }
@media (max-width: 760px) {
  /* 見出しを詰める：1行目に題・LED・🔍、2行目に編の切り替え（横にスクロール） */
  .hd-in { gap: 6px 10px; padding: 6px 12px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-mark svg { width: 24px; height: 24px; }
  .brand-t b { font-size: 15px; }
  .brand-t small { display: none; }
  .hd-sp { display: none; }
  .led { margin-left: auto; padding: 4px 8px; }
  .led .led-lab { display: none; }
  .hd .led canvas { height: 22px !important; width: auto !important; }
  .srch-tg { display: inline-grid; place-items: center; width: 36px; height: 32px; border-radius: 4px; border: 1px solid #39404a; background: var(--panel-2); color: var(--panel-ink); font-size: 15px; cursor: pointer; flex: none; }
  body.srch-open .srch-tg { background: #ffab1a; border-color: #ffab1a; }
  .hd-in > .srch { display: none; order: 5; flex: 1 1 100%; }
  body.srch-open .hd-in > .srch { display: flex; }
  .hd-in > .srch input, .hd-in > .srch input:focus { width: 100%; font-size: 16px; }
  .hd-in > .srch kbd { display: none; }
  .srch-res { left: 0; right: 0; width: auto; max-height: 60svh; }
  .hd-nav { order: 6; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hd-nav::-webkit-scrollbar { display: none; }
  .hd-nav a, .hd-btn { white-space: nowrap; flex: none; }
  .line-nav { padding: 6px 12px; }
}
@media (max-width: 760px) {
  body.has-dock { padding-bottom: var(--dock-h, 128px); }
  .has-dock .tl { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: auto; display: flex; flex-direction: column; border-top-width: 2px; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 18px rgba(0, 0, 0, .35); }
  .has-dock #tl-svg { order: 1; height: 72px; width: 100%; }
  .has-dock .tl-cap { display: none; }
  .has-dock .tl-ctl { order: 2; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 8px; border-right: 0; border-top: 1px solid #2a2f37; }
  .has-dock .tl-b { width: 42px; height: 36px; font-size: 14px; }
  .has-dock .tl-b.play { width: 56px; }
  .has-dock .tl-ctl select, .has-dock .tl-ctl input { font-size: 13px; padding: 5px 6px; height: 34px; }
  .has-dock .tl-ctl input[type=date] { max-width: 136px; }
  /* 地図は、見出しと下の年表のあいだに収める */
  .has-dock .app, .region.has-dock .app { height: auto; min-height: 0; }
  .has-dock .mapwrap { height: calc(100svh - var(--top-h, 170px) - var(--dock-h, 128px)); min-height: 300px; }
  /* 地図の見た目・色分けのボタンは折りたたむ */
  .mm-tg { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); cursor: pointer; }
  body[data-look="night"] .mm-tg { background: rgba(14, 20, 30, .88); color: #dfe6ee; border-color: #2e3a4a; }
  .map-mode:not(.open) > :not(.mm-tg) { display: none !important; }
  .map-mode.open .mm-tg { background: var(--ink); color: var(--paper); }
}
