:root {
  --pink: #1668c1;
  --pink-deep: #0f4f9c;
  --coral: #3f8fdc;
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2a37;
  --muted: #6b7684;
  --line: #dbe3ee;
  --shadow: 0 8px 24px rgba(18, 55, 110, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(165deg, #f6f8fb 0%, #eaf0f7 45%, #e2eaf4 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI",
    "Noto Sans JP", sans-serif;
  line-height: 1.6;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 92px;
  position: relative;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--coral), var(--pink-deep));
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 28px) 24px 56px;
  border-radius: 0 0 16px 16px;
  box-shadow: var(--shadow);
}
.hero h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: 0.5px; }
.tagline { margin: 10px 0 0; opacity: 0.95; font-size: 14px; }

/* Views */
.view { padding: 0 18px; }
.hidden { display: none; }

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 22px 18px;
  margin-top: -28px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 22px; }
.field-label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.chip:active { transform: scale(0.96); }
.chip.selected {
  background: var(--pink);
  border-color: var(--pink);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 104, 193, 0.4);
}

.text-input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.text-input:focus { border-color: var(--pink); }

/* Buttons */
.primary-btn {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, var(--coral), var(--pink-deep));
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  padding: 16px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(18, 55, 110, 0.35);
  font-family: inherit;
}
.primary-btn:active { transform: scale(0.98); }

.ghost-btn {
  flex: 1;
  border: 1.5px solid var(--pink);
  background: #fff;
  color: var(--pink-deep);
  padding: 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.text-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  padding: 12px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  width: 100%;
}
.hint { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0; }

/* Result */
.result-head { padding: 24px 6px 8px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--pink-deep);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}
#result-title { margin: 4px 0; font-size: 22px; }
.advice {
  background: #fff;
  border-left: 4px solid var(--pink);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin: 12px 0 0;
  box-shadow: var(--shadow);
}

/* Area picker */
.midpoint-box {
  background: #f5f8fc;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}
.mid-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mid-tag {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--pink); color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.mid-row .text-input { flex: 1; }
.primary-btn.soft { font-size: 15px; padding: 12px; margin-top: 2px; }
.or-sep {
  text-align: center; color: var(--muted); font-size: 12px;
  margin: 14px 0 10px; position: relative;
}
.or-sep::before, .or-sep::after {
  content: ""; position: absolute; top: 50%; width: 26%; height: 1px; background: var(--line);
}
.or-sep::before { left: 0; }
.or-sep::after { right: 0; }
.pin-end { width: 26px; height: 26px; background: #3a2e33; font-size: 12px; }

.geo-search { display: flex; gap: 8px; margin-bottom: 10px; }
.geo-search .text-input { flex: 1; }
.ghost-btn.small { flex: 0 0 auto; padding: 10px 14px; font-size: 13px; }
.ghost-btn.wide { width: 100%; margin-top: 10px; padding: 14px; }
#pick-map {
  height: 200px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 0;
}
.radius-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.radius-label { font-size: 13px; white-space: nowrap; }
.radius-label b { color: var(--pink-deep); font-size: 15px; }
#radius-slider {
  flex: 1;
  accent-color: var(--pink);
}
.pick-hint { text-align: left; margin: 8px 0 0; }

/* Map */
#map {
  height: 220px;
  margin: 12px 6px 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
  z-index: 0;
}
.pin {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3); border: 2px solid #fff;
}
.pin-num { width: 28px; height: 28px; background: linear-gradient(135deg, var(--coral), var(--pink-deep)); }
.pin-start { width: 36px; height: 36px; background: #3a2e33; font-size: 11px; }

/* Travel leg */
.tl-leg {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  padding: 4px 0 4px 56px; position: relative;
}
.tl-leg.leg::before {
  content: ""; position: absolute; left: 19px; top: -4px; bottom: -4px;
  width: 2px; background: var(--line);
}
.tl-leg .leg-icon { font-size: 14px; }

.tl-rating { font-size: 12px; color: #f0a500; font-weight: 700; margin-bottom: 2px; }

/* 予約・詳細リンク */
.tl-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.book-btn {
  display: inline-block; text-decoration: none;
  font-size: 12px; font-weight: 700;
  padding: 7px 12px; border-radius: 999px;
  background: #fff; color: var(--pink-deep);
  border: 1.5px solid var(--pink);
}
.book-btn:active { transform: scale(0.96); }
.affiliate-note { font-size: 11px; color: var(--muted); text-align: center; padding: 0 12px 6px; }

/* スポット差し替えボタン */
.swap-btn {
  margin-top: 10px;
  background: none;
  border: 1.5px dashed var(--pink);
  color: var(--pink-deep);
  font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px;
  cursor: pointer; font-family: inherit;
}
.swap-btn:active { transform: scale(0.96); }
.tl-edit-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-edit-btns .swap-btn { margin-top: 8px; }

/* スポット変更エディタ */
.edit-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 120;
}
.edit-overlay.hidden { display: none; }
.edit-card {
  background: #fff;
  width: 100%; max-width: 480px;
  border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  max-height: 86vh; overflow-y: auto;
}
.edit-card h3 { margin: 0 0 6px; }
.edit-current { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.edit-results { margin: 10px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.edit-result {
  text-align: left; background: #f5f8fc; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; gap: 2px;
}
.edit-result b { font-size: 14px; color: var(--ink); }
.edit-result span { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-result.selected { border-color: var(--pink); background: #e7effb; }
.edit-loading { font-size: 13px; color: var(--muted); padding: 8px; text-align: center; }
.edit-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.edit-actions .text-btn { width: auto; flex: 0 0 auto; }
.edit-actions .primary-btn { flex: 1; }

/* Timeline */
.timeline { position: relative; padding: 16px 6px 8px 6px; }
.tl-item {
  position: relative;
  padding-left: 56px;
  margin-bottom: 18px;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 38px;
  bottom: -18px;
  width: 2px;
  background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--pink-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(18, 55, 110, 0.3);
}
.tl-card {
  background: var(--card);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.tl-time { font-size: 12px; color: var(--pink-deep); font-weight: 700; }
.tl-name { font-size: 16px; font-weight: 800; margin: 2px 0 4px; }
.tl-desc { font-size: 13px; color: var(--muted); }
.tl-cost { font-size: 12px; color: var(--ink); margin-top: 6px; font-weight: 600; }

.total-bar {
  background: linear-gradient(135deg, var(--coral), var(--pink-deep));
  color: #fff;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 8px 6px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.total-bar .amount { font-size: 20px; font-weight: 800; }

.result-actions { padding: 6px 6px 24px; }
.action-row { display: flex; gap: 10px; margin-top: 12px; }

/* Saved */
.saved-title, .saved-back { padding: 24px 6px 0; }
.saved-title { font-size: 22px; }
.saved-list { padding: 12px 0; }
.saved-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  position: relative;
}
.saved-card h3 { margin: 0 0 4px; font-size: 16px; }
.saved-card .s-meta { font-size: 12px; color: var(--muted); }
.saved-card .s-del {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* Tabbar */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  display: flex;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.tab {
  flex: 1;
  border: none;
  background: none;
  padding: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.tab.active { color: var(--pink-deep); }

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 247, 251, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.loading-overlay.hidden { display: none; }
.loading-card { text-align: center; padding: 24px; }
.spinner {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 5px solid var(--line);
  border-top-color: var(--pink-deep);
  margin: 0 auto 18px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-weight: 800; color: var(--pink-deep); font-size: 16px; margin: 0; }
.loading-sub { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(58, 46, 51, 0.92);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tl-item, .total-bar, .result-head { animation: pop 0.35s ease both; }

/* ===== ワイド画面の左右パネル（PCで画面を埋める）===== */
.side { display: none; }

@media (min-width: 1040px) {
  .app {
    background: #fff;
    box-shadow: 0 0 70px rgba(18, 55, 110, 0.12);
  }
  .side {
    position: fixed;
    top: 0;
    height: 100vh;
    width: calc((100vw - 480px) / 2);
    min-width: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    box-sizing: border-box;
    pointer-events: none;
  }
  .side-left { left: 0; }
  .side-right { right: 0; }
  .side-inner { max-width: 340px; color: #6b4a54; }

  .side-logo { font-size: 44px; }
  .side-inner h2 { font-size: 34px; margin: 10px 0 8px; color: var(--pink-deep); line-height: 1.2; font-weight: 800; }
  .side-lead { font-size: 15px; color: #8a6b74; margin: 0 0 22px; }
  .side-features { list-style: none; padding: 0; margin: 0; }
  .side-features li {
    background: rgba(255, 255, 255, 0.75);
    border-radius: 14px; padding: 12px 15px; margin-bottom: 11px;
    font-size: 14px; font-weight: 600;
    box-shadow: 0 6px 16px rgba(18, 55, 110, 0.08);
  }

  .side-h { font-size: 21px; color: var(--pink-deep); margin: 0 0 18px; font-weight: 800; }
  .side-steps { list-style: none; padding: 0; margin: 0 0 22px; }
  .side-steps li { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; margin-bottom: 15px; color: #6b4a54; }
  .side-steps li span {
    flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
    background: var(--pink); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  }
  .side-emoji { font-size: 24px; letter-spacing: 2px; margin: 6px 0 18px; }
  .side-note { font-size: 13px; color: #8a6b74; background: rgba(255, 255, 255, 0.65); border-radius: 12px; padding: 12px 14px; line-height: 1.6; }
}

/* さらに広い画面では中央カラムをやや広げて余白を活かす */
@media (min-width: 1500px) {
  .side-inner { max-width: 380px; }
}

/* 現在地ボタン・集合情報 */
.loc-btn { flex: 0 0 auto; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 15px; }
.loc-btn:active { transform: scale(0.94); }
.meet-info { font-size: 13px; background: #f5f8fc; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; line-height: 1.7; }
.meet-info b { color: var(--pink-deep); font-size: 15px; }
.meet-info .mi-sub { color: var(--muted); font-size: 12px; }

/* 公平駅の候補チップ */
.cand-row { margin-bottom: 8px; }
.cand-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cand-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cand {
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit; display: flex; flex-direction: column; align-items: center; line-height: 1.3;
}
.cand span { font-size: 10px; color: var(--muted); font-weight: 600; }
.cand.selected { background: var(--pink); border-color: var(--pink); color: #fff; }
.cand.selected span { color: #fff; opacity: 0.9; }

/* ============================================================
   リデザイン：角ばり・高密度・PC 2カラム（ナビ系UI寄り）
   ============================================================ */

/* --- 角をシャープに（コンテナ・ボタン・入力・チップ・タグ）--- */
.card, .primary-btn, .ghost-btn, .text-input, #map, #pick-map,
.midpoint-box, .people-box, .meet-info, .tl-card, .advice, .total-bar,
.edit-card, .saved-card, .loading-card, .roulette-box,
.side-features li, .cand, .book-btn, .swap-btn, .edit-result {
  border-radius: 6px !important;
}
.chip { border-radius: 5px !important; }
.tag { border-radius: 3px !important; }
.hero { border-radius: 0 !important; }
.ghost-btn.small, .loc-btn { border-radius: 5px !important; }

/* --- 高密度：余白・文字を引き締める --- */
.hero { padding: 18px 18px 18px !important; }
.hero h1 { font-size: 23px !important; line-height: 1.15 !important; }
.tagline { font-size: 13px !important; }
.card { padding: 14px !important; margin-top: -20px; }
.field { margin-bottom: 13px !important; }
.field-label { font-size: 13px !important; margin-bottom: 6px !important; }
.chips { gap: 6px !important; }
.chip { padding: 6px 10px !important; font-size: 13px !important; }
.primary-btn { padding: 12px !important; font-size: 15px !important; }
.text-input { padding: 9px 11px !important; font-size: 14px !important; }
.view { padding: 0 14px; }
#result-title { font-size: 19px; }
.tl-name { font-size: 15px; }

/* --- 装飾サイドパネルは廃止（本体で横幅を使う）--- */
.side { display: none !important; }

/* --- 全体の背景を無地寄りのクリーンに --- */
html, body { background: #eef1f5 !important; }

/* ============================================================
   PC（>=1000px）：2カラム（左=入力 / 右=地図・結果）
   ============================================================ */
@media (min-width: 1000px) {
  .app {
    max-width: 1140px;
    display: grid;
    grid-template-columns: 400px 1fr;
    grid-template-rows: auto auto;
    column-gap: 24px;
    padding: 0 24px 28px;
    min-height: auto;
  }
  .hero { grid-column: 1 / -1; margin-bottom: 20px; }
  #form-view { grid-column: 1; grid-row: 2; display: block !important; }
  #result-view, #saved-view { grid-column: 2; grid-row: 2; }
  .card { margin-top: 0; }
  #pick-map { height: 260px; }
  #map { height: 340px; margin: 0 0 12px; }
  /* PCでは下部タブをヘッダー右上のナビに */
  .tabbar {
    position: absolute; top: 14px; right: 24px;
    transform: none; width: auto; max-width: none;
    border-top: none; background: transparent; gap: 6px; padding: 0; z-index: 5;
  }
  .tab { flex: 0 0 auto; padding: 8px 14px; border-radius: 5px; background: #fff; border: 1px solid var(--line); }
  .tab.active { background: var(--pink); color: #fff; border-color: var(--pink); }
  .app { padding-bottom: 28px; }
  .result-head { padding-top: 0; }
}

/* ============================================================
   NAVITIME風：上部ナビ・右ウィジェット・フッター・3カラム
   ============================================================ */
.hero { display: none !important; }
.side { display: none !important; }

/* 上部ナビ（スティッキー） */
.topbar { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 2px solid var(--pink); }
.tb-inner { max-width: 1160px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 9px 16px; }
.tb-logo { font-weight: 800; font-size: 16px; color: var(--pink-deep); }
.tb-mark { margin-right: 2px; }
.tb-nav { display: flex; align-items: center; gap: 6px; }
.tb-nav .tab { background: transparent; border: none; padding: 8px 12px; font-weight: 700; font-size: 14px; color: var(--muted); border-radius: 5px; cursor: pointer; font-family: inherit; width: auto; }
.tb-nav .tab.active { color: #fff; background: var(--pink); }
.tb-link { font-size: 13px; color: var(--muted); text-decoration: none; padding: 8px; }

/* キャッチ帯 */
.subbar { background: var(--pink); color: #fff; }
.subbar-inner { max-width: 1160px; margin: 0 auto; padding: 8px 16px; font-size: 13px; }

/* 右カラム：ウィジェット */
.widgets { padding: 0 14px; }
.widget { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 14px; }
.w-title { font-size: 14px; margin: 0 0 10px; padding-left: 8px; border-left: 3px solid var(--pink); }
.pop-list { display: flex; flex-direction: column; gap: 6px; }
.pop-pair { text-align: left; background: #f5f8fc; border: 1px solid var(--line); border-radius: 5px; padding: 9px 11px; font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; }
.pop-pair:hover { border-color: var(--pink); color: var(--pink-deep); }
.w-steps { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }
.w-ad-label { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.w-ad-box { background: #eef1f5; border: 1px dashed #c3ccd8; border-radius: 5px; padding: 26px 8px; text-align: center; font-size: 12px; color: var(--muted); }

/* フッター */
.site-footer { background: #1f2a37; color: #c3ccd8; margin-top: 24px; }
.foot-inner { max-width: 1160px; margin: 0 auto; padding: 18px 16px; font-size: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.foot-links a { color: #e2e8f0; }
.foot-links span { margin-left: 12px; opacity: 0.85; }

/* PC：3カラム（入力 / 地図・結果 / ウィジェット） */
@media (min-width: 1000px) {
  .app {
    max-width: 1160px;
    grid-template-columns: 360px minmax(0, 1fr) 268px;
    grid-template-rows: auto;
    column-gap: 22px;
    padding: 20px 16px 28px;
  }
  #form-view { grid-column: 1; grid-row: 1; display: block !important; }
  #result-view, #saved-view { grid-column: 2; grid-row: 1; }
  .widgets { grid-column: 3; grid-row: 1; padding: 0; }
  .tabbar { display: none !important; }
  .card { margin-top: 0; }
}

/* スマホ：ウィジェットはフォームの下に */
@media (max-width: 999px) {
  .tb-nav .tab { display: none; }        /* 下部タブがあるのでナビは隠す */
  .tb-link { display: none; }
  .widgets { margin-top: 4px; }
}

/* ============================================================
   デザインシステム v2（ダッシュボード：トークン刷新・ダーク・公平バー・KPI）
   ============================================================ */
:root{
  --pink:#1665d8; --pink-deep:#0f52b8; --coral:#3f8fdc;
  --bg:#eaeef4; --card:#ffffff; --surface:#ffffff; --surface-2:#f4f7fb;
  --ink:#0f1b2d; --ink-2:#33445c; --muted:#69788e;
  --line:#dbe2ec; --line-2:#c6d0dd;
  --good:#0ea66b; --good-050:#e4f7ef; --warn:#e08600; --warn-2:#c96f00;
  --shadow:0 1px 1px rgba(16,30,50,.05), 0 6px 18px rgba(16,30,50,.06);
}
@media (prefers-color-scheme:dark){ :root:not([data-theme="light"]){
  --pink:#4d92ff; --pink-deep:#3f83f0; --coral:#4d92ff;
  --bg:#0b1220; --card:#131c2c; --surface:#131c2c; --surface-2:#0f1826;
  --ink:#e8eef7; --ink-2:#b7c3d4; --muted:#8494a8;
  --line:#26324a; --line-2:#33425e;
  --good:#3ad39a; --good-050:#12271f; --warn:#f0a83a; --warn-2:#f0a83a;
  --shadow:0 1px 1px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}}
:root[data-theme="dark"]{
  --pink:#4d92ff; --pink-deep:#3f83f0; --coral:#4d92ff;
  --bg:#0b1220; --card:#131c2c; --surface:#131c2c; --surface-2:#0f1826;
  --ink:#e8eef7; --ink-2:#b7c3d4; --muted:#8494a8;
  --line:#26324a; --line-2:#33425e;
  --good:#3ad39a; --good-050:#12271f; --warn:#f0a83a; --warn-2:#f0a83a;
  --shadow:0 1px 1px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

html, body { background: var(--bg) !important; }
.num, .fbar>span, .kv, .radius-label b { font-variant-numeric: tabular-nums; }

/* パネル/カード：フラットで区切り線ベースのダッシュボード風 */
.card, .widget, .midpoint-box, .meet-info, .tl-card, .saved-card, .edit-card, .advice, .roulette-box {
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.midpoint-box, .tl-card { background: var(--surface-2); }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.tb-logo { color: var(--ink); }
.text-input, .chip, .tag, .book-btn, .cand, .pop-pair, .loc-btn, .ghost-btn, .seg { background: var(--surface); color: var(--ink); }
.subbar { background: var(--pink-deep); }

/* 見出しに色バー（NAVITIMEの節見出し感） */
.field-label { position: relative; padding-left: 10px; }
.field-label::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px; background: var(--pink); border-radius: 2px; }

/* テーマ切替ボタン */
.tb-theme { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 6px; padding: 6px 9px; cursor: pointer; font-size: 14px; margin-left: 4px; }
.tb-theme:hover { border-color: var(--pink); }

/* 公平バー（中間駅の各人所要時間） */
.fair-head { font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 2px 0 9px; }
.fair-head b { color: var(--pink-deep); font-size: 14px; }
.fbar-row { display: grid; grid-template-columns: 68px 1fr; gap: 9px; align-items: center; margin-bottom: 7px; }
.fbar-name { font-size: 12.5px; font-weight: 700; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbar { height: 22px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.fbar > span { display: flex; align-items: center; height: 100%; padding-left: 9px; color: #fff; font-size: 11.5px; font-weight: 800;
  background: linear-gradient(90deg, var(--pink), var(--pink-deep)); border-radius: 5px; transition: width .5s cubic-bezier(.2,.7,.2,1); }
.fbar.worst > span { background: linear-gradient(90deg, var(--warn), var(--warn-2)); }

/* サマリーKPI */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 6px; overflow: hidden; }
.kpi { background: var(--surface); padding: 11px 12px; }
.kpi .kv { font-size: 19px; font-weight: 900; letter-spacing: -.01em; color: var(--ink); }
.kpi .kv.good { color: var(--good); }
.kpi .kv .ku { font-size: 12px; font-weight: 800; margin-left: 1px; }
.kpi .kl { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 1px; }

/* 経路レグに交通色のアクセント */
.tl-leg .leg-icon { color: var(--pink); }
.tl-leg.leg::before { background: var(--pink); opacity: .5; }

/* 候補チップ：選択を黒基調に（提案トーン） */
.cand.selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.cand.selected span { color: #c7d2e2; }

/* ダークで地図の白容器が浮かないように */
#map, #pick-map { border: 1px solid var(--line); }

/* ============================================================
   初期オンボーディング（中央の空白を埋める）
   ============================================================ */
.welcome { display: flex; flex-direction: column; gap: 14px; }
.wl-hero {
  background: linear-gradient(135deg, rgba(22,101,216,.12), rgba(22,101,216,0) 58%), var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 22px 20px; box-shadow: var(--shadow);
}
.wl-badge { display: inline-block; font-size: 11.5px; font-weight: 800; color: var(--pink-deep);
  background: var(--surface-2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 20px; }
.wl-title { font-size: 22px; font-weight: 800; margin: 13px 0 8px; line-height: 1.32; }
.wl-sub { color: var(--muted); font-size: 13px; margin: 0; max-width: 54ch; line-height: 1.7; }

.wl-steps { display: flex; align-items: stretch; gap: 8px; }
.wl-step { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 10px 12px; text-align: center; box-shadow: var(--shadow); position: relative; }
.wl-n { position: absolute; top: 8px; left: 8px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--pink); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.wl-emoji { font-size: 26px; line-height: 1; }
.wl-st { font-weight: 800; font-size: 13.5px; margin-top: 8px; }
.wl-sd { font-size: 11px; color: var(--muted); margin-top: 2px; }
.wl-arrow { align-self: center; color: var(--line-2); font-weight: 800; font-size: 18px; }

.wl-sample { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; box-shadow: var(--shadow); }
.wl-sample-head { font-size: 12.5px; font-weight: 800; margin-bottom: 10px; }
.wl-sample-head span { font-weight: 600; color: var(--muted); font-size: 11px; margin-left: 6px; }
.wl-tl { display: flex; flex-direction: column; }
.wl-item { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600;
  padding: 8px 6px; border-left: 2px solid var(--line); margin-left: 8px; position: relative; }
.wl-item::before { content: ""; position: absolute; left: -6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--pink); border: 2px solid var(--surface); }
.wl-item b { color: var(--pink-deep); min-width: 46px; }
.wl-item > span { font-size: 15px; }

.wl-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 12px 14px; }
.wl-cta-lbl { font-weight: 800; font-size: 13px; color: var(--ink-2); }
.wl-cta-btn.pop-pair { background: var(--pink); border-color: var(--pink); color: #fff; font-size: 13.5px; padding: 10px 14px; }
.wl-cta-btn.pop-pair:hover { background: var(--pink-deep); color: #fff; }

.wl-feats { display: flex; gap: 8px; }
.wl-feat { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 11px; font-size: 11.5px; color: var(--muted); box-shadow: var(--shadow); }
.wl-feat b { display: block; color: var(--ink); font-size: 12.5px; margin-bottom: 2px; }

@media (min-width: 1000px) { #welcome { grid-column: 2; grid-row: 1; } }
@media (max-width: 999px) {
  .wl-steps { flex-wrap: wrap; }
  .wl-arrow { display: none; }
  .wl-step { flex: 1 1 92px; }
  .wl-feats { flex-direction: column; }
  #welcome { margin-top: 4px; padding: 0 14px; }
}

/* ===== マルチ駅入力 ===== */
.add-station { width: 100%; border: 1px dashed var(--line-2); background: var(--surface); color: var(--pink-deep);
  font-weight: 800; font-size: 13px; padding: 9px; border-radius: 6px; cursor: pointer; margin: 2px 0 8px; }
.add-station:hover { border-color: var(--pink); background: var(--surface-2); }
.del-btn { color: var(--muted) !important; }
.del-btn:hover { color: #e0463f !important; border-color: #e0463f !important; }
.mid-tag.t0 { background: var(--pink); }
.mid-tag.t1 { background: #7c4dd8; }
.mid-tag.t2 { background: #0a9d8e; }
.mid-tag.t3 { background: #e08600; }
