:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #121c2b;
  --muted: #5d6b7e;
  --line: #e0e6ee;
  --accent: #0b5fb4;
  --accent-soft: #e4effb;
  --route-all: #4a3cf0;
  --route-off: #9aa8bb;
  --route-on: #ff5a1f;
  --on-route: #ffffff;
  --glass: rgba(255, 255, 255, .74);
  --glass-line: rgba(255, 255, 255, .65);
  --shadow: 0 10px 32px rgba(18, 28, 43, .16);
  --shadow-sm: 0 4px 14px rgba(18, 28, 43, .12);
  --icon-filter: invert(1);
  /* ライト用の新デザイン: 濃い紺のすりガラス+オレンジ〜ピンク〜紫のグラデーション */
  --brand-grad: linear-gradient(135deg, #ff9a2e 0%, #ff4d6d 55%, #a63dff 100%);
  --brand-glow: rgba(255, 77, 109, .40);
  --dock: rgba(15, 22, 36, .86); --dock-line: rgba(255, 255, 255, .14); --dock-muted: rgba(255, 255, 255, .68);
  --main-top: 0px; --mt-extra: var(--top-h);
  --top-bg: transparent; --top-line: transparent; --top-blur: none; --top-pe: none;
  --brand-bg: var(--dock); --brand-pad: 5px 14px 5px 8px; --brand-fg: #fff; --brand-shadow: 0 8px 22px rgba(15, 22, 36, .28);
  --ibtn-bg: var(--dock); --ibtn-fg: #fff; --ibtn-hover: rgba(40, 52, 74, .95); --ibtn-shadow: 0 8px 22px rgba(15, 22, 36, .28);
  --badge-bg: rgba(255, 255, 255, .16); --badge-fg: #fff;
  --tab-bg: var(--dock); --tab-fg: var(--dock-muted); --tab-on-bg: var(--brand-grad); --tab-on-fg: #fff; --tab-line: var(--dock-line);
  --tabpc-bg: var(--dock); --tabpc-pad: 5px; --tabpc-shadow: 0 8px 22px rgba(15, 22, 36, .28); --tabpc-blur: blur(18px) saturate(1.4); --tabpc-h: 48px; --tabpc-mt: 4px;
  --chip-bg: var(--dock); --chip-all-bg: var(--dock); --chip-fg: #fff; --chip-line: var(--dock-line); --chip-shadow: 0 6px 16px rgba(15, 22, 36, .24);
  --chip-on-bg: var(--brand-grad); --chip-on-shadow: 0 6px 18px var(--brand-glow);
  --rk-bg: rgba(255, 255, 255, .16); --rk-fg: #fff;
  --lab-bg: var(--dock); --lab-fg: #fff; --lab-sub: var(--dock-muted); --lab-dot: inline-block;
  --ctl-bg: var(--dock); --ctl-line: var(--dock-line); --ctl-sep: rgba(255, 255, 255, .14);
  --attr-bg: var(--dock); --attr-fg: rgba(255, 255, 255, .85); --attr-text: rgba(255, 255, 255, .78); --attr-btn-filter: invert(1); --attr-inner: rgba(255, 255, 255, .85);
  --pin-bg: var(--brand-grad); --pin-fg: #fff;
  --fill: var(--brand-grad); --fill-shadow: 0 6px 16px var(--brand-glow);
  --sheet-bar: 5px; --sheet-bar-display: block;
  --wash: linear-gradient(180deg, rgba(120, 90, 255, .20) 0, rgba(255, 110, 150, .10) 150px, transparent 280px), linear-gradient(0deg, rgba(255, 150, 60, .18) 0, transparent 190px);
  --top-fade: linear-gradient(180deg, var(--bg) 40%, transparent);
  --tabbar-h: 64px;
  --top-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg:#0b1119; --surface:#151f2b; --surface-2:#1c2938; --text:#eaf0f7; --muted:#9aa9bb; --line:#263548; --accent:#5aa9f5; --accent-soft:#183049; --route-all:#4da3ff; --route-off:#56708b; --route-on:#ffb020; --on-route:#231600; --glass:rgba(21,31,43,.72); --glass-line:rgba(255,255,255,.09); --shadow:0 10px 32px rgba(0,0,0,.55); --shadow-sm:0 4px 14px rgba(0,0,0,.4); --icon-filter: invert(1); }
}
:root[data-theme="dark"] { --bg:#0b1119; --surface:#151f2b; --surface-2:#1c2938; --text:#eaf0f7; --muted:#9aa9bb; --line:#263548; --accent:#5aa9f5; --accent-soft:#183049; --route-all:#4da3ff; --route-off:#56708b; --route-on:#ffb020; --on-route:#231600; --glass:rgba(21,31,43,.72); --glass-line:rgba(255,255,255,.09); --shadow:0 10px 32px rgba(0,0,0,.55); --shadow-sm:0 4px 14px rgba(0,0,0,.4); --icon-filter: invert(1); }

/* ダーク: 新デザインの変数を、これまでの見た目と同じ値に固定(ダークは変えない) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --main-top: var(--top-h); --mt-extra: 0px; --top-bg: var(--glass); --top-line: var(--glass-line); --top-blur: blur(16px) saturate(1.5); --top-pe: auto; --brand-bg: transparent; --brand-pad: 0; --brand-fg: var(--text); --brand-shadow: none; --ibtn-bg: transparent; --ibtn-fg: var(--text); --ibtn-hover: var(--surface-2); --ibtn-shadow: none; --badge-bg: var(--accent-soft); --badge-fg: var(--accent); --tab-bg: var(--glass); --tab-fg: var(--muted); --tab-on-bg: var(--accent-soft); --tab-on-fg: var(--accent); --tab-line: var(--glass-line); --tabpc-bg: transparent; --tabpc-pad: 0; --tabpc-shadow: none; --tabpc-blur: none; --tabpc-h: var(--top-h); --tabpc-mt: 0px; --chip-bg: var(--glass); --chip-all-bg: color-mix(in srgb, var(--surface) 94%, transparent); --chip-fg: var(--text); --chip-line: var(--glass-line); --chip-shadow: var(--shadow-sm); --chip-on-bg: var(--accent); --chip-on-shadow: var(--shadow-sm); --rk-bg: var(--surface-2); --rk-fg: var(--muted); --lab-bg: var(--glass); --lab-fg: var(--text); --lab-sub: var(--muted); --lab-dot: none; --ctl-bg: var(--glass); --ctl-line: var(--glass-line); --ctl-sep: var(--line); --attr-bg: var(--glass); --attr-fg: var(--muted); --attr-text: inherit; --attr-btn-filter: none; --attr-inner: inherit; --pin-bg: var(--route-on); --pin-fg: var(--on-route); --fill: var(--accent); --fill-shadow: none; --sheet-bar: 0px; --sheet-bar-display: none; --wash: none; --top-fade: none; }
}
:root[data-theme="dark"] { --main-top: var(--top-h); --mt-extra: 0px; --top-bg: var(--glass); --top-line: var(--glass-line); --top-blur: blur(16px) saturate(1.5); --top-pe: auto; --brand-bg: transparent; --brand-pad: 0; --brand-fg: var(--text); --brand-shadow: none; --ibtn-bg: transparent; --ibtn-fg: var(--text); --ibtn-hover: var(--surface-2); --ibtn-shadow: none; --badge-bg: var(--accent-soft); --badge-fg: var(--accent); --tab-bg: var(--glass); --tab-fg: var(--muted); --tab-on-bg: var(--accent-soft); --tab-on-fg: var(--accent); --tab-line: var(--glass-line); --tabpc-bg: transparent; --tabpc-pad: 0; --tabpc-shadow: none; --tabpc-blur: none; --tabpc-h: var(--top-h); --tabpc-mt: 0px; --chip-bg: var(--glass); --chip-all-bg: color-mix(in srgb, var(--surface) 94%, transparent); --chip-fg: var(--text); --chip-line: var(--glass-line); --chip-shadow: var(--shadow-sm); --chip-on-bg: var(--accent); --chip-on-shadow: var(--shadow-sm); --rk-bg: var(--surface-2); --rk-fg: var(--muted); --lab-bg: var(--glass); --lab-fg: var(--text); --lab-sub: var(--muted); --lab-dot: none; --ctl-bg: var(--glass); --ctl-line: var(--glass-line); --ctl-sep: var(--line); --attr-bg: var(--glass); --attr-fg: var(--muted); --attr-text: inherit; --attr-btn-filter: none; --attr-inner: inherit; --pin-bg: var(--route-on); --pin-fg: var(--on-route); --fill: var(--accent); --fill-shadow: none; --sheet-bar: 0px; --sheet-bar-display: none; --wash: none; --top-fade: none; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px; line-height: 1.6; -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sign { display: block; flex: none; height: auto; }

/* ヘッダー(すりガラス) */
.top {
  position: fixed; inset: 0 0 auto 0; height: var(--top-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 16px; padding-top: env(safe-area-inset-top);
  background: var(--top-bg); backdrop-filter: var(--top-blur); -webkit-backdrop-filter: var(--top-blur);
  border-bottom: 1px solid var(--top-line); pointer-events: var(--top-pe);
}
.top > * { pointer-events: auto; }
.top::before { content: ""; position: absolute; inset: 0 0 -14px 0; z-index: -1; pointer-events: none; }
body[data-view="zukan"] .top::before { background: var(--top-fade); }
.brand { display: flex; align-items: center; gap: 10px; background: var(--brand-bg); padding: var(--brand-pad); border-radius: 99px; color: var(--brand-fg); box-shadow: var(--brand-shadow); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: .06em; }
.brand-mark svg { width: 30px; height: auto; display: block; }
.badge { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--badge-bg); color: var(--badge-fg); font-weight: 700; }
.icon-btn { width: 44px; height: 44px; border: 0; background: var(--ibtn-bg); color: var(--ibtn-fg); box-shadow: var(--ibtn-shadow); border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover { background: var(--ibtn-hover); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

/* タブ(スマホ:浮かぶすりガラスの丸いバー) */
.tabs {
  position: fixed; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 10px); z-index: 30;
  height: var(--tabbar-h); padding: 6px; gap: 6px;
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: var(--tab-bg); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid var(--tab-line); border-radius: 26px; box-shadow: var(--shadow);
}
.tabs button { border: 0; background: transparent; border-radius: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--tab-fg); font-size: 12px; font-weight: 700; min-height: 48px; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabs button[aria-selected="true"] { color: var(--tab-on-fg); background: var(--tab-on-bg); }

/* メイン */
main { position: fixed; inset: var(--main-top) 0 0 0; }
.view { position: absolute; inset: 0; }
.view[hidden] { display: none; }
#map { position: absolute; inset: 0; background: var(--surface-2); }

/* 地図の上に浮かぶ、人気TOP10のチップ。「全体」はリストの外に固定(スクロールしても動かない) */
.map-top { position: absolute; top: calc(8px + var(--mt-extra)); left: 0; right: 0; z-index: 5; pointer-events: none; }
.rank-label {
  display: inline-flex; align-items: baseline; gap: 6px; margin: 0 0 4px 12px; padding: 0 10px; border-radius: 99px;
  background: var(--lab-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--chip-line); box-shadow: var(--chip-shadow); pointer-events: auto; max-width: calc(100% - 24px);
}
.rank-label b { font-size: 11.5px; letter-spacing: .04em; white-space: nowrap; color: var(--lab-fg); }
.rank-label b::before { content: ""; display: var(--lab-dot); width: 7px; height: 7px; border-radius: 50%; background: var(--brand-grad); margin-right: 5px; box-shadow: 0 0 9px var(--brand-glow); }
.rank-label small { font-size: 10px; color: var(--lab-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row { display: flex; align-items: center; gap: 6px; padding: 0 0 6px 12px; pointer-events: auto; }
.map-chips {
  flex: 1; min-width: 0; display: flex; gap: 6px; padding: 2px 12px 6px 2px; margin-bottom: -4px; overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 8px, #000 calc(100% - 18px), transparent 100%);
}
.map-chips::-webkit-scrollbar { display: none; }
.mchip {
  flex: none; scroll-snap-align: start; display: flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 11px 0 5px; border-radius: 99px;
  border: 1px solid var(--chip-line); background: var(--chip-bg); color: var(--chip-fg);
  backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: var(--chip-shadow); font-weight: 700; font-size: 12.5px;
}
.mchip.all { padding: 0 13px; background: var(--chip-all-bg); }
.mchip .sign { width: 22px; height: auto; }
.mchip.on { background: var(--chip-on-bg); color: #fff; border-color: transparent; box-shadow: var(--chip-on-shadow); }
.rk { flex: none; min-width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--rk-bg); color: var(--rk-fg); }
.rk.r1 { background: #f5b301; color: #2a1c00; }
.rk.r2 { background: #b9c3d0; color: #1b2430; }
.rk.r3 { background: #d99660; color: #2a1500; }

/* 地図の部品をおしゃれに */
.maplibregl-ctrl-top-right { top: calc(124px + var(--mt-extra)); right: 2px; }
.maplibregl-ctrl-group { background: var(--ctl-bg) !important; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--ctl-line); border-radius: 16px !important; box-shadow: var(--shadow-sm) !important; overflow: hidden; }
.maplibregl-ctrl-group button { width: 40px !important; height: 40px !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--ctl-sep) !important; }
.maplibregl-ctrl-icon { filter: var(--icon-filter); }
/* ノースアップのボタン: 赤い地に白い「N」。地図が回ると「N」も回って、北の向きを指す */
.maplibregl-ctrl-group button.maplibregl-ctrl-compass { background: #d62828 !important; }
.maplibregl-ctrl-group button.maplibregl-ctrl-compass:hover, .maplibregl-ctrl-group button.maplibregl-ctrl-compass:active { background: #b61f1f !important; }
.maplibregl-ctrl-group button.maplibregl-ctrl-compass .maplibregl-ctrl-icon { background-image: none !important; filter: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.maplibregl-ctrl-group button.maplibregl-ctrl-compass .maplibregl-ctrl-icon::after { content: "N"; order: 1; color: #fff; font: 800 17px/1 Arial, Helvetica, sans-serif; }
.maplibregl-ctrl-group button.maplibregl-ctrl-compass .maplibregl-ctrl-icon::before { content: ""; order: 2; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid #fff; }
.maplibregl-ctrl-attrib { font-size: 11px; background: var(--attr-bg) !important; color: var(--attr-text); border-radius: 10px; }
.maplibregl-ctrl-attrib a { color: var(--attr-fg) !important; }
.maplibregl-ctrl-attrib-button { filter: var(--attr-btn-filter); }
.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-inner { color: var(--attr-inner); }
@media (max-width: 859px) {
  /* タブ(高さ var(--tabbar-h)、下から safe-area+10px の位置)の上に、12pxあけて置く。iPhoneなどの画面下の余白(safe-area)の分も含める(固定の86pxだと、出典の表示とタブが重なった) */
  body:not(.sheet-open) .maplibregl-ctrl-bottom-right, body:not(.sheet-open) .maplibregl-ctrl-bottom-left { margin-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 22px); }
}

/* 起点・終点のラベル(選んだ国道に表示) */
.pin { display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.pin-lab { background: var(--pin-bg); color: var(--pin-fg); font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px; box-shadow: 0 3px 10px rgba(0,0,0,.28); white-space: nowrap; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 4px solid var(--route-on); box-shadow: 0 0 0 4px color-mix(in srgb, var(--route-on) 28%, transparent); }

/* 図鑑 */
#view-zukan { overflow-y: auto; padding: calc(14px + var(--mt-extra)) 16px 120px; }
.zwrap { max-width: 1040px; margin: 0 auto; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 16px; max-width: 380px; }
.seg button { border: 0; background: transparent; border-radius: 12px; min-height: 42px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.zukan-head { margin: 14px 0 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.count { margin: 0; color: var(--muted); font-size: 14px; }
.count b { color: var(--text); font-size: 18px; }
.chips { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; font-size: 14px; min-height: 40px; }
.chip.on { background: var(--fill); border-color: transparent; color: #fff; font-weight: 700; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
.card { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 12px 14px; display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; min-height: 90px; box-shadow: var(--shadow-sm); }
.card:hover { border-color: var(--accent); }
.card .sign { width: 64px; height: auto; }
.card h3 { margin: 0; font-size: 17px; }
.card .tag { margin: 0; color: var(--muted); font-size: 13px; }
.card .meta { margin: 4px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.card .meta b { font-variant-numeric: tabular-nums; }

/* 都道府県別 */
.region { margin: 20px 0 8px; font-size: 13px; color: var(--muted); letter-spacing: .08em; font-weight: 700; }
.pref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.ptile { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.ptile:not(:disabled):hover { border-color: var(--accent); }
.ptile .pn { font-size: 16px; font-weight: 800; }
.ptile .pc { font-size: 12px; color: var(--accent); font-weight: 700; }
.ptile:disabled { opacity: .5; background: transparent; box-shadow: none; }
.ptile:disabled .pc { color: var(--muted); font-weight: 400; }
.prow { width: 100%; text-align: left; border: 0; background: var(--surface-2); border-radius: 16px; padding: 10px 12px; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; min-height: 64px; margin-bottom: 8px; }
.prow .sign { width: 48px; height: auto; }
.prow b { font-size: 16px; display: block; }
.roles { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.role { font-size: 11px; font-weight: 700; padding: 0 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.role.s { background: var(--route-on); color: var(--on-route); }
.prow .len { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 詳細カード(スマホ:浮かぶ丸いカード) */
.sheet {
  position: fixed; z-index: 40; left: 10px; right: 10px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 22px);
  max-height: 58vh; overflow-y: auto; overscroll-behavior: contain;
  background: color-mix(in srgb, var(--surface) 98%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-line); border-radius: 28px; box-shadow: var(--shadow);
  padding: 4px 18px 20px; animation: up .22s ease-out;
}
.sheet[hidden] { display: none; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.grab { display: block; width: 72px; height: 26px; margin: 0 auto; border: 0; background: transparent; position: relative; }
.grab::before { content: ""; position: absolute; left: 14px; right: 14px; top: 10px; height: 5px; border-radius: 3px; background: var(--line); }
.close { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border: 0; background: var(--surface-2); border-radius: 50%; font-size: 22px; line-height: 1; z-index: 2; }
.sheet { transition: max-height .3s cubic-bezier(.2, .8, .2, 1); touch-action: pan-y; }
.sheet.peek { max-height: 330px; overflow: hidden; padding-bottom: 14px; }
.sheet.peek #sheet-body { padding-bottom: 58px; }
.sheet.peek .more { position: absolute; left: 18px; right: 18px; bottom: 14px; width: auto; margin: 0; z-index: 4; }
.sheet.peek::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 72px; background: var(--surface); z-index: 3; }
.more { display: block; width: 100%; min-height: 44px; margin-top: 8px; border: 0; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.more[hidden] { display: none; }
/* 極小カード(スマホ幅のみ): 国道名と、起点・終点ボタンだけ */
@media (max-width: 859px) {
  .sheet.peek.mini { max-height: 200px; padding-bottom: 14px; }
  .sheet.mini #sheet-body { padding-bottom: 0; }
  .sheet.mini #sheet-body > :not(.head):not(.endbtns) { display: none; }
  .sheet.mini::after, .sheet.mini .more { display: none; }
}
.endbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
.endbtns.one { grid-template-columns: 1fr; }
.endbtn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 10px; line-height: 1.2; border: 1px solid var(--line); border-radius: 14px; background: var(--accent-soft); color: var(--accent); font: inherit; cursor: pointer; }
.endbtn b { font-size: 15px; font-weight: 800; line-height: 1.2; }
.endbtn small { font-size: 12px; line-height: 1.2; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endbtn:active { transform: scale(.98); }
.head { display: grid; grid-template-columns: 78px 1fr; gap: 14px; align-items: center; padding-right: 132px; }
.head .sign { width: 78px; height: auto; }
.head h2 { margin: 0; font-size: 22px; }
.head p { margin: 0; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.stats.s3 { grid-template-columns: repeat(3, 1fr); }
.stat { background: var(--surface-2); border-radius: 16px; padding: 10px 12px; }
.stat small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.s3 .stat b { font-size: 19px; }
.stat span { font-size: 13px; color: var(--muted); margin-left: 2px; }
/* 見どころ・豆知識 */
.trivia { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tv { background: var(--surface-2); border-radius: 18px; padding: 12px 14px; }
.tv-top { display: flex; align-items: flex-start; gap: 8px; }
.tv-top b { font-size: 15.5px; line-height: 1.45; }
.kind { --k: #6b7a90; flex: none; margin-top: 1px; font-size: 11px; font-weight: 800; padding: 1px 9px; border-radius: 99px; letter-spacing: .04em; white-space: nowrap;
  background: color-mix(in srgb, var(--k) 20%, var(--surface)); color: color-mix(in srgb, var(--k) 65%, var(--text)); }
.kind[data-k="日本一"] { --k: #d99a00; }
.kind[data-k="歴史"] { --k: #6f7fd0; }
.kind[data-k="絶景"] { --k: #17a2a2; }
.kind[data-k="珍しい"] { --k: #a85bd6; }
.kind[data-k="観光"] { --k: #2fa45a; }
.kind[data-k="峠"] { --k: #c8693a; }
.kind[data-k="データ"] { --k: #3f6f9f; }
.kind[data-k="通称"] { --k: #b0407f; }
.kind[data-k="橋・トンネル"] { --k: #7a6254; }
.kind[data-k="起点・終点"] { --k: #c44a3d; }
.kind[data-k="海の道"] { --k: #1f6fc0; }
.kind[data-k="ルート"] { --k: #6b7d1f; }
.tv-b { margin: 6px 0 4px; font-size: 14px; line-height: 1.65; }
.tv-s { display: block; font-size: 11px; color: var(--muted); }
.caution { margin: 8px 0 0; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.6;
  background: color-mix(in srgb, var(--route-on) 14%, var(--surface)); border-left: 4px solid var(--route-on); }
.caution b { display: block; font-size: 12px; margin-bottom: 2px; }
.sec { margin: 16px 0 6px; font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: .06em; }
.flow { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.pt { background: var(--surface-2); border-radius: 16px; padding: 10px 12px; }
.pt small { color: var(--muted); font-size: 12px; }
.pt b { display: block; font-size: 17px; }
.pt p { margin: 2px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.arrow { align-self: center; color: var(--accent); font-weight: 700; }
.pref-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pref { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 3px 12px; font-size: 14px; font-weight: 700; }
.ov { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ov li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 8px 10px; font-size: 14px; }
.ov .n { background: var(--accent); color: #fff; font-weight: 700; border-radius: 9px; padding: 2px 10px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.none { color: var(--muted); font-size: 14px; margin: 0; }
.note { margin: 12px 0 0; font-size: 13px; color: var(--muted); background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 10px; padding: 8px 12px; }
.src { margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.src a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.actions { margin-top: 14px; }
.primary { width: 100%; min-height: 50px; border: 0; border-radius: 16px; background: var(--fill); box-shadow: var(--fill-shadow); color: #fff; font-weight: 800; font-size: 16px; }

/* PC(広い画面) */
@media (min-width: 860px) {
  :root { --tabbar-h: 0px; }
  .tabs { top: var(--tabpc-mt); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); width: auto; height: var(--tabpc-h); padding: var(--tabpc-pad); gap: 6px; background: var(--tabpc-bg); backdrop-filter: var(--tabpc-blur); -webkit-backdrop-filter: var(--tabpc-blur); border: 0; border-radius: 99px; box-shadow: var(--tabpc-shadow); display: flex; align-items: center; }
  .tabs button { flex-direction: row; gap: 8px; padding: 8px 18px; border-radius: 99px; font-size: 15px; min-height: 44px; }
  #view-zukan { padding-bottom: 40px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .sheet { left: 16px; right: auto; top: calc(var(--top-h) + 16px); bottom: 16px; width: 400px; max-height: none; border-radius: 24px; }
  .sheet, .sheet.peek { max-height: none; transition: none; }
  .sheet.peek::after { display: none; }
  .sheet.peek { overflow-y: auto; }
  .sheet.peek #sheet-body { padding-bottom: 0; }
  .grab, .more { display: none !important; }
  body.sheet-open .map-top { left: 428px; }
  .maplibregl-ctrl-top-right { top: calc(126px + var(--mt-extra)); }
}
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; transition: none; } }

/* 詳細カードの「単独ページを開く」リンク */
.pagelink { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0 0; min-height: 52px; padding: 0 18px; border-radius: 16px; font-size: 16px; font-weight: 800; color: var(--accent); text-decoration: none;
  background: var(--accent-soft); border: 2px solid var(--accent); }
.pagelink svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pagelink:hover { background: var(--accent); color: #fff; }
.pagelink-note { margin: 6px 4px 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ライトの新デザイン用: 詳細カード上端のグラデーション線 / 地図の上下のうっすらした色 */
.sheet::before { content: ""; display: var(--sheet-bar-display); position: sticky; top: -4px; height: var(--sheet-bar); margin: -4px -18px 4px; background: var(--brand-grad); z-index: 3; }
#view-map::after { content: ""; position: absolute; inset: 0; background: var(--wash); pointer-events: none; z-index: 1; }

/* PCのライトでは、地図の上下の色のにじみを付けない(スマホは付ける) */
@media (min-width: 860px) {
  :root { --wash: none; }
}

/* ライト/ダークを切り替えたときの、ふんわり表示 */
.toast {
  position: fixed; left: 50%; top: 44%; z-index: 60; transform: translate(-50%, -50%) scale(.94);
  padding: 12px 28px; border-radius: 99px; font-size: 18px; font-weight: 800; letter-spacing: .08em; white-space: nowrap;
  color: #fff; background: rgba(15, 22, 36, .88); border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
  opacity: 0; pointer-events: none; transition: opacity .35s ease, transform .35s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .2s; transform: translate(-50%, -50%); } .toast.show { transform: translate(-50%, -50%); } }

/* 「ここへ行くなら」(アフィリエイト用の枠) */
.go-h { display: flex; align-items: center; gap: 8px; }
.pr { font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 0 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.go-note { margin: 0 0 8px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.go-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.go-i { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 18px; background: var(--surface-2); color: inherit; text-decoration: none; border: 1px solid transparent; }
a.go-i:hover { border-color: var(--accent); }
.go-ic { --k: #6b7a90; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 16px;
  background: color-mix(in srgb, var(--k) 22%, var(--surface)); color: color-mix(in srgb, var(--k) 70%, var(--text)); }
.go-ic[data-k="stay"] { --k: #6f7fd0; }
.go-ic[data-k="rent"] { --k: #17a2a2; }
.go-ic[data-k="gear"] { --k: #d99a00; }
.go-b b { display: block; font-size: 15px; line-height: 1.4; }
.go-b small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.55; margin-top: 1px; }
.go-tag { font-size: 11px; font-weight: 700; color: var(--muted); border: 1px dashed var(--muted); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.go-arrow { color: var(--accent); font-weight: 800; }

/* 検索窓(国道の番号)。色は、地図上のチップと同じ変数を使う(ライトは濃い紺、ダークは今までのすりガラス) */
.search { position: relative; margin: 0 12px 6px; max-width: 520px; pointer-events: auto; }
.search-box { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 13px; border-radius: 99px;
  background: var(--chip-bg); color: var(--chip-fg); border: 1px solid var(--chip-line); box-shadow: var(--chip-shadow);
  backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5); }
.search-box:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent), var(--chip-shadow); }
.search-box svg { width: 18px; height: 18px; flex: none; opacity: .85; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 16px; }
.search input::placeholder { color: var(--lab-sub); opacity: 1; }
.search-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .8; font-size: 20px; line-height: 1; }
.search-x[hidden] { display: none; }
.search-list { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 2; max-height: min(60vh, 380px); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 6px; list-style: none; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.search-list[hidden] { display: none; }
.s-hd { padding: 6px 10px 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.s-opt { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; width: 100%; min-height: 56px; padding: 8px 10px; border: 0; border-radius: 14px; background: transparent; color: inherit; text-align: left; }
.s-opt:hover, .s-opt.act { background: var(--surface-2); }
.s-opt .sign { width: 40px; height: auto; }
.s-m b { display: block; font-size: 16px; line-height: 1.4; }
.s-m small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.s-len { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.s-empty { padding: 12px 12px 14px; font-size: 14px; color: var(--muted); line-height: 1.7; }
/* 地図の上: 候補を開いている間は、詳細カードより手前に出す */
.map-top:focus-within { z-index: 45; }
/* 図鑑の上 */
#search-zukan { margin: 0 0 12px; }

.rank-line { margin: 4px 2px 12px; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* お気に入り */
.fav-btn { position: absolute; right: 54px; top: 10px; width: 40px; height: 40px; border: 0; background: var(--surface-2); border-radius: 50%; display: grid; place-items: center; z-index: 2; color: var(--muted); }
.fav-btn svg, .fav-x svg, .card-fav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.fav-btn[aria-pressed="true"], .fav-x, .card-fav { color: #ef476f; }
.fav-btn[aria-pressed="true"] svg, .fav-x svg, .card-fav svg { fill: currentColor; }
.sheet.pref .fav-btn { display: none; }
#view-fav { overflow-y: auto; padding: calc(14px + var(--mt-extra)) 16px 120px; }
.fav-title { margin: 4px 0 4px; font-size: 20px; }
.fav-note { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.fav-empty { padding: 28px 18px; border-radius: 20px; background: var(--surface); border: 1px dashed var(--line); text-align: center; color: var(--muted); line-height: 1.8; }
.fav-empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.fav-empty svg { width: 36px; height: 36px; fill: none; stroke: #ef476f; stroke-width: 2; stroke-linejoin: round; }
.cards li { position: relative; }
.fav-x, .card-fav { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; }
.fav-x:hover, .card-fav:hover { background: var(--surface-2); }
.card-fav { color: var(--muted); }
.card-fav[aria-pressed="true"] { color: #ef476f; }
.card-fav[aria-pressed="false"] svg { fill: none; }
.cards .card { padding-right: 52px; }

/* 起動中の画面(読み込み中のあいだ、空白の代わりに出す)。開いた瞬間に、ロゴが小さな点から一気にアップになって現れる。app.js が準備できたら、すっと薄くなって消える。万一消えなくても、15秒後に自動で消える */
#splash { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #fff; color: #111; overflow: hidden; animation: sp-failsafe .01s 15s forwards; }
#splash.done { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s ease .3s, visibility 0s .6s; }
/* アプリが開く瞬間: ロゴが一気に画面いっぱいまで拡大して、その向こうからアプリが現れる */
#splash.done .sp-logo { animation: sp-burst .6s cubic-bezier(.55, 0, .85, .35) both; }
#splash.done .sp-name { animation: sp-out .15s ease forwards; }
@keyframes sp-burst { 0% { transform: scale(1); opacity: 1; } 75% { opacity: 1; } 100% { transform: scale(50); opacity: 0; } }
@keyframes sp-out { to { opacity: 0; } }
.sp-bob { animation: sp-bob 1.6s ease-in-out 1s infinite; }
.sp-logo { display: block; width: 96px; height: auto; animation: sp-in .9s cubic-bezier(.2, .9, .25, 1.15) both; }
.sp-name { opacity: 0; animation: sp-fade .5s ease .55s forwards; }
#splash::before { content: ""; position: absolute; inset: 3% 2%; background: url(japan.svg) center / contain no-repeat; }  /* 白地に黒塗りの日本列島(固定。ロゴが拡大しても動かない) */
.sp-name { margin: 0; padding: 4px 16px; border-radius: 999px; background: #fff; border: 2px solid #111; font-size: 22px; font-weight: 800; letter-spacing: .12em; }
@keyframes sp-in { 0% { transform: scale(.05) rotate(-12deg); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes sp-fade { to { opacity: 1; } }
@keyframes sp-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes sp-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
/* 「動きを減らす」設定の端末でも、酔いにくい穏やかな動き(回転・上下なし。小さい状態からふわっと大きくなって現れるだけ)は残す */
@media (prefers-reduced-motion: reduce) { .sp-bob { animation: none; } .sp-logo { animation: sp-in-soft .9s ease-out both; } }
@keyframes sp-in-soft { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
/* 地図の＋−・北向きボタン: 素早く2回タップしても、ページ全体が拡大・縮小されないようにする(地図だけがズームする) */
.maplibregl-ctrl, .maplibregl-ctrl-group, .maplibregl-ctrl-group button, .maplibregl-ctrl button { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* 共有ボタン(シート右上)と、シェアの欄(シートの下) */
.share-btn { right: 98px; }
.share-btn svg { fill: none; }
.share-btn circle { fill: currentColor; stroke: none; }
.share { margin: 18px 0 0; }
.share h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.share-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-i { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border: 1px solid var(--line, rgba(128,128,128,.35)); border-radius: 14px; background: var(--surface-2); color: inherit; font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; }
.share-i:hover { border-color: var(--accent); color: var(--accent); }

/* 画面上部の小さなボタン(リンクのコピー・ホーム画面に追加)と、追加方法の案内 */
.top-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn.sm { width: 38px; height: 38px; }
.icon-btn.sm svg { width: 19px; height: 19px; }
.icon-btn[hidden] { display: none; }
.a2hs { position: fixed; inset: 0; z-index: 70; display: grid; align-items: end; justify-items: center; padding: 16px; background: rgba(8, 19, 61, .55); }
.a2hs[hidden] { display: none; }
.a2hs-panel { width: min(100%, 460px); max-height: 85vh; overflow: auto; padding: 20px 20px 18px; border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.a2hs-panel h2 { margin: 0 0 10px; font-size: 18px; }
.a2hs-steps { margin: 0 0 8px; padding-left: 22px; line-height: 1.7; font-size: 15px; }
.a2hs-steps li { margin: 4px 0; }
.a2hs-panel .primary { width: 100%; margin-top: 12px; }

