/* The phone pass, the play screen: header, menus as sheets, Codex, chart, journal (owner, 25 Nov; mockups in docs/DESIGN_TWEAKS_2026-11-25.md, "Mobile pass").
   Every rule inside @media (max-width: 700px): nothing here touches the desktop. */

@media (max-width: 700px) {
  /* ── 1. the play header: one row (Home, the world's name, the fate token, the player), the modes under it ── */
  .wf-play-head { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l r" "m m"; gap: 8px 8px; padding: 10px 12px 6px; }
  .wf-hd-l { gap: 8px; min-width: 0; }
  .wf-hd-l .wfu-home { width: 38px; height: 38px; padding: 0; justify-content: center; margin-right: 0; }
  .wf-hd-l .wfu-home span { display: none; }
  .wf-worldline { flex: 1 1 auto; min-width: 0; }
  .wf-wl-name { max-width: none !important; font-size: 18px; }
  #wf-drawer-open, #wf-chart-open { display: none !important; }     /* Details and Chart live in the player menu on a phone */
  .wf-hd-r { gap: 0; }
  .wf-menu-wrap .wfu-avatar { width: 38px; height: 38px; }
  /* the fate token: the same gold-outlined pill and coin, a little smaller so it fits along the top */
  .wf-play-head .wf-fate-chip { height: 34px; min-height: 0; padding: 3px 11px 3px 3px; gap: 6px; margin-left: 0; flex: none; font-size: 14px; }
  .wf-play-head .wf-fate-chip-coin { width: 28px; height: 28px; }
  .wf-play-head .wf-fate-chip.is-lit::before { left: 3px; width: 28px; height: 28px; margin-top: -14px; }
  /* the modes: a slimmer segmented row */
  .wf-seg { padding: 3px; border-radius: 11px; }
  .wf-seg button { min-height: 32px; padding: 6px 4px; border-radius: 8px; }
  .wf-seg .wf-admin-only { align-items: center; justify-content: center; }
  /* the stray "0/80 lb" line: it still lives in Details (wf-play-mobile.js tags the carry load; an empty rail folds away) */
  .wf-rail .wfm-lb, .wf-rail.wfm-rail-empty { display: none; }

  /* ── 3a. the player menu as a bottom sheet (wf-play-mobile.js moves it to the page level so the dim sits under it) ── */
  .wf-menu { position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 91; min-width: 0; max-height: 86vh; overflow-y: auto; overscroll-behavior: contain;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom)); background: #0e0e14; border: 0; border-top: 1px solid var(--bd-ctl, rgba(255, 255, 255, 0.22));
    border-radius: 24px 24px 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.7); backdrop-filter: none; }
  .wf-menu.is-on { animation: wfm-rise 240ms cubic-bezier(.2, .8, .2, 1) both; }
  .wf-menu.is-drag { animation: none; transition: none; }
  .wf-menu > .wfm-grab, .wf-gs-box > .wfm-grab, .wf-fate-box > .wfm-grab, .wf-codex-panel > .wfm-grab { position: sticky; top: 0; z-index: 3; margin: 0 -16px 4px; background: inherit; }
  .wf-menu > .wfm-grab { background: #0e0e14; }
  .wf-menu-who { padding: 2px 6px 12px; }
  .wf-menu .wf-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px; margin: 0 0 8px;
    text-align: left; text-decoration: none; font-size: 15px; border-radius: 14px; }
  .wf-menu .wf-menu-item:not(.wf-menu-item--gs) { border: 1px solid var(--bd, rgba(255, 255, 255, 0.12)); background: rgba(255, 255, 255, 0.035); color: var(--ink-2); }
  .wf-menu .wf-menu-item--gs { margin-top: 0; }
  .wf-menu .wf-menu-sep { display: none; }
  .wf-menu .wf-menu-item--out { color: var(--ink-muted); }

  /* ── 3b. Game settings as a bottom sheet: one column, 54px rows, the same groups ── */
  .wf-gs { align-items: flex-end; padding: 0; }
  .wf-gs-box { max-width: none; max-height: 86vh; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; border-width: 1px 0 0;
    overscroll-behavior: contain; animation: wfm-rise 240ms cubic-bezier(.2, .8, .2, 1) both; }
  .wf-gs-box.is-drag { animation: none; transition: none; }
  .wf-gs-box > .wfm-grab { background: #0e0e14; }
  .wf-gs-x { top: 30px; width: 38px; height: 38px; }
  .wf-gs-box h2 { font-size: 22px; padding-right: 44px; }
  .wf-gs-grid { grid-template-columns: 1fr !important; gap: 8px; }
  .wf-gs-grid .wf-menu-item { min-height: 54px; border-radius: 14px; font-size: 15px; }

  /* ── 3c. the Fate menu as a bottom sheet, one column ── */
  .wf-fate-menu { align-items: flex-end; padding: 0; }
  .wf-fate-box { max-width: none; max-height: 86vh; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; border-width: 1px 0 0;
    overscroll-behavior: contain; animation: wfm-rise 240ms cubic-bezier(.2, .8, .2, 1) both; }
  .wf-fate-box.is-drag { animation: none; transition: none; }
  .wf-fate-box > .wfm-grab { background: #15110d; }
  .wf-fate-box > .wfm-grab::before { background: #5a4630; }
  .wf-fate-power { min-height: 54px; padding: 10px 12px; }
  .wf-fate-close { min-width: 40px; min-height: 40px; }

  /* ── 4. the Codex: the full ring, one tap on a circle, the section in a bottom sheet ── */
  .wf-ring-tip { display: none !important; }
  .wf-ring-x { top: auto; right: auto; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: auto; min-width: 140px; height: 48px; padding: 0 30px;
    border-radius: 999px; font-family: var(--fm); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); background: rgba(14, 14, 20, 0.9); }
  .wf-ring-node { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  .wf-codex-panel { left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important; width: auto !important; height: 70vh; max-height: 70vh !important; z-index: 91;
    border: 0; border-top: 1px solid var(--bd-ctl, rgba(255, 255, 255, 0.22)); border-radius: 24px 24px 0 0 !important; background: #0e0e14; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.7); backdrop-filter: none;
    padding-bottom: env(safe-area-inset-bottom); }
  .wf-codex-panel.is-on { animation: wfm-rise 260ms cubic-bezier(.2, .8, .2, 1) both; }
  .wf-codex-panel.is-drag { animation: none; transition: none; }
  .wf-codex-panel > .wfm-grab { background: #0e0e14; margin: 0; }
  .wf-codex-head { position: static; padding: 2px 16px 8px; border-bottom: 0; font-size: 12px; letter-spacing: 0.2em; flex: none; }
  .wf-codex-x { width: 40px; height: 40px; font-size: 24px; border: 1px solid var(--bd-ctl, rgba(255, 255, 255, 0.22)); border-radius: 50%; color: var(--ink-2); }
  /* the sections wrap onto two rows of five, each with its count under its name (no sideways scrolling) */
  .wf-codex-tabs, .wf-tight .wf-codex-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; gap: 6px; padding: 0 12px 10px; flex: none; border-bottom: 1px solid var(--hair); }
  .wf-codex-tabs button, .wf-tight .wf-codex-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; min-width: 0; padding: 6px 2px;
    border-radius: 10px; font-size: 10px; letter-spacing: 0.02em; line-height: 1.15; }
  .wf-codex-tabs .wfm-tab-n { font-size: 11px; opacity: 0.75; letter-spacing: 0; }
  .wf-codex-body { flex: 1 1 auto; min-height: 0; padding: 6px 16px 18px; overscroll-behavior: contain; }
  .wf-codex-panel .wf-entry { padding: 15px 2px; min-height: 54px; }
  .wf-codex-panel .wf-codex-add { min-height: 48px; margin: 8px 0 6px; padding: 12px; text-align: center; border-radius: 12px; font-size: 14px; }

  /* the dim under the sheets built by wf-play-mobile.js */
  .wfm-play-dim { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.62); animation: wfm-fade 180ms ease both; }

  /* ── 5. the composer with the on-screen keyboard: the page is as tall as what the keyboard leaves; the compass steps aside while you type ── */
  .wf-composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .wf-composer-inner #wf-input { max-height: 24vh; overflow-y: auto; }      /* a long line scrolls inside the box instead of eating the story */
  html.wfm-kb .wf-play { height: var(--wfm-vvh); }
  html.wfm-kb .wf-composer-inner #wf-input { max-height: calc(var(--wfm-vvh) * 0.28); }
  html.wfm-kb .wf-composer { padding-bottom: 8px; }
  html.wfm-kb .wf-codex, html.wfm-kb .wf-party { display: none !important; }
}
