/* The phone pass, character, content dials, interview, review (owner, 25 Nov). Every rule inside @media (max-width: 700px): nothing here touches the desktop.
   Skins over the page's own controls: no id, name or handler is touched. Scripted parts live in static/js/wf-mobile-forge2.js (phone only). */
@media (max-width: 700px) {

  /* ── the top row of every page in this part of the forge: brand, Tavern and the player menu stay on one line ── */
  body.wfm-forge2 .wf-forge-head, .wf-forge:has(#st-start) .wf-forge-head { flex-wrap: nowrap !important; gap: 8px !important; padding-bottom: 10px !important; }
  body.wfm-forge2 .wf-forge-head .wf-brand, .wf-forge:has(#st-start) .wf-forge-head .wf-brand { letter-spacing: 0.2em !important; font-size: 11px !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

  /* ── accordion rows (character; the review's dossier uses the same look) ── */
  .wfm-acc-head, .wfm-dos > .wfu-band-k {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 14px; margin: 0 0 8px;
    border: 1px solid var(--bd-ctl, rgba(255, 255, 255, 0.22)); border-radius: 14px; background: rgba(255, 255, 255, 0.035);
    color: var(--ink); font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .wfm-acc-t, .wfm-dos .wfu-bk { flex: none; font-family: var(--fb); font-size: 16px; letter-spacing: 0; text-transform: none; color: var(--ink); }
  .wfm-acc-s { flex: 1; min-width: 0; text-align: right; font-size: 13px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wfm-acc-c { flex: none; width: 10px; height: 10px; margin: 0 4px 3px 2px; border-right: 2px solid var(--ink-dim); border-bottom: 2px solid var(--ink-dim); transform: rotate(45deg); transition: transform 180ms; }
  .wfm-acc-head.is-open, .wfm-dos.is-open > .wfu-band-k { border-color: var(--acc); }
  .wfm-acc-head.is-open .wfm-acc-c, .wfm-dos.is-open .wfm-acc-c { transform: rotate(225deg); margin-bottom: -3px; border-color: var(--acc); }
  .wfm-acc-shut { display: none !important; }
  .wfm-acc-body { animation: none; }

  /* ── character ── */
  body.wfm-char .wf-forge-scroll { padding-top: 14px !important; }
  body.wfm-char .wf-cc > div > .wf-group { margin-bottom: 14px; }
  body.wfm-char .wf-cc .wfm-hidek > .wf-kicker, body.wfm-char .wf-cc .wfm-hidek .wf-looks-sum { display: none !important; }
  body.wfm-char .wf-cc .wfm-acc-body { padding: 4px 6px 4px; margin-bottom: 14px; }
  body.wfm-char .wf-cc .wf-group.wfm-acc-body:not(.wfm-acc-shut) { margin-top: -2px; }
  body.wfm-char .wf-title-input, body.wfm-char .wf-cc-name { min-height: 52px; }
  body.wfm-char .wf-cc-split { grid-template-columns: minmax(0, 1fr) !important; gap: 14px !important; }
  body.wfm-char .wf-bare, body.wfm-char .wf-input, body.wfm-char select.wf-input { min-height: 48px; }
  body.wfm-char #cc-age { border: 1px solid var(--bd-ctl, rgba(255, 255, 255, 0.22)); border-radius: 12px; padding: 0 14px; font-size: 18px; }
  body.wfm-char .wfu-seg button { min-height: 48px; }
  body.wfm-char .wfu-pillrow { flex-direction: column; flex-wrap: nowrap; gap: 10px; }
  body.wfm-char .wfu-pillrow .wfu-pf, body.wfm-char .wf-cc .wfu-pill { display: block; width: 100%; }
  body.wfm-char .wfu-pill-btn { width: 100%; min-height: 48px; justify-content: flex-start; }
  body.wfm-char .wfu-pill-btn svg { margin-left: auto; }
  body.wfm-char .wfu-list { left: 0; right: 0; min-width: 0; max-height: 46vh; }
  /* the open Species / Archetype list never ends under the pinned bar (26 Nov): scrolling it into view keeps the bar's height clear below it */
  body.wfm-char .wfu-list, body.wfm-char .wfu-list li { scroll-margin-bottom: calc(var(--wfm-bar-h) + 18px + env(safe-area-inset-bottom)); }
  body.wfm-char .wfu-pop { display: none; }   /* the picker opens as a sheet; its content moves there while it is open */
  .wfm-sheet .wfu-pop { display: block !important; position: static; width: auto; max-height: none; padding: 0 0 6px; margin: 0; background: none; border: 0; box-shadow: none;
    opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
  .wfm-sheet .wfu-bub button { min-height: 44px; padding: 10px 16px; }
  .wfm-sheet .wfu-swr { gap: 14px; }
  .wfm-sheet .wfu-swr button { width: 44px; height: 44px; }
  .wfm-sheet .wfu-foot button { min-height: 44px; }
  body.wfm-char .wf-stat-hint { width: 40px !important; height: 40px !important; font-size: 13px !important; }
  body.wfm-forge2 .wfu-home { height: 40px; width: 40px; }
  body.wfm-char .wfm-attr-head { display: none !important; }
  body.wfm-char .wf-attr-rule { margin: 4px 2px 8px; font-size: 14px; }
  body.wfm-char .wf-stat-wrap { border-bottom: 0; }
  body.wfm-char .wf-stat { grid-template-columns: minmax(0, 1fr) 44px 34px 44px !important; gap: 2px !important; padding: 8px 0 2px !important; }
  body.wfm-char .wf-stat-name { font-size: 18px; }
  body.wfm-char .wf-pm { width: 44px !important; height: 44px !important; font-size: 24px !important; }
  body.wfm-char .wf-stat .wfu-sl { height: 48px; margin: 0 4px; }
  body.wfm-char .wf-stat .wfu-sl-thumb { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
  body.wfm-char .wf-stat .wfu-sl-rail, body.wfm-char .wf-stat .wfu-sl-fill { height: 6px; margin-top: -3px; }
  body.wfm-char #cc-ai { margin-top: 6px; min-height: 48px; width: 100%; }
  body.wfm-char .wf-cc .wf-basics-submit { margin-top: 12px; }
  .wfm-bar--col { flex-direction: column; align-items: stretch; gap: 6px; }
  .wfm-bar--col > #cc-status { flex: none; min-height: 0; margin: 0; padding: 0; text-align: center; font-size: 12px; line-height: 1.4; }
  .wfm-bar--col > #cc-status:empty { display: none; }
  .wfm-bar--col > #cc-go { flex: none; width: 100%; min-height: 52px; margin: 0; }

  /* ── content dials (the forge's page and the older "Tune your world" page share this layout) ── */
  body.wfm-dials .wf-forge-scroll { padding-top: 12px !important; }
  body.wfm-dials .forge-container { padding-left: 0 !important; padding-right: 0 !important; max-width: none; }
  body.wfm-dials .wf-forge-sub, body.wfm-dials .dials-sub { font-size: 15px; margin-top: 8px; }
  body.wfm-dials .wfu-seg, body.wfm-dials #play-mode-cards { width: 100%; max-width: none; }
  body.wfm-dials .wfu-seg button { min-height: 48px; font-size: 13px; }
  body.wfm-dials .wfu-mode { margin-top: 12px; padding: 0; border: 0; background: none; }
  body.wfm-dials .wfu-mode-head { display: none; }
  .wfu-mode-desc, .wfm-modedesc { margin: 10px 2px 12px; font-size: 14px; line-height: 1.45; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  .wfu-mode-desc.is-open, .wfm-modedesc.is-open { white-space: normal; }
  body.wfm-dials .wfu-mode-rows { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 0; padding: 0; border: 1px solid var(--bd-2); border-radius: 14px; background: rgba(255, 255, 255, 0.03); overflow: hidden; }
  body.wfm-dials .wfu-row { min-height: 54px; padding: 0 14px; gap: 12px; font-size: 16px; border-bottom: 1px solid var(--bd-2); }
  body.wfm-dials .wfu-row:last-child { border-bottom: 0; }
  body.wfm-dials .wfu-row .st { order: 2; margin-left: auto; font-size: 12px; letter-spacing: 0.08em; }
  body.wfm-dials .wfu-row .d { order: 3; position: relative; width: 46px; height: 28px; border-radius: 14px; border: 0; background: rgba(255, 255, 255, 0.16); transition: background 200ms; }
  body.wfm-dials .wfu-row .d::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 200ms; }
  body.wfm-dials .wfu-row.is-on .d { background: var(--acc); border: 0; }
  body.wfm-dials .wfu-row.is-on .d::after { transform: translateX(18px); background: #0b0a10; }
  body.wfm-dials .wfu-row.is-na .d { opacity: 0.35; }
  body.wfm-dials .wfu-row .d { flex: none; }
  /* Custom: the page's own switches, one per row */
  body.wfm-dials .wf-hp-custom.wfu-custom { display: block; margin: 12px 0 0; padding: 0; border: 1px solid var(--bd-2); border-radius: 14px; background: rgba(255, 255, 255, 0.03); overflow: hidden; }
  body.wfm-dials .wf-hp-custom.wfu-custom[hidden] { display: none; }
  body.wfm-dials .wf-hp-custom.wfu-custom .wf-hp-switch { min-height: 54px; padding: 0 14px; border-bottom: 1px solid var(--bd-2); font-size: 16px; }
  body.wfm-dials .wf-hp-custom.wfu-custom .wf-hp-switch:last-child { border-bottom: 0; }
  body.wfm-dials .wf-hp-custom.wfu-custom .wf-hp-switch input { width: 46px; height: 28px; border-radius: 14px; }
  body.wfm-dials .wf-hp-custom.wfu-custom .wf-hp-switch input::after { top: 3px; left: 3px; width: 22px; height: 22px; }
  body.wfm-dials .wf-hp-custom.wfu-custom .wf-hp-switch input:checked::after { transform: translateX(18px); }
  /* the dna page's dials: tighter rows, a bigger touch strip on each slider */
  body.wfm-dials .slider-group { padding: 16px 0 12px; }
  body.wfm-dials .slider-label span { font-size: 20px; }
  body.wfm-dials .forge-container .slider-value, body.wfm-dials .slider-value { font-size: 26px; }
  body.wfm-dials .slider-desc { font-size: 14px; line-height: 1.4; margin-bottom: 0; }
  body.wfm-dials .slider-group .wfu-sl { height: 52px; margin: 8px 8px 0; }
  body.wfm-dials .slider-group .wfu-sl-thumb { width: 28px; height: 28px; margin: -14px 0 0 -14px; }
  body.wfm-dials .slider-group .wfu-sl-rail, body.wfm-dials .slider-group .wfu-sl-fill { height: 6px; margin-top: -3px; }
  body.wfm-dials .slider-group .wfu-sl-nl { font-size: 12px; }

  /* the older page: three modes as one segmented control, the rest of the card groups as plain stacked rows */
  body.wfm-dials .dials-page { padding-top: 14px; }
  body.wfm-dials .dials-header { padding-bottom: 8px; }
  body.wfm-dials .dials-section { margin: 0; padding: 18px 0 8px; }
  body.wfm-dials #play-mode-cards { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-columns: none; gap: 0; padding: 4px;
    border: 1px solid var(--bd-ctl); border-radius: 12px; background: rgba(255, 255, 255, 0.04); }
  body.wfm-dials #play-mode-cards .play-mode-card { align-items: center; justify-content: center; min-height: 48px; padding: 10px 4px !important; border: 0; border-radius: 9px; background: transparent; box-shadow: none; grid-column: auto; }
  body.wfm-dials #play-mode-cards .play-mode-card[hidden] { display: none !important; }
  body.wfm-dials #play-mode-cards .play-mode-desc { display: none; }
  body.wfm-dials #play-mode-cards .play-mode-name { font-family: var(--fm); font-size: 13px !important; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
  body.wfm-dials #play-mode-cards .play-mode-name::after { content: none !important; }
  body.wfm-dials #play-mode-cards .play-mode-card.active { background: var(--acc); box-shadow: none; }
  body.wfm-dials #play-mode-cards .play-mode-card.active .play-mode-name { color: #0b0a10; font-weight: 600; }
  body.wfm-dials .play-mode-cards:not(#play-mode-cards) { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  body.wfm-dials .play-mode-cards:not(#play-mode-cards) .play-mode-card { min-height: 54px; padding: 12px 14px; gap: 2px; border-radius: 14px; }
  body.wfm-dials .play-mode-cards:not(#play-mode-cards) .play-mode-desc { font-size: 13px; }
  body.wfm-dials .slider-row { padding: 14px 0 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label val" "track track" "lo hi"; align-items: center; column-gap: 12px; }
  body.wfm-dials .slider-label-wrap, body.wfm-dials .slider-track-wrap { display: contents; }
  body.wfm-dials .slider-label { grid-area: label; font-size: 20px; }
  body.wfm-dials .slider-row .slider-value { grid-area: val; font-size: 26px; min-width: 2ch; text-align: right; padding: 4px 0; }
  body.wfm-dials .slider-row .slider-input { grid-area: track; width: 100%; height: 44px; margin: 4px 0 0; --p: 50%;
    background: linear-gradient(var(--acc), var(--acc)) left center / var(--p) 6px no-repeat, linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)) center / 100% 6px no-repeat; }
  body.wfm-dials .slider-row .slider-input::-webkit-slider-thumb { width: 28px; height: 28px; background: #fff; box-shadow: 0 0 16px color-mix(in srgb, var(--acc) 75%, transparent), 0 2px 8px rgba(0, 0, 0, 0.6); }
  body.wfm-dials .slider-row .slider-input::-moz-range-thumb { width: 28px; height: 28px; background: #fff; }
  body.wfm-dials .slider-range-lo { grid-area: lo; font-size: 11px; justify-self: start; }
  body.wfm-dials .slider-hi { grid-area: hi; margin: 0; font-size: 11px; justify-self: end; text-align: right; }
  body.wfm-dials .toggle-row { min-height: 54px; padding: 8px 0; }
  body.wfm-dials .toggle-label { font-size: 16px; }
  body.wfm-dials .toggle-desc { font-size: 12px; line-height: 1.35; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  body.wfm-dials .toggle-switch { width: 46px; height: 28px; }
  body.wfm-dials .toggle-switch::after { background: #fff; top: 3px; left: 3px; width: 20px; height: 20px; }
  body.wfm-dials .toggle-input:checked + .toggle-switch::after { transform: translateX(18px); background: var(--acc); }
  /* the main button pinned to the bottom (the shared bar) */
  body.wfm-dials .wfm-bar--dials { margin: 0; padding-top: 22px; border: 0; flex-direction: row; gap: 10px; }
  body.wfm-dials .wfm-bar--dials > * { min-height: 52px; font-size: 12px; letter-spacing: 0.08em; line-height: 1.2; text-align: center; white-space: normal; }
  body.wfm-dials .wfm-bar--dials > .btn-primary, body.wfm-dials .wfm-bar--dials > .wf-btn--primary { flex: 1 1 0; letter-spacing: 0.04em; padding-left: 8px; padding-right: 8px; }
  body.wfm-dials .wfm-bar--dials > :not(.btn-primary):not(.wf-btn--primary) { flex: 0 0 29%; }
  body.wfm-dials .dials-actions.wfm-bar { flex-direction: row; }
  body.wfm-dials #eleven-toast, body.wfm-dials .eleven-toast { bottom: calc(var(--wfm-bar-h) + 16px) !important; z-index: 1000; }

  /* ── interview ── */
  body.wfm-chat #wf-slots, body.wfm-chat #wf-story { display: none !important; }   /* its list opens from the "What's built" pill */
  body.wfm-chat .wf-iv-scroll { display: block !important; padding: 14px 0 !important; }
  body.wfm-chat .wf-iv-col { gap: 12px; max-width: none; }
  body.wfm-chat .wfu-note:has(#wf-progress-label) { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -6px 0 8px !important; }
  .wfm-built { flex: none; min-height: 40px; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-family: var(--fm); font-size: 12px; letter-spacing: 0.08em;
    color: var(--acc); background: color-mix(in srgb, var(--acc) 10%, transparent); border: 1px solid color-mix(in srgb, var(--acc) 50%, transparent); }
  body.wfm-chat .wf-msg--guide { align-self: flex-start; max-width: 90%; padding-left: 0; border-left: 0; }
  body.wfm-chat .wf-msg--guide .wf-msg-who, body.wfm-chat .wf-msg--you .wf-msg-who { display: none; }
  body.wfm-chat .wf-msg--guide .wf-msg-text { display: block; padding: 12px 16px; border-radius: 18px 18px 18px 6px; background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bd-2); font-size: 17px; line-height: 1.5; }
  body.wfm-chat .wf-msg--you { max-width: 86%; }
  body.wfm-chat .wf-msg--you .wf-msg-text { padding: 11px 16px; border-radius: 18px 18px 6px 18px; font-size: 15px; }
  body.wfm-chat .wf-iv-empty-h { font-size: 26px; margin: 8px 0 8px; }
  body.wfm-chat .wf-iv-composer { border-top: 0; padding: 6px 0 calc(10px + env(safe-area-inset-bottom)); }
  body.wfm-chat .wf-iv-inner { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "chips" "forge" "box" "hint"; row-gap: 8px; }
  body.wfm-chat .wf-chips { grid-area: chips; margin-bottom: 0; }
  body.wfm-chat .wf-chips:empty { display: none; }
  body.wfm-chat .wf-iv-actions { display: contents; }
  body.wfm-chat #wf-forge { grid-area: forge; justify-self: start; flex: none; width: auto; min-height: 40px; padding: 8px 16px; border-radius: 999px; font-size: 12px; letter-spacing: 0.08em;
    background: color-mix(in srgb, var(--acc) 16%, transparent); color: var(--acc); border: 1px solid color-mix(in srgb, var(--acc) 60%, transparent); box-shadow: none; }
  body.wfm-chat #wf-forge::after { content: "\2192"; margin-left: 8px; }
  body.wfm-chat #wf-forge.wf-btn--dim, body.wfm-chat #wf-forge:disabled { opacity: 0.5; background: transparent; border-color: var(--bd-ctl); color: var(--ink-2); }
  body.wfm-chat #wf-input { grid-area: box; min-height: 56px; max-height: 132px; padding: 16px 62px 14px 18px !important; font-size: 16px; line-height: 1.35; resize: none; box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--acc) 50%, transparent) !important; border-radius: 24px; background: rgba(255, 255, 255, 0.04); }
  body.wfm-chat #wf-answer { grid-area: box; justify-self: end; align-self: end; width: 52px; min-width: 0; height: 40px; min-height: 40px; margin: 0 9px 9px 0; padding: 0; flex: none;
    border-radius: 999px; border: 0; background: var(--acc); color: #0b0a10; font-size: 0; box-shadow: none; z-index: 1; }
  body.wfm-chat #wf-answer::after { content: "\2191"; font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: 0; }
  body.wfm-chat #wf-answer:disabled { opacity: 0.45; }
  body.wfm-chat #wf-hint { grid-area: hint; order: 0; flex: none; text-align: center; font-size: 10.5px; line-height: 1.4; }
  .wfm-sheet #wf-slot-list { margin-top: 0; }
  .wfm-sheet #wf-slot-list .wf-choice { width: 100%; min-height: 54px; }
  .wfm-sheet .wf-iv-hint { margin-top: 10px; font-size: 11px; }
  .wfm-sheet #wf-story-text { margin-top: 0; font-size: 16px; line-height: 1.55; }

  /* ── review: a dossier of collapsible rows, the main button pinned ── */
  body.wfm-review .wf-forge-scroll { padding-top: 10px !important; }
  body.wfm-review .wfu-dossier { padding-bottom: 0; }
  body.wfm-review .wfu-band.wfm-dos { display: block; padding: 0; border-top: 0; }
  body.wfm-review .wfm-dos > .wfu-band-k { flex-wrap: wrap; row-gap: 6px; }
  body.wfm-review .wfm-dos .wfu-bk .dim { display: none; }
  body.wfm-review .wfm-dos .wfu-edit { display: none; flex: 1 0 100%; margin: 4px 0 4px; min-height: 40px; align-items: center; }
  body.wfm-review .wfm-dos.is-open .wfu-edit { display: inline-flex; }
  body.wfm-review .wfm-dos > .wfu-band-c { display: none; padding: 4px 6px 16px; }
  body.wfm-review .wfm-dos.is-open > .wfu-band-c { display: block; }
  body.wfm-review .wfu-wname { font-size: 28px; }
  body.wfm-review .wfu-prow { padding: 12px 0; }
  body.wfm-review .wfu-pl { padding-top: 0; }
  body.wfm-review .wfu-seg { max-width: none; }
  body.wfm-review .wfu-seg button { min-height: 48px; padding: 10px 2px; font-size: 13px; overflow-wrap: anywhere; }
  body.wfm-review .wfm-bar--begin { padding: 22px 14px calc(14px + env(safe-area-inset-bottom)); flex-direction: column; align-items: stretch; gap: 6px; }
  body.wfm-review .wfm-bar--begin .wfu-begin-in { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
  body.wfm-review .wfm-bar--begin .wfu-hint { order: 2; text-align: center; font-size: 10.5px; line-height: 1.4; }
  body.wfm-review .wfm-bar--begin .wf-btn--begin { order: 1; width: 100%; min-height: 56px; padding: 16px 14px; justify-content: center; box-shadow: none !important; }
  body.wfm-review .wfm-bar--begin .wf-btn--begin:hover { box-shadow: none !important; }

  /* ── where you start (forge_start): the choice is one full-width field and its list opens inside the screen ── */
  .wf-pm-start .wfu-pill { display: block; width: 100%; }
  .wf-pm-start .wfu-pill-btn { width: 100%; min-height: 52px; justify-content: space-between; }
  .wf-pm-start .wfu-list { left: 0; right: 0; min-width: 0; max-height: 50vh; }
  .wf-pm-start .wfu-list li { min-height: 48px; justify-content: center; }
  .wf-pm-start .wf-basics-submit { min-height: 56px; }

  /* ── the forging screen (forge_forging): the clock and the list fit the width ── */
  .wf-gen { box-sizing: border-box; max-width: 100vw; }
  .wf-gen-pctrow { flex-wrap: wrap; gap: 4px 12px; }
}
