  :root {
    --bg: #f6f8fa;
    --card: #ffffff;
    --ink: #1f2933;
    --ink-soft: #52606d;
    --line-border: #e4e9ee;
    --ok: #2e7d5b;
    --ok-bg: #e8f4ee;
    --warn: #b4610e;
    --warn-bg: #fdf1e3;
    --bad: #b3342d;
    --bad-bg: #fbeceb;
    --accent: #33628c;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    line-height: 1.5;
  }
  .wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
  header { margin-bottom: 20px; }
  header h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
  header p { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.95rem; }
  .demo-note {
    margin-top: 10px; font-size: 0.8rem; color: var(--ink-soft);
    background: #eef2f6; border: 1px solid var(--line-border);
    border-radius: 8px; padding: 8px 12px;
  }
  section {
    background: var(--card); border: 1px solid var(--line-border);
    border-radius: 14px; padding: 20px; margin-bottom: 20px;
  }
  section h2 { margin: 0 0 4px; font-size: 1.15rem; }
  section .sub { margin: 0 0 16px; color: var(--ink-soft); font-size: 0.88rem; }

  /* Steps */
  .step { margin-bottom: 20px; }
  .step:last-child { margin-bottom: 0; }
  .step-title { font-weight: 700; font-size: 0.92rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
  .step-num {
    width: 22px; height: 22px; border-radius: 50%; flex: none;
    background: var(--accent); color: #fff; font-size: 0.78rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .step-done .step-num { background: var(--ok); }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip {
    display: inline-flex; align-items: center; gap: 7px;
    border: 2px solid var(--line-border); border-radius: 999px;
    background: #fff; padding: 6px 12px; font-size: 0.85rem;
    cursor: pointer; color: var(--ink-soft);
    transition: all 0.15s ease;
  }
  .chip .dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
  .chip.on { border-color: var(--ink); color: var(--ink); background: #f0f5fa; font-weight: 600; }
  .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .stations { display: flex; flex-wrap: wrap; gap: 7px; }
  .station-pill {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1.5px solid; border-radius: 999px;
    padding: 4px 11px; font-size: 0.8rem; cursor: pointer;
    background: #fff; transition: all 0.15s ease;
  }
  .station-pill .sdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
  .station-pill.ic { font-weight: 700; }
  .station-pill.on { box-shadow: 0 0 0 2px var(--accent); font-weight: 700; }
  .station-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .step-note { margin-top: 6px; font-size: 0.78rem; color: var(--ink-soft); }

  /* Check / Reset actions */
  .actions { display: flex; gap: 10px; margin-top: 4px; }
  .btn-primary, .btn-ghost {
    border-radius: 10px; padding: 10px 22px; font-size: 0.92rem; font-weight: 700;
    cursor: pointer; transition: all 0.15s ease;
  }
  .btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
  .btn-primary:hover:not(:disabled) { background: #28516f; }
  .btn-primary:disabled { background: #b9c6d2; border-color: #b9c6d2; cursor: not-allowed; }
  .btn-ghost { background: #fff; color: var(--ink-soft); border: 1px solid var(--line-border); }
  .btn-ghost:hover { color: var(--bad); border-color: var(--bad); }
  .btn-primary:focus-visible, .btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .actions-note { margin-top: 8px; font-size: 0.78rem; color: var(--ink-soft); }

  /* Result popout */
  .modal-backdrop {
    position: fixed; inset: 0; background: rgba(31, 41, 51, 0.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; z-index: 100; overflow-y: auto;
  }
  .modal-backdrop[hidden] { display: none; }
  .modal {
    background: var(--card); border-radius: 14px; width: 100%; max-width: 620px;
    box-shadow: 0 12px 40px rgba(15, 23, 32, 0.25);
    padding: 22px; position: relative;
  }
  .modal h3 { margin: 0 0 4px; font-size: 1.15rem; }
  .modal .close-x {
    position: absolute; top: 12px; right: 12px;
    border: 1px solid var(--line-border); background: #fff; color: var(--ink-soft);
    border-radius: 8px; width: 30px; height: 30px; font-size: 0.95rem; cursor: pointer;
  }
  .modal .close-x:hover { color: var(--bad); border-color: var(--bad); }
  .modal .sub { margin: 0 0 14px; color: var(--ink-soft); font-size: 0.85rem; }
  .totals-hero {
    background: #f0f5fa; border: 1px solid #d8e3ec; border-radius: 12px;
    padding: 16px 18px; display: flex; gap: 24px; flex-wrap: wrap;
  }
  .totals-hero .th { display: flex; flex-direction: column; }
  .totals-hero .th .lbl { font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
  .totals-hero .th .val { font-size: 1.7rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
  .totals-hero .th .val small { font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); }

  /* Line status cards */
  .line-card {
    border: 1px solid var(--line-border); border-radius: 12px;
    padding: 16px; margin-bottom: 16px; background: #fbfcfd;
  }
  .line-card:last-child { margin-bottom: 0; }
  .line-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
  .line-head .name { font-weight: 700; font-size: 1rem; }
  .status-pill {
    margin-left: auto; font-size: 0.75rem; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
  }
  .status-pill.ok { background: var(--ok-bg); color: var(--ok); }
  .status-pill.cut { background: var(--warn-bg); color: var(--warn); }
  .notice { margin-top: 12px; padding: 10px 13px; border-radius: 10px; font-size: 0.85rem; }
  .notice.cut { background: var(--warn-bg); border: 1px solid #f0d2ab; color: var(--warn); }
  .notice.ok { background: var(--ok-bg); border: 1px solid #bfe0cf; color: var(--ok); }
  .notice strong { display: block; margin-bottom: 2px; }

  /* Result */
  .journey-picks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
  .journey-btn {
    display: flex; align-items: center; gap: 12px; text-align: left;
    border: 1px solid var(--line-border); border-radius: 10px;
    background: #fff; padding: 10px 14px; cursor: pointer;
    font-size: 0.88rem; color: var(--ink); transition: all 0.15s ease;
  }
  .journey-btn:hover { border-color: var(--accent); }
  .journey-btn .jdots { display: flex; align-items: center; gap: 3px; flex: none; }
  .journey-btn .jd { width: 9px; height: 9px; border-radius: 50%; }
  .journey-btn .jline { width: 14px; height: 3px; }
  .journey-card {
    margin-top: 14px; border: 1px solid var(--line-border);
    border-radius: 12px; padding: 16px; background: #f9fbfc;
  }
  .journey-card .route { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
  .journey-card .meta { color: var(--ink-soft); font-size: 0.85rem; }
  .journey-card .time {
    margin-top: 10px; font-size: 1.4rem; font-weight: 700; color: var(--accent);
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  }
  .journey-card .time small { font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); }
  .journey-card .snap { margin-top: 6px; font-size: 0.78rem; color: var(--ink-soft); }
  .journey-card.unavailable { background: var(--bad-bg); border-color: #eccfcd; }
  .journey-card.unavailable .time { color: var(--bad); font-size: 1rem; }
  .legs { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
  .leg { display: flex; align-items: baseline; gap: 9px; font-size: 0.87rem; }
  .leg .ldot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; }
  .leg.walk { color: var(--ink-soft); }
  .leg .lmeta { color: var(--ink-soft); font-size: 0.8rem; }
  .totals {
    margin-top: 14px; padding-top: 11px; border-top: 1px dashed #c9d2da;
    display: flex; gap: 18px; flex-wrap: wrap; font-weight: 700; font-size: 0.95rem;
  }
  .totals .t { color: var(--accent); }
  .totals small { font-weight: 500; color: var(--ink-soft); }

/* Map popout */
.modal-map { max-width: 760px; display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.map-scroll { overflow-y: auto; border: 1px solid var(--line-border); border-radius: 10px; background: #fff; }
.map-scroll img { display: block; width: 100%; height: auto; }

/* Real-time departures */
.departures { margin-top: 14px; border: 1px solid #d8e3ec; background: #f0f5fa; border-radius: 12px; padding: 14px 16px; }
.dep-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dep-title { font-weight: 700; font-size: 0.92rem; }
.dep-line { color: #fff; font-size: 0.72rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.dep-list { display: flex; flex-direction: column; gap: 6px; }
.dep-item { display: flex; align-items: baseline; gap: 12px; font-size: 0.9rem; }
.dep-item:first-child { font-weight: 700; }
.dep-time { font-size: 1.15rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.dep-wait { color: var(--ink-soft); font-size: 0.82rem; }
.dep-dir { color: var(--ink-soft); font-size: 0.78rem; font-style: italic; }
.dep-arrive { margin-top: 10px; font-size: 0.88rem; }
.dep-note { margin-top: 8px; font-size: 0.75rem; color: var(--ink-soft); }
