@charset "UTF-8";

:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #14202b;
    --muted: #6b7785;
    --faint: #94a3b8;
    --line: #e3e8ee;
    --line-strong: #cbd5e1;
    --amber: #d97706;
    --amber-soft: #fff7e6;
    --amber-line: #fde68a;
    --green: #059669;
    --green-soft: #ecfdf5;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .045);
    --radius: 16px;
    --topbar-h: 150px;
    --day1: #2563eb;
    --day1-soft: #eff6ff;
    --day2: #7c3aed;
    --day2-soft: #f5f3ff;
    --day3: #0d9488;
    --day3-soft: #ecfdf5;
  }

  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
      "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  button { font: inherit; color: inherit; }
  a { color: inherit; }
  svg { display: block; }

  .app {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
  }

  /* ---------- sticky header ---------- */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: max(12px, env(safe-area-inset-top)) 16px 10px;
    background: rgba(244, 246, 248, .9);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid rgba(227, 232, 238, .8);
  }
  .topbar-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }
  .brand-icon {
    flex: 0 0 auto;
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .brand-text { min-width: 0; }
  .brand-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
  }
  .brand-sub {
    margin-top: 3px;
    font-size: 10.5px;
    color: var(--muted);
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
  }
  .theme-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .15s ease;
  }
  .theme-btn:active { transform: scale(.92); }
  .theme-btn svg { width: 15px; height: 15px; }
  .status-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 0;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
  }
  .status-pill.is-before { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
  .status-pill.is-live { color: #92400e; background: var(--amber-soft); border-color: var(--amber-line); }
  .status-pill.is-after { color: #64748b; background: #f1f5f9; border-color: #e2e8f0; }
  .status-pill.is-sim { color: #6d28d9; background: #f5f3ff; border-color: #ddd6fe; }
  .sim-x {
    display: inline-grid;
    place-items: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(109, 40, 217, .1);
    color: #6d28d9;
    text-decoration: none;
    font-size: 11px;
    line-height: 1;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 10px;
  }
  .tab {
    position: relative;
    border: 0;
    background: transparent;
    padding: 7px 8px 11px;
    border-radius: 11px;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease, box-shadow .18s ease;
  }
  .tab:active { transform: scale(.985); }
  .tab[aria-selected="true"] {
    background: #fff;
    box-shadow: var(--shadow);
  }
  .tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 5px;
    height: 3px;
    border-radius: 3px;
    background: var(--accent, #2563eb);
  }
  .tab-date {
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--text);
    white-space: nowrap;
  }
  .tab[aria-selected="true"] .tab-date { color: var(--accent, #2563eb); }
  .tab-city {
    display: block;
    margin-top: 2px;
    font-size: 9.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .today-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, .12);
  }

  /* ---------- progress ---------- */
  .progress-row { margin-top: 8px; }
  .progress-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 10.5px;
    color: var(--muted);
  }
  .progress-meta b { color: var(--text); font-weight: 800; }
  .progress-track {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ebf1;
  }
  .progress-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: var(--accent, #2563eb);
    transition: width .35s cubic-bezier(.22, .8, .3, 1), background .25s ease;
  }

  /* ---------- day head ---------- */
  .day-head {
    position: relative;
    padding: 18px 16px 14px;
    background:
      radial-gradient(120% 90% at 100% 0%, var(--accent-soft, #eff6ff) 0%, rgba(244, 246, 248, 0) 62%),
      var(--bg);
  }
  .day-kicker {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--accent, #2563eb);
  }
  .day-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
  }
  .day-title {
    margin: 0;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.1;
  }
  .today-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--amber-soft);
    border: 1px solid var(--amber-line);
    color: #92400e;
    font-size: 9.5px;
    font-weight: 800;
  }
  .day-route {
    margin-top: 6px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--muted);
  }
  .day-stay {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--accent-soft, #eff6ff);
    color: var(--accent, #2563eb);
    font-size: 10.5px;
    font-weight: 700;
  }

  /* 当天路线链 */
  .route-strip {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 11px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .route-strip::-webkit-scrollbar { display: none; }
  .stop {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #475569;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
  }
  .stop svg {
    width: 12px;
    height: 12px;
    color: var(--accent, #2563eb);
  }
  .route-arrow {
    flex: 0 0 auto;
    position: relative;
    width: 13px;
    height: 1px;
    margin: 0 2px;
    background: var(--line-strong);
  }
  .route-arrow::after {
    content: "";
    position: absolute;
    right: -1px;
    top: -2px;
    width: 5px;
    height: 5px;
    border-top: 1px solid var(--line-strong);
    border-right: 1px solid var(--line-strong);
    transform: rotate(45deg);
  }

  /* 卡片正面的线路/交通方式 */
  .line-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 9px;
    padding: 8px 9px;
    border: 1px solid #eef2f6;
    border-left: 3px solid var(--accent, #2563eb);
    border-radius: 10px;
    background: #f8fafc;
  }
  .line-mode {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 2px 5px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    color: var(--accent, #2563eb);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.4;
    white-space: nowrap;
  }
  .line-body {
    flex: 1;
    min-width: 0;
  }
  .line-route {
    display: block;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.45;
  }
  .line-meta {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.45;
  }

  /* 地铁分段指引：方向 / 换乘 / 站数 */
  .steps {
    margin-top: 8px;
    padding: 8px 9px;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: #fff;
  }
  .step {
    display: flex;
    gap: 7px;
    align-items: flex-start;
    color: #475569;
    font-size: 10.5px;
    line-height: 1.5;
  }
  .step + .step { margin-top: 5px; }
  .step-no {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 15px;
    height: 15px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--accent-soft, #eff6ff);
    color: var(--accent, #2563eb);
    font-size: 8.5px;
    font-weight: 800;
  }
  .step-text { flex: 1; min-width: 0; }

  .arrival-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 8px 9px 8px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
  }
  .arrival-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
  }
  .seg {
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    background: var(--bg);
  }
  .seg button {
    border: 0;
    background: transparent;
    padding: 5px 9px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .seg button[aria-pressed="true"] {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
  }

  /* ---------- timeline ---------- */
  .timeline {
    position: relative;
    padding: 0 16px 12px;
  }
  .timeline::before {
    content: "";
    position: absolute;
    left: 66px;
    top: 18px;
    bottom: 26px;
    width: 2px;
    border-radius: 2px;
    background: var(--line);
  }

  .item {
    position: relative;
    display: grid;
    grid-template-columns: 48px 20px minmax(0, 1fr);
    column-gap: 8px;
    z-index: 1;
  }
  .time-col {
    padding-top: 15px;
    text-align: right;
  }
  .time-start {
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
  }
  .time-end {
    margin-top: 2px;
    font-size: 9.5px;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
  }
  .rail {
    display: flex;
    justify-content: center;
    padding-top: 18px;
  }
  .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: #fff;
    transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
  }
  .item.is-future .dot { border-color: var(--accent, #2563eb); }
  .item.is-past .dot { background: var(--line-strong); border-color: var(--line-strong); }
  .item.is-now .dot {
    background: var(--amber);
    border-color: var(--amber);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, .14);
    animation: pulse 2.2s ease-in-out infinite;
  }
  .item.is-done .dot { background: var(--green); border-color: var(--green); }
  .item.is-now.is-done .dot { background: var(--amber); border-color: var(--amber); }

  @keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(217, 119, 6, .14); }
    50% { box-shadow: 0 0 0 8px rgba(217, 119, 6, .05); }
  }

  .card {
    margin: 5px 0 10px;
    padding: 13px 13px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    transition: opacity .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
  }
  .item.is-past .card { opacity: .56; }
  .item.is-past.is-done .card { opacity: .78; }
  .item.is-now .card {
    border-color: rgba(217, 119, 6, .42);
    background: linear-gradient(180deg, #fffdf8 0%, var(--amber-soft) 100%);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, .07), var(--shadow);
  }
  .item.is-done .card { border-color: rgba(5, 150, 105, .26); }

  .card-top {
    display: flex;
    align-items: flex-start;
    gap: 9px;
  }
  .icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 10px;
    background: var(--accent-soft, #eff6ff);
    color: var(--accent, #2563eb);
  }
  .icon svg { width: 17px; height: 17px; }
  .card-title-wrap { flex: 1; min-width: 0; }
  .card-title {
    font-size: 14.5px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -.015em;
  }
  .card-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    font-size: 10px;
    color: var(--muted);
  }
  .chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 5px;
    border-radius: 5px;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
  }
  .check {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-top: -2px;
    border: 1.5px solid var(--line-strong);
    border-radius: 50%;
    background: #fff;
    color: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, background .18s ease, border-color .18s ease, color .18s ease;
  }
  .check:active { transform: scale(.88); }
  .check svg { width: 15px; height: 15px; }
  .check[aria-pressed="true"] {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
  }

  .card-desc {
    margin-top: 9px;
    font-size: 12px;
    line-height: 1.6;
    color: #475569;
  }
  .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
  }
  .meta span {
    padding: 3px 6px;
    border: 1px solid #eef2f6;
    border-radius: 6px;
    background: #fafcfd;
    color: #64748b;
    font-size: 9.5px;
    line-height: 1.3;
  }

  .expand {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 9px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent, #2563eb);
    font-size: 10.5px;
    font-weight: 800;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .expand svg {
    width: 12px;
    height: 12px;
    transition: transform .22s ease;
  }
  .item.expanded .expand svg { transform: rotate(180deg); }

  .details {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .26s cubic-bezier(.22, .8, .3, 1);
  }
  .details > div { overflow: hidden; }
  .item.expanded .details { grid-template-rows: 1fr; }
  .detail-row {
    display: flex;
    gap: 8px;
    padding-top: 7px;
    font-size: 11px;
    line-height: 1.55;
  }
  .detail-label {
    flex: 0 0 34px;
    color: var(--faint);
  }
  .detail-value {
    flex: 1;
    min-width: 0;
    color: #475569;
  }

  .now-line {
    grid-column: 2 / 4;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 66px;
    padding: 3px 0 5px;
    scroll-margin-top: calc(var(--topbar-h) + 16px);
  }
  .now-pill {
    flex: 0 0 auto;
    padding: 3px 8px;
    border: 1px solid var(--amber-line);
    border-radius: 999px;
    background: var(--amber-soft);
    color: #92400e;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .01em;
    white-space: nowrap;
  }
  .now-rule {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, #f59e0b 0%, rgba(245, 158, 11, 0) 100%);
  }

  .foot {
    padding: 6px 16px calc(30px + env(safe-area-inset-bottom));
    color: var(--faint);
    font-size: 9.5px;
    line-height: 1.65;
    text-align: center;
  }
  .foot button {
    border: 0;
    background: transparent;
    color: var(--faint);
    font-size: 9.5px;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    padding: 4px;
  }

  .now-btn {
    position: fixed;
    right: max(16px, calc(50% - 224px));
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 40;
    display: none;
    align-items: center;
    gap: 5px;
    padding: 9px 13px;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .01em;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .now-btn.show { display: inline-flex; }
  .now-btn svg { width: 13px; height: 13px; }

  .empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
  }

  @media (min-width: 520px) {
    body { background: #eef1f4; }
    .app {
      box-shadow: 0 0 0 1px rgba(16, 24, 40, .04), 0 24px 70px rgba(16, 24, 40, .08);
      min-height: 100vh;
    }
  }

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

  /* ---------- dark theme ---------- */
  [data-theme="dark"] {
    --bg: #0b0f14;
    --card: #151b23;
    --text: #e8eef5;
    --muted: #93a1b0;
    --faint: #64748b;
    --line: #25303b;
    --line-strong: #3a4754;
    --amber: #fbbf24;
    --amber-soft: #2a2113;
    --amber-line: #5a4214;
    --green: #34d399;
    --green-soft: #0f2a22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .22);
    --day1: #60a5fa;
    --day1-soft: #13243d;
    --day2: #a78bfa;
    --day2-soft: #251b3d;
    --day3: #2dd4bf;
    --day3-soft: #0f2a28;
  }
  [data-theme="dark"] body { background: #070a0e; }
  [data-theme="dark"] .app { background: var(--bg); box-shadow: 0 0 0 1px rgba(255, 255, 255, .04), 0 24px 70px rgba(0, 0, 0, .45); }
  [data-theme="dark"] .topbar {
    background: rgba(11, 15, 20, .9);
    border-bottom-color: rgba(37, 48, 59, .8);
  }
  [data-theme="dark"] .tab[aria-selected="true"] { background: var(--card); }
  [data-theme="dark"] .theme-btn { background: var(--card); }
  [data-theme="dark"] .status-pill { background: var(--card); }
  [data-theme="dark"] .status-pill.is-before { background: #10233f; border-color: #1e3a5f; color: #93c5fd; }
  [data-theme="dark"] .status-pill.is-live { background: var(--amber-soft); border-color: var(--amber-line); color: #fbbf24; }
  [data-theme="dark"] .status-pill.is-after { background: #1a222c; border-color: var(--line); color: #94a3b8; }
  [data-theme="dark"] .status-pill.is-sim { background: #251b3d; border-color: #3b2a5f; color: #c4b5fd; }
  [data-theme="dark"] .sim-x { background: rgba(196, 181, 253, .12); color: #c4b5fd; }
  [data-theme="dark"] .day-head {
    background:
      radial-gradient(120% 90% at 100% 0%, var(--accent-soft) 0%, rgba(11, 15, 20, 0) 62%),
      var(--bg);
  }
  [data-theme="dark"] .arrival-toggle { background: var(--card); }
  [data-theme="dark"] .seg button[aria-pressed="true"] { background: #1e2630; color: var(--text); }
  [data-theme="dark"] .today-badge { color: #fbbf24; }
  [data-theme="dark"] .route-arrow { background: var(--line-strong); }
  [data-theme="dark"] .stop { background: var(--card); color: #cbd5e1; }
  [data-theme="dark"] .progress-track { background: #26303b; }
  [data-theme="dark"] .item.is-now .card {
    background: linear-gradient(180deg, #241c0f 0%, var(--amber-soft) 100%);
  }
  [data-theme="dark"] .item.is-past .card { opacity: .45; }
  [data-theme="dark"] .item.is-past.is-done .card { opacity: .7; }
  [data-theme="dark"] .chip { background: #1e2630; color: #94a3b8; }
  [data-theme="dark"] .check { background: var(--card); }
  [data-theme="dark"] .check[aria-pressed="true"] { color: #052e22; }
  [data-theme="dark"] .card-desc { color: #cbd5e1; }
  [data-theme="dark"] .meta span { background: #10161d; border-color: var(--line); color: #94a3b8; }
  [data-theme="dark"] .line-box { background: #10161d; border-color: var(--line); }
  [data-theme="dark"] .line-mode { background: #1e2630; border-color: var(--line); }
  [data-theme="dark"] .line-route { color: #e2e8f0; }
  [data-theme="dark"] .steps { background: #10161d; border-color: var(--line-strong); }
  [data-theme="dark"] .step { color: #cbd5e1; }
  [data-theme="dark"] .detail-value { color: #cbd5e1; }
  [data-theme="dark"] .now-pill { color: #fbbf24; }
  [data-theme="dark"] .now-btn { background: #f8fafc; color: #0b0f14; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
