/* ルートプランナー 試作版のスタイル */
:root {
  --bg: #f4f1ea;
  --surface: #fffdf9;
  --surface-2: #f8f5ee;
  --ink: #1d2a2f;
  --ink-2: #3d4a4e;
  --muted: #687377;
  --line: #ddd6c7;
  --line-strong: #c7bfae;
  --accent: #c94a26;
  --accent-hover: #b03f1f;
  --accent-ink: #ffffff;
  --accent-soft: #fbebe3;
  --accent-text: #a33a1a;
  --ok: #1f7a6c;
  --ok-soft: #e1f1ed;
  --warn: #9a5a07;
  --warn-soft: #fcf0d6;
  --danger: #a3271b;
  --danger-soft: #fbe5e2;
  --focus: #2f5fb3;
  --day1: #c94a26;
  --day2: #1f7a6c;
  --day3: #2f5fb3;
  --day4: #7a4fa3;
  --day5: #8a6a12;
  --day6: #4d7c0f;
  --day7: #0e7490;
  --day8: #6b5d52;
  /* 地図の有料区間（高速道路・有料道路）。日ごとの色（赤橙・緑・青・紫・黄土）や、
     Google の地図の道路（白・黄・橙）・水（青）・緑地（緑）のどれとも違う赤紫にする */
  --toll: #d6338a;
  --toll-soft: #fbe4ef;
  /* 入力欄・カードの地、濃い色（--ink）で塗った上の文字など。ダークモードで差し替える */
  --field: #ffffff;
  --on-ink: #ffffff;
  --on-ink-muted: #b9c4c7;
  --on-ink-warn: #f7c97a;
  --on-fill: #ffffff;       /* アクセント・成功の色で塗った上の文字 */
  --on-danger: #ffffff;
  --warn-line: #ecd49a;
  --ok-line: #b8ddd4;
  --danger-line: #efc2bb;
  --accent-line: #f1c4b3;
  --danger-hover: #8a1f15;
  --glass: rgba(255, 253, 249, .92);
  --map-bg: #e6ebdf;
  --scrim: rgba(29, 42, 47, .55);
  --band: rgba(31, 122, 108, .18);
  --toast-link: #ffd2bf;
  /* 天気のアイコン */
  --wx-sun: #f0a020;
  --wx-moon: #c9a63a;
  --wx-cloud: #9aa6ac;
  --wx-rain: #3b82c4;
  --wx-snow: #79b4de;
  --wx-bolt: #f2c200;
  color-scheme: light;
  --cal-sat: #2f5fb3;
  --cal-sun: #c0392b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(29, 42, 47, .06), 0 4px 16px rgba(29, 42, 47, .06);
  --topbar-h: 56px;
  /* プルダウンの矢印（色は --ink-2 と同じ。背景画像では currentColor を使えないため、色ごとに用意する） */
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%233d4a4e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ダークモード（右上のボタンで切り替え。public/theme.js が最初に決める） */
:root[data-theme="dark"] {
  color-scheme: dark;
  --cal-sat: #7ea9f2;
  --cal-sun: #f08a7e;
  --bg: #121719;
  --surface: #1a2023;
  --surface-2: #20282b;
  --ink: #e6eaeb;
  --ink-2: #c2cacc;
  --muted: #8f9b9f;
  --line: #2e383c;
  --line-strong: #435056;
  --accent: #e3653f;
  --accent-hover: #ec7955;
  --accent-ink: #ffffff;
  --accent-soft: #3a2218;
  --accent-text: #f4a283;
  --ok: #3fa594;
  --ok-soft: #142c26;
  --warn: #e5ad4f;
  --warn-soft: #2f2610;
  --danger: #ee7b6d;
  --danger-soft: #361a17;
  --focus: #7ea9f2;
  --day1: #ea6b44;
  --day2: #36a993;
  --day3: #5f90e2;
  --day4: #a882d4;
  --day5: #c7a343;
  --day6: #8cbf45;
  --day7: #3cb4d4;
  --day8: #b0a295;
  --toll: #ef5fa6;
  --toll-soft: #3a1829;
  --field: #11171a;
  --on-ink: #121719;
  --on-ink-muted: #4d585c;
  --on-ink-warn: #8a5000;
  --on-danger: #2a0f0b;
  --warn-line: #5b4619;
  --ok-line: #24493f;
  --danger-line: #5a2a25;
  --accent-line: #5c3020;
  --danger-hover: #f39184;
  --glass: rgba(26, 32, 35, .92);
  --map-bg: #1d2427;
  --scrim: rgba(0, 0, 0, .6);
  --band: rgba(63, 165, 148, .22);
  --toast-link: #b4401c;
  --wx-cloud: #aab5ba;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .3);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23c2cacc' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 26px; line-height: 1.35; margin: 0 0 6px; letter-spacing: .01em; }
h2 { font-size: 16px; line-height: 1.4; margin: 0; }
h3 { font-size: 16px; line-height: 1.4; margin: 0; }
p { margin: 0; }
a { color: inherit; }
/* プルダウン：ブラウザ標準の矢印は文字と上下の位置がずれて見えるため、自前の矢印を右端の上下中央に置く。
   地の色は各欄の background-color で決める（background の一括指定を使うと、この矢印が消える） */
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 10px top 52%; /* 和文の文字は箱の中央より少し下に描かれるため、矢印も少し下げて文字の中央にそろえる */
  background-size: 12px 12px;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 上部バー ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  height: var(--topbar-h); padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand small { font-size: 11px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.mainnav { display: flex; gap: 4px; margin-left: auto; height: 100%; }
.mainnav a {
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.mainnav a:hover { color: var(--ink); }
.mainnav a.current { color: var(--ink); border-bottom-color: var(--accent); }
.count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-size: 12px; line-height: 20px; text-align: center; }

/* ライト／ダークの切り替え */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.theme-toggle:hover { background: var(--bg); color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ---------- 作成の流れ ---------- */
.flowbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.steps { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 4px; }
.steps li + li::before { content: ""; width: 20px; height: 1px; background: var(--line-strong); margin-right: 4px; }
.steps a, .steps span {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px;
  font-size: 14px; text-decoration: none; color: var(--muted); white-space: nowrap;
}
.steps b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 12px; }
.steps a:hover { background: var(--bg); color: var(--ink); }
.steps .done b { background: var(--ok); border-color: var(--ok); color: var(--on-fill); }
.steps .done { color: var(--ink-2); }
.steps .current { color: var(--ink); font-weight: 700; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.steps .current b { background: var(--accent); border-color: var(--accent); color: var(--on-fill); }
.steps span.locked { opacity: .5; }
.flow-note { margin-left: auto; font-size: 13px; color: var(--muted); }
.flow-note b { color: var(--ink); }

.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--danger-soft); color: var(--danger); border-bottom: 1px solid var(--danger-line); font-size: 14px;
}
.notice code { background: var(--field); padding: 1px 6px; border-radius: 4px; color: var(--ink); }

/* ---------- 共通部品 ---------- */
main { flex: 1; padding: 28px 20px 40px; }
.narrow { max-width: 760px; margin: 0 auto; }
.wide { max-width: 1120px; margin: 0 auto; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--accent); margin-bottom: 2px; }
.lead { color: var(--muted); margin-bottom: 20px; }
.hint { color: var(--muted); font-size: 13px; }
.pad { padding: 12px 16px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.footnote { padding: 14px 20px 20px; font-size: 12px; color: var(--muted); text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: var(--surface); border-color: var(--line-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--bg); }
.btn.danger { background: var(--danger); color: var(--on-danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn.text { background: transparent; color: var(--muted); padding-inline: 10px; }
.btn.text:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.btn.text.danger-text:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; font-weight: 500; }
.btn.lg { min-height: 48px; padding: 10px 28px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; line-height: 1; padding: 4px 7px; border-radius: 5px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; font-weight: 500;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge.changed { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
/* 道路（スカイライン・峠道など）を走る区間 */
.badge.road { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); font-weight: 600; }

.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.form-error ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- 1. 条件入力 ---------- */
.form { padding: 8px 28px 24px; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 20px 0 4px; min-width: 0; }
fieldset:first-child { border-top: 0; }
legend { padding: 0 10px 0 0; font-weight: 700; font-size: 14px; color: var(--accent-text); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
/* 条件入力はPCでの利用を前提に、横に広く使って項目を並べる（狭い画面では下の @media で1列に戻す） */
.input-wide { max-width: 1200px; margin: 0 auto; }
.input-wide .form { padding: 8px 32px 0; }
.form-row { display: grid; gap: 0 24px; align-items: start; }
.form-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* 出発時刻と宿泊地/自宅到着時刻：到着時刻は日ごとに「（任意）」が付いて幅を取るため、少し広くして3日分を1行に並べる */
.form-row.cols-times { grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); }
/* 出発日は説明が長いので広め、日程・移動手段・人数は短いので狭め */
.form-row.cols-when { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
/* 高速道路の使い方：5つの選択肢を横一列に並べる */
.option-list.option-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.option-list.option-row label { display: flex; }
.option-list.option-row span { flex: 1; }
/* 日ごとの目安：チェックボックスは距離の目安の右に置き、日ごとのスライダーは下の行に横幅いっぱいで並べる
   （日数が多くても縦に伸びすぎないように）。hidden のときは消えたままにするため :not([hidden]) を付ける */
.form-row .per-day:not([hidden]) { display: contents; }
.form-row .per-day > .check { justify-self: start; margin-top: 34px; }
.form-row .day-targets { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 24px; margin: 0 0 16px; }
/* 「AIに相談する」は、下までスクロールしなくても押せるよう画面の下に留める */
.input-wide .form-foot { position: sticky; bottom: 0; z-index: 5; background: var(--surface); padding-bottom: 20px; }
.field { display: block; margin-bottom: 16px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input[type="text"], .field input[type="date"], .field input[type="number"], .field select, .field textarea {
  display: block; width: 100%; margin-top: 6px; padding: 9px 12px; min-height: 42px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background-color: var(--field); font-weight: 400; font-size: 15px; color: var(--ink);
}
.field select { padding-right: 34px; } /* 右端の矢印に文字が重ならないように */
.field textarea { resize: vertical; }

/* 出発日のカレンダー */
.date-picker { position: relative; margin-top: 6px; }
.date-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--field); color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 400; text-align: left; cursor: pointer;
}
.date-trigger.is-empty { color: var(--muted); }
.date-trigger svg { flex: none; color: var(--muted); }
.date-trigger:hover { border-color: var(--ink-2); }
.date-trigger[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.date-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 100%; min-width: 280px; max-width: 360px; /* 入力欄の幅に合わせる（スマホで画面からはみ出さない） */
  padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .18); font-weight: 400; color: var(--ink);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 17px; }
.cal-nav { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 18px; cursor: pointer; }
.cal-nav:hover:not(:disabled) { background: var(--bg); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { padding: 4px 0; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-week .sun { color: var(--cal-sun); }
.cal-week .sat { color: var(--cal-sat); }
.cal-day {
  position: relative; display: flex; align-items: center; justify-content: center; height: 42px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: inherit; font-size: 15px;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.cal-day:hover:not(:disabled) { background: var(--bg); }
.cal-day.sun { color: var(--cal-sun); }
.cal-day.sat { color: var(--cal-sat); }
.cal-day.out { opacity: .45; }
.cal-day:disabled { color: var(--muted); opacity: .35; cursor: default; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--ink-2); font-weight: 700; }
.cal-day.in-trip { background: var(--accent-soft); border-radius: 0; }
.cal-day.trip-end { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.cal-day.selected { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.cal-day.selected.has-trip { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.cal-day:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; z-index: 1; }
.cal-day .wx-dot { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); }
.wx-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); vertical-align: middle; }
.cal-day.selected .wx-dot { background: var(--accent-ink); }
.cal-holidays { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--cal-sun); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cal-legend .sw { display: inline-block; width: 14px; height: 10px; margin-right: 4px; border-radius: 3px; background: var(--accent-soft); vertical-align: middle; }
.cal-legend .wx-dot { margin-right: 5px; }
.cal-foot { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.cal-foot .grow { margin-right: auto; }
.field input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.segment { display: flex; margin-top: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--field); }
.segment label { flex: 1; cursor: pointer; }
.segment label + label { border-left: 1px solid var(--line-strong); }
.segment input, .chips input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: block; padding: 9px 8px; text-align: center; font-weight: 400; font-size: 14px; color: var(--ink); }
.segment input:checked + span { background: var(--ink); color: var(--on-ink); font-weight: 600; }
.segment input:focus-visible + span, .chips input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips label { cursor: pointer; }
.chips span { display: block; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--field); font-weight: 400; font-size: 14px; color: var(--ink); }
.chips input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.chips input:checked + span::before { content: "✓ "; }
.range-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.range-row input { flex: 1; accent-color: var(--accent); }
.range-row output { min-width: 70px; text-align: right; font-size: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 20px; margin-top: 4px; }
#trip-form-error { margin-bottom: 12px; }
/* 条件を直したことのお知らせ（エラーではない） */
.form-error.info { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
/* 日程と距離が釣り合わないときの、条件を直すボタン */
.fix-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.field-hint { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.day-targets { display: grid; gap: 8px; margin-top: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.day-target { display: grid; grid-template-columns: 52px 1fr 64px; grid-template-areas: "label slider out" ". range range"; align-items: center; column-gap: 10px; font-weight: 400; }
.day-target .dt-label { grid-area: label; font-weight: 700; }
.day-target input[type="range"] { grid-area: slider; width: 100%; accent-color: var(--accent); }
.day-target .dt-out { grid-area: out; text-align: right; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-target .dt-range { grid-area: range; font-size: 12px; color: var(--muted); }
/* 日ごとの出発時刻 */
.start-time-list { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 6px; } /* 3日分が1行に並ぶよう、間を詰める */
.start-time { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.start-time .st-label { font-weight: 700; font-size: 14px; white-space: nowrap; }
.start-time .st-label small { font-weight: 400; color: var(--muted); font-size: 12px; }
/* 日ごとの出発時刻・到着の締め切り：見出し（「1日目」など）と上下の中央をそろえる（入力欄の上の余白 margin-top をなくす） */
.start-time select { margin-top: 0; padding: 6px 26px 6px 9px; background-position: right 8px top 52%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background-color: var(--field); font: inherit; font-size: 15px; }
/* 高速道路・有料道路の使い方（説明つきの選択肢） */
.option-list { display: grid; gap: 6px; margin-top: 6px; }
.option-list label { cursor: pointer; }
.option-list input { position: absolute; opacity: 0; pointer-events: none; }
.option-list span { display: block; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--field); }
.option-list b { display: block; font-size: 14px; }
.option-list small { display: block; margin-top: 1px; font-size: 12px; font-weight: 400; color: var(--muted); }
.option-list input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.option-list input:checked + span small { color: var(--on-ink); opacity: .8; }
.option-list input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.privacy-note { margin: 8px 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }

/* ---------- チャット共通 ---------- */
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pane-head .eyebrow { margin: 0; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-top-right-radius: 4px; }
.msg.change { align-self: stretch; max-width: none; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 13px; border-radius: var(--radius-sm); }
.msg .who { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.msg.user .who { color: var(--on-ink-muted); }
.msg .why { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.msg .btn { margin-top: 10px; }
.msg.typing { color: var(--muted); }
.msg.typing::after { content: "…"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.options { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.options button, .suggests button {
  padding: 6px 14px; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--field); color: var(--accent-text); cursor: pointer; font-size: 13px;
}
.options button:hover, .suggests button:hover { background: var(--accent-soft); }
.msg.error { align-self: stretch; max-width: none; background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); }
.msg.error .who { color: var(--danger); }
.msg.progress-msg { align-self: stretch; max-width: none; background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13px; }
.q-cards { display: grid; gap: 10px; align-self: stretch; }
.q-card { padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); background: var(--field); }
.q-text { font-weight: 700; font-size: 14px; }
.q-why { font-size: 12px; color: var(--muted); margin-top: 2px; }
.q-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.q-options button { padding: 6px 14px; border: 1px solid var(--accent); border-radius: 999px; background: var(--field); color: var(--accent-text); cursor: pointer; font-size: 13px; }
.q-options button:hover { background: var(--accent-soft); }
.q-options button.on { background: var(--accent); color: var(--on-fill); font-weight: 600; }
.q-options button.on::before { content: "✓ "; }
.q-send { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.generate-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.usage-line { font-size: 12px; color: var(--muted); }
.usage-line:empty { display: none; }
.setup-guide { align-self: stretch; padding: 14px 16px; border: 1px solid var(--warn-line); border-radius: var(--radius-sm); background: var(--warn-soft); font-size: 14px; }
.setup-guide h3 { margin-bottom: 6px; color: var(--warn); }
.setup-guide ol { margin: 8px 0; padding-left: 20px; }
.setup-guide code { background: var(--field); padding: 1px 5px; border-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--field); }

/* ---------- 2. AIと相談 ---------- */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; max-width: 1120px; margin: 0 auto; align-items: start; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 480px; }
.cond-card { padding-bottom: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.cond-list { margin: 8px 16px 0; }
.cond-list div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.cond-list dt { color: var(--muted); }
.cond-list dd { margin: 0; font-weight: 600; }
.cond-list .new dd { color: var(--accent-text); }

/* ---------- 3. プラン確認・保存 ---------- */
/* 案①・案②の切り替え */
.variant-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.variant-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.variant-tabs button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.variant-tabs button:hover:not(:disabled) { background: var(--bg); }
.variant-tabs button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
.variant-tabs button small { font-size: 11px; font-weight: 500; opacity: .8; }
.variant-tabs button .badge { padding: 2px 5px; }
.variant-tabs button:disabled { cursor: not-allowed; opacity: .6; }
.variant-bar .hint { font-size: 12px; }
/* 案の比較 */
.dialog.compare-dialog { width: min(1080px, calc(100% - 32px)); max-height: calc(100vh - 48px); }
.compare-scroll { overflow-x: auto; margin-top: 4px; }
.compare-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.compare-table th, .compare-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; min-width: 180px; }
.compare-table th[scope="row"] { min-width: 76px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.compare-table thead th { font-size: 15px; border-bottom: 2px solid var(--line-strong); }
.compare-table td.current, .compare-table th.current { background: var(--surface-2); }
.compare-table .cmp-title { font-size: 12px; font-weight: 400; color: var(--muted); }
.compare-table .over-note { color: var(--warn); font-weight: 700; }
.compare-table .warn-text { color: var(--danger); font-weight: 700; }
.cmp-spots { margin: 4px 0 0; padding-left: 18px; color: var(--ink-2); }
.cmp-actions { display: flex; flex-wrap: wrap; gap: 6px; }
/* 走行時間（1日ごと） */
/* 7泊8日まで並ぶため、狭い画面では次の行に折り返す（数字の途中では折り返さない） */
.stat .day-durs { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.stat .day-dur { white-space: nowrap; }
.stat .day-dur small { display: block; font-size: 11px; color: var(--muted); }
.stat .day-dur b { font-size: 17px; }
.plan-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-bottom: 16px; }
.plan-heading { min-width: 0; }
.plan-heading h1 { font-size: 22px; margin: 0; }
.plan-heading .sub { font-size: 13px; color: var(--muted); }
.stats { display: flex; gap: 22px; margin-left: auto; min-width: 0; }
.stats .stat { min-width: 0; }
.stat { font-size: 12px; color: var(--muted); line-height: 1.3; }
.stat b { display: block; font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.plan-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; } /* 狭い画面ではボタンを折り返す */
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; margin-right: 4px; }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.save-state.unsaved::before { background: var(--warn); }
.save-state.dirty::before { background: var(--accent); }
.save-state.saved::before { background: var(--ok); }

.pane-tabs { display: none; }
/* 行程・地図・修正チャットの3列。行程とチャットの幅は仕切りで変えられる（--w-itinerary・--w-assistant。地図は残りの幅） */
.plan-layout { display: grid; grid-template-columns: var(--w-itinerary, 380px) 16px minmax(0, 1fr) 16px var(--w-assistant, 330px); }
.splitter { position: relative; cursor: col-resize; touch-action: none; border-radius: 4px; }
.splitter::after { content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: 44px; margin: -22px 0 0 -2px; border-radius: 2px; background: var(--line-strong); transition: background .15s; }
.splitter:hover::after, .splitter:focus-visible::after, .splitter.dragging::after { background: var(--accent); }
.splitter:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing .pane { pointer-events: none; } /* 仕切りを動かしている間、地図がマウスを奪わないようにする */
.pane { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 520px; overflow: hidden; position: relative; }
/* 確認画面（PCの3列表示）：ページ全体をブラウザの表示領域の高さに収め、縦のスクロールなしで全体を見られるようにする。
   行程・地図・チャットの列は、上の見出しなどを除いた残りの高さいっぱいに広がる（各列の中は従来どおりスクロールできる）。
   表示領域がとても低いときは、列が低くなりすぎて操作しにくくならないよう、ページの高さ 780px（列の高さ約480px）を
   下限にして、ページをスクロールさせる */
@media (min-width: 1241px) {
  body:has(.screen[data-screen="plan"]:not([hidden])) { height: 100vh; min-height: 780px; }
  body:has(.screen[data-screen="plan"]:not([hidden])) main { display: flex; flex-direction: column; min-height: 0; padding: 14px 20px 12px; }
  .screen[data-screen="plan"]:not([hidden]) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .screen[data-screen="plan"] .variant-bar { margin-bottom: 10px; }
  .screen[data-screen="plan"] .plan-toolbar { margin-bottom: 12px; }
  .screen[data-screen="plan"] .plan-layout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .screen[data-screen="plan"] .pane { height: auto; min-height: 0; }
  /* 下の注意書きは内容を変えずに、文字と余白を小さくする */
  body:has(.screen[data-screen="plan"]:not([hidden])) .footnote { padding: 6px 20px 8px; font-size: 11px; line-height: 1.5; }
}

/* 7泊8日まで並ぶため、入りきらない分は次の行に折り返す */
.day-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.day-tabs button { flex: 1 0 auto; min-width: 60px; white-space: nowrap; display: flex; flex-direction: column; align-items: center; padding: 5px 4px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; font-size: 13px; color: var(--muted); line-height: 1.3; }
.day-tabs button small { white-space: nowrap; font-size: 11px; font-variant-numeric: tabular-nums; }
.day-tabs button:hover { background: var(--bg); }
.day-tabs button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); font-weight: 700; }
.day-tabs button.over small { color: var(--warn); font-weight: 700; }
.day-tabs button[aria-selected="true"].over small { color: var(--on-ink-warn); }
.day-tabs button small.over-note { color: var(--warn); font-weight: 700; }
.day-tabs button[aria-selected="true"] small.over-note { color: var(--on-ink-warn); }
.itinerary { flex: 1; overflow-y: auto; padding: 0 14px 16px; }

.cond-summary { margin: 12px 0 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; }
.cond-summary summary { padding: 7px 12px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.cond-summary .chips-static { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }

.day-block { padding-top: 16px; }
.day-title { display: flex; align-items: baseline; gap: 10px; font-weight: 700; }
.day-title .dot { width: 10px; height: 10px; border-radius: 50%; align-self: center; flex: none; }
.day-title .nums { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.limit { margin: 6px 0 4px; }
.limit .range-track { height: 10px; }
.limit-text { font-size: 12px; color: var(--muted); margin-top: 2px; }
.limit.over .limit-text, .limit.under .limit-text { color: var(--warn); font-weight: 700; }
/* 目安の範囲（帯）と実際の距離（棒） */
.range-track { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--line); }
.range-track .band { position: absolute; top: -3px; bottom: -3px; border-radius: 3px; background: var(--band); border: 1px dashed var(--ok); }
.range-track .fill { position: absolute; left: 0; top: 1px; bottom: 1px; border-radius: 3px; background: var(--ok); }
.range-track.over .fill, .range-track.under .fill { background: var(--warn); }
.hw-note { margin: 4px 0 0; font-size: 12px; }

.verify { margin: 12px 0 0; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--line); background: var(--surface-2); }
.verify.has-error { border-color: var(--warn-line); background: var(--warn-soft); }
.verify.clean { border-color: var(--ok-line); background: var(--ok-soft); }
.verify summary { padding: 8px 12px; cursor: pointer; font-weight: 700; color: var(--ink-2); }
.verify-body { padding: 0 12px 10px; display: grid; gap: 6px; }
.issue-list { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.issue-list li.error { color: var(--danger); }
.issue-list li.warn { color: var(--ink-2); }

.spots { list-style: none; margin: 8px 0 0; padding: 0; }
.leg { margin: 0 0 0 13px; padding: 5px 0 5px 22px; border-left: 2px dashed var(--line-strong); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spot-card { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 8px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; }
.spot-card:hover { background: var(--bg); }
.spot.active .spot-card { background: var(--field); border-color: var(--ink); box-shadow: 0 2px 10px rgba(29, 42, 47, .12); }
.pin { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 700; }
.spot-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.spot-head strong { font-size: 14px; }
.spot-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reason { margin-top: 3px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.reason b { font-size: 11px; color: var(--muted); margin-right: 6px; }
.spot-actions { display: none; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.spot.active .spot-actions { display: flex; }
.spot-actions .btn { white-space: normal; text-align: left; }

.map-wrap { position: relative; flex: 1; min-height: 0; background: var(--map-bg); overflow: hidden; }
/* Google の地図と簡易図（SVG）は、どちらか一方を枠いっぱいに出す */
.gmap, .svgmap { position: absolute; inset: 0; }
.gmap[hidden], .svgmap[hidden] { display: none; }
.svgmap > svg { display: block; width: 100%; height: 100%; }
.map-pin { cursor: pointer; }
.map-pin .num { font-weight: 700; fill: #fff; pointer-events: none; }
.map-label { fill: var(--ink); paint-order: stroke; stroke: var(--bg); stroke-linejoin: round; pointer-events: none; }
.dim { opacity: .15; }
.map-note { position: absolute; top: 10px; left: 12px; right: 12px; width: fit-content; padding: 2px 8px; border-radius: 4px; background: var(--glass); font-size: 11px; color: var(--muted); }
.map-scale { position: absolute; right: 14px; bottom: 50px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 3px 6px; border-radius: 4px; background: var(--glass); font-size: 11px; color: var(--ink-2); pointer-events: none; }
.map-scale span { display: block; height: 6px; border: 2px solid var(--ink-2); border-top: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid; }
.map-legend i.dash { border-top-style: dashed; }
.map-legend i.toll { border-top: 4px solid var(--toll); }
.badge.toll { background: var(--toll-soft); color: var(--toll); border-color: transparent; font-weight: 700; }
.map-card {
  position: absolute; left: 12px; right: 12px; bottom: 50px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(29, 42, 47, .18);
  font-size: 13px; max-width: 460px;
}
.map-card .spot-head { padding-right: 28px; }
.map-card .close { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 18px; color: var(--muted); }
.map-card .close:hover { background: var(--bg); }
.map-card .spot-actions { display: flex; }

/* 地図の上に重ねる部品（Google の地図の操作ボタンより上に出す） */
.map-note, .map-card, .map-switch { z-index: 10; }
/* 地図／航空写真の切り替えタブ */
.map-switch {
  position: absolute; top: 10px; left: 10px; display: flex; overflow: hidden;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: 0 2px 8px rgba(29, 42, 47, .15);
}
.map-switch[hidden] { display: none; }
.map-switch button { min-height: 36px; padding: 4px 16px; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.map-switch button + button { border-left: 1px solid var(--line); }
.map-switch button[aria-selected="true"] { background: var(--ink); color: var(--on-ink); font-weight: 700; }
.map-switch button:focus-visible { outline: 2px solid var(--accent, #c8502d); outline-offset: -2px; }
/* OpenStreetMap の出典があるときは、タブと重ならないよう下に出す */
.map-switch:not([hidden]) ~ .map-note, .map-note:has(~ .map-switch:not([hidden])) { top: 54px; }
/* Google の地図の番号つきピン（Advanced Marker）。位置の点がピンの中心に来るよう、半分下げる */
.gpin { position: relative; width: 26px; height: 26px; transform: translateY(50%); cursor: pointer; }
.gpin.active { width: 34px; height: 34px; }
.gpin.faded { opacity: .45; }
.gpin-dot {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  border: 2.5px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  color: #fff; font-size: 13px; font-weight: 700; box-sizing: border-box;
}
.gpin.active .gpin-dot { border-width: 4px; font-size: 15px; }
.gpin-label {
  position: absolute; left: calc(100% + 4px); top: 50%; transform: translateY(-50%); white-space: nowrap;
  padding: 1px 6px; border-radius: 4px; background: var(--glass); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  font-size: 12px; font-weight: 500; color: var(--ink);
}
.gpin.active .gpin-label { font-weight: 700; }
.spot-hours { margin-top: 2px; font-size: 12px; color: var(--muted); }
.spot-wx { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 3px; font-size: 12px; color: var(--ink-2); }
.spot-wx .wx-when { color: var(--muted); }
.wx-icon { display: inline-flex; align-items: center; gap: 1px; vertical-align: -5px; }
.wx-icon svg { width: 22px; height: 22px; flex: none; }
.wx-icon svg.sub { width: 17px; height: 17px; }
.wx-join { font-size: 10px; color: var(--muted); }
.wx-icon .f-sun { fill: var(--wx-sun); }
.wx-icon .s-sun { stroke: var(--wx-sun); stroke-width: 2; stroke-linecap: round; fill: none; }
.wx-icon .f-moon { fill: var(--wx-moon); }
.wx-icon .f-cloud { fill: var(--wx-cloud); }
.wx-icon .s-fog { stroke: var(--wx-cloud); stroke-width: 2; stroke-linecap: round; fill: none; }
.wx-icon .s-rain { stroke: var(--wx-rain); stroke-width: 2; stroke-linecap: round; fill: none; }
.wx-icon .f-snow { fill: var(--wx-snow); }
.wx-icon .f-bolt { fill: var(--wx-bolt); }
.spot-wx.warn { color: var(--warn, #9a5a07); }
.spot-wx b { font-weight: 700; }
.wx-summary { margin: 4px 0 10px; }
.wx-summary.warn { color: var(--warn, #9a5a07); }
.weather-note { display: block; margin-top: 4px; }
.spot-hours.warn { color: var(--warn, #a15c00); font-weight: 600; }
.live { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.weather-list { margin: 2px 0 6px 1.2em; font-size: 12px; color: var(--ink-2); }
.weather-list li { margin: 2px 0; }
.attribution { font-size: 11px; }
.map-error { padding: 24px; color: var(--muted); font-size: 13px; }
/* 広い画面では日程側に同じ情報が出るため、地図上のカードは出さない */
@media (min-width: 901px) { .map-card { display: none; } }

.suggests { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }

/* ---------- 4. My Travel Plan ---------- */
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.list-tools { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.search { flex: 1; max-width: 420px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23687377' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat 12px center; }
.list-meta { font-size: 13px; color: var(--muted); }
.group { margin-top: 24px; }
.group-title { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.group-title span { font-weight: 400; color: var(--muted); font-size: 13px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }

.plan-card { display: flex; flex-direction: column; padding: 18px 18px 12px; transition: box-shadow .2s, border-color .2s; }
.plan-card:hover { border-color: var(--line-strong); }
.plan-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.plan-card.past { background: var(--surface-2); }
.card-top { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start; }
.date-box { display: flex; flex-direction: column; align-items: center; padding: 6px 0 5px; border-radius: var(--radius-sm); background: var(--ink); color: var(--on-ink); line-height: 1.15; }
.date-box .m { font-size: 11px; opacity: .8; }
.date-box .d { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.date-box .w { font-size: 11px; opacity: .8; }
.date-box.undated { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-strong); padding: 12px 0; font-size: 12px; }
.past .date-box { background: var(--muted); }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-route { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-when { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 0; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.figs div { line-height: 1.25; }
.figs dt { font-size: 11px; color: var(--muted); }
.figs dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-bars { margin: 10px 0 0; display: grid; gap: 4px; }
.day-bar { display: grid; grid-template-columns: 40px 1fr 52px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-bar .val { text-align: right; }
.day-bar.over .val, .day-bar.under .val { color: var(--warn); font-weight: 700; }
.bars-caption { font-size: 11px; color: var(--muted); margin-top: 4px; }
.memo { margin-top: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 12px; }
.card-foot .updated { font-size: 12px; color: var(--muted); margin-right: auto; }

.draft-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid var(--warn-line); font-size: 14px; }
.draft-banner p { flex: 1; min-width: 200px; }

.empty, .list-error { padding: 48px 20px; text-align: center; color: var(--muted); margin-top: 16px; }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty .btn, .list-error .btn { margin-top: 16px; }
.list-error { color: var(--danger); }

.skeleton { height: 230px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; border: 1px solid var(--line); animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.status-box { padding: 40px 24px; text-align: center; }
.status-box h2 { margin-bottom: 8px; }
.status-box .btn { margin-top: 16px; }

/* ---------- オーバーレイ・ダイアログ・トースト ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--scrim); padding: 20px; }
.overlay-card { width: min(440px, 100%); padding: 24px; }
.progress { margin: 14px 0; padding-left: 0; list-style: none; }
.progress li { padding: 8px 0 8px 30px; position: relative; color: var(--muted); }
.progress li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); }
.progress li.doing { color: var(--ink); font-weight: 700; }
.progress li.doing::before { border-color: var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.progress li.done { color: var(--ink); }
.progress li.done::before { background: var(--ok); border-color: var(--ok); }
.progress { max-height: 50vh; overflow-y: auto; }
.job-issues { margin: 4px 0 0; padding-left: 16px; font-size: 12px; font-weight: 400; color: var(--warn); }
.job-issues li { padding: 0; }
.job-issues li::before { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.dialog { width: min(500px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog.narrow-dialog { width: min(420px, calc(100% - 32px)); }
.dialog::backdrop { background: var(--scrim); }
.dialog h2 { font-size: 18px; margin-bottom: 4px; }
.dialog .field { margin-top: 14px; margin-bottom: 0; }
.dialog .hint { margin-top: 12px; }
.dialog .form-error { margin-top: 12px; }
.dialog-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.dialog-text { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.save-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.radio-list label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; font-size: 13px; }
.radio-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-list input { margin-top: 5px; accent-color: var(--accent); }
.radio-list b { display: block; font-size: 14px; }
.share-url input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.share-url .hint { margin-top: 6px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* 地点の追加・宿泊地の変更 */
.search-row { display: flex; gap: 8px; margin-top: 6px; }
.search-row input { flex: 1; min-width: 0; margin-top: 0 !important; }
.spot-results { display: grid; gap: 6px; margin-top: 10px; max-height: 240px; overflow-y: auto; }
.spot-results:empty { display: none; }
.spot-results label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field); cursor: pointer; font-weight: 400; }
.spot-results label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.spot-results input { margin-top: 3px; }
.spot-results b { display: block; color: var(--ink); }
.spot-results small { display: block; color: var(--muted); font-size: 12px; }
.spot-results .empty-note { color: var(--muted); font-size: 13px; padding: 4px 2px; }
.add-spot { margin: 6px 0 4px 34px; }
.badge.mine { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.spot-time .late { color: var(--danger); font-weight: 700; }
.arrive-by { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.arrive-by select { padding: 3px 24px 3px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background-color: var(--field); background-position: right 7px top 52%; background-size: 10px 10px; color: var(--ink); font: inherit; font-size: 13px; }
.spot-picked { padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); }
.spot-picked b { display: block; color: var(--ink); }
.spot-picked small { display: block; color: var(--muted); font-size: 12px; }
/* 地図を押したときの「日程に追加」の吹き出し。Google の吹き出しはダークモードでも白地のため、
   画面の配色（ダークモードでは明るい文字）を引き継がず、白地に合う濃い文字色に固定する */
.map-pick { max-width: 240px; font-size: 13px; line-height: 1.5; color: #1d2a2f; }
.map-pick b { display: block; font-size: 14px; color: #1d2a2f; }
.map-pick small { display: block; margin-top: 2px; color: #5b6569; }
.map-pick small.warn { color: #9a5a07; }
.map-pick .map-pick-photo { display: block; width: 240px; max-width: 100%; height: 150px; object-fit: cover; border-radius: 6px; margin-bottom: 4px; background: #e8e8e8; }
.map-pick .map-pick-credit { margin: 0 0 6px; font-size: 11px; }
.map-pick .map-pick-note { margin-bottom: 6px; }
.map-pick a { color: #1a5fb4; }
/* 吹き出しの×ボタン。ダークモードでは Google が×を白にするが、吹き出しは白地のままのため、濃い灰色に固定する */
#gmap .gm-style-iw-chr .gm-ui-hover-effect > span { background-color: #3c4043 !important; }
.map-pick .btn { margin-top: 8px; }
.map-hint { color: var(--muted); font-size: 12px; margin-left: auto; }
/* ドラッグでの並べ替え */
.spots li.spot[draggable="true"] .spot-card { cursor: grab; }
.spots li.spot.dragging { opacity: .45; }
.spots li.spot.drop-above .spot-card { box-shadow: 0 -3px 0 var(--accent); }
.spots li.spot.drop-below .spot-card { box-shadow: 0 3px 0 var(--accent); }
/* ロック（地点名の右の南京錠。押すと切り替わる） */
.lock-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 2px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; vertical-align: middle; }
.lock-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lock-btn:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
.lock-btn.on { color: var(--ink); background: var(--surface-2); border-color: var(--line-strong); }
.lock-btn.on svg rect { fill: currentColor; }
.lock-btn:disabled { opacity: .5; cursor: default; }

/* スマホ用のしおり */
.dialog.guide-dialog { width: min(640px, calc(100% - 32px)); }
.guide-links { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 12px 10px; background: var(--surface-2); }
.guide-links h3 { margin: 12px 0 6px; font-size: 14px; }
.guide-links ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.guide-links a { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; }
.guide-links a:hover { border-color: var(--accent); }
.guide-links a small { display: block; color: var(--muted); font-size: 12px; }
.guide-links .guide-link { display: flex; gap: 8px; align-items: stretch; }
.guide-links .guide-link a { flex: 1; min-width: 0; }
.guide-links .guide-link .btn { flex: none; align-self: center; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--on-ink); padding: 10px 12px 10px 20px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: calc(100% - 32px);
}
.toast a { color: var(--toast-link); font-weight: 700; padding: 2px 8px; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 画面幅が狭いとき ---------- */
@media (max-width: 1240px) {
  .plan-layout { grid-template-columns: var(--w-itinerary, 360px) 16px minmax(0, 1fr); row-gap: 16px; }
  .splitter[data-split="assistant"] { display: none; }
  .pane-assistant { grid-column: 1 / -1; height: 420px; min-height: 0; }
}
@media (max-width: 900px) {
  main { padding: 20px 16px 32px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .brand small { display: none; }
  .mainnav { gap: 0; }
  .mainnav a { padding: 0 8px; font-size: 13px; white-space: nowrap; }
  .theme-toggle { padding: 4px 8px; }
  .theme-toggle .theme-label { display: none; }
  .flowbar { padding: 8px 16px; }
  .steps { width: 100%; overflow-x: auto; }
  .steps li + li::before { width: 10px; }
  .steps a, .steps span { font-size: 13px; padding-right: 8px; }
  .flow-note { margin-left: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-when, .form-row.cols-times, .option-list.option-row { grid-template-columns: minmax(0, 1fr); }
  .form-row .per-day > .check { margin: 0 0 10px; }
  .form, .input-wide .form { padding: 4px 16px 16px; }
  .input-wide .form-foot { position: static; padding-bottom: 0; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-card { height: 70vh; }
  .cond-card { position: static; }

  .plan-toolbar { gap: 10px 16px; }
  .stats { margin-left: 0; gap: 16px; }
  /* 日ごとの走行時間は日数が多いと横に収まらないため、総距離・日数の下の行にまとめる */
  .stats { flex-wrap: wrap; row-gap: 10px; }
  .stats .stat-durs { order: 3; flex-basis: 100%; }
  .plan-actions { width: 100%; }
  .plan-actions .save-state { margin-right: auto; }
  /* スマホでは日程・地図・AIをタブで切り替える */
  .pane-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: var(--radius); background: var(--line); }
  .pane-tabs button { flex: 1; padding: 8px 4px; border: 0; border-radius: var(--radius-sm); background: transparent; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
  .pane-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  .plan-layout { grid-template-columns: 1fr; }
  .plan-layout > .pane, .plan-layout > .splitter { display: none; }
  .plan-layout[data-pane="itinerary"] .pane-itinerary,
  .plan-layout[data-pane="map"] .pane-map,
  .plan-layout[data-pane="assistant"] .pane-assistant { display: flex; }
  .pane { height: calc(100vh - 290px); min-height: 420px; }
  .pane-itinerary { height: auto; }
  .itinerary { overflow: visible; }
  .pane-assistant { grid-column: auto; }

  .list-head { flex-direction: column; }
  .list-tools { flex-wrap: wrap; }
  .search { max-width: none; flex-basis: 100%; }
  .plan-grid { grid-template-columns: 1fr; }
  .segment span { font-size: 13px; padding: 9px 4px; }
  .generate-bar { flex-direction: column; align-items: stretch; }
  .day-target { grid-template-columns: 50px 90px 24px 1fr; }
}
@media (max-width: 480px) {
  /* 狭い画面ではロゴの文字を省き、ナビを1行に収める */
  .brand span { display: none; }
  .stats b { font-size: 18px; }
}
