/* まどがわ — 夜の車窓の紺地 × サンセリフ × 寒色。左右は色覚対応の 2 色（橙・空色）＋ L/R の文字 */
:root {
  --bg: #0E1A24;
  --surface: #142433;
  --surface-2: #1B2F41;
  --line: #2C4458;
  --text: #E6EDF2;
  --muted: #A7B8C6;
  --accent: #7FD1C7;
  --accent-ink: #0E1A24;
  --left: #E69F00;
  --right: #56B4E9;
  --warn: #F0E442;
  --check: #8C9AA6;
  --tunnel: #3A4F61;
  --radius: 14px;
  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.7; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--text); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 8px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ヘッダー */
.top { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #11212E 0%, var(--bg) 100%); }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.brand img { flex: none; }
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: .04em; }
.brand-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .lang { margin-left: auto; font-size: 14px; white-space: nowrap; padding: 8px 4px; }
@media (max-width: 560px) { .brand-sub { display: none; } }

/* 見出し・本文 */
.hero { padding: 22px 0 6px; }
.hero h1 { font-size: 24px; line-height: 1.4; margin: 0 0 6px; letter-spacing: .02em; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
h2 { font-size: 19px; margin: 0 0 10px; letter-spacing: .02em; }
h3 { font-size: 16px; margin: 0 0 8px; }

/* 入力 */
.trip { margin: 16px 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.trip fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.trip legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.stations { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .lbl { font-size: 13px; color: var(--muted); }
.field input, .field select { width: 100%; min-height: 44px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.swap { min-width: 44px; min-height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.swap svg { width: 20px; height: 20px; stroke: var(--text); fill: none; stroke-width: 2; }
.more-input { margin-top: 12px; }
.more-input summary { cursor: pointer; color: var(--muted); font-size: 14px; min-height: 48px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.msg { color: var(--warn); font-size: 14px; margin: 8px 0 0; min-height: 0; }
.text-btn { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-height: 44px; cursor: pointer; color: var(--text); }
.jst { font-size: 12px; color: var(--muted); margin-left: 4px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* タブ */
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.tabs button { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }

/* 答えカード */
.card { padding: 18px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.card .headline { font-size: 22px; font-weight: 700; line-height: 1.45; margin: 6px 0; }
.card .sub { color: var(--muted); margin: 0 0 10px; }
.card .note { font-size: 14px; margin: 4px 0; }
.card .rev { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); }
.side-L { color: var(--left); }
.side-R { color: var(--right); }
.sidetag { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 6px; font-weight: 700; font-family: var(--mono); color: var(--accent-ink); font-size: .85em; vertical-align: .1em; }
.sidetag.L { background: var(--left); }
.sidetag.R { background: var(--right); }
.chip { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.chip.seen { color: var(--accent); }
.chip.los_only { color: var(--text); }
.chip.check { color: var(--check); border-style: dashed; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); margin: 2px 4px 2px 0; }
.badge.borderline { border-color: var(--warn); color: var(--warn); }
details.more { margin-top: 10px; font-size: 14px; color: var(--muted); }
details.more summary { cursor: pointer; min-height: 48px; }

/* タイムライン */
.panel { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl > li { border-top: 1px solid var(--line); }
.tl > li:first-child { border-top: 0; }
.row-btn { width: 100%; display: flex; flex-direction: column; gap: 2px; background: none; border: 0; padding: 10px 4px; cursor: pointer; text-align: left; color: var(--text); min-height: 44px; }
.row-btn.R { align-items: flex-end; text-align: right; }
.row-btn .name { font-weight: 700; }
.row-btn .meta { font-size: 13px; color: var(--muted); }
.row-btn[aria-expanded="true"] { background: rgba(127, 209, 199, .07); }
.row-btn.L { border-left: 4px solid var(--left); padding-left: 10px; }
.row-btn.R { border-right: 4px solid var(--right); padding-right: 10px; }
.row-btn.check .name { opacity: .75; }
.topics { padding: 6px 12px 12px; font-size: 14px; }
.topics p { margin: 6px 0; }
.topics .src { color: var(--muted); font-size: 12px; }
.tl-tunnel { font-size: 13px; color: var(--muted); padding: 8px 4px; }
.legend-box { font-size: 14px; }
.legend-box summary { cursor: pointer; font-weight: 700; min-height: 48px; }
.checklist { font-size: 14px; color: var(--muted); margin: 10px 0 0; }

/* 地図 */
.map-wrap { position: relative; }
#map { height: 420px; border-radius: 12px; overflow: hidden; background: #0B141C; }
.view-ctl { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.view-ctl button { min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 13px; }
.view-ctl button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.m1 { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 560px) { #map { height: 340px; } }

/* カレンダー */
.cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal { border-collapse: separate; border-spacing: 2px; font-size: 11px; }
.cal th { font-weight: 400; color: var(--muted); padding: 0 4px; white-space: nowrap; text-align: right; }
.cal thead th { text-align: left; font-family: var(--mono); }
.cal td { width: 14px; min-width: 14px; height: 22px; border-radius: 3px; background: var(--bg); text-align: center; color: var(--accent-ink); font-family: var(--mono); padding: 0; }
.cal td.h { background-image: repeating-linear-gradient(135deg, rgba(14, 26, 36, .55) 0 2px, transparent 2px 5px); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.cal-legend span::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; background: var(--accent); }
.cal-legend .hatch::before { background: var(--accent) repeating-linear-gradient(135deg, rgba(14, 26, 36, .55) 0 2px, transparent 2px 5px); }

/* 固定ページ */
.page { padding: 20px 0 28px; }
.page h1 { font-size: 24px; line-height: 1.4; margin: 0 0 12px; }
.page h2 { margin-top: 28px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.page p, .page li { color: var(--text); }
.page table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.page th, .page td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.page th { background: var(--surface); }
.page dl dt { font-weight: 700; margin-top: 14px; }
.page dl dd { margin: 4px 0 0; }
.crumb { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

/* フッター */
.foot { border-top: 1px solid var(--line); margin-top: 24px; padding: 20px 0 32px; font-size: 13px; color: var(--muted); }
.foot nav ul { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.foot nav a { display: inline-block; padding: 6px 0; }
.foot p { margin: 6px 0; }
noscript p { color: var(--warn); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
/* タップ領域 44px（WCAG 2.5.5） */
summary { min-height: 44px; box-sizing: border-box; padding-block: 10px; }
#v-heading, #v-north { min-height: 44px; }
.maplibregl-ctrl-group button { width: 44px; height: 44px; }
summary { min-height: 48px; }
.maplibregl-ctrl-attrib-button { width: 44px; height: 44px; background-position: center; }
/* === ui-polish v1 === */
html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
h1,h2,h3,h4{text-wrap:balance}
p,li,dd,figcaption{text-wrap:pretty}
/* === /ui-polish === */
