  :root {
    --bg: #fafaf7;
    --fg: #1a1a1a;
    --panel: #ffffff;
    --panel-border: #e6e2d6;
    --muted: #777;
    --accent: #22c55e;
    --bg-sub: #f3f1ea;
    --fg-muted: #5c5c5c;
    --fg-faint: #8a8a8a;
    --border-strong: #d4d0c2;
    --reticle-stroke: #16a34a;
    --reticle-accent: #22c55e;
  }
  body.dark {
    --bg: #0f1115;
    --fg: #e8e8e6;
    --panel: #181b22;
    --panel-border: #2a2e38;
    --muted: #888;
    --accent: #4ade80;
    --bg-sub: #101216;
    --fg-muted: #a8a8a6;
    --fg-faint: #6a6a68;
    --border-strong: #353941;
    --reticle-stroke: #22c55e;
    --reticle-accent: #4ade80;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; overflow: hidden; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", sans-serif;
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
  }

  /* 100dvh = 動的ビューポート高さ。iOS Chrome/Safari等の下部バーを除いた
     可視領域に収まるので、最下部の時間増減ボタンがバーに隠れない（100vhはフォールバック） */
  #app { display: grid; grid-template-rows: 1fr auto; height: 100vh; height: 100dvh; }

  /* Top bar */
  .top-bar {
    position: absolute; top: 16px; left: 16px; right: 16px;
    display: flex; justify-content: space-between; align-items: center;
    pointer-events: none; z-index: 10;
  }
  .brand {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 10px 16px;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .brand .title { font-size: 13px; font-weight: 700; letter-spacing: 0.05em; }
  .brand .sub { font-size: 10px; color: var(--muted); margin-top: 2px; letter-spacing: 0.1em; }
  .brand-link {
    display: inline-block; margin-top: 6px;
    font-size: 10px; font-weight: 600; color: var(--accent);
    text-decoration: none; letter-spacing: 0.02em;
  }
  .brand-link:hover { text-decoration: underline; }

  .top-actions { display: flex; gap: 8px; pointer-events: auto; }
  .top-actions button {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    color: var(--fg);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  /* 設定ボタン（歯車アイコン）は正方形に */
  button.settings-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px !important; line-height: 0;
  }
  button.settings-btn svg { display: block; }
  .theme-toggle {
    display: flex; align-items: center; gap: 0;
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 20px; padding: 3px; cursor: pointer;
    pointer-events: auto; position: relative; width: 64px; height: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: background 0.3s;
  }
  .theme-toggle .tt-track {
    position: absolute; inset: 3px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 6px;
  }
  .theme-toggle .tt-track svg { width: 14px; height: 14px; color: var(--muted); display: block; }
  .theme-toggle .tt-knob {
    position: absolute; top: 3px; left: 3px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--fg);
    transition: transform 0.25s cubic-bezier(0.2,0.8,0.2,1);
    z-index: 1;
  }
  .theme-toggle.dark .tt-knob { transform: translateX(34px); }
  body.dark .theme-toggle { background: #1d2129; border-color: #333; }
  body.dark .theme-toggle .tt-knob { background: #e0e0e0; }
  .top-actions button:hover { background: rgba(0,0,0,0.04); }
  body.dark .top-actions button:hover { background: rgba(255,255,255,0.06); }
  .top-actions button.active { background: rgba(0,0,0,0.08); border-color: var(--fg); }
  body.dark .top-actions button.active { background: rgba(255,255,255,0.1); }

  /* Settings panel — redesigned */
  @keyframes settingsSlideIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  .settings-panel {
    position: absolute; top: 60px; right: 16px;
    background: color-mix(in srgb, var(--panel) 95%, transparent);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    width: 296px;
    z-index: 20; pointer-events: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.04);
    font-size: 13px;
    overflow: hidden;
    transform-origin: top right;
    animation: settingsSlideIn 0.18s cubic-bezier(0.2,0.8,0.2,1);
  }
  body.dark .settings-panel {
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
  }

  .sp-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--panel-border);
  }
  .sp-head .sp-title { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
  .sp-head .sp-sub { font-size: 10px; color: var(--muted); margin-top: 2px; letter-spacing: 0.08em; }
  .sp-close {
    width: 26px; height: 26px;
    border: none; background: transparent;
    border-radius: 8px; cursor: pointer; color: var(--muted);
    font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
  }
  .sp-close:hover { background: rgba(0,0,0,0.05); color: var(--fg); }
  body.dark .sp-close:hover { background: rgba(255,255,255,0.08); }

  .sp-body { padding: 8px 16px 14px; display: flex; flex-direction: column; gap: 4px; }

  .sp-section-label {
    font-size: 10px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.12em;
    margin: 12px 0 6px; font-weight: 600;
  }
  .sp-section-label:first-child { margin-top: 4px; }

  .sp-disclaimer {
    margin-top: 14px; padding: 10px 12px; border-radius: 8px;
    background: color-mix(in srgb, var(--panel-border) 30%, transparent);
    font-size: 11px; line-height: 1.6; color: var(--fg-muted);
  }

  .rr-disclaimer {
    padding: 8px 16px 12px;
    font-size: 10px; line-height: 1.5; color: var(--fg-muted); opacity: 0.8;
  }

  .sp-row {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 32px; gap: 12px;
  }
  .sp-row + .sp-row { border-top: 1px dashed color-mix(in srgb, var(--panel-border) 70%, transparent); }
  .sp-row .sp-label { flex: 1; font-size: 12.5px; }
  .sp-row .sp-value {
    font-size: 11px; color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", "Menlo", monospace;
    min-width: 28px; text-align: right;
  }

  /* iOS-style toggle */
  .sp-toggle {
    width: 38px; height: 22px; border-radius: 11px; border: none;
    background: color-mix(in srgb, var(--panel-border) 100%, transparent);
    cursor: pointer; position: relative; transition: background 0.2s;
    flex-shrink: 0;
  }
  .sp-toggle.on { background: var(--accent); }
  .sp-toggle::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s cubic-bezier(0.2,0.8,0.2,1);
  }
  .sp-toggle.on::after { transform: translateX(16px); }

  /* Slider row: label on top, slider full-width below */
  .sp-slider-row { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
  .sp-slider-row .sp-label-line {
    display: flex; justify-content: space-between; align-items: baseline;
  }
  .sp-slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px; border-radius: 2px;
    background: linear-gradient(to right,
      var(--accent) 0%, var(--accent) var(--fill, 50%),
      color-mix(in srgb, var(--panel-border) 100%, transparent) var(--fill, 50%),
      color-mix(in srgb, var(--panel-border) 100%, transparent) 100%);
    outline: none; cursor: pointer;
  }
  .sp-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--panel); border: 2px solid var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    cursor: grab; transition: transform 0.1s;
  }
  .sp-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
  .sp-slider::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--panel); border: 2px solid var(--accent);
    cursor: grab;
  }

  /* Segmented control */
  .sp-segmented {
    display: flex;
    background: color-mix(in srgb, var(--panel-border) 60%, transparent);
    border-radius: 8px; padding: 2px; gap: 2px;
    flex-shrink: 0;
  }
  .sp-segmented button {
    border: none; background: transparent;
    padding: 5px 10px; font-size: 11px; font-weight: 500;
    color: var(--muted); cursor: pointer;
    border-radius: 6px; transition: all 0.15s;
    font-family: inherit;
  }
  .sp-segmented button:hover { color: var(--fg); }
  .sp-segmented button.on {
    background: var(--panel); color: var(--fg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  body.dark .sp-segmented button.on { box-shadow: 0 1px 3px rgba(0,0,0,0.4); }

  /* Map */
  .map-wrap {
    position: relative;
    width: 100%; height: 100%;
    overflow: hidden;
  }
  .route-map { display: block; }

  .shared-banner {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    z-index: 20; display: flex; align-items: center; gap: 8px;
    background: var(--accent); color: #fff;
    padding: 7px 12px 7px 14px; border-radius: 20px;
    font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  }
  .shared-banner-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #fff;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.7); animation: shared-pulse 1.6s infinite;
  }
  @keyframes shared-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
    70% { box-shadow: 0 0 0 7px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
  }
  .shared-banner-close {
    background: rgba(255,255,255,0.25); border: none; color: #fff;
    width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
    font-size: 10px; line-height: 1; padding: 0; margin-left: 2px;
  }
  .shared-banner-close:hover { background: rgba(255,255,255,0.4); }

  .zoom-controls {
    position: absolute; right: 16px; bottom: 16px;
    display: flex; flex-direction: column; gap: 4px;
    z-index: 5;
  }
  .zoom-controls button {
    width: 36px; height: 36px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    color: var(--fg);
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  }
  .zoom-controls button:hover { background: rgba(0,0,0,0.04); }
  body.dark .zoom-controls button:hover { background: rgba(255,255,255,0.06); }

  .zoom-level {
    position: absolute; right: 16px; bottom: 140px;
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 8px; padding: 4px 10px;
    font-size: 12px; color: var(--muted);
    z-index: 5; pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    font-variant-numeric: tabular-nums;
    text-align: center; min-width: 48px;
  }

  .zoom-hint {
    position: absolute; right: 16px; top: 70px;
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 8px; padding: 6px 10px;
    font-size: 10px; color: var(--muted);
    z-index: 5; pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    letter-spacing: 0.02em;
  }
  .zoom-hint kbd {
    background: var(--bg); border: 1px solid var(--panel-border);
    border-radius: 3px; padding: 1px 5px; font-size: 9px;
    font-family: monospace;
  }

  /* Timeline */
  .timeline-bar {
    background: var(--panel);
    border-top: 1px solid var(--panel-border);
    padding: 14px 24px 16px;
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto auto;
    column-gap: 24px;
    row-gap: 10px;
    align-items: center;
    z-index: 20;
    position: relative;
  }
  .time-display { grid-row: 1 / span 2; }
  .time-date { font-size: 11px; color: var(--muted); letter-spacing: 0.05em; margin-bottom: 2px; }
  .time-big {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 38px; font-weight: 600; letter-spacing: 0.02em;
    line-height: 1;
  }
  .time-sub { font-size: 11px; color: var(--muted); margin-top: 6px; letter-spacing: 0.05em; }
  .now-btn-mobile { display: none; }       /* デスクトップでは非表示。現在時刻はcontrols側を使う */
  .mobile-float-controls { display: none; } /* デスクトップでは非表示（モバイルのみ表示） */

  .scrubber-wrap { position: relative; padding: 16px 0 4px; }
  .scrubber-zoom {
    position: absolute; top: 0; right: 0;
    display: flex; gap: 2px; z-index: 2;
  }
  .scrubber-zoom button {
    width: 22px; height: 18px; font-size: 13px; line-height: 1;
    background: var(--panel); border: 1px solid var(--panel-border);
    color: var(--muted); cursor: pointer; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
  }
  .scrubber-zoom button:hover { color: var(--fg); }

  .ctrl-btn {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 4px 8px !important; min-width: 40px !important;
  }
  .ctrl-icon { font-size: 14px; line-height: 1; }
  .ctrl-text { font-size: 8px; color: var(--muted); line-height: 1; }
  .ticks { position: absolute; left: 0; right: 0; top: 0; height: 14px; }
  .tick { position: absolute; transform: translateX(-50%); }
  .tick-line { width: 1px; height: 6px; background: var(--panel-border); margin: 0 auto; }
  .tick-label { font-size: 9px; color: var(--muted); font-family: monospace; margin-top: 2px; }

  .scrubber {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px; border-radius: 2px;
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill, 0%), var(--panel-border) var(--fill, 0%), var(--panel-border) 100%);
    outline: none; cursor: pointer;
  }
  .scrubber::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--panel);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: grab;
  }
  .scrubber::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--panel);
    cursor: grab;
  }

  .controls { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
  .controls button {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--fg);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    min-width: 32px;
  }
  .controls button:hover { background: rgba(0,0,0,0.04); }
  body.dark .controls button:hover { background: rgba(255,255,255,0.06); }
  .controls .play-btn {
    background: var(--accent); border-color: var(--accent); color: white;
    padding: 6px 14px; font-size: 14px;
  }
  .controls .play-btn:hover { filter: brightness(1.05); }
  .speed-group { display: flex; gap: 2px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--panel-border); }
  .speed-group button { padding: 6px 8px; font-size: 11px; min-width: 30px; }
  .speed-group button.active { background: var(--accent); color: white; border-color: var(--accent); }
  .controls .now-btn {
    margin-left: 8px;
    padding: 6px 14px;
    background: var(--fg); color: var(--bg);
    border-color: var(--fg);
    font-weight: 600;
  }

  /* Legend */
  .legend {
    position: absolute; left: 16px; bottom: 16px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 11px;
    line-height: 1.7;
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .legend .row { display: flex; align-items: center; gap: 8px; }
  .legend .swatch {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent);
  }
  .legend .swatch.train {
    width: 18px; height: 8px; border-radius: 2px;
    background: var(--accent);
  }
  .legend .label-mini { color: var(--muted); font-size: 10px; }

  /* Embed mode: ツール本体UIを非表示、ヒーローオーバーレイを表示 */
  body.embed .top-bar { display: none; }
  body.embed .timeline-bar { display: none; }
  body.embed .legend { display: none; }
  body.embed .zoom-hint { display: none; }
  body.embed #app { grid-template-rows: 1fr; }

  /* ── Embed: キャッチコピー（左上） ── */
  .embed-catchphrase {
    position: absolute; top: 32px; left: 32px; z-index: 10;
    pointer-events: none;
    transition: opacity 0.6s ease-out;
  }
  .embed-catchphrase.fade-out { opacity: 0; }
  .embed-catchphrase-line {
    font-size: 54px; font-weight: 800; line-height: 1.5;
    color: var(--fg);
    opacity: 0; transform: translateX(-30px);
    animation: embedSlideIn 0.5s ease-out forwards;
    text-shadow: 0 1px 8px rgba(255,255,255,0.6);
  }
  body.dark .embed-catchphrase-line {
    text-shadow: 0 1px 12px rgba(0,0,0,0.7);
  }
  .embed-catchphrase-sub {
    font-size: 15px; font-weight: 600; color: var(--muted);
    letter-spacing: 0.08em; margin-bottom: 8px; margin-left: 10px;
    opacity: 0; transform: translateX(-20px);
    animation: embedSlideIn 0.5s ease-out forwards;
    animation-delay: 0.2s;
  }
  .embed-catchphrase-line:nth-child(2) { animation-delay: 0.6s; }
  .embed-catchphrase-line:nth-child(3) { animation-delay: 1.2s; }
  .embed-catchphrase-line:nth-child(4) { animation-delay: 1.8s; }
  @keyframes embedSlideIn {
    to { opacity: 1; transform: translateX(0); }
  }

  /* ── Embed: 時計パネル（左下） ── */
  .embed-clock {
    position: absolute; bottom: 24px; left: 24px; z-index: 10;
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border); border-radius: 14px;
    padding: 14px 18px 12px; min-width: 220px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 32px -12px rgba(0,0,0,0.12);
  }
  body.dark .embed-clock {
    box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 16px 48px -12px rgba(0,0,0,0.6);
  }
  .embed-clock-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.22em;
    color: var(--muted); text-transform: uppercase;
  }
  .embed-clock-demo {
    font-size: 10px; color: var(--accent); margin-top: 4px;
    font-weight: 600; letter-spacing: 0.05em;
  }
  .embed-clock-time {
    display: flex; align-items: baseline; gap: 1px;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 44px; font-weight: 500; letter-spacing: -0.02em;
    line-height: 1.05; margin-top: 6px;
    font-variant-numeric: tabular-nums; color: var(--fg);
  }
  .embed-clock-sep { color: var(--muted); opacity: 0.5; }
  .embed-clock-sec { font-size: 22px; color: var(--muted); margin-left: 4px; }
  .embed-clock-date {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: 0.05em;
  }
  .embed-clock-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; color: var(--muted);
    margin-top: 10px; padding-top: 10px;
    border-top: 1px dashed var(--panel-border);
  }
  .embed-clock {
    text-decoration: none; color: inherit;
    cursor: pointer; display: block;
    transition: border-color .2s;
  }
  .embed-clock:hover { border-color: var(--accent); }
  .embed-clock-action {
    font-size: 11px; font-weight: 600; color: var(--accent);
    margin-top: 10px; padding-top: 10px;
    border-top: 1px dashed var(--panel-border);
    letter-spacing: 0.02em;
  }
  .embed-clock-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 0 rgba(22,163,74,0.5);
    animation: embed-pulse 1.8s ease-out infinite;
  }
  @keyframes embed-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(22,163,74,0); }
    100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
  }

  /* ── Embed: アクションボタン（右上） ── */
  .embed-actions {
    position: absolute; top: 24px; right: 24px; z-index: 10;
    display: flex; gap: 8px; pointer-events: auto;
  }
  .embed-icon-btn {
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border); color: var(--fg);
    border-radius: 10px; padding: 9px 14px; font-size: 13px;
    font-family: inherit; cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: background .15s, border-color .15s;
  }
  .embed-icon-btn:hover { border-color: var(--fg); }
  .embed-icon-btn.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }

  /* ── Embed: 設定パネル ── */
  .embed-settings {
    position: absolute; top: 72px; right: 24px; z-index: 11;
    width: 260px; pointer-events: auto;
    background: color-mix(in srgb, var(--panel) 95%, transparent);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border); border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 12px 40px -8px rgba(0,0,0,0.18);
    display: flex; flex-direction: column; gap: 10px; font-size: 13px;
    animation: settingsSlideIn 0.18s cubic-bezier(0.2,0.8,0.2,1);
  }
  body.dark .embed-settings {
    box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 16px 60px -8px rgba(0,0,0,0.7);
  }
  .embed-settings h3 {
    margin: 0; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--muted); font-weight: 700;
  }
  .embed-settings .sp-row { border: none; }
  .embed-settings .sp-note {
    font-size: 10px; color: var(--muted);
    border-top: 1px dashed var(--panel-border); padding-top: 10px; margin-top: 2px;
    line-height: 1.5;
  }

  /* =====================================================
   * Route Panel — 経路設定パネル
   * ===================================================== */
  .route-panel {
    display: flex; flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 32px -12px rgba(0,0,0,0.12);
    font-size: 13px;
    min-width: 280px; max-width: 380px;
  }
  body.dark .route-panel {
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 24px 60px -12px rgba(0,0,0,0.6);
  }
  .rp-fields { flex: 1; padding: 10px 0; min-width: 0; }
  .rp-row {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 4px 14px;
  }
  .rp-row + .rp-row { border-top: 1px dashed var(--panel-border); }
  .rp-icon {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  }
  .rp-icon-dep {
    background: transparent;
    border: 2.5px solid var(--fg);
  }
  .rp-icon-dest {
    background: var(--fg);
  }
  .rp-input-wrap {
    flex: 1; display: flex; align-items: center; min-width: 0;
  }
  .rp-input {
    width: 100%; border: none; background: transparent;
    font: inherit; font-size: 13px; font-weight: 600;
    color: var(--fg); outline: none;
    padding: 4px 0;
  }
  .rp-input::placeholder { color: var(--fg-faint); font-weight: 400; }
  .rp-clear {
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
    background: transparent; border: none;
    color: var(--fg-faint); font-size: 14px; line-height: 1;
    cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .rp-clear:hover { color: var(--fg); background: color-mix(in oklab, var(--fg) 6%, transparent); }

  /* Suggestions dropdown */
  .rp-suggest {
    position: absolute; top: 100%; left: 30px; right: 14px;
    z-index: 20;
    list-style: none; margin: 4px 0 0; padding: 4px 0;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 200px; overflow-y: auto;
  }
  body.dark .rp-suggest {
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  }
  .rp-suggest-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; cursor: pointer;
    transition: background .1s;
  }
  .rp-suggest-item:hover { background: color-mix(in oklab, var(--fg) 5%, transparent); }
  .rp-suggest-name { font-size: 13px; font-weight: 600; }
  .rp-suggest-code { font-size: 10px; color: var(--fg-faint); letter-spacing: 0.1em; }

  .rp-top {
    display: flex; align-items: stretch;
  }

  /* 検索条件セクション */
  .rp-condition {
    border-top: 1px solid var(--panel-border);
    padding: 0;
  }
  .rp-condition-summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px;
    cursor: pointer;
    transition: background .15s;
  }
  .rp-condition-summary:hover { background: color-mix(in oklab, var(--fg) 3%, transparent); }
  .rp-condition-text {
    font-size: 12px; font-weight: 600; color: var(--fg);
    font-variant-numeric: tabular-nums;
  }
  .rp-condition-toggle {
    font-size: 10px; color: var(--fg-faint); font-weight: 500;
    display: flex; align-items: center; gap: 4px;
  }
  .rp-condition-arrow {
    font-size: 10px; display: inline-block;
    transition: transform .15s;
  }
  .rp-condition-arrow.open { transform: rotate(180deg); }

  .rp-opts-detail {
    padding: 8px 14px 4px;
    border-top: 1px dashed var(--panel-border);
    display: flex; flex-direction: column; gap: 8px;
  }

  .rp-condition .rp-search-btn {
    display: block; width: calc(100% - 28px);
    margin: 8px 14px 10px;
  }

  /* Swap button */
  .rp-swap {
    width: 36px; flex-shrink: 0;
    background: transparent; border: none;
    border-left: 1px solid var(--panel-border);
    border-radius: 0;
    color: var(--fg-muted); font-size: 16px;
    cursor: pointer;
    transition: background .15s, color .15s;
  }
  .rp-swap:hover {
    background: color-mix(in oklab, var(--fg) 5%, transparent);
    color: var(--fg);
  }

  /* 検索オプションパネル */
  .route-panel-area {
    position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
    z-index: 12; pointer-events: auto;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
  }
  /* 検索履歴 */
  .rp-history-link {
    align-self: flex-end !important;
    background: transparent; border: none;
    color: var(--fg-faint); font-size: 10px; font-weight: 500;
    text-decoration: underline; cursor: pointer;
    padding: 2px 0; margin-bottom: -2px;
  }
  .rp-history-link:hover { color: var(--fg-muted); }
  .rp-history-panel {
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 12px; padding: 8px 0; width: 100%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px -8px rgba(0,0,0,0.12);
  }
  .rp-history-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 14px 8px; font-size: 11px; font-weight: 700; color: var(--fg-muted);
  }
  .rp-history-close {
    background: transparent; border: none; color: var(--fg-faint);
    font-size: 14px; cursor: pointer; padding: 0;
  }
  .rp-history-item {
    display: block; width: 100%; text-align: left;
    background: transparent; border: none; border-top: 1px solid var(--panel-border);
    padding: 8px 14px; font: inherit; font-size: 12px; font-weight: 500;
    color: var(--fg); cursor: pointer;
  }
  .rp-history-item:hover { background: color-mix(in oklab, var(--fg) 4%, transparent); }

  /* サジェスト履歴セクション */
  .rp-suggest-section {
    padding: 6px 12px 4px; font-size: 9px; font-weight: 700;
    color: var(--fg-faint); letter-spacing: 0.1em; text-transform: uppercase;
  }
  .rp-suggest-history .rp-suggest-name { color: var(--fg-muted); }

  /* オプション: 日時ラベル */
  .rp-opts-datetime-label {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: var(--fg);
    font-variant-numeric: tabular-nums;
    padding-bottom: 6px;
  }
  .rp-opts-datetime-label svg { color: var(--fg-faint); flex-shrink: 0; }
  .rp-date-day { font-size: 10px; font-weight: 500; color: var(--fg-faint); }
  .rp-schedule-tag {
    font-size: 9px; font-weight: 600; color: var(--fg-faint);
    background: color-mix(in srgb, var(--panel-border) 60%, transparent);
    padding: 1px 6px; border-radius: 4px;
  }

  /* スピナーピッカー */
  .rp-picker-grid {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 4px 0;
  }
  .rp-picker-col {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
  }
  .rp-spin-btn {
    background: transparent; border: none;
    color: var(--fg-faint); font-size: 8px; cursor: pointer;
    padding: 2px 8px; line-height: 1;
    transition: color .15s;
  }
  .rp-spin-btn:hover { color: var(--fg); }
  .rp-spin-val {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 16px; font-weight: 700; color: var(--fg);
    background: transparent; border: 1px solid var(--panel-border);
    border-radius: 6px; width: 36px; text-align: center;
    padding: 4px 0; outline: none;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
  }
  .rp-spin-val::-webkit-inner-spin-button,
  .rp-spin-val::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  .rp-spin-val:focus { border-color: var(--accent); }
  .rp-spin-val-lg { font-size: 20px; width: 40px; padding: 6px 0; }
  .rp-spin-label { font-size: 9px; color: var(--fg-faint); font-weight: 500; }
  .rp-picker-sep { width: 12px; }
  .rp-disabled { opacity: 0.3; pointer-events: none; }
  .rp-picker-colon {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 20px; font-weight: 700; color: var(--fg-muted);
    align-self: center; margin-top: -12px;
  }

  /* ① クイックボタン */
  .rp-quick-btns {
    display: flex; gap: 6px; justify-content: center;
    padding: 4px 0;
  }
  .rp-quick-btn {
    padding: 5px 12px;
    background: transparent; border: 1px solid var(--panel-border);
    border-radius: 20px;
    font: inherit; font-size: 10px; font-weight: 600;
    color: var(--fg-muted); cursor: pointer;
    transition: background .15s, color .15s;
  }
  .rp-quick-btn:hover {
    background: color-mix(in oklab, var(--fg) 6%, transparent);
    color: var(--fg);
  }
  .rp-quick-btn:active, .rp-adj-btn:active, .rp-spin-btn:active {
    transform: scale(0.92);
  }

  /* ② モード選択バー */
  .rp-mode-bar {
    display: flex; gap: 0; margin-top: 6px;
    background: color-mix(in srgb, var(--panel-border) 50%, transparent);
    border-radius: 8px; padding: 2px;
  }
  .rp-mode-item {
    flex: 1; padding: 7px 0;
    border: none; background: transparent;
    font: inherit; font-size: 11px; font-weight: 600;
    color: var(--fg-faint); cursor: pointer;
    border-radius: 6px; transition: all .15s;
    text-align: center;
  }
  .rp-mode-item:hover { color: var(--fg-muted); }
  .rp-mode-item.active {
    background: var(--panel); color: var(--fg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }
  body.dark .rp-mode-item.active { box-shadow: 0 1px 3px rgba(0,0,0,0.4); }

  .rp-search-btn {
    padding: 10px 0;
    background: var(--fg); color: var(--bg);
    border: none; border-radius: 9px;
    font: inherit; font-size: 13px; font-weight: 700;
    cursor: pointer; letter-spacing: 0.04em;
    transition: opacity .15s;
  }
  .rp-search-btn:hover { opacity: 0.88; }
  .rp-search-btn:active { transform: scale(0.97); }

  .rp-search-clear {
    padding: 6px 0;
    background: transparent; color: var(--fg-faint);
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    font: inherit; font-size: 11px; font-weight: 500;
    cursor: pointer;
    transition: color .15s, background .15s;
  }
  .rp-search-clear:hover { color: var(--fg); background: color-mix(in oklab, var(--fg) 5%, transparent); }

  /* =====================================================
   * Route Result Panel — 経路検索結果
   * ===================================================== */
  .rr-summary {
    display: flex; align-items: center; gap: 4px;
    padding: 10px 8px; border-bottom: 1px solid var(--panel-border);
  }
  .rr-nav-btn {
    width: 28px; height: 28px; flex-shrink: 0;
    background: transparent; border: 1px solid var(--panel-border);
    border-radius: 7px; color: var(--fg-muted);
    font-size: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
  }
  .rr-nav-btn:hover { background: color-mix(in oklab, var(--fg) 6%, transparent); color: var(--fg); }
  .rr-summary-center { flex: 1; min-width: 0; text-align: center; }
  .rr-summary-top { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
  .rr-summary-time {
    font-size: 18px; font-weight: 700; color: var(--fg);
    font-variant-numeric: tabular-nums;
  }
  .rr-summary-info { font-size: 11px; color: var(--fg-muted); font-weight: 500; }
  .rr-summary-bottom {
    display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 4px;
  }
  .rr-summary-dep {
    font-size: 11px; color: var(--fg-faint); font-variant-numeric: tabular-nums;
    font-weight: 700;
  }
  .rr-summary-arr {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 20px; font-weight: 700; color: var(--fg);
    font-variant-numeric: tabular-nums;
  }
  .rr-summary-arr-label { font-size: 11px; font-weight: 500; color: var(--fg-muted); margin-left: 2px; }

  .rr-scroll {
    max-height: 360px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.15) transparent;
  }
  .rr-scroll::-webkit-scrollbar { width: 6px; }
  .rr-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
  body.dark .rr-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

  .rr-legs { padding: 12px 18px 14px; }

  .rr-leg { padding-bottom: 4px; }
  .rr-leg-head {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 7px;
    margin-bottom: 8px;
    color: #fff;
  }
  .rr-leg-id {
    font-size: 12px; font-weight: 800;
    opacity: 0.8;
  }
  .rr-leg-line { font-size: 12px; font-weight: 700; }
  .rr-leg-count { font-size: 10px; opacity: 0.8; flex-shrink: 0; }

  /* 経路レグ: CSS Grid 2カラム。バーは右カラムの border-left */
  .rr-leg-grid {
    display: grid;
    grid-template-columns: 62px 1fr;
    margin-left: 10px;
  }
  .rr-stop-label { font-size: 9px; font-weight: 500; margin-left: 1px; color: var(--fg-faint); }

  /* 左カラム（時刻） */
  .rr-g-time {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 13px; font-variant-numeric: tabular-nums;
    text-align: right; padding-right: 10px;
    padding-top: 4px; padding-bottom: 4px;
    display: flex; align-items: center; justify-content: flex-end;
  }
  /* 右カラム（駅名）— border-left でバーを描画 */
  .rr-g-name {
    border-left: 3px solid var(--bar-color);
    padding-left: 10px;
    padding-top: 4px; padding-bottom: 4px;
    display: flex; align-items: center;
  }

  /* 出発: 太字黒 */
  .rr-g-dep.rr-g-time { font-weight: 800; color: var(--fg); }
  .rr-g-dep.rr-g-name { font-size: 14px; font-weight: 800; color: var(--fg); }
  /* 到着: 太字グレー */
  .rr-g-arr.rr-g-time { font-weight: 700; color: var(--fg-muted); }
  .rr-g-arr.rr-g-name { font-size: 13px; font-weight: 700; color: var(--fg-muted); }
  /* トグル行 */
  .rr-g-toggle.rr-g-name { padding-top: 2px; padding-bottom: 2px; }
  /* 途中駅 */
  .rr-g-mid.rr-g-time {
    font-size: 10px; font-weight: 400; color: var(--fg-faint);
    padding-top: 2px; padding-bottom: 2px;
  }
  .rr-g-mid.rr-g-name {
    font-size: 10px; font-weight: 400; color: var(--fg-faint);
    padding-top: 2px; padding-bottom: 2px;
  }

  /* 途中駅アコーディオン */
  .rr-mid { padding: 2px 0; }
  .rr-mid-toggle {
    background: transparent; border: none; cursor: pointer;
    font: inherit; font-size: 10px; font-weight: 500;
    color: var(--fg-faint); padding: 3px 0;
    display: flex; align-items: center; gap: 4px;
  }
  .rr-mid-toggle:hover { color: var(--fg-muted); }
  .rr-mid-arrow {
    font-size: 10px; transition: transform .15s;
    display: inline-block; width: 12px; height: 12px;
    text-align: center; line-height: 12px;
  }
  .rr-mid-hint {
    font-size: 9px; color: var(--fg-faint); font-weight: 400;
    margin-left: 4px; opacity: 0.7;
  }
  .rr-mid-arrow.open { transform: rotate(180deg); }

  /* 乗り換え表示 — グリッドと同じ2カラムで揃える */
  .rr-xfer {
    display: grid;
    grid-template-columns: 62px 1fr;
    margin-left: 10px; padding: 0;
  }
  .rr-xfer-spacer { }
  .rr-xfer-label {
    font-size: 11px; color: var(--fg-faint); font-weight: 500;
    padding-left: 10px; padding-top: 6px; padding-bottom: 6px;
    border-left: 3px dashed var(--border-strong);
  }

  @media (max-width: 640px) {
    /* 上部はアプリ同様、検索ビューのみ。ブランド・上部アクションは撤去
       （テーマ/設定は下の浮遊バーへ移す。設定パネルはtop-barの外に出したのでtop-bar全体を隠せる） */
    .top-bar { display: none; }
    .route-panel-area {
      top: 8px; left: 8px; right: 8px; transform: none;
      align-items: stretch;
    }
    .route-panel { min-width: 0; max-width: none; width: 100%; }

    /* PC向けの操作ヒント・地図ズーム/フィットボタン・倍率表示はモバイル不要 */
    .zoom-hint { display: none; }
    .zoom-controls { display: none; }
    .zoom-level { display: none; }

    /* 再生バーの「真上」に確実にアンカーする浮遊バー（決め打ちpxを使わない）
       timeline-area を基準に bottom:100% で再生バーの上端に乗せる */
    .timeline-area { position: relative; }
    .mobile-float-controls {
      display: flex; align-items: flex-end; justify-content: space-between;
      position: absolute; left: 10px; right: 10px; bottom: 100%;
      margin-bottom: 8px; z-index: 16; pointer-events: none;
    }
    .mobile-float-controls > * { pointer-events: auto; }
    .mfc-left { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
    .mfc-left a {
      font-size: 12px; color: var(--accent); font-weight: 700; text-decoration: none;
      background: color-mix(in srgb, var(--panel) 88%, transparent);
      padding: 4px 10px; border-radius: 13px;
      box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    }
    .mfc-left a.app-dl-link { background: var(--accent); color: #fff; }
    .mfc-right { display: flex; align-items: center; gap: 8px; }
    .mfc-right button { padding: 6px 12px; font-size: 12px; }

    /* 下部 再生バー: 1カラムに積み、各要素を全幅に */
    .timeline-bar {
      grid-template-columns: 1fr;
      grid-template-rows: auto auto;
      column-gap: 0; row-gap: 8px;
      padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    }
    .time-display { grid-row: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
    .time-big { font-size: 34px; }
    .time-date { margin-bottom: 0; }
    .time-sub { display: none; }            /* 「名古屋市営地下鉄」非表示 */
    /* 現在時刻は時計の隣に小さく（アプリ風）。controls側の現在時刻ボタンは隠す */
    .time-clock-row { display: flex; align-items: center; gap: 10px; }
    .now-btn-mobile {
      display: inline-flex; align-items: center;
      padding: 5px 12px; border-radius: 14px;
      background: transparent; border: 1px solid var(--border-strong);
      color: var(--fg-muted); font: inherit; font-size: 11px; font-weight: 700;
      cursor: pointer;
    }
    .controls .now-btn { display: none; }

    /* 時間軸の±と倍速はモバイル不要（アプリへ誘導） */
    .scrubber-zoom { display: none; }
    .speed-group { display: none; }

    /* 設定パネルはモバイルでは下端のシート型に。
       z-indexを再生バー(20)より上げないと時刻パネルの後ろに隠れる */
    .settings-panel {
      position: fixed; top: auto; left: 0; right: 0; bottom: 0;
      width: 100%; max-width: none; max-height: 78vh; overflow-y: auto;
      border-radius: 16px 16px 0 0;
      z-index: 40;
    }

    .controls { justify-content: center; gap: 4px 6px; }
    .ctrl-btn { min-width: 34px !important; padding: 4px 6px !important; }

    /* 情報パネル: 左右中央・下寄せ・時刻パネルより手前のシート型。
       ※map-wrap内のabsoluteだと再生バー(timeline-area)の後ろに隠れるため、
         ビューポート基準のfixed + 高z-indexで前面に出す（時刻パネルを覆う）。
       ※ベース定義(.info-panel-wrap)がこの後方にあり同詳細度だと後勝ちするため、
         .map-wrap を付けて詳細度で確実に勝たせる */
    .map-wrap .info-panel-wrap {
      position: fixed; left: 0; right: 0; bottom: 0; top: auto;
      z-index: 40; display: flex; justify-content: center;
    }
    .map-wrap .info-panel {
      width: 100% !important; max-width: 520px;
      max-height: 85vh; overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      border-radius: 16px 16px 0 0;
      font-size: 13px;
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    /* 余白とフォントを詰める */
    .ip-header { padding: 12px 14px 8px; gap: 10px; }
    .ip-chip { width: 32px; height: 32px; font-size: 12px; }
    .ip-title-ja { font-size: 15px; }
    .ip-countdown { padding: 8px 14px; }
    .ip-countdown-num { font-size: 30px; }
    .ip-arrivals { padding: 6px 14px 10px; }
    .ip-arrivals li { padding: 7px 0; }
    .ip-actions { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
    .ip-actions button { padding: 11px 8px; font-size: 13px; }
    /* タイムライン(電車パネル)の行間を詰める */
    .ip-timeline { padding: 6px 14px 10px; }
  }

  /* 駅選択時アクションポップアップ */
  @keyframes popup-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  .station-action-popup {
    animation: popup-in 150ms ease-out both;
  }
  .station-action-popup rect { transition: opacity .12s; }
  .station-action-popup g:hover rect { opacity: 0.85; }

  /* 乗車中パルスアニメーション */
  @keyframes boarding-pulse {
    0%   { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.8); opacity: 0; }
  }
  .boarding-pulse { transform-origin: 0 0; }
  .boarding-ring { animation: boarding-pulse 2s ease-out infinite; }
  .boarding-badge {
    font-size: 14px; font-weight: 700; letter-spacing: 0.08em;
    fill: var(--fg); paint-order: stroke;
    stroke: var(--panel); stroke-width: 5; stroke-linejoin: round;
  }

  /* 乗車中ステータス表示 */
  .boarding-status {
    z-index: 11; pointer-events: auto;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px; font-weight: 600; color: var(--fg);
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px -8px rgba(0,0,0,0.12);
    white-space: nowrap;
  }
  .boarding-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--line-color);
    box-shadow: 0 0 0 0 var(--line-color);
    animation: boarding-status-pulse 2s ease-out infinite;
  }
  @keyframes boarding-status-pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--line-color) 50%, transparent); }
    70%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--line-color) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--line-color) 0%, transparent); }
  }
  .boarding-cancel {
    background: transparent; border: none;
    color: var(--fg-faint); font-size: 14px;
    cursor: pointer; padding: 0 0 0 4px; line-height: 1;
  }
  .boarding-cancel:hover { color: var(--fg); }

  /* 乗車中ボタン（パネル内） */
  .ip-btn-boarding-active {
    background: var(--reticle-stroke) !important; color: #fff !important;
    border-color: var(--reticle-stroke) !important;
  }
  .ip-summary-row {
    display: flex; align-items: center; gap: 8px;
  }
  .ip-summary-info {
    flex-shrink: 0;
  }
  .ip-summary-station {
    font-size: 11px; color: var(--fg-muted); font-weight: 500;
    line-height: 1.2;
  }
  .ip-summary-time {
    font-size: 14px; color: var(--fg); font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
  }
  .ip-summary-btns {
    display: flex; gap: 6px; flex: 1; justify-content: flex-end;
  }
  .ip-summary-btns .ip-btn-detail {
    text-align: center; padding: 6px 10px;
  }
  .ip-btn-route {
    background: transparent !important; color: var(--fg) !important;
    border: 1px solid var(--border-strong) !important;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
  }
  .ip-btn-route:hover {
    background: color-mix(in oklab, var(--fg) 5%, transparent) !important;
  }
  .ip-btn-route-sub {
    font-size: 9px; font-weight: 500; color: var(--fg-faint);
    display: block;
  }

  /* 検索時刻同期ボタン */
  .sync-time-btn {
    position: fixed; left: 16px; bottom: 120px;
    z-index: 15; pointer-events: auto;
    background: var(--reticle-stroke); color: #fff;
    border: none; border-radius: 9px;
    padding: 9px 14px;
    font: inherit; font-size: 11px; font-weight: 700;
    cursor: pointer; letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    animation: panel-slide-in 200ms cubic-bezier(.2,.8,.3,1) both;
    transition: opacity .15s;
  }
  .sync-time-btn:hover { opacity: 0.88; }

  /* =====================================================
   * Reticle — 選択照準アニメーション
   * ===================================================== */
  @keyframes reticle-snap-in {
    from { transform: scale(1.4); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
  }
  .reticle {
    animation: reticle-snap-in 360ms cubic-bezier(.2, 1.4, .4, 1) both;
    transform-origin: center;
    transform-box: fill-box;
  }

  /* =====================================================
   * Info Panel — 駅・電車選択パネル（共通）
   * ===================================================== */
  .info-panel-wrap {
    position: absolute; right: 24px; bottom: 24px;
    z-index: 15; pointer-events: auto;
  }
  @media (max-width: 480px) {
    .info-panel-wrap { right: 16px; bottom: 16px; }
    .info-panel { width: calc(100vw - 32px) !important; }
  }

  .info-panel {
    width: 340px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04),
                0 18px 40px -12px rgba(0,0,0,0.18);
    font-size: 14px;
    animation: panel-slide-in 240ms cubic-bezier(.2, .8, .3, 1) both;
  }
  body.dark .info-panel {
    box-shadow: 0 4px 20px rgba(0,0,0,0.5),
                0 24px 60px -12px rgba(0,0,0,0.6);
  }
  @keyframes panel-slide-in {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }

  /* Header */
  .ip-header {
    padding: 16px 18px 12px;
    display: flex; align-items: center; gap: 12px;
  }
  .ip-chip {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--line-color, var(--accent));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 13px; letter-spacing: -0.02em;
    flex-shrink: 0;
  }
  .ip-chip-sq {
    width: 26px; height: 26px; border-radius: 6px;
    font-size: 11px;
  }
  .ip-title { flex: 1; line-height: 1.2; min-width: 0; }
  .ip-title-ja { font-size: 17px; font-weight: 700; }
  .ip-chip-sq ~ .ip-title .ip-title-ja { font-size: 14px; }
  .ip-title-en {
    font-size: 10px; color: var(--fg-muted);
    letter-spacing: 0.18em; margin-top: 2px;
  }
  /* Line switcher (複数路線駅用) */
  .ip-line-switcher {
    display: flex; gap: 4px; flex-shrink: 0;
  }
  .ip-line-dot {
    width: 24px; height: 24px; border-radius: 6px;
    border: 2px solid transparent;
    color: #fff; font-size: 10px; font-weight: 800;
    font-family: inherit;
    cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: 0.45;
    transition: opacity .15s, border-color .15s;
  }
  .ip-line-dot:hover { opacity: 0.75; }
  .ip-line-dot.active { opacity: 1; border-color: currentColor; }

  .ip-close {
    width: 26px; height: 26px; border-radius: 6px;
    background: transparent; border: none;
    color: var(--fg-faint); font-size: 18px; line-height: 1;
    cursor: pointer; padding: 0; flex-shrink: 0;
    font-family: inherit;
  }
  .ip-close:hover {
    background: color-mix(in oklab, var(--fg) 6%, transparent);
    color: var(--fg);
  }

  /* Countdown */
  .ip-countdown {
    padding: 0 18px 14px;
    display: flex; align-items: baseline; gap: 10px;
  }
  .ip-countdown-label {
    display: block;
    font-family: inherit;
    font-size: 10px; font-weight: 600; color: var(--fg-muted);
    letter-spacing: 0.06em; margin-bottom: 4px;
  }
  .ip-countdown-num {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 38px; font-weight: 500;
    letter-spacing: -0.02em; line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--line-color, var(--accent));
  }
  .ip-countdown-unit {
    font-size: 16px; color: var(--fg-muted);
    margin-left: 4px; font-weight: 500;
  }
  .ip-countdown-meta { flex: 1; text-align: right; }
  .ip-meta-line { font-size: 12px; color: var(--fg-muted); }
  .ip-meta-sub {
    font-size: 10px; color: var(--fg-faint);
    letter-spacing: 0.1em; margin-top: 2px;
  }

  /* Tabs */
  .ip-tabs {
    display: flex; padding: 0 18px; gap: 24px;
    border-bottom: 1px solid var(--panel-border);
  }
  .ip-tab {
    padding: 10px 0 12px;
    font-size: 12px; font-weight: 700;
    color: var(--fg-faint);
    background: transparent; border: none; cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
    transition: color .15s;
  }
  .ip-tab:hover { color: var(--fg-muted); }
  .ip-tab.active {
    color: var(--fg);
    border-bottom-color: var(--line-color, var(--accent));
  }

  /* Arrival list */
  .ip-arrivals { list-style: none; padding: 10px 18px 12px; margin: 0; }
  .ip-arrival {
    display: flex; align-items: center; gap: 12px; padding: 8px 0;
  }
  .ip-arrival-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--border-strong);
    flex-shrink: 0;
  }
  .ip-arrival.next .ip-arrival-dot {
    background: var(--line-color, var(--accent));
  }
  .ip-arrival-time {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 14px; font-weight: 600;
    min-width: 50px;
    font-variant-numeric: tabular-nums;
  }
  .ip-arrival-dir { flex: 1; font-size: 12px; color: var(--fg-muted); }
  .ip-arrival-wait {
    font-size: 11px; color: var(--fg-faint);
    font-variant-numeric: tabular-nums; font-weight: 500;
  }
  .ip-arrival.next .ip-arrival-wait {
    color: var(--line-color, var(--accent));
    font-weight: 700;
  }

  /* Actions */
  .ip-actions {
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr 44px;
    gap: 8px;
    border-top: 1px solid var(--panel-border);
  }
  .ip-btn {
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 13px; font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity .15s, background .15s;
  }
  .ip-btn-primary {
    background: var(--fg); color: var(--bg);
  }
  .ip-btn-primary:hover { opacity: 0.88; }
  .ip-btn:active { transform: scale(0.96); }
  .ip-btn-ghost {
    background: transparent;
    color: var(--fg);
    border-color: var(--border-strong);
  }
  .ip-btn-ghost:hover {
    background: color-mix(in oklab, var(--fg) 5%, transparent);
  }
  .ip-btn-icon {
    padding: 11px 0;
    background: transparent; color: var(--fg-muted);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    font-size: 14px; cursor: pointer;
    font-family: inherit;
    transition: color .15s, background .15s;
  }
  .ip-btn-icon:hover {
    color: var(--fg);
    background: color-mix(in oklab, var(--fg) 4%, transparent);
  }
  .ip-actions-col {
    grid-template-columns: 1fr 1fr;
  }
  .ip-btn-with-sub {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 8px 6px;
    min-height: 52px;
  }
  .ip-btn-sub {
    font-size: 9px; font-weight: 600;
    white-space: nowrap;
  }

  /* =====================================================
   * Train timeline (電車パネルの停車駅タイムライン)
   * ===================================================== */
  .ip-timeline {
    list-style: none; padding: 8px 18px 12px; margin: 0;
    max-height: 320px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.15) transparent;
  }
  .ip-timeline::-webkit-scrollbar { width: 6px; }
  .ip-timeline::-webkit-scrollbar-track { background: transparent; }
  .ip-timeline::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15); border-radius: 3px;
  }
  body.dark .ip-timeline::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
  }
  .ip-stop {
    display: grid;
    grid-template-columns: 50px 24px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
  }
  .ip-stop-time {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 11px;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
  }
  .ip-stop.past .ip-stop-time { color: var(--fg-faint); }

  .ip-stop-rail {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    min-height: 30px;
  }
  .ip-stop-rail::before,
  .ip-stop-rail::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: var(--border-strong);
  }
  .ip-stop-rail::before { top: -8px; bottom: calc(50% + 6px); }
  .ip-stop-rail::after  { bottom: -8px; top: calc(50% + 6px); }
  .ip-stop:first-child .ip-stop-rail::before { display: none; }
  .ip-stop:last-child  .ip-stop-rail::after  { display: none; }
  .ip-stop.departed .ip-stop-rail::after  { background: var(--line-color, var(--accent)); }
  .ip-stop.next     .ip-stop-rail::before { background: var(--line-color, var(--accent)); }

  .ip-stop-dot {
    position: relative;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
  }
  .ip-stop.next .ip-stop-dot {
    width: 12px; height: 12px;
    background: var(--panel);
    border: 3px solid var(--line-color, var(--accent));
  }

  .ip-stop-name { font-size: 13px; font-weight: 500; }
  .ip-stop.past .ip-stop-name {
    color: var(--fg-faint);
    text-decoration: line-through;
    text-decoration-color: var(--fg-faint);
  }
  .ip-stop.departed .ip-stop-name { color: var(--fg-muted); }
  .ip-stop.next .ip-stop-name { font-weight: 700; color: var(--fg); }
  .ip-stop.future .ip-stop-name { color: var(--fg); }

  .ip-stop-badge {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.12em;
    color: transparent;
  }
  .ip-stop.next .ip-stop-badge { color: var(--line-color, var(--accent)); }
  .ip-stop.departed .ip-stop-badge { color: var(--fg-faint); }

  /* Summary footer */
  .ip-summary {
    padding: 12px 18px;
    background: var(--bg-sub);
    border-top: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--fg-muted);
  }
  .ip-btn-detail {
    padding: 6px 12px;
    background: transparent; color: var(--fg);
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: background .15s;
  }
  .ip-btn-detail:hover {
    background: color-mix(in oklab, var(--fg) 5%, transparent);
  }

  /* 検索結果更新フラッシュ */
  @keyframes result-flash {
    0%   { opacity: 0.3; }
    100% { opacity: 1; }
  }
  .info-panel.result-updated {
    animation: result-flash 300ms ease-out;
  }

  /* 駅設定フラッシュ */
  @keyframes input-flash {
    0%   { background: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: 0 0 0 2px var(--accent); }
    100% { background: transparent; box-shadow: 0 0 0 0 transparent; }
  }
  .rp-input.input-flash {
    animation: input-flash 800ms ease-out;
    border-radius: 4px;
  }

  /* ボタン全般のトランジション */
  .ip-btn, .rp-search-btn, .rp-quick-btn, .rp-adj-btn, .rp-spin-btn, .rp-mode-item, .ipt-tab {
    transition: all .15s;
  }

  /* 情報パネルタブ切り替え */
  .info-panel-tabs {
    display: flex; gap: 0; margin-bottom: 6px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    overflow: hidden;
  }
  .ipt-tab {
    flex: 1; padding: 7px 0;
    background: transparent; border: none;
    font: inherit; font-size: 11px; font-weight: 600;
    color: var(--fg-faint); cursor: pointer;
    transition: all .15s; text-align: center;
  }
  .ipt-tab:hover { color: var(--fg-muted); }
  .ipt-tab.active {
    background: var(--fg); color: var(--bg);
  }
  .ipt-tab + .ipt-tab { border-left: 1px solid var(--panel-border); }

  /* パネル表示時にズームコントロールを上に移動 */
  .map-wrap:has(.info-panel-wrap) .zoom-controls {
    bottom: auto; top: 80px;
  }
  .map-wrap:has(.info-panel-wrap) .zoom-level {
    bottom: auto; top: 210px;
  }
