/* まちの間取り（暮らしモード）
   既存の分析画面（web/css/app.css）とは独立。スマホ前提で幅320〜430pxを主に見る。 */

:root {
  --bg: #F4F2EE;
  --outer: #E9E6E0;
  --surface: #FFFFFF;
  --ink: #1E1E1C;
  --muted: #5E5B55;
  --line: #D9D5CE;
  --line-strong: #C9C4BB;
  --line-soft: #E6E2DB;
  --accent: #2F6B5A;
  --accent-ink: #1F4D40;
  --accent-soft: #E4EEEA;
  --placeholder: #DCD8D1;
  --placeholder-soft: #EDEAE4;
  --sans: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --serif: 'Shippori Mincho', 'Hiragino Mincho ProN', serif;
  --header-h: 64px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--outer);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
}

div, span, p, a, button, label, h1, h2, h3, li, td, th {
  line-break: strict;
  word-break: auto-phrase;
  overflow-wrap: break-word;
  text-wrap: pretty;
}
h1 { text-wrap: balance; }

a { color: var(--accent); }
a:hover { color: var(--accent-ink); }

button { font-family: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ───────── ヘッダー（唯一の固定要素） */

.header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  transition: transform .22s ease;
}
.header.is-hidden { transform: translateY(-100%); }

.header-home {
  height: 56px;
  padding: 0 8px 0 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 16px; font-weight: 700; letter-spacing: .04em; }

.header-station {
  height: var(--header-h);
  padding: 8px 4px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-center {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  flex: 1 1 auto; min-width: 0;
}
.header-title {
  max-width: 100%;
  font-size: 18px; font-weight: 700; line-height: 1.25; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-settings {
  min-height: 22px; max-width: 100%;
  padding: 0 6px; border: 0; background: transparent;
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); letter-spacing: .02em;
  position: relative;
}
/* 見た目は22pxの文字列のまま、押せる範囲だけ44pxに広げる */
.header-settings::before {
  content: ""; position: absolute; left: 0; right: 0; top: -11px; bottom: -11px;
}
.header-settings > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.header-settings .base-name { max-width: 150px; min-width: 5.5em; }
.header-settings > span:last-child { flex-shrink: 0; overflow: visible; }
@media (max-width: 360px) { .header-settings .base-prefix { display: none; } }
.header-actions { display: flex; gap: 4px; }

.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  border: 0; background: transparent; padding: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); text-decoration: none;
}
.icon-btn[aria-pressed="true"] svg { fill: var(--accent); stroke: var(--accent); }

/* ───────── 区画 */

.section {
  background: var(--surface);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.section + .section, .section.sep { border-top: 8px solid var(--bg); }
.section.scroll-x { padding-right: 0; }
.section.scroll-x > .section-head { padding-right: 20px; }
.section-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.5; }
.section-sub { font-size: 12px; color: var(--muted); }
.section-head { display: flex; flex-direction: column; gap: 2px; }
.section-head.row { flex-direction: row; align-items: baseline; justify-content: space-between; }

.hscroll {
  display: flex; gap: 12px;
  overflow-x: auto; padding-right: 20px;
  scroll-snap-type: x proximity;
  align-items: flex-start;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.xsmall { font-size: 11px; }
.nodata { color: var(--muted); font-weight: 500; }

.note {
  font-size: 11px; color: var(--muted); line-height: 1.6;
}

/* ───────── ボタン */

.btn {
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; color: var(--ink);
}
.btn-primary {
  min-height: 48px; border: 0; background: var(--accent); color: #fff;
  font-weight: 700;
}
.btn-primary:hover { color: #fff; background: var(--accent-ink); }
.btn-outline-accent { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.btn-text {
  min-height: 44px; padding: 0; border: 0; background: transparent;
  color: var(--accent); font-size: 13px; align-self: flex-start;
}
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

.chip {
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 13px;
  display: inline-flex; align-items: center;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  font-size: 12px; padding: 5px 10px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  flex-shrink: 0;
  font-size: 10px; font-weight: 700; line-height: 1.4;
  color: #fff; background: var(--accent);
  padding: 2px 6px; border-radius: 4px;
}

/* ───────── ホーム */

.hero { padding: 32px 20px 24px; gap: 20px; }
.hero h1 {
  margin: 0; font-family: var(--serif); font-size: 24px; line-height: 1.55; font-weight: 700;
}
.hero h1 .blk { display: block; }
.hero h1 .ib { display: inline-block; }
.hero-lead { font-size: 13px; line-height: 1.7; color: var(--muted); }

.search-box { display: flex; flex-direction: column; gap: 10px; position: relative; }
.search-row { display: flex; gap: 8px; }
.search-input {
  flex: 1 1 auto; min-width: 0; height: 48px;
  padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 16px; font-family: inherit; background: var(--surface); color: var(--ink);
}
.search-go {
  width: 48px; height: 48px; flex-shrink: 0;
  border: 0; border-radius: 8px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.entry-row { display: flex; gap: 8px; }
/* 3つ並ぶので、320px でも「すべての駅」が2行に折り返さない詰め方にする */
.entry-row .btn {
  flex: 1 1 0; min-width: 0; font-size: 12px; padding: 0 8px; gap: 4px;
  white-space: nowrap; border-color: var(--line);
}
.entry-row .btn svg { flex: 0 0 auto; }

.suggest {
  list-style: none; margin: 0; padding: 4px 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  max-height: 320px; overflow-y: auto;
}
.suggest[hidden] { display: none; }
.suggest a, .suggest button {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 0; background: transparent; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--ink); text-decoration: none; font-size: 14px;
}
.suggest a:hover, .suggest button:hover, .suggest .is-active { background: var(--bg); }
.suggest .sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.suggest .msg { padding: 10px 12px; font-size: 13px; color: var(--muted); }

.base-empty {
  padding: 16px; border-radius: 10px; background: var(--accent-soft);
  display: flex; flex-direction: column; gap: 12px;
}
.base-empty p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--accent-ink); }
.base-set {
  padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.base-set .name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.base-set > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.town-card {
  flex-shrink: 0; width: 150px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column;
  color: var(--ink); text-decoration: none; background: var(--surface);
}
.town-card.wide { width: 160px; }
.town-card:hover { color: var(--ink); border-color: var(--line-strong); }
.town-card .thumb { position: relative; height: 84px; background: var(--placeholder-soft); overflow: hidden; }
.town-card .body { padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.town-card .name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.town-card .catch { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* 街並みの絵（カードの地図の代わり）。何をいくつ描くかは common.js の scene() */
.scene { display: block; width: 100%; height: 100%; }
.sc-sky { fill: var(--placeholder-soft); }
.sc-ground { fill: var(--placeholder); }
.sc-tower { fill: #9FA7A6; }
.sc-mid { fill: #C3BDB2; }
.sc-house { fill: #E2D6C3; }
.sc-roof { fill: #A0765A; }
.sc-win { fill: var(--surface); opacity: .85; }
.sc-door { fill: #A0765A; }
.sc-shop { fill: #C8744F; }
.sc-tree { fill: #7FA58F; }
.sc-trunk { fill: #7A6450; }
.sc-person { fill: var(--accent-ink); }
.scene-tag {
  position: absolute; top: 6px; left: 6px; max-width: calc(100% - 12px);
  padding: 1px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .88); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; line-height: 1.6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.feature {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: 10px; background: var(--bg);
}
.feature .ico {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px;
  background: var(--surface); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.feature .t { font-size: 14px; font-weight: 700; }
.feature .d { font-size: 12px; line-height: 1.6; color: var(--muted); }
.features { display: flex; flex-direction: column; gap: 10px; }

.list-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 14px 0; border-bottom: 1px solid var(--line-soft);
  color: var(--ink); text-decoration: none;
}
.list-link:hover { color: var(--ink); }
.list-link > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-link .name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-link .catch { font-size: 12px; color: var(--muted); }

.footer { padding: 20px; display: flex; flex-direction: column; gap: 8px; }

/* ───────── 駅紹介ページ */

.map-wrap { position: relative; height: 240px; background: var(--placeholder); border-bottom: 1px solid var(--line-strong); }
.map-wrap iframe { width: 100%; height: 100%; border: 0; display: block; opacity: 0; transition: opacity .35s ease; }
.map-wrap iframe.is-loaded { opacity: 1; }
.map-links {
  background: var(--surface);
  display: flex; justify-content: flex-end; gap: 16px; padding: 0 16px;
}
.map-links a { min-height: 44px; display: inline-flex; align-items: center; font-size: 12px; text-decoration: none; }

.intro { padding: 20px 20px 16px; gap: 10px; }
.intro .meta { font-size: 12px; color: var(--muted); line-height: 1.5; }
.intro h1 { margin: 0; font-family: var(--serif); font-size: 25px; line-height: 1.4; font-weight: 700; }

.summary-box {
  padding: 12px; border-radius: 8px; background: var(--bg);
  display: flex; flex-direction: column; gap: 4px;
}
.summary-box .lead { font-size: 12px; color: var(--muted); }
.summary-box .text { font-size: 15px; font-weight: 700; line-height: 1.6; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 11px; color: var(--muted); }
.legend > span { display: flex; align-items: center; gap: 6px; min-width: 0; }
.legend .base-label { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot-here { width: 12px; height: 12px; border-radius: 999px; background: var(--accent); flex-shrink: 0; }
.dot-base { width: 10px; height: 10px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; flex-shrink: 0; }

.scales { display: flex; flex-direction: column; gap: 14px; }
.scale { display: flex; flex-direction: column; gap: 6px; }
.scale-labels { display: flex; justify-content: space-between; font-size: 12px; }
.scale-track { position: relative; height: 20px; }
.scale-track::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--line); border-radius: 2px; }
.scale-dot {
  position: absolute; top: 3px; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 999px;
}
.scale-dot.here { background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--accent); z-index: 1; }
.scale-dot.base { background: #fff; border: 2px solid var(--ink); }
.scale-nodata { font-size: 11px; color: var(--muted); }

.spec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.spec {
  padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.spec.hit, .time-card.hit { background: var(--accent-soft); border-color: var(--accent); }
.spec-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 18px; }
.spec-label { font-size: 11px; color: var(--muted); }
.spec-value { font-size: 18px; font-weight: 700; line-height: 1.4; }
.spec-value .unit { font-size: 12px; font-weight: 500; margin-left: 2px; }
.spec-diff { font-size: 11px; color: var(--accent); }
.spec-note { font-size: 10px; color: var(--muted); }

.time-card {
  flex-shrink: 0; width: 240px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.time-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 18px; }
.time-label { font-size: 13px; font-weight: 700; color: var(--accent); }
.time-text { font-size: 13px; line-height: 1.6; }
.time-basis { font-size: 11px; color: var(--muted); }

.bars { background: var(--placeholder-soft); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.bar-row .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { position: relative; height: 12px; }
.bar-fill { height: 100%; border-radius: 3px; background: var(--accent); min-width: 2px; }
.bar-fill.base { background: #fff; border: 1.5px solid var(--ink); }
.bar-val { font-size: 10px; color: var(--ink); margin-top: 1px; }

.tabs-wrap { background: var(--surface); border-top: 8px solid var(--bg); }
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 8px; }
.tab {
  flex: 1 1 0; min-height: 48px; border: 0; background: transparent;
  font-size: 13px; font-weight: 500; color: var(--muted);
  border-bottom: 3px solid transparent;
}
.tab[aria-selected="true"] { font-weight: 700; color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { padding: 12px 20px 20px; display: flex; flex-direction: column; }
.tab-panel[hidden] { display: none; }

.fac-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 12px 8px; border-bottom: 1px solid var(--line-soft);
  color: var(--ink); text-decoration: none;
}
.fac-row:hover { color: var(--ink); background: var(--bg); }
.fac-row .l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fac-row .lt { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.fac-row .ls { font-size: 11px; color: var(--muted); }
.fac-row .r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fac-row .n { font-size: 14px; font-weight: 700; text-align: right; }

.chart-block { display: flex; flex-direction: column; gap: 8px; }
.chart-title { font-size: 13px; font-weight: 700; }
.age-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 40px; align-items: center; gap: 8px; font-size: 11px; }
.age-row .v { text-align: right; font-variant-numeric: tabular-nums; }
.age-track { position: relative; height: 14px; background: var(--placeholder-soft); border-radius: 3px; }
.age-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.age-mark { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px solid var(--ink); }
.translate {
  font-size: 13px; line-height: 1.7; background: var(--accent-soft); color: var(--accent-ink);
  padding: 12px; border-radius: 8px;
}

.raw-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.raw-table th, .raw-table td { padding: 8px 4px; border-bottom: 1px solid var(--line-soft); text-align: right; vertical-align: top; }
.raw-table th:first-child, .raw-table td:first-child { text-align: left; }
.raw-table thead th { font-size: 11px; color: var(--muted); font-weight: 500; }
.raw-table td.src { font-size: 10px; color: var(--muted); }

.feedback-q { font-size: 15px; font-weight: 700; }
.feedback-row { display: flex; gap: 8px; }
.feedback-row .btn { flex: 1 1 0; }

/* ───────── シート（画面下からせり上がる） */

.sheet-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 30, 28, .45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s ease;
}
.sheet-overlay.is-open { opacity: 1; }
.sheet {
  width: 100%; max-width: 430px; max-height: 88vh;
  background: var(--surface); border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .15);
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .24s ease;
}
.sheet-overlay.is-open .sheet { transform: translateY(0); }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); align-self: center; margin-top: 10px; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 0 20px; flex-shrink: 0; }
.sheet-title { font-size: 17px; font-weight: 700; margin: 0; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.sheet-group { display: flex; flex-direction: column; gap: 8px; }
.sheet-group-title { font-size: 14px; font-weight: 700; }

.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick {
  min-height: 44px; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface);
  text-align: left; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.pick .sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pick[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

.line-list { display: flex; flex-direction: column; }
.line-op { font-size: 12px; color: var(--muted); padding: 12px 0 4px; }


.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 13px;
  padding: 10px 16px; border-radius: 8px; max-width: calc(100% - 32px);
}

.loading { padding: 40px 20px; text-align: center; color: var(--muted); }
.error-box { padding: 24px 20px; display: flex; flex-direction: column; gap: 12px; }

/* ───────── 手直し：キャッチの下の一文・24時間・施設・肌感 */

.catch-sub { margin: 0; font-family: var(--serif); font-size: 15px; line-height: 1.6; font-weight: 600; color: var(--muted); }

/* 24時間のカードは高さを揃える。余りはカードの下端に寄る（要素の間は空けない） */
.hscroll.stretch { align-items: stretch; }
.time-scene { font-size: 16px; font-weight: 700; line-height: 1.5; }
.time-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.time-facts li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; line-height: 1.55; }
.time-facts svg { margin-top: 3px; color: var(--accent); }

.fac-group { margin: 16px 0 4px; font-size: 13px; font-weight: 700; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.fac-group-sub { font-size: 11px; font-weight: 500; color: var(--accent-ink); }
.fac-group:first-of-type { margin-top: 4px; }
.standout { font-size: 10px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; }
.fac-empty { padding: 12px; border-radius: 8px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fac-more { margin-top: 12px; }
.fac-more > summary {
  min-height: 44px; display: flex; align-items: center; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--accent); list-style: none;
}
.fac-more > summary::-webkit-details-marker { display: none; }
.fac-more > summary::after { content: "＋"; margin-left: 6px; }
.fac-more[open] > summary::after { content: "－"; }

.feel-list { display: flex; flex-direction: column; padding-top: 8px; }
.feel { padding: 14px 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; }
.feel-title { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.feel-big { font-size: 18px; font-weight: 700; line-height: 1.45; }
.feel-word { display: block; font-size: 12px; font-weight: 500; color: var(--accent-ink); }
.feel-line { font-size: 13px; }
.feel-cmp { font-size: 11px; color: var(--muted); }

.ten { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; max-width: 320px; }
.ten-cell svg { width: 100%; height: auto; display: block; }
.ten-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); }
.ten-legend > span { display: inline-flex; align-items: center; gap: 4px; }
.ten-key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.c0 { fill: #D9D5CE; background: #D9D5CE; }
.c1 { fill: #E0A458; background: #E0A458; }
.c2 { fill: #2F6B5A; background: #2F6B5A; }
.c3 { fill: #7FA89A; background: #7FA89A; }
.c4 { fill: #8C6A5D; background: #8C6A5D; }
/* 色のクラスは凡例では背景色、アイコンでは塗りに使う */
.ten .ten-cell { background: transparent; }

/* ───────── シェア用の街カード（card.html。1200×630 を JPEG に撮る） */

.share-card-page { margin: 0; width: 1200px; height: 630px; overflow: hidden; background: var(--bg); }
.share-card {
  width: 1200px; height: 630px; box-sizing: border-box; padding: 44px 60px;
  display: grid; grid-template-columns: 1fr 470px; gap: 40px; align-items: stretch;
}
.shc-left { display: flex; flex-direction: column; min-width: 0; }
.shc-meta { font-size: 24px; color: var(--muted); }
.shc-name {
  margin-top: 6px; font-family: var(--serif); font-weight: 700; font-size: 84px; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shc-catch {
  margin-top: 20px; font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shc-sub {
  margin-top: 16px; font-size: 22px; line-height: 1.55; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shc-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shc-stats.is-few { grid-template-columns: 1fr; }
.shc-stat { padding: 10px 14px; border-radius: 12px; background: var(--bg); min-width: 0; }
.shc-stat-label { font-size: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shc-stat-value { font-size: 30px; font-weight: 700; line-height: 1.3; }
.shc-stat-value span { font-size: 20px; font-weight: 400; margin-left: 3px; }
.shc-near { font-size: 19px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shc-divider { height: 1px; background: var(--line); }

.shc-tags { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; max-height: 100px; overflow: hidden; }
.shc-tags span {
  flex-shrink: 0; padding: 6px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 20px; font-weight: 500; white-space: nowrap;
}
.shc-brand {
  margin-top: auto; display: flex; align-items: center; gap: 12px;
  font-size: 28px; font-weight: 700; color: var(--ink);
}
.shc-brand-sub { font-size: 20px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.shc-logo {
  width: 40px; height: 40px; border-radius: 9px; background: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 24V14l8-6 8 6v10' fill='none' stroke='white' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: cover;
}
.shc-right {
  align-self: stretch; width: 470px; box-sizing: border-box; padding: 26px 30px;
  border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
}
.shc-right .shc-scales-title { margin-top: 2px; }
.shc-scales-title { font-size: 22px; font-weight: 700; }
.shc-scale { display: grid; grid-template-columns: 92px 1fr 92px; align-items: center; gap: 12px; }
.shc-end { font-size: 21px; color: var(--muted); white-space: nowrap; }
.shc-end:first-child { text-align: right; }
.shc-track { position: relative; height: 22px; }
.shc-track::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 3px; border-radius: 2px; background: var(--line); }
.shc-dot { position: absolute; top: 0; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; box-sizing: border-box; }
.shc-dot.is-here { background: var(--accent); }
.shc-dot.is-base { background: var(--surface); border: 3px solid var(--ink); }
.shc-nodata { position: absolute; left: 50%; top: 0; transform: translateX(-50%); padding: 0 10px; background: var(--surface); font-size: 16px; color: var(--muted); line-height: 22px; white-space: nowrap; }
.shc-legend { display: flex; gap: 24px; font-size: 17px; color: var(--muted); padding-top: 4px; }
.shc-legend > span { display: flex; align-items: center; gap: 8px; }
.shc-legend .shc-dot { position: static; margin: 0; width: 18px; height: 18px; }

/* ───────── 読み込みの見せ方
   描き終えてフォントがそろうまで本体を隠し、まとめて出す（common.js の reveal()）。
   部品やフォントが届いた順にばらばらに現れるのを防ぐ。
   スクリプトが止まっても隠れたままにならないよう、4秒で必ず出す。 */
@view-transition { navigation: auto; }
html:not(.is-ready) .app { visibility: hidden; animation: kurashi-failsafe 0s 4s forwards; }
html.is-ready .app { animation: kurashi-in .18s ease-out; }
html:not(.is-ready) body:has(.app)::after {
  content: ""; position: fixed; left: 50%; top: 45%; width: 28px; height: 28px; margin-left: -14px;
  border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: kurashi-spin .8s linear infinite, kurashi-hide 0s 4s forwards;
}
@keyframes kurashi-failsafe { to { visibility: visible; } }
@keyframes kurashi-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes kurashi-spin { to { transform: rotate(360deg); } }
@keyframes kurashi-hide { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  html.is-ready .app { animation: none; }
  .map-wrap iframe { transition: none; }
}

/* ───────── シェアのシート */
.share-list { display: flex; flex-direction: column; gap: 8px; }
.share-item {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); text-decoration: none; font: inherit; font-size: 15px; font-weight: 700;
  text-align: left; cursor: pointer; width: 100%;
}
.share-item:hover { border-color: var(--line-strong); color: var(--ink); }
.share-ico {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--ink);
}
.share-ico.is-x { background: #000; color: #fff; }
.share-ico.is-line { background: #06C755; color: #fff; }
.share-ico.is-facebook { background: #1877F2; color: #fff; }

/* ───────── 地図から選ぶ（区の形と線路の下絵。地図サービスのタイルは使わない）

   拡大は svg の viewBox を書き換えて行う。CSS の transform で拡大すると
   ブラウザが等倍で描いた結果を引き伸ばすので、ベクターなのにぼやける。
   指で動かしている最中だけ transform を使い、離した時点で viewBox に移す。 */

.sheet.is-full { height: 100dvh; max-height: 100dvh; border-radius: 0; }
.sheet.is-full .sheet-body { flex: 1 1 auto; padding: 0; overflow: hidden; }
.mapview { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.mapwrap {
  position: relative; flex: 1 1 auto; min-height: 0;
  background: var(--surface); overflow: hidden;
  touch-action: none;                 /* 指の操作は自前で扱う（ページごと動くのを防ぐ） */
}
.dotmap {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none;
  transform-origin: 0 0;              /* 動かしている最中だけ使う */
}

/* 拡大しても線の太さと点の大きさを変えない */
.dm-wards path { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.dm-rails path { fill: none; stroke: #C9C4BB; stroke-width: 1.6px; vector-effect: non-scaling-stroke; }
.dm-dots path {
  fill: none; stroke: var(--accent); stroke-width: 7px; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.dm-dots path.on { opacity: .85; }

/* 文字の大きさは JS が倍率に合わせて入れる（地図の座標なので） */
.dm-labels text, .dm-wardnames text {
  opacity: 0; transition: opacity .18s ease;
  paint-order: stroke; stroke-width: 4px; vector-effect: non-scaling-stroke;
}
.dm-labels text.on, .dm-wardnames text.on { opacity: 1; }
.dm-labels text { fill: var(--ink); stroke: #fff; }
.dm-wardnames text { fill: var(--muted); stroke: var(--surface); text-anchor: middle; }

.dm-sel path {
  fill: none; stroke: var(--accent); stroke-width: 18px; stroke-linecap: round;
  vector-effect: non-scaling-stroke; opacity: .25;
}
.dm-sel text {
  font-weight: 700; fill: var(--accent-ink); text-anchor: middle;
  paint-order: stroke; stroke: #fff; stroke-width: 5px; vector-effect: non-scaling-stroke;
  transform: translateY(-1.4em);
}

.maphint {
  position: absolute; left: 12px; right: 76px; top: 10px; z-index: 2;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px;
  font-size: 11px; color: var(--muted); line-height: 1.5;
}
.mapzoom {
  position: absolute; right: 10px; top: 10px; z-index: 2;
  display: flex; flex-direction: column; gap: 6px;
}
.mapzoom .icon-btn {
  width: 44px; height: 44px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .95);
  font-size: 17px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
/* 選ぶ前から場所を取っておく。あとから出てくると地図が飛んで、
   ダブルタップの2回目が別の場所と判定されてしまう。 */
.mappick {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  min-height: 48px; box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.mappick.is-empty {
  background: rgba(255, 255, 255, .95); color: var(--muted);
  border: 1px solid var(--line-strong); box-shadow: none; pointer-events: none;
}
.maphint { transition: opacity .3s ease; }
.maphint.is-gone { opacity: 0; pointer-events: none; }
