/* しずあん — 白地図に立つ街（紙色×墨×深いティール） */
:root {
  --paper: #EEF1F2;
  --paper-2: #E3E8EA;
  --surface: #FFFFFF;
  --ink: #1D1F24;
  --ink-2: #454C54;
  --ink-3: #5F6770;
  --line: #CDD5D9;
  --accent: #0D5C6E;
  --accent-ink: #FFFFFF;
  --lamp: #F2C46B;
  --focus: #0D5C6E;
  --shadow: 0 1px 2px rgba(29,31,36,.08), 0 6px 18px rgba(29,31,36,.10);
  --radius: 12px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.6; }
button, input { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- アプリ枠 ---------- */
.app { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: 100vh; height: 100svh; min-height: 480px; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 25; } /* カード(10)・一覧(8)・使い方(20)より上＝検索候補を隠さない */
.brand-h { margin: 0; font-size: inherit; font-weight: inherit; flex: none; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); line-height: 1.15; flex: none; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: .08em; }
.brand-sub { font-size: 11px; color: var(--ink-3); letter-spacing: .02em; }
.search { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.search input { width: 100%; min-width: 0; height: 44px; padding: 0 44px 0 14px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); font-size: 16px; }
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(13,92,110,.18); }
.search-go { position: absolute; right: 0; top: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 22px; background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: var(--paper-2); }
.top-actions { display: flex; flex: none; align-items: center; }
.lang-btn { width: auto; min-width: 44px; padding: 0 8px; font-size: 13px; font-weight: 700; text-decoration: none; color: var(--accent); white-space: nowrap; }
.ls-short { display: none; }
.results { position: absolute; left: 0; right: 0; top: 50px; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: min(60vh, 420px); overflow: auto; z-index: 20; }
.results li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 44px; align-items: center; }
.results li[aria-selected="true"], .results li:hover { background: var(--paper); }
.results .r-sub { color: var(--ink-3); font-size: 13px; flex: none; }
.results .r-empty { cursor: default; color: var(--ink-3); }

.quick { background: var(--paper); border-bottom: 1px solid var(--line); position: relative; z-index: 5; min-width: 0; }
.quick-row { display: flex; gap: 6px; padding: 6px 12px; overflow-x: auto; scrollbar-width: none; }
.quick-row::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); cursor: pointer; font-size: 14px; }
.chip:hover { border-color: var(--ink-3); }

/* ---------- 地図ステージ ---------- */
.stage { position: relative; min-height: 0; overflow: hidden; background: var(--paper-2); }
.map { position: absolute; inset: 0; }
.toast { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); max-width: min(92%, 520px); margin: 0; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 10px; font-size: 14px; z-index: 22; box-shadow: var(--shadow); text-wrap: pretty; }

.stay-panel { position: absolute; left: 12px; bottom: 12px; max-width: min(360px, calc(100% - 24px)); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 8; display: flex; flex-direction: column; max-height: calc(100% - 24px); }
.app:not([data-mode="stay"]) .stay-panel { display: none; }
.stay-toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 0; background: transparent; cursor: pointer; font-weight: 700; text-align: left; }
.stay-toggle .stay-open { font-weight: 400; color: var(--accent); font-size: 13px; margin-left: 4px; }
.lamp { width: 12px; height: 12px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 0 3px rgba(242,196,107,.35), 0 0 10px 2px rgba(242,196,107,.8); flex: none; }
#stay-count { font-variant-numeric: tabular-nums; }
.stay-body { padding: 0 14px 12px; overflow: auto; min-height: 0; }
.sliders { display: grid; gap: 8px; padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 13px; align-items: center; }
.slider input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); height: 28px; }
.slider output { font-weight: 700; font-variant-numeric: tabular-nums; }
.rule { margin: 0; font-size: 12px; color: var(--ink-3); }
.text-btn { justify-self: start; min-height: 36px; padding: 0 4px; border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 13px; }
.list-title { font-size: 13px; margin: 10px 0 4px; color: var(--ink-2); }
.stay-list { list-style: none; margin: 0; padding: 0; }
.stay-list button { display: flex; width: 100%; justify-content: space-between; gap: 10px; min-height: 40px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; font-size: 14px; }
.stay-list button:hover { background: var(--paper); }
.stay-list .w { color: var(--ink-3); font-size: 12px; margin-right: 6px; }
.stay-list .n { color: var(--ink-3); font-size: 12px; flex: none; font-variant-numeric: tabular-nums; }

/* ---------- カード（下からシート／PC は右パネル） ---------- */
.card { position: absolute; left: 0; right: 0; bottom: 0; max-height: 78%; background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 24px rgba(29,31,36,.18); z-index: 10; display: flex; flex-direction: column; }
.app.card-open .stay-panel { visibility: hidden; }
.card-scroll { overflow: auto; padding: 14px 16px 18px; overscroll-behavior: contain; }
.card-head { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: start; }
.card-head h2 { margin: 0; font-size: 21px; line-height: 1.3; text-wrap: balance; }
.card-alt { grid-column: 1 / -1; margin: 0; color: var(--ink-2); font-size: 14px; }
.card-ward { margin: 0; color: var(--ink-2); font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-block; padding: 1px 8px; border: 1px solid var(--accent); color: var(--accent); border-radius: 10px; font-size: 12px; font-weight: 700; }
.card-sub { margin: 6px 0 10px; font-size: 12px; color: var(--ink-3); }
.metric { padding: 10px 0; border-top: 1px solid var(--line); }
.metric-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.metric-name { font-weight: 700; font-size: 14px; }
.cls { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; }
.sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(29,31,36,.18); flex: none; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin: 6px 0 4px; }
.scale i { height: 6px; border-radius: 2px; opacity: .35; }
.scale i.on { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }
.metric p { margin: 0; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.facts { list-style: none; margin: 0; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.stay-match { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: #FBF1DB; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.actions { display: grid; gap: 8px; padding: 6px 0 4px; }
.primary-btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 22px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; text-decoration: none; }
.primary-btn:hover { background: #0A4A59; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ghost-btn { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); cursor: pointer; font-size: 14px; }
.ghost-btn:hover { border-color: var(--ink-3); }
.share-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.disclaimer { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); }
.howto { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.howto h3 { margin: 0 0 4px; font-size: 14px; }
.howto p { margin: 0; font-size: 13px; color: var(--ink-2); text-wrap: pretty; }
.card-close { margin: -6px -8px 0 0; }

/* ---------- ドック（タブ＋凡例・地図の外＝カードと重ならない） ---------- */
.dock { background: var(--surface); border-top: 1px solid var(--line); padding: 6px 12px 8px; position: relative; z-index: 6; }
.modes { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.15fr; gap: 4px; background: var(--paper); border-radius: 12px; padding: 3px; }
.mode { min-height: 40px; padding: 2px 6px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-size: 13px; line-height: 1.2; color: var(--ink-2); }
.mode[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }
.legend { min-height: 76px; padding-top: 6px; display: grid; gap: 2px; }
.lg-head { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; font-size: 13px; }
.lg-head b { font-size: 13px; }
.lg-head span { color: var(--ink-3); font-size: 12px; }
.lg-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.lg-scale div { font-size: 11px; line-height: 1.25; color: var(--ink-2); }
.lg-scale i { display: block; height: 8px; border-radius: 2px; margin-bottom: 2px; box-shadow: inset 0 0 0 1px rgba(29,31,36,.14); }
.lg-foot { font-size: 11px; color: var(--ink-3); line-height: 1.45; margin: 0; }
.lg-key { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-2); }

/* ---------- オーバーレイ ---------- */
.intro { position: absolute; inset: 0; background: rgba(238,241,242,.72); display: grid; place-items: center; z-index: 20; /* ヘッダー(25)より下＝開いていても検索候補を使える */ padding: 16px; }
.intro-box { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 18px 16px; max-width: 460px; max-height: 100%; overflow: auto; }
.intro-box h2 { margin: 0 0 8px; font-size: 18px; }
.intro-box ol { margin: 0 0 14px; padding-left: 1.3em; font-size: 14px; display: grid; gap: 6px; }
.about-box p { font-size: 13px; margin: 0 0 8px; color: var(--ink-2); }

/* ---------- 出典フッター ---------- */
.foot { padding: 20px 16px 28px; background: var(--paper); border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.foot h2 { font-size: 13px; margin: 0 0 6px; }
.foot ul { margin: 0 0 8px; padding-left: 1.2em; display: grid; gap: 2px; }
.foot-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.foot-nav ul { list-style: none; padding: 0; gap: 0; }
.foot-nav a { display: inline-block; padding: 6px 0; min-height: 32px; color: var(--accent); }
.foot .attrib { max-width: 72ch; }

/* ---------- 固定ページ・ガイド ---------- */
.doc { font-size: 16px; line-height: 1.8; }
.doc-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.doc-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.doc-nav a { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink-2); text-decoration: none; }
.doc-nav a:hover, .doc-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.doc-nav .doc-map { color: var(--accent); font-weight: 700; }
.doc-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.doc-article h1 { font-size: clamp(24px, 5vw, 32px); line-height: 1.35; margin: 0 0 6px; text-wrap: balance; letter-spacing: .01em; }
.doc-meta { margin: 0 0 22px; color: var(--ink-3); font-size: 13px; }
.doc-article h2 { font-size: 20px; line-height: 1.45; margin: 34px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); text-wrap: balance; }
.doc-article h3 { font-size: 17px; margin: 22px 0 6px; }
.doc-article p, .doc-article li { text-wrap: pretty; }
.doc-article p { margin: 0 0 14px; }
.doc-article ul, .doc-article ol { padding-left: 1.4em; margin: 0 0 16px; }
.doc-article li { margin-bottom: 6px; }
.doc-article a { color: var(--accent); text-underline-offset: 3px; }
.doc-article .lead { font-size: 17px; color: var(--ink-2); }
.doc-article .note { padding: 12px 14px; background: var(--surface); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; font-size: 15px; }
.doc-article code, .doc-article .formula { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }
.doc-article .formula { display: block; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; white-space: pre-wrap; margin: 0 0 14px; }
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
.doc-article table { border-collapse: collapse; width: 100%; font-size: 14px; background: var(--surface); font-variant-numeric: tabular-nums; }
.doc-article th, .doc-article td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.doc-article th { background: var(--paper-2); font-weight: 700; }
.doc-article td a { overflow-wrap: anywhere; }
.faq-item h2 { font-size: 18px; }
.doc-cta { margin: 28px 0 0; }
.doc-related { margin-top: 36px; padding: 16px 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-related h2 { font-size: 15px; margin: 0 0 6px; }
.doc-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.doc-related a { display: inline-block; padding: 6px 0; color: var(--accent); }
.doc-related a[aria-current="page"] { color: var(--ink); font-weight: 700; text-decoration: none; }
.foot p { margin: 0 0 4px; }
.foot .copy { color: var(--ink-3); }

/* ---------- MapLibre ---------- */
.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl-bottom-right { bottom: 0; }

/* ---------- 404 ---------- */
.nf-main { max-width: 560px; margin: 0 auto; padding: 64px 20px; }
.nf-main h1 { font-size: 24px; }

@media (min-width: 900px) {
  .top { padding: 10px 16px; gap: 16px; }
  .search { max-width: 560px; }
  .card { left: auto; right: 12px; top: 12px; bottom: 40px; width: 390px; max-height: none; border-radius: 16px; box-shadow: var(--shadow); }
  .app.card-open .stay-panel { visibility: visible; }
  .dock { display: grid; grid-template-columns: minmax(420px, 520px) 1fr; gap: 16px; align-items: center; padding: 8px 16px; }
  .legend { padding-top: 0; }
  .mode { font-size: 14px; }
}
@media (max-width: 599px) {
  .results { position: fixed; left: 8px; right: 8px; top: 58px; }
}
@media (max-width: 420px) {
  .brand-sub { display: none; }
  .brand-name { font-size: 18px; }
  .top { gap: 6px; padding: 6px 8px; }
  .top-actions .icon-btn { width: 40px; }
  .top-actions .lang-btn { width: auto; min-width: 36px; padding: 0 4px; }
  .ls-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* 読み上げ名としては残す */
  .ls-short { display: inline; }
  .mode { font-size: 12px; padding: 2px 3px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
/* === 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 === */
