:root {
      --bg: #ede3d0;
      --bg-soft: #ddcfb7;
      --ink: #28231c;
      --muted: #776b59;
      --line: rgba(47, 38, 26, 0.16);
      --card: #faf3e5;
      --brand: #81251d;
      --brand-2: #a8452f;
      --brand-soft: #ead9ca;
      --accent: #c5962e;
      --accent-soft: #f2e3ba;
      --danger: #a43c2d;
      --shadow: 0 18px 45px rgba(50, 39, 25, 0.16);
      --radius: 18px;
      --radius-sm: 12px;
      --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
      --serif: "STKaiti", "KaiTi", "Songti SC", "Noto Serif CJK SC", "STSong", Georgia, serif;
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      color: var(--ink);
      background:
        radial-gradient(circle at 14% 4%, rgba(255, 250, 234, 0.92), transparent 30rem),
        radial-gradient(circle at 88% 2%, rgba(194, 161, 116, 0.22), transparent 28rem),
        repeating-linear-gradient(112deg, rgba(93, 72, 44, 0.018) 0 1px, transparent 1px 12px),
        var(--bg);
      font-family: var(--sans);
      line-height: 1.6;
      min-height: 100vh;
    }
    button, input, select, textarea { font: inherit; color: inherit; }
    button { cursor: pointer; }
    a { color: inherit; }

        .wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
    /* Safe area for notch devices */
    .app-header { padding-top: env(safe-area-inset-top, 0); }
    .footer { padding-bottom: calc(36px + env(safe-area-inset-bottom, 0)); }
    .modal-backdrop { padding-top: env(safe-area-inset-top, 0); padding-bottom: env(safe-area-inset-bottom, 0); }

    .public-notice {
      margin: 12px auto 0;
      width: min(1180px, calc(100% - 32px));
      background: #f4e2c8;
      border: 1px solid rgba(129, 37, 29, 0.22);
      border-left: 5px solid var(--brand);
      border-radius: 12px;
      padding: 11px 14px;
      color: #6d4c26;
      font-size: 13px;
      line-height: 1.55;
    }
    .public-notice strong { color: var(--brand); }

    .vertical-title {
      writing-mode: vertical-rl;
      letter-spacing: 0.32em;
      color: var(--brand);
      font-family: var(--serif);
      font-weight: 600;
      border-right: 1px solid rgba(129, 37, 29, 0.45);
      padding-right: 10px;
      margin-right: 12px;
      line-height: 1;
      white-space: nowrap;
    }
    .chapter-divider {
      display: flex;
      align-items: center;
      gap: 12px;
      margin: 30px 0 18px;
      color: var(--brand);
      font-size: 12px;
      letter-spacing: 0.16em;
      font-weight: 700;
    }
    .chapter-divider::before,
    .chapter-divider::after {
      content: "";
      height: 1px;
      flex: 1;
      background: linear-gradient(90deg, transparent, rgba(129, 37, 29, 0.38), transparent);
    }
    .chapter-divider span {
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    .chapter-divider b {
      width: 6px;
      height: 6px;
      background: var(--brand);
      transform: rotate(45deg);
      display: inline-block;
    }
    @keyframes cloudDrift {
      0% { transform: translateX(-18px); opacity: 0.62; }
      50% { opacity: 0.9; }
      100% { transform: translateX(28px); opacity: 0.58; }
    }
    @keyframes birdFly {
      0%, 100% { transform: translate(0, 0); opacity: 0.68; }
      35% { transform: translate(12px, -14px); opacity: 0.95; }
      70% { transform: translate(25px, 3px); opacity: 0.72; }
    }
    .cloud-path { animation: cloudDrift 16s ease-in-out infinite alternate; transform-origin: center; }
    .cloud-path.slow { animation-duration: 24s; animation-delay: -7s; }
    .bird-path { animation: birdFly 8s ease-in-out infinite; }
    .bird-path.delay { animation-delay: -3s; }

    .app-header {
      position: sticky;
      top: 0;
      z-index: 20;
      background: rgba(237, 227, 208, 0.88);
      backdrop-filter: blur(16px);
      border-bottom: 1px solid rgba(47, 38, 26, 0.16);
    }
    .header-inner {
      min-height: 68px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }
    .brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: 0.03em; }
    .brand-mark {
      width: 38px; height: 38px; border-radius: 12px;
      display: grid; place-items: center;
      color: #fff7e8; background: linear-gradient(145deg, var(--brand), var(--brand-2));
      box-shadow: 0 8px 18px rgba(91, 36, 27, 0.24);
      font-size: 18px;
      letter-spacing: -0.08em;
    }
    .brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: -4px; }
    .header-actions { display: flex; gap: 8px; align-items: center; }
    .fav-count { color: var(--muted); font-size: 13px; margin-right: 2px; }

    .btn {
      border: 1px solid var(--line);
      background: rgba(255, 253, 248, 0.7);
      color: var(--ink);
      padding: 9px 14px;
      border-radius: 8px;
      transition: 0.2s ease;
      white-space: nowrap;
    }
    .btn:hover { transform: translateY(-1px); border-color: rgba(129, 37, 29, 0.35); background: #fffdf8; }
    .btn-primary {
      border-color: transparent;
      background: linear-gradient(135deg, var(--brand), var(--brand-2));
      color: #fff;
      box-shadow: 0 10px 22px rgba(129, 37, 29, 0.24);
    }
    .btn-primary:hover { background: linear-gradient(135deg, #21543b, #34795a); }
    .btn-ghost { border-color: transparent; background: transparent; color: var(--brand); }
    .btn-danger { border-color: rgba(180, 73, 62, 0.2); color: var(--danger); background: rgba(180, 73, 62, 0.05); }

    .hero {
      padding: 58px 0 34px;
      display: grid;
      grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
      gap: 42px;
      align-items: end;
      position: relative;
      overflow: hidden;
      background:
        linear-gradient(105deg, rgba(250, 243, 229, 0.96) 0%, rgba(250, 243, 229, 0.74) 52%, rgba(214, 195, 158, 0.24) 100%),
        var(--bg);
      border: 1px solid rgba(47, 38, 26, 0.15);
      border-radius: 30px;
      box-shadow: var(--shadow);
      padding: 48px 42px 40px;
    }
    .hero > *:not(.hero-poster) { position: relative; z-index: 2; }
    .hero-poster {
      position: absolute;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      opacity: 0.86;
    }
    .hero-poster svg { width: 100%; height: 100%; display: block; }
    .hero h1 {
      font-family: var(--serif);
      font-size: clamp(36px, 5.5vw, 68px);
      line-height: 1.05;
      margin: 12px 0 16px;
      font-weight: 600;
      letter-spacing: -0.02em;
      color: #241f18;
      text-shadow: 0 2px 18px rgba(255, 248, 232, 0.8);
    }
    .eyebrow { color: var(--brand); font-weight: 700; letter-spacing: 0.14em; font-size: 13px; text-transform: uppercase; }
    .hero p.lead { color: var(--muted); max-width: 680px; font-size: 17px; margin: 0 0 24px; }
    .search-row { display: flex; gap: 10px; max-width: 720px; }
    .search-box {
      flex: 1;
      min-width: 0;
      position: relative;
    }
    .search-box span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); opacity: 0.55; }
    .search-box input {
      width: 100%;
      height: 50px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--card);
      padding: 0 18px 0 44px;
      outline: none;
      box-shadow: 0 8px 24px rgba(36, 50, 41, 0.07);
    }
    .search-box input:focus { border-color: rgba(129, 37, 29, 0.45); box-shadow: 0 0 0 4px rgba(168, 69, 47, 0.12); }
    .quick-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
    .quick-tag {
      border: 1px solid var(--line);
      background: rgba(250, 243, 229, 0.72);
      color: var(--muted);
      padding: 6px 11px;
      border-radius: 7px;
      font-size: 13px;
      box-shadow: 0 3px 10px rgba(47, 36, 22, 0.05);
    }
    .quick-tag:hover { color: var(--brand); border-color: rgba(129, 37, 29, 0.32); }

    .hero-stats {
      background: linear-gradient(150deg, rgba(44, 34, 22, 0.86), rgba(106, 45, 31, 0.84));
      color: #f7ecd7;
      border: 1px solid rgba(255, 244, 220, 0.2);
      border-radius: 20px;
      padding: 22px;
      box-shadow: 0 16px 36px rgba(34, 25, 17, 0.28);
    }
    .hero-stats h2 { font-family: var(--serif); margin: 0 0 6px; font-weight: 600; }
    .hero-stats p { color: rgba(247, 236, 215, 0.74); font-size: 13px; margin: 0 0 18px; }
    .stat { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.13); padding: 11px 0; }
    .stat:last-child { border-bottom: 0; }
    .stat b { font-size: 20px; }

    .map-section { margin: 6px 0 28px; }
    .china-map {
      width: 100%;
      height: 520px;
      background: linear-gradient(180deg, #f0e7d4, #e4d5ba);
      border: 1px solid var(--line);
      border-radius: 24px;
      overflow: hidden;
      box-shadow: 0 12px 32px rgba(36, 50, 41, 0.07);
    }
    .map-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; }
    .map-legend span { display: inline-flex; align-items: center; gap: 5px; }
    .map-legend i { width: 8px; height: 8px; border-radius: 50%; background: #a83d28; display: inline-block; }
    .map-legend i.green { background: #8a6a2b; }

    .assistant-panel {
      margin: 18px 0 26px;
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 24px;
      box-shadow: var(--shadow);
      padding: 22px;
      display: none;
    }
    .assistant-panel.open { display: block; }
    .panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
    .panel-head h2 { margin: 0; font-family: var(--serif); font-size: 26px; }
    .panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
    .ai-prompt {
      width: 100%;
      min-height: 92px;
      resize: vertical;
      margin-top: 16px;
      border: 1px solid var(--line);
      background: #fffdf7;
      border-radius: 16px;
      padding: 14px 16px;
      outline: none;
    }
    .ai-prompt:focus { border-color: rgba(129, 37, 29, 0.5); box-shadow: 0 0 0 4px rgba(168, 69, 47, 0.1); }
    .ai-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
    .ai-note { color: var(--muted); font-size: 12px; margin-left: auto; }
    .ai-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
    .ai-result {
      border: 1px solid var(--line);
      background: linear-gradient(180deg, #fffdf8, #f7f1e6);
      border-radius: 16px;
      padding: 15px;
      cursor: pointer;
      transition: 0.2s ease;
    }
    .ai-result:hover { transform: translateY(-3px); border-color: rgba(129, 37, 29, 0.32); box-shadow: 0 12px 26px rgba(55, 40, 24, 0.12); }
    .ai-result h4 { margin: 0 0 4px; }
    .ai-result .reason { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
    .match-score { color: var(--brand); font-weight: 700; }

    .weather-section { margin: 0 0 26px; }
    .weather-card {
      background: linear-gradient(135deg, #f4ecdb, #e8d8bd);
      border: 1px solid var(--line);
      border-radius: 24px;
      padding: 20px 22px;
      box-shadow: 0 12px 30px rgba(36, 50, 41, 0.06);
      display: grid;
      grid-template-columns: minmax(210px, 0.75fr) minmax(0, 2.25fr);
      gap: 22px;
    }
    .weather-now { display: flex; gap: 16px; align-items: center; }
    .weather-emoji { font-size: 62px; line-height: 1; filter: drop-shadow(0 8px 12px rgba(36, 50, 41, 0.12)); }
    .weather-temp { font-family: var(--serif); font-size: 42px; line-height: 1; font-weight: 600; }
    .weather-loc { color: var(--muted); font-size: 13px; }
    .weather-desc { margin: 6px 0 0; font-weight: 600; }
    .weather-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 11px; }
    .weather-toolbar .btn { padding: 6px 11px; font-size: 12px; border-radius: 999px; }
    .weather-live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
    .live-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: #c5962e; box-shadow: 0 0 0 4px rgba(197, 150, 46, 0.16);
      animation: livePulse 1.8s ease-in-out infinite;
    }
    .live-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(180, 73, 62, 0.14); }
    @keyframes livePulse { 0%, 100% { opacity: 0.55; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.08); } }
    .weather-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 13px; margin-top: 12px; }
    .weather-forecast { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
    .day {
      background: rgba(250, 243, 229, 0.66);
      border-radius: 13px;
      padding: 10px 5px;
      text-align: center;
      border: 1px solid rgba(36, 50, 41, 0.07);
    }
    .day b { display: block; font-size: 13px; }
    .day .day-emoji { font-size: 25px; margin: 7px 0 3px; }
    .day span { display: block; color: var(--muted); font-size: 12px; }
    .weather-hint { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }

    .filter-bar {
      display: grid;
      grid-template-columns: 1fr 0.8fr 1.4fr 0.9fr auto;
      gap: 12px;
      align-items: end;
      margin-bottom: 22px;
    }
    .field label { display: block; color: var(--muted); font-size: 12px; margin: 0 0 6px 2px; }
    .field select, .field input {
      width: 100%; height: 42px; border: 1px solid var(--line);
      background: rgba(255,253,248,0.75); border-radius: 12px; padding: 0 12px; outline: none;
    }
    .field select:focus, .field input:focus { border-color: rgba(129, 37, 29, 0.4); box-shadow: 0 0 0 3px rgba(168, 69, 47, 0.09); }
    .chips { display: flex; gap: 7px; flex-wrap: wrap; padding-bottom: 1px; }
    .chip {
      border: 1px solid var(--line);
      background: rgba(255,253,248,0.7);
      color: var(--muted);
      border-radius: 10px;
      padding: 8px 12px;
      font-size: 13px;
      transition: 0.18s ease;
    }
    .chip:hover { color: var(--brand); }
    .chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
    .reset-btn { height: 42px; padding: 0 16px; border-radius: 12px; }

    .section-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 14px; }
    .section-head h2 { font-family: var(--serif); font-size: 27px; margin: 0; }
    .section-head p { color: var(--muted); margin: 0; font-size: 13px; }

    .route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
    .route-card {
      background: linear-gradient(180deg, rgba(250, 243, 229, 0.98), rgba(237, 227, 208, 0.98)), var(--card);
      border: 1px solid var(--line);
      border-top: 7px solid var(--brand);
      border-radius: 8px 8px 16px 16px;
      overflow: hidden;
      cursor: pointer;
      transition: 0.22s ease;
      position: relative;
      display: flex;
      flex-direction: column;
      box-shadow: 0 8px 20px rgba(45, 32, 20, 0.08);
    }
    .route-card::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: 12px;
      width: 1px;
      background: rgba(129, 37, 29, 0.12);
      z-index: 3;
      pointer-events: none;
    }
    .route-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: rgba(129, 37, 29, 0.28); }
    .card-img { height: 205px; background: var(--brand-soft); overflow: hidden; position: relative; }
    .card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease, filter 0.5s ease; filter: sepia(0.24) saturate(0.72) contrast(1.02); }
    .route-card:hover .card-img img { transform: scale(1.045); }
    .card-img::after {
      content: "";
      position: absolute; inset: 0;
      background: linear-gradient(180deg, transparent 45%, rgba(19, 33, 26, 0.56));
    }
    .region-pill {
      position: absolute; top: 12px; left: 12px; z-index: 1;
      background: rgba(250, 243, 229, 0.9);
      backdrop-filter: blur(6px);
      color: var(--brand);
      font-size: 12px;
      font-weight: 700;
      padding: 5px 9px;
      border-radius: 999px;
      box-shadow: 0 5px 14px rgba(30, 21, 12, 0.14);
    }
    .fav-btn {
      position: absolute; top: 10px; right: 10px; z-index: 2;
      width: 36px; height: 36px; border: 0; border-radius: 50%;
      background: rgba(250, 243, 229, 0.92);
      color: var(--brand);
      font-size: 18px;
      display: grid; place-items: center;
      transition: 0.2s ease;
    }
    .fav-btn:hover { transform: scale(1.08); }
    .fav-btn.active { background: #fff1e3; color: var(--accent); }
    .card-body {
      padding: 16px 17px 17px;
      display: flex;
      flex-direction: column;
      flex: 1;
      background:
        repeating-linear-gradient(0deg, rgba(87, 67, 42, 0.025) 0 1px, transparent 1px 10px),
        rgba(250, 243, 229, 0.5);
    }
    .card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
    .card-title h3 { font-family: var(--serif); font-size: 22px; margin: 0; }
    .card-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }
    .badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
    .badge { font-size: 12px; color: #7c241d; background: var(--brand-soft); padding: 4px 8px; border-radius: 999px; }
    .badge.warm { color: #755416; background: var(--accent-soft); }
    .badge.credibility { font-weight: 700; }
    .badge.cred-A { color: #1f5b34; background: #dbead5; }
    .badge.cred-B { color: #70521a; background: #f3e4bd; }
    .badge.cred-C { color: #6c5c45; background: #e7dfd2; }
    .badge.cred-D { color: #8a2e26; background: #f2d7d0; }
    .status-pill.credibility { font-weight: 700; }
    .status-pill.cred-A { color: #1f5b34; background: #dbead5; }
    .status-pill.cred-B { color: #70521a; background: #f3e4bd; }
    .status-pill.cred-C { color: #6c5c45; background: #e7dfd2; }
    .status-pill.cred-D { color: #8a2e26; background: #f2d7d0; }
    .card-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
    .card-stats div { text-align: center; }
    .card-stats b { display: block; font-size: 14px; }
    .card-stats span { color: var(--muted); font-size: 11px; }

    .empty-state {
      display: none;
      border: 1px dashed rgba(36, 50, 41, 0.25);
      border-radius: 20px;
      padding: 48px 20px;
      text-align: center;
      color: var(--muted);
      background: rgba(255,253,248,0.4);
    }
    .empty-state.visible { display: block; }
    .empty-state .big { font-size: 44px; display: block; margin-bottom: 8px; }

    .modal-backdrop {
      position: fixed; inset: 0; z-index: 60;
      background: rgba(19, 29, 24, 0.52);
      backdrop-filter: blur(6px);
      display: none;
      align-items: flex-start;
      justify-content: center;
      padding: 30px 16px;
      overflow-y: auto;
    }
    .modal-backdrop.open { display: flex; }
    .modal {
      width: min(1020px, 100%);
      background: var(--bg);
      border: 2px solid rgba(129, 37, 29, 0.42);
      border-radius: 10px 10px 24px 24px;
      overflow: hidden;
      box-shadow: 0 32px 80px rgba(0,0,0,0.34), inset 0 0 0 5px rgba(250, 243, 229, 0.2);
      animation: modalIn 0.24s ease;
    }
    @keyframes modalIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
    .modal-hero { position: relative; height: 330px; background: var(--brand-soft); }
    .modal-hero img { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(0.2) saturate(0.74) contrast(1.03); }
    .modal-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 42%, rgba(18, 29, 23, 0.72)); }
    .modal-close {
      position: absolute; top: 16px; right: 16px; z-index: 2;
      width: 40px; height: 40px; border: 0; border-radius: 50%;
      background: rgba(255,253,248,0.9); color: var(--ink); font-size: 20px;
      display: grid; place-items: center;
    }
    .modal-title { position: absolute; left: 26px; bottom: 24px; z-index: 2; color: #fff; }
    .modal-title .region { font-size: 13px; opacity: 0.82; }
    .modal-title h2 { font-family: var(--serif); font-size: clamp(32px, 5vw, 52px); margin: 4px 0 0; line-height: 1.05; }
    .modal-content {
      padding: 24px;
      background:
        repeating-linear-gradient(0deg, rgba(87, 67, 42, 0.025) 0 1px, transparent 1px 12px),
        var(--bg);
    }
    .route-tabs {
      position: sticky;
      top: 0;
      z-index: 12;
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding: 9px 10px;
      margin: 0 0 20px;
      background: rgba(250, 243, 229, 0.92);
      border: 1px solid var(--line);
      border-radius: 14px;
      backdrop-filter: blur(16px);
      box-shadow: 0 10px 24px rgba(45, 32, 20, 0.07);
      scrollbar-width: none;
    }
    .route-tabs::-webkit-scrollbar { display: none; }
    .route-tabs button {
      flex: 0 0 auto;
      border: 1px solid transparent;
      background: transparent;
      color: var(--muted);
      padding: 8px 12px;
      border-radius: 9px;
      font-size: 13px;
      transition: 0.18s ease;
    }
    .route-tabs button:hover { color: var(--brand); background: rgba(129, 37, 29, 0.06); }
    .route-tabs button.active {
      color: #fff7e8;
      background: linear-gradient(135deg, var(--brand), var(--brand-2));
      box-shadow: 0 7px 16px rgba(129, 37, 29, 0.18);
    }
    .guide-section { scroll-margin-top: 72px; }
    .modal-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.6fr); gap: 24px; }
    .guide-section { margin-bottom: 26px; }
    .guide-section h3 {
      font-family: var(--serif);
      font-size: 22px;
      margin: 0 0 10px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding-left: 10px;
      border-left: 4px solid var(--brand);
      color: var(--brand);
    }
    .guide-section p, .guide-section li { color: #39483f; }
    .guide-section ul { padding-left: 20px; margin: 8px 0; }
    .stat-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
    .stat-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
    .stat-box b { display: block; font-size: 18px; color: var(--brand); }
    .stat-box span { color: var(--muted); font-size: 12px; }
    .itinerary { display: grid; gap: 10px; }
    .day-item { display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start; }
    .day-num { width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
    .day-body { background: rgba(255,253,248,0.72); border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; }
    .day-body b { color: var(--brand); }
    .day-body p { margin: 3px 0 0; font-size: 14px; }
    .gear-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .gear-group { background: rgba(255,253,248,0.72); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; }
    .gear-group h4 { margin: 0 0 8px; font-family: var(--serif); font-size: 17px; color: var(--brand); }
    .gear-group ul { padding-left: 18px; margin: 0; }
    .gear-group li { font-size: 14px; margin: 3px 0; color: #3d4c43; }
    .transport-list { display: grid; gap: 11px; }
    .transport-item { background: rgba(255,253,248,0.72); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 13px; padding: 13px 14px; }
    .transport-item h4 { margin: 0 0 6px; font-family: var(--serif); font-size: 18px; color: var(--brand); }
    .transport-item p { margin: 4px 0; color: #3d4c43; font-size: 14px; }
    .transport-item .note { color: var(--muted); font-size: 13px; }
    .side-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
    .side-card h4 { margin: 0 0 10px; font-family: var(--serif); font-size: 18px; }
    .side-card p, .side-card li { color: #4c5a51; font-size: 14px; }
    .side-card ul { padding-left: 18px; margin: 0; }
    .status-actions { display: flex; flex-wrap: wrap; gap: 7px; }
    .status-actions button {
      border: 1px solid var(--line);
      background: rgba(250, 243, 229, 0.72);
      color: var(--muted);
      border-radius: 9px;
      padding: 8px 11px;
      font-size: 13px;
      transition: 0.18s ease;
    }
    .status-actions button.active {
      color: #fff7e8;
      border-color: transparent;
      background: linear-gradient(135deg, var(--brand), var(--brand-2));
      box-shadow: 0 7px 16px rgba(129, 37, 29, 0.18);
    }
    .badge.status-wish { color: #70521a; background: #f3e4bd; }
    .badge.status-done { color: #1f5b34; background: #dbead5; }
    .gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
    .gallery img { width: 100%; height: 84px; object-fit: cover; border-radius: 10px; cursor: pointer; }
    .mini-map { width: 100%; height: 240px; border-radius: 14px; overflow: hidden; background: #e7dcc5; border: 1px solid var(--line); }
    .mini-map .leaflet-container { font-family: var(--sans); }
    .mini-map-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
    .risk { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 12px; border-radius: 0 10px 10px 0; margin-bottom: 8px; font-size: 14px; }
    .coordinate-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
    .coordinate-actions .btn { padding: 7px 10px; font-size: 12px; border-radius: 10px; }

    .settings-modal { max-width: 620px; }
    .settings-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
    .settings-head h2 { font-family: var(--serif); margin: 0; font-size: 26px; }
    .settings-head p { color: var(--muted); margin: 3px 0 0; font-size: 13px; }
    .settings-body { padding: 6px 20px 20px; }
    .settings-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
    .settings-grid .field input, .settings-grid .field textarea { width: 100%; }
    .settings-grid .field textarea { min-height: 86px; resize: vertical; border: 1px solid var(--line); background: #fffdf7; border-radius: 12px; padding: 10px 12px; outline: none; }
    .settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
    .settings-note { margin-top: 14px; padding: 11px 12px; border-radius: 12px; background: var(--accent-soft); color: #74502c; font-size: 12px; line-height: 1.5; }

    .footer { margin-top: 42px; border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: 13px; }
    .footer strong { color: var(--ink); }

    @media (max-width: 900px) {
      .hero { grid-template-columns: 1fr; gap: 22px; padding-top: 34px; }
      .route-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .filter-bar { grid-template-columns: 1fr 1fr; }
      .weather-card { grid-template-columns: 1fr; }
      .weather-forecast { grid-template-columns: repeat(4, 1fr); }
      .ai-results { grid-template-columns: 1fr; }
      .modal-grid { grid-template-columns: 1fr; }
      .modal-hero { height: 260px; }
      .china-map { height: 420px; }
    }
    @media (max-width: 620px) {
      .wrap { width: min(100% - 22px, 1180px); }
      .header-inner { min-height: 60px; }
      .header-actions .fav-count { display: none; }
      .hero h1 { font-size: 40px; }
      .search-row { flex-direction: column; }
      .route-grid { grid-template-columns: 1fr; }
      .filter-bar { grid-template-columns: 1fr; }
      .weather-forecast { grid-template-columns: repeat(2, 1fr); }
      .stat-list { grid-template-columns: repeat(2, 1fr); }
      .gallery { grid-template-columns: repeat(2, 1fr); }
      .china-map { height: 340px; }
    .gear-grid { grid-template-columns: 1fr; }
    }

    .routebook-banner {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 18px;
      background: linear-gradient(135deg, #f5ecd9, #e8d6ba);
      border: 1px solid var(--line);
      border-left: 5px solid var(--brand);
      border-radius: 14px;
      padding: 15px 16px;
      margin-bottom: 16px;
    }
    .routebook-banner h3 {
      margin: 0 0 5px;
      font-family: var(--serif);
      color: var(--brand);
      font-size: 21px;
    }
    .routebook-banner p { margin: 0; color: var(--muted); font-size: 13px; }
    .routebook-actions { display: flex; flex-wrap: wrap; gap: 8px; }
    .routebook-actions .btn { padding: 8px 11px; font-size: 12px; border-radius: 8px; }

    .routebook-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .routebook-card {
      background: rgba(250, 243, 229, 0.72);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 14px;
    }
    .routebook-card h4 {
      margin: 0 0 9px;
      font-family: var(--serif);
      color: var(--brand);
      font-size: 18px;
    }
    .routebook-card p, .routebook-card li { color: #3d4c43; font-size: 14px; }
    .routebook-card ul { padding-left: 18px; margin: 6px 0 0; }
    .status-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
    .status-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 5px 8px;
      border-radius: 8px;
      font-size: 12px;
      background: var(--brand-soft);
      color: var(--brand);
    }
    .status-pill.open { background: #dcebd8; color: #335e36; }
    .status-pill.warn { background: var(--accent-soft); color: #755416; }
    .budget-row { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px dashed rgba(47,38,26,0.16); padding: 7px 0; }
    .budget-row:last-child { border-bottom: 0; }
    .budget-row span { color: var(--muted); }
    .budget-row b { font-weight: 500; text-align: right; }
    .season-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 8px; }
    .season-card {
      border: 1px solid var(--line);
      background: rgba(255,253,248,0.6);
      border-radius: 10px;
      padding: 9px 10px;
    }
    .season-card.best { border-color: rgba(129,37,29,0.45); background: #f6e4d9; }
    .season-card b { color: var(--brand); }
    .season-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

    .checkpoint-timeline { display: grid; gap: 11px; margin-top: 8px; }
    .checkpoint-item {
      display: grid;
      grid-template-columns: 42px 1fr;
      gap: 11px;
      align-items: start;
    }
    .checkpoint-dot {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: var(--brand);
      color: #fff7e8;
      display: grid;
      place-items: center;
      font-size: 12px;
      font-weight: 700;
    }
    .checkpoint-body {
      background: rgba(250,243,229,0.7);
      border: 1px solid var(--line);
      border-radius: 11px;
      padding: 10px 12px;
    }
    .checkpoint-body b { color: var(--brand); }
    .checkpoint-body p { margin: 3px 0 0; color: #3d4c43; font-size: 13px; }
    .checkpoint-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
    .checkpoint-meta span { font-size: 11px; color: var(--muted); }

    .elevation-wrap {
      background: rgba(250,243,229,0.6);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 12px;
    }
    .elevation-wrap svg { width: 100%; height: 220px; display: block; overflow: visible; }
    .elevation-legend { display: flex; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 6px; }

    .service-list { display: grid; gap: 8px; }
    .service-item {
      border-left: 3px solid var(--brand);
      background: rgba(250,243,229,0.65);
      padding: 9px 11px;
      border-radius: 0 10px 10px 0;
    }
    .service-item b { color: var(--brand); }
    .service-item p { margin: 2px 0 0; color: #3d4c43; font-size: 13px; }

    .routebook-media { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 9px; }
    .routebook-media figure { margin: 0; }
    .routebook-media img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; display: block; filter: sepia(0.18) saturate(0.76) contrast(1.02); }
    .routebook-media figcaption { color: var(--muted); font-size: 11px; margin-top: 5px; line-height: 1.4; }
    .track-map {
      width: 100%;
      height: 380px;
      border-radius: 14px;
      overflow: hidden;
      background: #e7dcc5;
      border: 1px solid var(--line);
    }
    .track-map .leaflet-container { font-family: var(--sans); }

    .track-source { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

    .track-pending {
      border: 1px dashed var(--line);
      border-radius: 14px;
      background: linear-gradient(180deg, rgba(197, 150, 46, 0.10), rgba(231, 220, 197, 0.35));
      padding: 18px 20px;
      color: var(--muted);
    }
    .track-pending b {
      display: block;
      color: var(--brand);
      font-family: var(--serif);
      font-size: 17px;
      margin-bottom: 6px;
    }
    .track-pending p { margin: 0 0 6px; font-size: 13px; line-height: 1.6; }
    .track-pending .track-pending-note { color: var(--muted); font-size: 12px; opacity: 0.85; }

    @media (max-width: 900px) {
      .routebook-grid { grid-template-columns: 1fr; }
      .routebook-media { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .season-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 620px) {
      .routebook-banner { flex-direction: column; }
      .routebook-media { grid-template-columns: 1fr 1fr; }
    }

    @media print {
      body * { visibility: hidden; }
      #modalBackdrop.open,
      #modalBackdrop.open * { visibility: visible; }
      #modalBackdrop.open {
        position: absolute;
        inset: auto;
        display: block;
        overflow: visible;
        padding: 0;
        background: transparent;
        backdrop-filter: none;
      }
      #modalBackdrop.open .modal {
        width: 100%;
        box-shadow: none;
        border: none;
      }
      .modal-close,
      .routebook-actions,
      .mini-map,
      .mini-map-note,
      .coordinate-actions { display: none; }
    }

    /* ===== Premium UI polish ===== */
    body {
      background:
        radial-gradient(circle at 12% -2%, rgba(255, 251, 240, 0.95), transparent 34rem),
        radial-gradient(circle at 88% 3%, rgba(196, 150, 46, 0.16), transparent 28rem),
        linear-gradient(180deg, #f3ead8 0%, #e9dcc5 100%);
    }

    .app-header {
      background: linear-gradient(180deg, rgba(250, 244, 231, 0.88), rgba(240, 230, 210, 0.78));
      backdrop-filter: blur(22px) saturate(1.18);
      box-shadow: 0 12px 36px rgba(45, 32, 20, 0.06);
    }

    .hero {
      border: 1px solid rgba(129, 37, 29, 0.12);
      background:
        linear-gradient(105deg, rgba(255, 250, 239, 0.88), rgba(250, 243, 229, 0.66) 54%, rgba(216, 194, 156, 0.20)),
        radial-gradient(circle at 78% 20%, rgba(197, 150, 46, 0.14), transparent 18rem);
      box-shadow:
        0 28px 70px rgba(47, 36, 22, 0.13),
        inset 0 1px 0 rgba(255, 255, 255, 0.58);
    }

    .hero h1 {
      background: linear-gradient(120deg, #2a2118 0%, #7a2a20 48%, #a86b25 100%);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
      filter: drop-shadow(0 8px 22px rgba(129, 37, 29, 0.14));
    }

    .search-box input {
      backdrop-filter: blur(8px);
      box-shadow: 0 14px 34px rgba(47, 36, 22, 0.10);
      transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
    }
    .search-box input:focus {
      transform: translateY(-1px);
    }

    .btn {
      transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    }
    .btn:hover {
      box-shadow: 0 9px 20px rgba(129, 37, 29, 0.12);
    }
    .btn-primary {
      background: linear-gradient(135deg, #7d2119 0%, #a8462e 100%);
      box-shadow: 0 12px 26px rgba(129, 37, 29, 0.22);
    }

    .section-head h2 {
      position: relative;
      padding-bottom: 10px;
    }
    .section-head h2::after {
      content: "";
      position: absolute;
      left: 0;
      bottom: 0;
      width: 42px;
      height: 3px;
      border-radius: 999px;
      background: linear-gradient(90deg, var(--brand), var(--accent));
    }

    .weather-card,
    .assistant-panel,
    .route-card,
    .modal {
      backdrop-filter: blur(16px) saturate(1.05);
    }

    .route-card {
      box-shadow: 0 12px 28px rgba(45, 32, 20, 0.08);
      transition: transform 0.26s ease, box-shadow 0.26s ease, border-color 0.26s ease;
    }
    .route-card:hover {
      box-shadow: 0 22px 46px rgba(45, 32, 20, 0.16);
    }
    .card-img::after {
      background: linear-gradient(180deg, transparent 42%, rgba(18, 26, 20, 0.70));
    }
    .card-img img {
      transition: transform 0.65s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.4s ease;
    }
    .route-card:hover .card-img img {
      transform: scale(1.06);
    }

    .weather-card {
      box-shadow: 0 18px 40px rgba(45, 32, 20, 0.08);
      border: 1px solid rgba(129, 37, 29, 0.10);
    }

    .china-map {
      box-shadow: 0 18px 44px rgba(45, 32, 20, 0.10);
      border: 1px solid rgba(129, 37, 29, 0.10);
    }

    .modal {
      backdrop-filter: blur(20px) saturate(1.08);
      box-shadow: 0 34px 90px rgba(0, 0, 0, 0.32), inset 0 0 0 5px rgba(250, 243, 229, 0.18);
    }

    .side-card,
    .gear-group,
    .transport-item,
    .checkpoint-body,
    .routebook-card,
    .elevation-wrap {
      transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    }
    .side-card:hover,
    .gear-group:hover,
    .transport-item:hover,
    .checkpoint-body:hover,
    .routebook-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 26px rgba(45, 32, 20, 0.08);
    }

    .public-notice {
      backdrop-filter: blur(12px);
      box-shadow: 0 10px 24px rgba(129, 37, 29, 0.05);
    }

    ::-webkit-scrollbar {
      width: 11px;
      height: 11px;
    }
    ::-webkit-scrollbar-track {
      background: rgba(240, 230, 210, 0.7);
    }
    ::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, #a8462e, #c5962e);
      border-radius: 999px;
      border: 2px solid rgba(240, 230, 210, 0.8);
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
      }
    }

    /* ============================================================
       Mobile UX Optimizations
       ============================================================ */

    /* Ensure touch targets are at least 44×44px (Apple HIG) on mobile */
    @media (max-width: 700px) {
      /* Header: keep compact, allow wrap */
      .app-header { position: sticky; top: 0; }
      .header-inner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 0;
        min-height: 54px;
      }
      .brand { font-size: 15px; }
      .brand-mark { width: 34px; height: 34px; font-size: 16px; }
      .brand small { display: none; }
      .header-actions { gap: 6px; }
      .header-actions .btn {
        padding: 7px 10px;
        font-size: 13px;
        min-height: 38px;
      }

      /* Hero */
      .hero {
        padding: 28px 18px 24px;
        border-radius: 20px;
        gap: 18px;
      }
      .hero-poster { opacity: 0.55; }
      .hero h1 { font-size: 32px; line-height: 1.15; }
      .hero p.lead { font-size: 14px; max-width: 100%; }
      .vertical-title { display: none; }
      .eyebrow { font-size: 11px; }
      .search-row { flex-direction: column; gap: 8px; }
      .search-box input { height: 46px; font-size: 16px; /* prevent iOS zoom */ }
      .search-row .btn-primary { width: 100%; height: 46px; }
      .quick-tags { gap: 6px; }
      .quick-tag {
        padding: 7px 10px;
        font-size: 12px;
        min-height: 34px;
      }

      /* Stats card */
      .hero-stats {
        padding: 16px;
        border-radius: 16px;
      }
      .hero-stats h2 { font-size: 18px; }
      .stat { padding: 8px 0; }
      .stat b { font-size: 17px; }

      /* Public notice */
      .public-notice {
        font-size: 12px;
        padding: 9px 12px;
        line-height: 1.5;
      }

      /* Filter bar */
      .filter-bar {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
      }
      .filter-bar .field:nth-child(3) {
        grid-column: 1 / -1;
      }
      .filter-bar .reset-btn {
        grid-column: 1 / -1;
        height: 42px;
      }
      .field select, .field input {
        height: 42px;
        font-size: 15px; /* prevent iOS zoom */
      }
      .chip {
        padding: 9px 13px;
        font-size: 13px;
        min-height: 38px;
      }
      .chips { gap: 6px; }

      /* Route grid - single column on mobile */
      .route-grid {
        grid-template-columns: 1fr;
        gap: 14px;
      }
      .card-img { height: 180px; }
      .card-body { padding: 14px 15px 15px; }
      .card-title h3 { font-size: 20px; }
      .card-stats { gap: 4px; }
      .card-stats b { font-size: 13px; }
      .card-stats span { font-size: 10px; }

      /* China map */
      .map-section { margin: 4px 0 20px; }
      .china-map {
        height: 300px;
        border-radius: 16px;
        touch-action: pan-x pan-y;
      }
      .map-legend { font-size: 11px; gap: 6px; }

      /* Weather */
      .weather-card {
        padding: 16px;
        border-radius: 18px;
        gap: 14px;
      }
      .weather-now { flex-direction: row; align-items: center; gap: 12px; }
      .weather-emoji { font-size: 48px; }
      .weather-temp { font-size: 34px; }
      .weather-forecast { grid-template-columns: repeat(4, 1fr); gap: 5px; }
      .day { padding: 8px 3px; }
      .day .day-emoji { font-size: 20px; margin: 4px 0 2px; }
      .day b { font-size: 11px; }
      .day span { font-size: 10px; }

      /* AI assistant panel */
      .assistant-panel { padding: 16px; border-radius: 18px; }
      .panel-head h2 { font-size: 20px; }
      .ai-prompt { min-height: 80px; font-size: 15px; }
      .ai-actions { flex-direction: column; align-items: stretch; gap: 8px; }
      .ai-actions .btn { width: 100%; min-height: 42px; }
      .ai-note { margin-left: 0; text-align: center; }
      .ai-results { grid-template-columns: 1fr; gap: 10px; }

      /* Modal */
      .modal-backdrop {
        padding: 0;
        align-items: stretch;
      }
      .modal {
        width: 100%;
        min-height: 100%;
        border-radius: 0;
        max-height: none;
      }
      .modal-hero { height: 200px; }
      .modal-title h2 { font-size: 28px; }
      .modal-content { padding: 16px; }
      .modal-grid { grid-template-columns: 1fr; gap: 16px; }
      .stat-list { grid-template-columns: repeat(2, 1fr); gap: 8px; }
      .stat-box { padding: 10px; }
      .stat-box b { font-size: 16px; }

      /* Route tabs - horizontally scrollable */
      .route-tabs {
        padding: 7px 8px;
        gap: 6px;
        margin-bottom: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }
      .route-tabs button {
        padding: 9px 14px;
        font-size: 13px;
        min-height: 38px;
        white-space: nowrap;
        flex: 0 0 auto;
      }

      /* Guide sections */
      .guide-section h3 { font-size: 18px; }
      .guide-section { margin-bottom: 20px; }

      /* Gear grid */
      .gear-grid { grid-template-columns: 1fr; gap: 10px; }
      .gear-group h4 { font-size: 15px; }

      /* Itinerary */
      .day-item { grid-template-columns: 44px 1fr; gap: 10px; }
      .day-num { width: 38px; height: 38px; font-size: 14px; }
      .day-body { padding: 10px 12px; }

      /* Gallery */
      .gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }
      .gallery img { height: 120px; border-radius: 10px; }

      /* Side cards */
      .side-card { padding: 14px; border-radius: 14px; }
      .status-actions { display: flex; flex-wrap: wrap; gap: 6px; }
      .status-actions button {
        flex: 1;
        min-width: 80px;
        min-height: 40px;
        font-size: 13px;
        padding: 8px 10px;
      }
      .coordinate-actions { flex-wrap: wrap; gap: 6px; }
      .coordinate-actions .btn {
        flex: 1;
        min-width: 90px;
        min-height: 38px;
        font-size: 12px;
        padding: 8px;
      }
      .mini-map { height: 180px; }

      /* Checkpoints */
      .checkpoint-timeline { gap: 8px; }
      .checkpoint-item { grid-template-columns: 36px 1fr; gap: 9px; }
      .checkpoint-dot { width: 30px; height: 30px; font-size: 10px; }
      .checkpoint-body { padding: 9px 10px; font-size: 12px; }
      .checkpoint-meta span { font-size: 10px; }

      /* Season grid */
      .season-grid { grid-template-columns: 1fr; }
      .season-card { padding: 8px 10px; }

      /* Routebook banner */
      .routebook-banner { flex-direction: column; gap: 10px; padding: 12px; }
      .routebook-actions .btn { padding: 8px 10px; font-size: 12px; min-height: 36px; }

      /* Footer */
      .footer { padding: 22px 0 28px; font-size: 12px; line-height: 1.6; }

      /* Settings modal */
      .settings-modal { width: 100%; border-radius: 0; }
      .settings-grid { grid-template-columns: 1fr; }
      .settings-body { padding: 16px; }

      /* Chapter divider */
      .chapter-divider { margin: 22px 0 14px; font-size: 11px; }
    }

    /* Extra-small phones */
    @media (max-width: 380px) {
      .hero h1 { font-size: 27px; }
      .weather-forecast { grid-template-columns: repeat(2, 1fr); }
      .stat-list { grid-template-columns: 1fr 1fr; }
      .filter-bar { grid-template-columns: 1fr; }
      .card-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    }

    /* Smooth touch scrolling for all scrollable areas */
    .route-tabs,
    .chips,
    .quick-tags {
      -webkit-overflow-scrolling: touch;
    }

    /* Prevent text selection on interactive buttons for better feel */
    .btn, .chip, .quick-tag, .fav-btn, .route-card {
      -webkit-tap-highlight-color: transparent;
      user-select: none;
    }

    /* Active state feedback on touch */
    @media (hover: none) {
      .btn:active { transform: scale(0.97); }
      .route-card:active { transform: scale(0.99); }
      .chip:active { transform: scale(0.95); }
      .quick-tag:active { transform: scale(0.95); }
    }

    /* ===== PWA & Offline ===== */
    .pwa-install-banner {
      display: none;
      position: fixed;
      bottom: calc(16px + env(safe-area-inset-bottom));
      left: 16px;
      right: 16px;
      background: linear-gradient(135deg, #81251d, #a8452f);
      color: #f7ecd7;
      padding: 14px 18px;
      border-radius: 14px;
      box-shadow: 0 8px 32px rgba(129, 37, 29, 0.35);
      z-index: 9999;
      align-items: center;
      gap: 12px;
      animation: slideUp 0.4s ease;
    }
    .pwa-install-banner.show { display: flex; }
    .pwa-install-banner p { flex: 1; margin: 0; font-size: 14px; line-height: 1.4; }
    .pwa-install-banner .pwa-btn {
      background: rgba(255,255,255,0.2);
      border: 1px solid rgba(255,255,255,0.3);
      color: #fff;
      padding: 8px 16px;
      border-radius: 8px;
      font-size: 13px;
      cursor: pointer;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .pwa-install-banner .pwa-btn:active { background: rgba(255,255,255,0.35); }
    .pwa-install-banner .pwa-dismiss {
      background: none;
      border: none;
      color: rgba(255,255,255,0.6);
      font-size: 20px;
      cursor: pointer;
      padding: 4px;
      line-height: 1;
    }

    .offline-indicator {
      display: none;
      position: fixed;
      top: calc(8px + env(safe-area-inset-top));
      left: 50%;
      transform: translateX(-50%);
      background: #c0392b;
      color: #fff;
      padding: 6px 18px;
      border-radius: 20px;
      font-size: 13px;
      z-index: 10000;
      box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }
    .offline-indicator.show { display: block; }

    @keyframes slideUp {
      from { transform: translateY(100%); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    @media (max-width: 700px) {
      .pwa-install-banner {
        left: 12px;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        padding: 12px 14px;
      }
      .pwa-install-banner p { font-size: 13px; }
    }

    /* ===== Elevation Profile ===== */
    .elevation-profile {
      background: var(--paper);
      border-radius: 12px;
      padding: 16px;
      border: 1px solid var(--line);
    }
    .profile-header {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: 10px;
      flex-wrap: wrap;
      gap: 6px;
    }
    .profile-header span {
      font-weight: 700;
      font-size: 16px;
      color: var(--ink);
    }
    .profile-header small {
      color: var(--muted);
      font-size: 13px;
    }
    .elevation-profile svg {
      width: 100%;
      height: auto;
      display: block;
    }
    .profile-note {
      font-size: 12px;
      color: var(--muted);
      margin: 8px 0 0;
      text-align: right;
    }

    /* ===== Time Estimate ===== */
    .time-estimate {
      background: linear-gradient(135deg, rgba(129,37,29,0.06), rgba(168,69,47,0.04));
      border-radius: 12px;
      padding: 16px;
      margin-top: 14px;
      border: 1px solid rgba(129,37,29,0.15);
    }
    .time-estimate h4 {
      margin: 0 0 12px;
      font-size: 15px;
      color: var(--brand);
    }
    .estimate-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
      margin-bottom: 12px;
    }
    .estimate-box {
      text-align: center;
      background: rgba(255,255,255,0.6);
      border-radius: 8px;
      padding: 10px 6px;
    }
    .estimate-box b {
      display: block;
      font-size: 20px;
      color: var(--brand);
      line-height: 1.2;
    }
    .estimate-box span {
      font-size: 12px;
      color: var(--muted);
    }
    .fitness-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 0;
      border-top: 1px solid rgba(129,37,29,0.1);
    }
    .fitness-label { font-size: 13px; color: var(--ink); }
    .fitness-stars { font-size: 14px; letter-spacing: 2px; }
    .estimate-note {
      font-size: 11px;
      color: var(--muted);
      margin: 8px 0 0;
      line-height: 1.5;
    }

    /* ===== Weather Gear Alert ===== */
    .weather-gear-alert {
      margin-top: 16px;
      padding: 14px;
      background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(239,68,68,0.06));
      border-radius: 10px;
      border: 1px solid rgba(245,158,11,0.25);
    }
    .weather-gear-alert h4 {
      margin: 0 0 10px;
      font-size: 14px;
      color: #92400e;
    }
    .gear-alert-group {
      margin-bottom: 8px;
    }
    .gear-alert-group:last-child { margin-bottom: 0; }
    .gear-alert-group b {
      font-size: 13px;
      color: var(--ink);
    }
    .gear-alert-group.essential b { color: #dc2626; }
    .gear-alert-group.recommended b { color: #d97706; }
    .gear-alert-group ul {
      margin: 4px 0 0;
      padding-left: 18px;
    }
    .gear-alert-group li {
      font-size: 13px;
      color: #444;
      line-height: 1.6;
    }

    @media (max-width: 700px) {
      .estimate-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
      }
      .estimate-box { padding: 8px 4px; }
      .estimate-box b { font-size: 17px; }
      .estimate-box span { font-size: 11px; }
      .time-estimate { padding: 12px; }
      .elevation-profile { padding: 10px; }
      .profile-header small { font-size: 11px; }
    }

    /* ===== 详情页元信息栏：可信度 / 开放状态 / 门票 / 更新时间 / 轨迹 ===== */
    .route-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin: 0 0 20px;
      padding-bottom: 16px;
      border-bottom: 1px solid var(--line);
    }
    .route-meta-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
    .route-meta-actions button {
      border: 1px solid var(--line);
      background: rgba(250, 243, 229, 0.72);
      color: var(--muted);
      border-radius: 999px;
      padding: 6px 12px;
      font-size: 12px;
      font-family: var(--sans);
      cursor: pointer;
      transition: 0.18s ease;
    }
    .route-meta-actions button:hover { border-color: rgba(129, 37, 29, 0.35); }
    .route-meta-actions button.active {
      color: #fff7e8;
      border-color: transparent;
      background: linear-gradient(135deg, var(--brand), var(--brand-2));
      box-shadow: 0 6px 14px rgba(129, 37, 29, 0.16);
    }

    /* ===== 加载骨架屏：替代「加载中…」文字 ===== */
    .skeleton {
      position: relative;
      overflow: hidden;
      border-radius: 14px;
      background: linear-gradient(100deg, #e8dfcd 28%, #f4eee2 42%, #e8dfcd 58%);
      background-size: 260% 100%;
      animation: skeletonShimmer 1.5s ease-in-out infinite;
    }
    .skeleton-map { width: 100%; height: 100%; min-height: 240px; }
    @keyframes skeletonShimmer {
      0% { background-position: 120% 50%; }
      100% { background-position: -20% 50%; }
    }
    @media (prefers-reduced-motion: reduce) {
      .skeleton { animation: none; }
    }

    /* ===== 手机吸底操作条：常用动作不再埋在路书横幅里 ===== */
    .modal-action-bar { display: none; }

    /* ===== 夜间模式：纸色反转成墨色，朱红提亮保证对比度 ===== */
    :root[data-theme="night"] {
      --bg: #13110e;
      --bg-soft: #1b1814;
      --ink: #efe6d6;
      --muted: #a89b87;
      --line: rgba(239, 230, 214, 0.18);
      --card: #1d1a16;
      --brand: #c9645a;
      --brand-2: #dc8478;
      --brand-soft: #2a2320;
      --accent: #d8b162;
      --accent-soft: #2b2620;
      --danger: #d4695c;
      --shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
    }
    :root[data-theme="night"] body {
      background:
        radial-gradient(circle at 14% 4%, rgba(74, 62, 47, 0.34), transparent 30rem),
        radial-gradient(circle at 88% 2%, rgba(122, 74, 46, 0.2), transparent 28rem),
        repeating-linear-gradient(112deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 12px),
        var(--bg);
    }
    :root[data-theme="night"] .app-header {
      background: linear-gradient(180deg, rgba(28, 25, 21, 0.92), rgba(23, 20, 17, 0.82));
    }
    :root[data-theme="night"] .btn { background: rgba(255, 255, 255, 0.06); color: var(--ink); border-color: var(--line); }
    :root[data-theme="night"] .btn:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(201, 100, 90, 0.45); }
    :root[data-theme="night"] .btn-primary { color: #1a1512; }
    :root[data-theme="night"] .ai-prompt,
    :root[data-theme="night"] .settings-grid .field textarea { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
    :root[data-theme="night"] .ai-result {
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    }
    :root[data-theme="night"] .card-img img,
    :root[data-theme="night"] .modal-hero img,
    :root[data-theme="night"] .gallery img {
      filter: saturate(0.8) contrast(1.03) brightness(0.88);
    }
    :root[data-theme="night"] .status-actions button,
    :root[data-theme="night"] .route-meta-actions button {
      background: rgba(255, 255, 255, 0.06);
      color: var(--muted);
    }
    :root[data-theme="night"] .skeleton {
      background: linear-gradient(100deg, #262119 28%, #332c23 42%, #262119 58%);
      background-size: 260% 100%;
    }
    :root[data-theme="night"] .modal-action-bar {
      background: rgba(22, 19, 16, 0.94);
      box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
    }
    :root[data-theme="night"] .modal-action-bar .action {
      background: rgba(255, 255, 255, 0.06);
      color: var(--ink);
    }
    :root[data-theme="night"] .modal-action-bar .action[data-make-pages] {
      background: var(--brand);
      border-color: var(--brand);
      color: #1a1512;
    }

    @media (max-width: 900px) {
      .modal-action-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        gap: 8px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
        background: rgba(250, 245, 234, 0.94);
        backdrop-filter: blur(16px) saturate(1.1);
        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 24px rgba(36, 31, 25, 0.08);
      }
      .modal-action-bar .action {
        flex: 1 1 0;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 10px 6px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: rgba(255, 253, 247, 0.78);
        color: var(--ink);
        font-family: var(--sans);
        font-size: 13px;
        text-decoration: none;
        cursor: pointer;
      }
      .modal-action-bar .action:active { transform: translateY(1px); }
      .modal-action-bar .action[data-make-pages] {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff;
        font-weight: 600;
      }
      /* 底部条会遮住内容，给弹层留出空间；路书横幅里的按钮在手机端收起来 */
      .modal-content { padding-bottom: 84px; }
      .routebook-actions { display: none; }
    }
