/* The phone pass, the chart (map) and the journal (owner, 25 Nov). Every rule inside @media (max-width: 700px): nothing here touches the desktop. */
@media (max-width: 700px) {

  /* ═════ THE CHART: the map fills the whole screen; Back top left, zoom floating on the right, the legend a pill, the places a peek sheet ═════ */
  .wf-chart-dim { background: #0b0907 !important; backdrop-filter: none !important; }
  .wf-chart { inset: 0 !important; display: block !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; animation: none !important; }
  .wf-chart-map { position: absolute !important; inset: 0 !important; }
  #wf-chart-close { display: none !important; }

  /* the Back arrow (made by wf-mobile-play2.js; it clicks the Close button) */
  .wfm2-back { display: flex !important; align-items: center; justify-content: center; position: absolute; left: 12px; top: calc(12px + env(safe-area-inset-top)); z-index: 7; width: 48px; height: 48px; min-height: 48px; padding: 0;
    border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(16, 12, 8, 0.9); color: #f1e6d2; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
  .wfm2-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

  /* the title: a small dark chip beside the Back arrow */
  .wf-chart-map .wf-chart-title, .wf-chart-map.is-earth .wf-chart-title { left: 68px !important; top: calc(12px + env(safe-area-inset-top)) !important; right: 72px; max-width: none !important; min-height: 48px; box-sizing: border-box;
    padding: 7px 14px 8px !important; border-radius: 14px !important; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(16, 12, 8, 0.9) !important; z-index: 6; display: flex; flex-direction: column; justify-content: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
  .wf-chart-title h2, .wf-chart-map.is-earth .wf-chart-title h2 { font-size: 17px !important; line-height: 1.15; color: #f1e6d2; text-shadow: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wf-chart-title .wf-kicker, .wf-chart-map.is-earth .wf-chart-title .wf-kicker { font-size: 8px; letter-spacing: 0.1em; line-height: 1.3; color: #b9a98d !important; margin-top: 2px; }
  .wf-chart-views { margin-top: 6px; }
  .wf-chart-view { min-height: 30px; }

  /* zoom in / out / expand: floating dark squares, stacked on the right */
  .wf-chart-zoom { right: 12px !important; top: calc(12px + env(safe-area-inset-top)) !important; gap: 10px !important; z-index: 7; }
  .wf-chart-zoom button { width: 48px !important; height: 48px !important; min-height: 48px; border-radius: 14px !important; font-size: 24px !important; border: 1px solid rgba(255, 255, 255, 0.18) !important; background: rgba(16, 12, 8, 0.9) !important; color: #f1e6d2 !important; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
  .wf-chart-zoom button:disabled { opacity: 0.4; }

  /* the legend: a dark pill floating over the bottom of the map, above the peek sheet */
  .wf-chart-map .wf-chart-legend, .wf-chart-map.is-earth .wf-chart-legend { left: 50% !important; right: auto !important; bottom: calc(var(--wfm2-peek, 148px) + 14px) !important; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px) !important;
    flex-wrap: wrap; justify-content: center; gap: 6px 14px !important; padding: 9px 16px !important; border-radius: 22px !important; background: rgba(16, 12, 8, 0.92) !important; color: #efe3cc !important;
    font-size: 10px; font-weight: 600; letter-spacing: 0.1em; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); z-index: 5; }
  .wf-chart-legend .d { width: 9px; height: 9px; margin-right: 6px; background: #b8b2c8; }
  .wf-chart-legend .d.here { background: var(--acc); }
  .wf-chart-legend i:nth-child(2) .d { background: #8fb0ee; }
  #wf-chart-scale { display: none !important; }

  /* the tooltip ("The chart") would land on the title: hidden while the chart is up */
  body:has(.wf-chart-dim.is-on) .wf-tip { display: none !important; }

  /* the lower panel is a peek sheet pinned to the bottom: a grab handle, PLACES · N and the first line; drag it up (or tap the handle) for the list */
  .wf-chart { --wfm2-peek: 148px; }
  .wf-chart-rail { position: absolute !important; left: 0; right: 0; bottom: 0; height: 70%; z-index: 8; display: flex; flex-direction: column; border: 0 !important; border-top: 1px solid rgba(255, 255, 255, 0.16) !important; border-radius: 22px 22px 0 0;
    background: linear-gradient(180deg, #1b150f, #0f0b08) !important; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.55); transform: translateY(calc(100% - var(--wfm2-peek, 148px))); transition: transform 280ms cubic-bezier(.2, .8, .2, 1); touch-action: none; }
  .wf-chart-rail.is-open { transform: none; touch-action: auto; }
  .wf-chart-rail.is-drag { transition: none; }
  .wfm2-handle { display: block !important; flex: none; padding: 10px 0 8px; cursor: grab; touch-action: none; }
  .wfm2-handle::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 9px; background: #4a3f33; margin: 0 auto; }
  .wf-chart-rail .wf-rail-head { flex: none; padding: 0 20px 6px !important; border: 0 !important; touch-action: none; }
  .wf-chart-rail .wf-rail-head .wf-kicker, .wf-chart-rail .wf-rail-head .wf-spacer, .wf-chart-rail .wf-rail-head .wf-btn { display: none !important; }
  .wf-chart-rail .wf-rail-head .wfm2-places { display: flex !important; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; }
  .wfm2-places b { font: 600 11px/1 var(--fm); letter-spacing: 0.2em; text-transform: uppercase; color: var(--acc); }
  .wfm2-places span { font-size: 12px; color: #8d7f6b; }
  .wf-chart-rail:not(.is-open) .wfm2-places span { display: block; }
  .wf-chart-rail.is-open .wfm2-places span { display: none; }
  .wfm2-scroll { flex: 1; min-height: 0; overflow: hidden; padding: 4px 20px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .wf-chart-rail.is-open .wfm2-scroll { overflow-y: auto; }
  .wf-chart-rail .wf-rail-body { flex: none; overflow: visible; padding: 0 !important; }
  .wf-chart-rail .wf-rail-place { font-size: 22px; margin: 0 0 6px; }
  .wf-chart-rail .wf-rail-desc { font-size: 15px; margin-top: 10px; }
  .wf-chart-rail .wf-codex-empty { font-size: 16px; line-height: 1.4; color: #cdbfa8; margin: 2px 0 0; }
  .wfm2-list { margin-top: 22px; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 14px; }
  .wfm2-list h4 { margin: 0 0 8px; font: 600 10px/1 var(--fm); letter-spacing: 0.2em; text-transform: uppercase; color: #8d7f6b; }
  .wfm2-place { display: flex !important; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 12px; margin: 0 0 6px; text-align: left; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: #efe3cc; font-size: 15px; cursor: pointer; }
  .wfm2-place[aria-pressed="true"] { border-color: var(--acc); }
  .wfm2-place i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #b8b2c8; }
  .wfm2-place[data-state="here"] i { background: var(--acc); }
  .wfm2-place[data-state="visited"] i { background: #8fb0ee; }
  .wfm2-place em { margin-left: auto; font: normal 600 9px/1 var(--fm); letter-spacing: 0.14em; text-transform: uppercase; color: #8d7f6b; }
}
@media (max-width: 700px) {

  /* ═════ THE JOURNAL: a full-screen book on a dark leather desk ═════ */
  .wfj { justify-content: flex-start !important; gap: 10px !important; padding: calc(64px + env(safe-area-inset-top)) 8px calc(10px + env(safe-area-inset-bottom)) !important; overflow: hidden;
    background: radial-gradient(120% 70% at 50% 30%, rgba(120, 78, 44, 0.28), rgba(0, 0, 0, 0) 70%), repeating-linear-gradient(35deg, rgba(255, 255, 255, 0.018) 0 2px, rgba(0, 0, 0, 0.03) 2px 4px), #1d140e !important; }
  .wfj-x { left: 12px !important; right: auto !important; top: calc(10px + env(safe-area-inset-top)) !important; width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 28px; line-height: 1; opacity: 1;
    color: #efe0c8; border: 1px solid rgba(201, 180, 154, 0.35) !important; border-radius: 12px; background: rgba(0, 0, 0, 0.3) !important; display: flex; align-items: center; justify-content: center; }
  .wfj-title { display: block !important; position: absolute; left: 68px; top: calc(10px + env(safe-area-inset-top)); height: 44px; line-height: 44px; font-size: 21px; color: #efe0c8; z-index: 4; }

  /* Contents: top right, in the bar */
  .wfj-foot button[data-toc] { position: fixed; right: 12px; top: calc(10px + env(safe-area-inset-top)); z-index: 6; min-height: 44px; height: 44px; padding: 0 14px 0 12px; border-radius: 12px; font: 600 11px/1 var(--fm, monospace);
    letter-spacing: 0.14em; text-transform: uppercase; color: #efe0c8; border: 1px solid rgba(201, 180, 154, 0.35); background: rgba(0, 0, 0, 0.3); display: flex; align-items: center; gap: 8px; }
  .wfj-foot button[data-toc]::before { content: ""; width: 14px; height: 10px; background: linear-gradient(#efe0c8 0 0) 0 0 / 100% 2px no-repeat, linear-gradient(#efe0c8 0 0) 0 50% / 70% 2px no-repeat, linear-gradient(#efe0c8 0 0) 0 100% / 100% 2px no-repeat; }

  /* the book fills the width */
  .wfj-book { padding: 6px !important; border-radius: 10px !important; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05); }
  .wfj-book.is-pad { padding: 0 !important; }
  /* handwriting large enough to read (the measure box shares these rules, so the pages are cut to match) */
  .wfj-hand, .wfj-note { font-size: 5.3cqw; }
  .wfj-head { font-size: 6cqw; }
  .wfj-toc button { font-size: 5.3cqw; padding: 1.4cqw 0; }
  .wfj-toc button span { font-size: 4.2cqw; }
  .wfj-empty { font-size: 5.8cqw; margin-top: 40cqw; }
  .wfj-label { font-size: 4.6cqw; }

  /* the controls: Back, the page counter, Turn; big targets */
  .wfj-foot { display: grid !important; grid-template-columns: 1fr auto 1fr; gap: 10px !important; width: 100%; align-items: center; }
  .wfj-foot button[data-prev], .wfj-foot button[data-next] { min-height: 48px; border-radius: 12px; font: 600 12px/1 var(--fm, monospace); letter-spacing: 0.16em; text-transform: uppercase; color: #efe0c8; background: rgba(0, 0, 0, 0.3); border-color: rgba(201, 180, 154, 0.35); }
  .wfj-count { min-width: 64px; font-size: 17px; color: #d9c7a8; }
  .wfj-pen { gap: 10px; font-size: 14px; }
  .wfj-art button { min-height: 34px; padding: 4px 14px; border-radius: 999px; border: 1px solid rgba(201, 180, 154, 0.35); background: transparent; color: #d9c7a8; font: italic 14px "IM Fell English", Georgia, serif; }
  .wfj-art button[aria-checked="true"] { background: #e6d3a6; color: #2a1d14; border-color: #e6d3a6; }

  /* the gold Write button, bottom right of the page */
  .wfj-write { display: flex !important; align-items: center; gap: 8px; position: absolute; right: 16px; bottom: 16px; z-index: 7; min-height: 48px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; background: #e0b152; color: #2a1d14;
    font: 700 12px/1 var(--fm, monospace); letter-spacing: 0.16em; text-transform: uppercase; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); cursor: pointer; }
  .wfj-write svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
}
