/* The phone pass, settings, account, billing, profiles, FAQ, legal, admin (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.
   One header on all of them: a back arrow (38px), the Home button, a small brand, then a one-line title.
   Pages are tagged in their templates with .wfm-page (+ .wfm-account, .wfm-faq, .wfm-admin ...). */
@media (max-width: 700px) {

  /* ---- one header pattern ------------------------------------------------------------------------------------ */
  .wfm-page { padding: 14px 16px 0 !important; }
  .wfm-page .wf-picker-head { flex-wrap: nowrap !important; align-items: center; gap: 8px !important; padding-bottom: 12px !important; min-height: 38px; }
  .wfm-page .wf-picker-head .wf-brand { order: 1; margin-left: 4px; font-size: 11px; letter-spacing: 0.22em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .wfm-page .wf-picker-head .wf-spacer { order: 2; flex: 1; }
  .wfm-page .wf-picker-head .wfu-home { order: -1; flex: none; }
  /* Home shows where the back arrow does not already go there (admin sub-pages, the showcase journal) */
  .wfm-admin .wf-picker-head .wfu-home, .wfm-legal .wf-picker-head .wfu-home { display: inline-flex; }
  .wfm-page .wf-picker-head > :not(.wf-brand):not(.wf-spacer):not(.wfu-home):not(.wfm-hback) { order: 3; flex: none; }
  /* the back button: the page's own "Your worlds" / "Back" / "Admin" link, drawn as an arrow in a 38px square */
  .wfm-page .wfm-hback { order: -2 !important; flex: none; position: relative; width: 38px; height: 38px; min-height: 38px !important; padding: 0 !important;
    margin: 0 !important; font-size: 0 !important; letter-spacing: 0 !important; line-height: 0; border-radius: 10px;
    display: inline-flex !important; align-items: center; justify-content: center; overflow: hidden; }
  .wfm-page .wfm-hback::before { content: ""; width: 10px; height: 10px; margin-left: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
  .wfm-page .wf-picker-head .wf-btn:not(.wfm-hback) { min-height: 40px; padding: 0 14px; font-size: 12px; }
  .wfm-page .wf-picker-head a.wf-brand { padding: 12px 0; margin-top: -12px; margin-bottom: -12px; }

  /* the page title: one line, normal size */
  .wfm-page .wf-picker-title { font-size: min(var(--wfm-title), 6.3vw) !important; line-height: 1.15 !important; margin: 4px 0 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wfm-legal .wf-picker-title { white-space: normal; }
  .wfm-page .wf-sub { margin: 4px 0 0; font-size: 14px; }
  .wfm-page .wf-picker-rule { margin: 12px 0 0 !important; }
  .wfm-page .wf-picker-scroll { margin: 0 -4px !important; padding: 0 4px 36px !important; }

  /* fields and buttons: finger-sized */
  .wfm-page .wf-input, .wfm-page input[type="text"], .wfm-page input[type="password"], .wfm-page input[type="email"], .wfm-page input[type="search"],
  .wfm-page input[type="number"], .wfm-page input:not([type]), .wfm-page select, .wfm-page textarea { min-height: 48px; font-size: 16px; box-sizing: border-box; max-width: 100%; }
  .wfm-page textarea { min-height: 96px; }
  .wfm-page .wf-btn { min-height: 48px; }
  .wfm-page input[type="checkbox"] { width: 22px; height: 22px; flex: none; }

  /* ---- settings ---------------------------------------------------------------------------------------------- */
  .wfm-settings .st-row { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; margin-top: 12px; border: 1px solid var(--bd, rgba(255,255,255,.12)); border-radius: 14px; background: var(--surface, rgba(255,255,255,.035)); }
  .wfm-settings .st-row h2 { font-size: 20px; }
  .wfm-settings .st-row p { font-size: 14px; }
  .wfm-settings .st-row [data-no-i18n] { display: flex; gap: 8px; }
  .wfm-settings .st-row [data-no-i18n] .wf-btn { flex: 1; min-height: 48px; justify-content: center; }
  .wfm-settings .st-row .wfu-edit { margin-top: 0; min-height: 48px; justify-content: center; border: 1px solid var(--acc); border-radius: 12px; padding: 0 16px; }
  .wfm-settings .st-soon { margin-top: 18px; }

  /* ---- account: every section a collapsible row (wf-mobile-account.js adds .wfm-acc) -------------------------- */
  .wfm-account .ac-wrap { max-width: none; }
  .wfm-account .ac-card { padding: 14px 16px; margin-top: 10px; border-radius: 14px; }
  .wfm-account .ac-card h2 { font-size: 20px; margin: 0 0 6px; }
  .wfm-account .ac-card p { font-size: 15px; }
  .wfm-account .ac-card.wfm-acc > h2 { position: relative; display: flex; align-items: center; min-height: 44px; margin: 0; padding: 0 34px 0 0; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
  .wfm-account .ac-card.wfm-acc > h2::after { content: ""; position: absolute; right: 8px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--ink-dim); border-bottom: 2px solid var(--ink-dim); transform: translateY(-70%) rotate(45deg); transition: transform 160ms ease; }
  .wfm-account .ac-card.wfm-acc.is-open > h2 { margin-bottom: 8px; }
  .wfm-account .ac-card.wfm-acc.is-open > h2::after { transform: translateY(-30%) rotate(-135deg); }
  .wfm-account .ac-card.wfm-acc:not(.is-open) > :not(h2) { display: none !important; }
  .wfm-account .ac-card.wfm-acc > h2:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; border-radius: 4px; }
  .wfm-account .ac-row { max-width: none; }
  .wfm-account .ac-card > .ac-actions:not([style*="wrap"]) { flex-direction: column; align-items: stretch; gap: 8px; }
  .wfm-account .ac-card > .ac-actions:not([style*="wrap"]) > .wf-btn { width: 100%; min-height: 48px; justify-content: center; text-align: center; }
  .wfm-account .ac-actions[style*="wrap"] .wf-btn { min-height: 44px; }
  .wfm-account .ac-ask { align-items: center; min-height: 44px; }
  .wfm-account #ac-public-on { margin-right: 2px; }
  .wfm-account .ac-card label { min-height: 40px; }

  /* ---- profiles ("Who's playing?") ------------------------------------------------------------------------- */
  .wfm-profiles .pf-lead { font-size: 16px; margin: 16px 0 22px; }
  .wfm-profiles .pf-grid { gap: 20px 14px; }
  .wfm-profiles .pf-tile { width: calc(50% - 10px); min-height: 150px; justify-content: center; padding: 12px 0; border-radius: 14px; font-size: 16px; }
  .wfm-profiles .pf-face { width: 96px; height: 96px; border-radius: 14px; }
  .wfm-profiles .pf-pin { max-width: none; margin-top: 24px; }
  .wfm-profiles .pf-pin .wf-btn { min-height: 52px; justify-content: center; }
  .wfm-profiles .pf-foot { text-align: center; }
  .wfm-profiles .pf-foot a { display: inline-block; padding: 12px 8px; }

  /* ---- billing ------------------------------------------------------------------------------------------------ */
  .wfm-billing .wb-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wfm-billing .wb-card { padding: 16px; border-radius: 14px; }
  .wfm-billing .wb-big { font-size: 38px; }
  .wfm-billing .wb-packs .wf-btn, .wfm-billing .wb-card .wf-btn { flex: 1 1 100%; min-height: 48px; justify-content: center; }
  .wfm-billing .wb-section { margin-top: 26px; }
  .wfm-billing .wb-section h2 { font-size: 22px; }
  .wfm-billing .wb-table { display: block; overflow-x: auto; max-width: 100%; }
  .wfm-billing .wb-table[hidden] { display: none; }
  .wfm-billing .wb-note { margin: 14px 0; line-height: 1.5; }

  /* ---- AI key ------------------------------------------------------------------------------------------------- */
  .wfm-keys .wk-lead { font-size: 16px; margin-top: 16px; }
  .wfm-keys .wk-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wfm-keys .wk-card { padding: 16px; border-radius: 14px; }
  .wfm-keys .wk-row { flex-direction: column; align-items: stretch; }
  .wfm-keys .wk-row .wf-input { min-width: 0; width: 100%; }
  .wfm-keys .wk-row .wf-btn { width: 100%; justify-content: center; }
  .wfm-keys .wk-section h2 { font-size: 24px; }

  /* ---- public profile (/u/name) ---------------------------------------------------------------------------- */
  .wfm-public .pp-wrap { max-width: none; }
  .wfm-public .pp-name { font-size: clamp(28px, 8vw, 34px); line-height: 1.1; overflow-wrap: anywhere; }

  /* ---- accept the new terms -------------------------------------------------------------------------------- */
  .wfm-accept .at-card { padding: 16px; border-radius: 14px; margin-top: 14px; }
  .wfm-accept .at-agree { align-items: center; min-height: 44px; }
  .wfm-accept .at-card .wf-btn { width: 100%; min-height: 52px; justify-content: center; }

  /* ---- FAQ and legal ------------------------------------------------------------------------------------------ */
  .wfm-page .lg-wrap { padding-bottom: 28px; max-width: none; }
  .wfm-page .lg-wrap p, .wfm-page .lg-wrap li { font-size: 17px; line-height: 1.65; }
  .wfm-page .lg-wrap h2 { font-size: 22px; margin: 26px 0 8px; }
  .wfm-page .lg-meta { margin: 12px 0 8px; font-size: 11px; }
  /* Terms / Privacy / Credits as large pills */
  .wfm-page .lg-nav { flex-wrap: wrap; gap: 8px; margin: 8px 0 6px; }
  .wfm-page .lg-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border: 1px solid var(--bd-ctl, rgba(255,255,255,.22)); border-radius: 999px; font-size: 13px; color: var(--ink-2); text-decoration: none; background: rgba(255,255,255,.035); }
  .wfm-page .lg-nav a:active { color: var(--acc); border-color: var(--acc); }
  .wfm-faq .lg-nav { margin-top: 18px; }
  .wfm-faq .lg-nav a[href="/faq"] { display: none; }
  .wfm-faq .lg-meta { display: none; }
  /* the search box and the Q&A rows (wf-mobile-account.js builds them; no script, no change: the page stays a plain long text) */
  .wfm-faq .wfm-faq-search { display: block; width: 100%; margin: 14px 0 12px; padding: 0 14px; border: 1px solid var(--bd-ctl, rgba(255,255,255,.22)); border-radius: 12px; background: rgba(255,255,255,.04); color: var(--ink); font-family: var(--fb); }
  .wfm-faq .wfm-qa { margin: 0 0 8px; border: 1px solid var(--bd, rgba(255,255,255,.12)); border-radius: 14px; background: rgba(255,255,255,.035); overflow: hidden; }
  .wfm-faq .wfm-qa > h2 { position: relative; display: flex; align-items: center; min-height: 54px; margin: 0 !important; padding: 10px 44px 10px 14px; font-family: var(--fb); font-size: 16px !important; font-weight: 500; line-height: 1.35; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
  .wfm-faq .wfm-qa > h2::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--ink-dim); border-bottom: 2px solid var(--ink-dim); transform: translateY(-70%) rotate(45deg); transition: transform 160ms ease; }
  .wfm-faq .wfm-qa.is-open > h2::after { transform: translateY(-30%) rotate(-135deg); }
  .wfm-faq .wfm-qa > h2:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
  .wfm-faq .wfm-qa-a { padding: 0 14px 6px; }
  .wfm-faq .wfm-qa-a > :first-child { margin-top: 0; }
  .wfm-faq .wfm-qa:not(.is-open) .wfm-qa-a { display: none; }
  .wfm-faq .wfm-qa[hidden] { display: none; }
  .wfm-faq .wfm-faq-none { margin: 14px 2px; font-size: 15px; color: var(--ink-dim); }
  .wfm-faq .wfm-faq-none[hidden] { display: none; }

  /* ---- admin (readable, not redesigned) ------------------------------------------------------------------------ */
  .wfm-admin-note { margin: 8px 0 12px; padding: 10px 14px; border: 1px solid var(--bd, rgba(255,255,255,.12)); border-radius: 12px; background: rgba(255,255,255,.035);
    font-family: var(--fm, ui-monospace, monospace); font-size: 12px; letter-spacing: 0.06em; color: var(--ink-dim, #9a9aa6); }
  .wfm-admin { max-width: 100%; }
  .wfm-admin table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .wfm-admin table[hidden] { display: none !important; }
  .wfm-admin .btn, .wfm-admin .wf-btn, .wfm-admin button { min-height: 44px; }
  .wfm-admin table .btn, .wfm-admin table .wf-btn, .wfm-admin table button { min-height: 40px; }
  .wfm-admin input, .wfm-admin select, .wfm-admin textarea { min-height: 44px; font-size: 16px; max-width: 100%; box-sizing: border-box; }
  .wfm-admin input[type="checkbox"], .wfm-admin input[type="radio"] { min-height: 0; width: 20px; height: 20px; }
  .wfm-admin .admin-blurb, .wfm-admin .lc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .wfm-admin :is(p, li, dd, dt, span, div, code, a, label, h2, h3) { overflow-wrap: break-word; }
  .wfm-admin pre, .wfm-admin code { overflow-wrap: anywhere; }
  .wfm-admin pre { white-space: pre-wrap; max-width: 100%; overflow-x: auto; }
  .wfm-admin.admin-page { padding-bottom: 24px; }
  .wfm-admin .admin-section, .wfm-admin.conn-page .conn-section { padding: 14px 16px; margin-bottom: 12px; }
  /* section headings collapse (admin.html: wf-mobile-account.js adds .wfm-sec) */
  .wfm-admin .admin-section.wfm-sec > h2 { position: relative; display: flex; align-items: center; min-height: 44px; margin: 0; padding-right: 34px; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
  .wfm-admin .admin-section.wfm-sec > h2::after { content: ""; position: absolute; right: 8px; top: 50%; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .7; transform: translateY(-70%) rotate(45deg); }
  .wfm-admin .admin-section.wfm-sec.is-open > h2::after { transform: translateY(-30%) rotate(-135deg); }
  .wfm-admin .admin-section.wfm-sec:not(.is-open) > :not(h2) { display: none !important; }
}
