  /* ==========================================================================
     PRINT: itinerary on paper / "Save as PDF"
     Two buttons call window.print(); without this block they dumped the whole
     8-tab SPA. Print only the active view, on white, with usable URLs.
     ========================================================================== */
  @page {
    margin: 14mm 12mm;
  }

  @media print {
    /* Ink discipline: drop the washi tint, the dotted grid, and every shadow. */
    :root {
      --color-washi-0: #FFFFFF;
      --color-washi-1: #FFFFFF;
      --color-washi-2: #FFFFFF;
      --color-washi-3: #FFFFFF;
      --color-washi-4: #FFFFFF;
    }

    html, body {
      background: #FFFFFF !important;
      color: #000000 !important;
      font-size: 10.5pt;
    }

    /* Chrome that carries no meaning on paper. */
    .sticky-nav-bar,
    .back-to-top-btn,
    .theme-toggle-btn,
    .mascot-trigger-btn,
    .mascot-live,
    .mascot-modal-overlay,
    .topbar-music-btn,
    .toast,
    .nav-currency-bar,
    .day-selector-bar,
    #dayPillsSection,
    .btn-share,
    .modal-overlay,
    .pwa-ios-hint,
    .editorial-countdown-card,
    .countdown-header,
    .editorial-action-bar,
    audio {
      display: none !important;
    }

    /* Only the view the reader is on; never the hidden tabs. */
    .section-view {
      display: none !important;
    }
    .section-view.active {
      display: block !important;
    }

    /* The hero is a photo cover — keep the title, drop the bitmap. */
    .editorial-hero {
      min-height: auto !important;
      background: #FFFFFF !important;
      padding: 0 0 10mm !important;
      border-bottom: 2pt solid #000000;
    }
    .editorial-hero::before {
      display: none !important;
    }
    .editorial-main-title {
      color: #000000 !important;
    }

    .day-card,
    .timeline-node,
    .budget-stat-card,
    .alldays-card,
    .hotel-card-item,
    .packing-item-card,
    tr {
      break-inside: avoid;
      page-break-inside: avoid;
    }

    h1, h2, h3, h4 {
      break-after: avoid;
      page-break-after: avoid;
    }

    /* Printed links are otherwise unusable on paper. */
    a[href^="http"]::after {
      content: " (" attr(href) ")";
      font-size: 8pt;
      color: #555555;
      word-break: break-all;
    }
    /* Buttons that are really JS actions, not navigation. */
    .btn-share {
      display: none !important;
    }
  }

  /* ==========================================================================
     DARK MODE — FINAL SURFACE PASS (藍夜 indigo night)
     Rule: in dark mode no box is grey and no box is white. Every surface is a
     tinted indigo/navy; accent boxes use solid dark tints of their own hue
     (a translucent gold/red wash over navy blends into mud-grey, so no washes).
     Kept last so it wins over earlier light rules. Audit: tools/audit_dark_boxes.py
     ========================================================================== */
  :root[data-theme="dark"] {
    --ticket-adv-bg: #3A1622;
    --ticket-adv-text: #FCA5A5;
    --ticket-adv-border: #6E2738;
    --ticket-free-bg: #1A2E54;
    --ticket-free-text: #C7D6F0;
    --ticket-free-border: #2C4778;
    --dark-glass: rgba(16, 38, 84, 0.55);
    --dark-glass-border: rgba(140, 180, 245, 0.32);
    --dark-gold-box: #2E2410;
    --dark-gold-border: #5E4718;
    --dark-red-box: #3A1622;
    --dark-red-border: #6E2738;
    --gold-wash: #2E2410;
    --gold-wash-text: #F2C879;
    --gold-wash-border: #5E4718;
  }
  :root[data-theme="dark"] .jp-phrase-filter-bar {
    background: rgba(10, 20, 40, 0.94) !important;
    border-color: var(--color-washi-4) !important;
  }
  :root[data-theme="dark"] .node-spot-img-wrap,
  :root[data-theme="dark"] .alldays-photo-item {
    background: var(--color-washi-3) !important;
  }
  :root[data-theme="dark"] .node-spot-img-bottom-bar {
    background: linear-gradient(180deg, rgba(6, 14, 34, 0) 0%, rgba(6, 14, 34, 0.88) 100%) !important;
  }
  :root[data-theme="dark"] .fatigue-stat {
    background: var(--color-washi-1) !important;
    border-color: var(--color-washi-4) !important;
  }
  :root[data-theme="dark"] .settlement-table th,
  :root[data-theme="dark"] .cat-chip-btn:hover,
  :root[data-theme="dark"] .member-chip-btn:hover {
    background: var(--color-washi-2) !important;
  }
  :root[data-theme="dark"] .vn-quick-pill {
    background: var(--color-washi-2) !important;
    color: var(--color-sumi-800) !important;
    border: 1px solid var(--color-washi-4) !important;
  }
  :root[data-theme="dark"] .topbar-theme-btn,
  :root[data-theme="dark"] .topbar-music-btn,
  :root[data-theme="dark"] .editorial-pill-link,
  :root[data-theme="dark"] .editorial-countdown-card {
    background: var(--dark-glass) !important;
    border-color: var(--dark-glass-border) !important;
  }
  :root[data-theme="dark"] .node-optional-tip,
  :root[data-theme="dark"] .backup-spot-trigger,
  :root[data-theme="dark"] .backup-spot-type-tag,
  :root[data-theme="dark"] .node-optional-badge {
    background: var(--dark-gold-box) !important;
    border-color: var(--dark-gold-border) !important;
  }
  :root[data-theme="dark"] .cat-badge.shrine,
  :root[data-theme="dark"] .view-hanko-seal,
  :root[data-theme="dark"] .currency-modal-header .cat-badge.shrine,
  :root[data-theme="dark"] .currency-modal-header .view-hanko-seal {
    background: var(--dark-red-box) !important;
  }

  /* ==========================================================================
     STANDALONE PAGE CHROME (vietnam.html)
     Views that left the main tab bar get their own thin top bar instead of the
     full sticky tab grid.
     ========================================================================== */
  .page-topbar {
    position: sticky;
    top: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    background: rgba(250, 248, 245, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-washi-4);
  }

  .page-topbar-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-washi-4);
    background: var(--color-washi-1);
    color: var(--color-indigo);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition-snappy);
  }

  .page-topbar-back:hover {
    border-color: var(--color-indigo);
    background: #FFFFFF;
    transform: translateY(-1px);
  }

  .page-topbar-title {
    font-family: 'Shippori Mincho', serif;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--color-indigo);
    letter-spacing: 0.02em;
  }

  .page-topbar-theme {
    margin-left: auto;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    border-radius: 50%;
    border: 1px solid var(--color-washi-4);
    background: var(--color-washi-1);
    color: var(--color-sumi-600);
    cursor: pointer;
    transition: var(--transition-snappy);
  }

  .page-topbar-theme:hover {
    border-color: var(--color-indigo);
    transform: translateY(-1px);
  }

  :root[data-theme="dark"] .page-topbar {
    background: rgba(10, 20, 40, 0.94);
    border-bottom-color: #2C4778;
  }

  :root[data-theme="dark"] .page-topbar-back,
  :root[data-theme="dark"] .page-topbar-theme {
    background: #152A4A;
    border-color: #2C4778;
    color: #E6EDF7;
  }

  :root[data-theme="dark"] .page-topbar-back:hover,
  :root[data-theme="dark"] .page-topbar-theme:hover {
    background: #1D3A63;
    border-color: #4A6FA5;
  }

  :root[data-theme="dark"] .page-topbar-title {
    color: #E6EDF7;
  }

  /* ==========================================================================
     DAILY VIEW MODE SWITCH (单日精读 / 14日全览)
     The 14-day overview used to be its own tab; it is the same dataset, so it
     is now a mode of the itinerary tab.
     ========================================================================== */
  .daily-mode-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin: 0 0 18px;
    background: var(--color-washi-2);
    border: 1px solid var(--color-washi-4);
    border-radius: 999px;
  }

  .daily-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--color-sumi-600);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: var(--transition-snappy);
  }

  .daily-mode-btn:hover {
    color: var(--color-indigo);
  }

  .daily-mode-btn.active {
    background: var(--color-indigo);
    color: #FFFFFF;
    box-shadow: 0 2px 10px rgba(30, 49, 75, 0.24);
  }

  .daily-mode-icon {
    font-size: 0.95rem;
    line-height: 1;
  }

  :root[data-theme="dark"] .daily-mode-switch {
    background: #0F1F3A;
    border-color: #2C4778;
  }

  :root[data-theme="dark"] .daily-mode-btn {
    color: #9FB3D1;
  }

  :root[data-theme="dark"] .daily-mode-btn.active {
    background: #2C4778;
    color: #F2F7FF;
    box-shadow: 0 2px 12px rgba(56, 189, 248, 0.18);
  }

  /* ==========================================================================
     VIEW SUB-TABS (自驾：租车 / 警讯退税 / 紧急求助)
     Former standalone tabs that became segments of one tab.
     ========================================================================== */
  .subtab-switch {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 5px;
    margin: 0 0 22px;
    background: var(--color-washi-2);
    border: 1px solid var(--color-washi-4);
    border-radius: 999px;
    width: fit-content;
    max-width: 100%;
  }

  .subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--color-sumi-600);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-snappy);
  }

  .subtab-btn:hover {
    color: var(--color-indigo);
  }

  .subtab-btn.active {
    background: var(--color-indigo);
    color: #FFFFFF;
    box-shadow: 0 2px 10px rgba(30, 49, 75, 0.24);
  }

  .subtab-icon {
    font-size: 0.95rem;
    line-height: 1;
  }

  :root[data-theme="dark"] .subtab-switch {
    background: #0F1F3A;
    border-color: #2C4778;
  }

  :root[data-theme="dark"] .subtab-btn {
    color: #9FB3D1;
  }

  :root[data-theme="dark"] .subtab-btn.active {
    background: #2C4778;
    color: #F2F7FF;
    box-shadow: 0 2px 12px rgba(56, 189, 248, 0.18);
  }

  /* Add-to-checklist button (was borrowing .nav-tab, which the tab switcher
     strips the active styling from on every view change). */
  .btn-add-item {
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-indigo);
    background: var(--color-indigo);
    color: #FFFFFF;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-snappy);
  }

  .btn-add-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(30, 49, 75, 0.22);
  }

  :root[data-theme="dark"] .btn-add-item {
    background: #2C4778;
    border-color: #4A6FA5;
    color: #F2F7FF;
  }

  /* --- Packing: fold-away reference sections (read once, then out of the way) --- */
  .packing-fold {
    border: 1px solid var(--fold-border, #DDD6C8);
    border-radius: 12px;
    background: var(--fold-bg, #FFFFFF);
    margin-bottom: 12px;
    overflow: hidden;
  }
  .packing-fold > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--fold-text, #1F1E1C);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .packing-fold > summary::-webkit-details-marker { display: none; }
  .packing-fold > summary .fold-meta {
    margin-left: auto;
    font-weight: 500;
    font-size: 0.76rem;
    color: var(--fold-muted, #7A7367);
    white-space: nowrap;
  }
  .packing-fold > summary::after {
    content: '';
    width: 8px; height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin: -4px 2px 0 4px;
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.2s ease;
  }
  .packing-fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
  .packing-fold > summary:focus-visible { outline: 2px solid #BA3C38; outline-offset: -2px; border-radius: 12px; }
  .packing-fold-body { padding: 0 16px 16px; }
  .packing-fold-body > div { margin-bottom: 0 !important; }
  .packing-fold-group { margin-bottom: 18px; }
  .packing-add-dock { margin: 18px 0 12px; }
  .packing-add-dock .custom-item-bar { margin: 0; }
  @media (prefers-reduced-motion: reduce) { .packing-fold > summary::after { transition: none; } }
  :root[data-theme="dark"] .packing-fold {
    --fold-border: rgba(255,255,255,0.14);
    --fold-bg: #12213E;
    --fold-text: #FFFFFF;
    --fold-muted: #CBD5E1;
  }

/* No-beef snippets (2026-11-05, rebased onto remote v82 theme): small polite
   sentences, not a card to hand over. Base .phrase-item / .phrase-speak-btn
   styling comes from this file; here only the snippet list layout and card
   surface, using the current theme's jp tokens (light and dark both). */
.nobeef-snippets { display: grid; gap: 8px; margin-top: 12px; }
.nobeef-snippets .nobeef-snippet {
  background: var(--jp-surface);
  border: 1px solid var(--jp-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
}
