/* Fstep compact layouts. Deliberate reflow, not page-wide overflow clipping.
   Existing desktop, content, authentication and tool behavior stay unchanged. */
.mobile-choice-toggle { display: none; }
@media (max-width: 1023px) {
  #productSidebar { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  #productWorkspace > .topbar { padding-left: max(var(--shell-gutter), env(safe-area-inset-left)); padding-right: max(var(--shell-gutter), env(safe-area-inset-right)); }
}
@media (min-width: 760px) and (max-width: 1023px) {
  #productWorkspace .product-view > section.module-hero:first-child { grid-template-columns: minmax(0,1fr) 160px; gap: 20px; }
  #appPage .module-hero-art { display: none; }
  #appPage .module-features { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  #appPage .module-feature strong { font-size: 13px; line-height: 1.6; }
  #appPage .ency-layout { display: flex; flex-direction: column; gap: 20px; }
  #appPage .ency-primary { width: 100%; }
  #appPage .ency-primary .module-hero { grid-template-columns: minmax(0,1fr); }
  #appPage .ency-learning-rail { width: 100%; grid-template-columns: repeat(2,minmax(0,1fr)); }
  #appPage .ency-rail-panel:last-child { grid-column: 1/-1; }
}
@media (max-width: 759px) {
  #appPage { --shell-gutter: 16px; }
  #productWorkspace > .topbar { height: 64px; min-height: 64px; gap: 8px; }
  #appPage .mobile-shell-brand { gap: 2px; }
  #appPage .mobile-shell-brand .brand { font-size: 18px; }
  #productWorkspace :is(.product-view, .container, .module-hero-copy, .account-panel) { min-width: 0; }
  #productWorkspace > .guest-banner { position: static; display: flex; flex-wrap: wrap; gap: 8px 12px; padding-block: 12px; font-size: 13px; line-height: 1.7; }
  #productWorkspace > .guest-banner > div { min-width: 0; flex: 1 1 190px; }
  #productWorkspace > .guest-banner button { min-height: 44px; padding: 8px 12px; flex-shrink: 0; }
  #productWorkspace .product-view > section.module-hero:first-child,
  #appPage .ency-primary .module-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-height: 0; padding: 24px 0 20px; }
  #appPage .module-hero h1, #appPage .ency-primary .module-hero h1 { font-size: 28px; line-height: 1.35; margin: 0 0 8px; overflow-wrap: anywhere; }
  #appPage .module-hero-copy > p, #appPage .ency-primary .module-hero-copy > p { font-size: 14px; line-height: 1.8; margin: 0; }
  #appPage .module-hero :is(.library-count, .tool-total) { display: flex; flex-direction: row; align-items: baseline; gap: 7px; justify-content: flex-start; min-height: 0; min-width: 0; width: fit-content; max-width: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; white-space: normal; }
  #appPage .module-hero :is(.library-count, .tool-total)::after { display: none; }
  #appPage .module-hero :is(.library-count, .tool-total) strong { font-size: 22px; line-height: 1.4; }
  #appPage .module-hero :is(.library-count, .tool-total) span { font-size: 13px; margin: 0; color: #68748a; }
  #appPage .resume-counts { display: flex; flex-wrap: wrap; gap: 10px 20px; }
  #appPage .resume-counts > div { display: flex; align-items: baseline; gap: 6px; padding: 0; min-height: 0; border: 0; background: none; }
  #appPage .resume-counts > div::after { display: none; }
  #appPage .resume-counts strong { font-size: 22px; }
  #appPage .resume-counts span { font-size: 13px; }
  #appPage :is(.library-panel,.skill-panel,.tool-directory,.ency-directory,.knowledge-panel,.resume-panel,.workshop-catalog) { padding: 16px; border-radius: 12px; margin-bottom: 28px; }
  #appPage :is(.feed-heading,.skill-toolbar,.tool-directory-head,.knowledge-toolbar) { padding: 0 0 16px; gap: 14px; }
  #appPage :is(.feed-heading,.skill-toolbar,.tool-directory-head,.knowledge-toolbar) h2 { font-size: 21px; }
  #appPage :is(.feed-heading,.skill-toolbar,.tool-directory-head,.knowledge-toolbar) p { font-size: 13px; line-height: 1.7; }
  #appPage :is(.search,.tool-search,.ency-search) { width: 100%; max-width: none; min-height: 48px; }
  #appPage :is(.search,.tool-search,.ency-search) input { font-size: 16px; width: 0; min-width: 0; }
  #appPage :is(.search,.tool-search,.ency-search) button { min-width: 64px; min-height: 44px; font-size: 14px; padding-inline: 12px; }
  #appPage :is(.filter-chip,.type-filter,.tool-filter,.knowledge-filter,.knowledge-sub-filter,.ency-filter) { min-height: 44px; max-width: 100%; font-size: 13px; line-height: 1.6; padding: 9px 11px; white-space: normal; overflow-wrap: anywhere; }
  #appPage :is(.category-chips,.type-filters,.knowledge-primary-filters,.knowledge-sub-filters,.ency-filters) { gap: 8px; flex-wrap: wrap; overflow: visible; }
  #appPage .skill-filters { gap: 12px; margin: 16px 0; }
  #appPage .knowledge-filter-block { padding: 16px 0; }
  #appPage [data-mobile-extra="true"], #encyToc [data-mobile-extra="true"] { display: none; }
  #appPage #skillCategoryFilters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mobile-choice-toggle:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 4px; margin: 3px 0 8px; border: 0; background: transparent; font: inherit; font-size: 13px; color: #6541e9; cursor: pointer; }
  .mobile-choice-toggle::after { content: '⌄'; font-size: 17px; }
  .mobile-choice-toggle[aria-expanded="true"]::after { content: '⌃'; }
  .mobile-choice-toggle:focus-visible { outline: 2px solid #6541e9; outline-offset: 2px; }
  #appPage .hotspot-heading { flex-wrap: wrap; align-items: baseline; gap: 5px 12px; }
  #appPage .hotspot-heading h2 { font-size: 21px; }
  #appPage .hotspot-heading > span { max-width: 100%; text-align: left; font-size: 12px; }
  #appPage .hotspot-lead-content { min-height: 0; padding: 20px; }
  #appPage .hotspot-lead h3 { display: block; font-size: 21px; line-height: 1.55; overflow: visible; -webkit-line-clamp: unset; }
  #appPage .hotspot-lead-content > p { font-size: 14px; line-height: 1.8; }
  #appPage .hotspot-lead-meta { font-size: 12px; }
  #appPage .hotspot-lead-meta > span:last-child { margin-left: 0; }
  #appPage .hotspot-row { min-height: 72px; padding: 10px 0; align-items: start; }
  #appPage .hotspot-copy h3 { display: block; font-size: 15px; line-height: 1.6; overflow: visible; -webkit-line-clamp: unset; }
  #appPage .hotspot-copy time { font-size: 12px; line-height: 1.6; }
  #appPage .article-row { grid-template-columns: minmax(0,1fr) 84px; gap: 12px; align-items: start; padding: 20px 0; }
  #appPage .article-thumbnail { width: 84px; height: 64px; margin-top: 3px; }
  #appPage .article-row h3 { font-size: 17px; line-height: 1.65; display: block; overflow: visible; -webkit-line-clamp: unset; overflow-wrap: anywhere; }
  #appPage .article-row p { font-size: 14px; line-height: 1.8; }
  #appPage .article-meta { flex-wrap: wrap; font-size: 12px; gap: 7px; }
  #appPage .article-tags { flex-wrap: wrap; }
  #appPage .article-tags span { font-size: 12px; white-space: normal; }
  #appPage .read-action { opacity: 1; transform: none; font-size: 12px; }
  #appPage .skill-card { padding: 18px; }
  #appPage .skill-card-top { padding-left: 56px; min-height: 48px; }
  #appPage .skill-card-top > .topic-icon { left: 18px; top: 18px; }
  #appPage .skill-card h3 { margin: 8px 0 14px; font-size: 19px; line-height: 1.6; display: block; overflow: visible; -webkit-line-clamp: unset; }
  #appPage .skill-card > p { margin-left: 0; font-size: 15px; line-height: 1.85; display: block; overflow: visible; -webkit-line-clamp: unset; }
  #appPage .skill-card-facts { margin-left: 0; font-size: 12px; }
  #appPage .skill-card-tags { margin-left: 0; }
  #appPage :is(.skill-card-tags span,.skill-category,.skill-type,.tool-card-tags span,.knowledge-row-meta span) { font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
  #appPage .skill-platforms { font-size: 12px; flex-basis: 100%; }
  #appPage .skill-action { font-size: 13px; }
  #appPage .ency-item { display: grid; grid-template-columns: minmax(0,1fr) 80px; align-items: start; gap: 12px; }
  #appPage .ency-item-copy { min-width: 0; }
  #appPage .ency-item > .semantic-concept { width: 80px; margin-top: 34px; aspect-ratio: 1; }
  #appPage .ency-item > .semantic-concept svg { width: 100%; height: 100%; }
  #appPage .ency-item h2 { font-size: 18px; line-height: 1.65; }
  #appPage .ency-item p { font-size: 14px; line-height: 1.85; }
  #appPage .ency-meta { flex-wrap: wrap; gap: 6px; }
  #appPage .ency-meta span { font-size: 12px; }
  #appPage .ency-head > div { flex-wrap: wrap; gap: 6px; }
  #appPage .ency-learning-rail { gap: 12px; }
  #appPage .ency-path-copy strong { font-size: 15px; line-height: 1.7; }
  #appPage .ency-path-copy small { font-size: 13px; }
  #appPage .tool-card-summary { font-size: 15px; line-height: 1.85; }
  #appPage .tool-card h2 { overflow-wrap: anywhere; }
  #appPage .tool-card-footer { font-size: 13px; flex-wrap: wrap; }
  #appPage .knowledge-row { padding: 18px; }
  #appPage .knowledge-row h3 { font-size: 18px; line-height: 1.7; display: block; overflow: visible; -webkit-line-clamp: unset; }
  #appPage .knowledge-row-content > p { font-size: 14px; line-height: 1.85; }
  #appPage .knowledge-row-bottom { flex-wrap: wrap; gap: 8px; font-size: 12px; }
  #appPage .resume-toolbar { gap: 12px; padding: 18px 0; }
  #appPage .resume-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; gap: 10px; }
  #appPage .resume-filters select { width: 100%; min-width: 0; min-height: 48px; font-size: 16px; }
  #appPage .resume-filters select:last-child { grid-column: 1/-1; }
  #appPage .resume-template-card { grid-template-columns: 64px minmax(0,1fr); gap: 14px; padding: 20px 0; }
  #appPage .resume-card-preview { width: 64px; height: 88px; }
  #appPage .resume-row h3 { font-size: 18px; line-height: 1.6; overflow-wrap: anywhere; }
  #appPage .resume-row p { font-size: 14px; line-height: 1.8; }
  #appPage .resume-card-actions { display: flex; gap: 8px; flex-wrap: wrap; grid-column: 1/-1; }
  #appPage .resume-card-actions > button { min-width: 0; min-height: 44px; flex: 1 1 70px; padding-inline: 8px; }
  #appPage .resume-summary { font-size: 14px; }
  #appPage :is(.pagination,.tool-pagination,.ency-pagination,.account-pagination) { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; padding-bottom: 4px; }
  #appPage :is(.pagination,.tool-pagination,.ency-pagination,.account-pagination) button { min-height: 44px; padding: 9px 11px; }
  #appPage :is(.notice,.account-error) { flex-wrap: wrap; gap: 12px; margin-inline: 0; padding: 16px; overflow-wrap: anywhere; }
  #appPage :is(.empty-state,.tool-state,.ency-state) { padding: 32px 16px; margin-inline: 0; }
  #appPage .workshop-tool { grid-template-columns: 44px minmax(0,1fr); gap: 12px; align-items: start; padding: 24px 0; }
  #appPage .workshop-tool-symbol { width: 44px; height: 48px; }
  #appPage .workshop-tool h2 { font-size: 19px; line-height: 1.6; overflow-wrap: anywhere; }
  #appPage .workshop-tool p { font-size: 15px; line-height: 1.85; }
  #appPage .workshop-format-chips span { font-size: 12px; }
  #appPage .workshop-tool .workshop-button { grid-column: 1/-1; width: 100%; justify-self: stretch; }
  #appPage .workshop-shell { overflow: visible; }
  #appPage :is(.workshop-workspace,.workshop-notes,.workshop-extra) { padding: 20px 16px; }
  #appPage .workshop-breadcrumb { font-size: 14px; gap: 8px; }
  #appPage .workshop-breadcrumb > span:last-child { overflow-wrap: anywhere; min-width: 0; }
  #appPage :is(.workshop-extra,.workshop-shell,.workshop-breadcrumb) { scroll-margin-top: 80px; }
  #appPage .workshop-view :is(input,select,textarea) { max-width: 100%; min-width: 0; font-size: 16px; }
  #appPage .workshop-view input:not([type=checkbox],[type=radio],[type=range]) { min-height: 44px; }
  #appPage .workshop-view input[type=file] { width: 100%; overflow: hidden; }
  #appPage .workshop-view input::file-selector-button { min-height: 44px; max-width: 100%; }
  #appPage :is(.workshop-description,.workshop-notes p,.workshop-notes ol,.workshop-submit-row p,.workshop-upload p,.workshop-extra-note) { font-size: 14px; line-height: 1.85; }
  #appPage .workshop-submit-row { flex-direction: column; align-items: stretch; }
  #appPage .workshop-submit-row p { min-width: 0; }
  #appPage .workshop-submit-row .workshop-button { width: 100%; }
  #appPage :is(.workshop-preview-head,.workshop-search-pages,.workshop-extra-actions) { flex-wrap: wrap; }
  #appPage .workshop-editor-viewport { border: 1px solid #e4e4f0; border-radius: 8px; max-width: 100%; }
  #appPage .workshop-editor-heading button { min-height: 44px; }
  #appPage .account-page { padding: 24px var(--shell-gutter) 32px; }
  #appPage .account-heading p { font-size: 14px; line-height: 1.8; }
  #appPage .account-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); padding: 6px; gap: 4px; }
  #appPage .account-tabs button { font-size: 13px; padding: 8px 4px; min-height: 44px; }
  #appPage .account-panel { padding: 22px 16px; }
  #appPage .account-panel > p { font-size: 14px; }
  #appPage .account-permission { flex-wrap: wrap; font-size: 14px; }
  #appPage .account-row-actions { align-self: stretch; flex-wrap: wrap; }
  #appPage .account-row-actions > button { flex: 1; }
  #appPage .account-field input, #appPage .account-search :is(input,select) { font-size: 16px; }
  #appPage .account-facts dd { overflow-wrap: anywhere; }
  #appPage footer .container { padding-block: 24px max(24px,env(safe-area-inset-bottom)); gap: 12px; }
  #appPage footer a { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
  /* Separate scrollable reading surfaces; nothing is cropped to hide overflow. */
  .modal-backdrop, body.authenticated .modal-backdrop { padding: max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); height: var(--mobile-visual-height,100dvh); bottom: auto; top: var(--mobile-visual-top,0px); }
  :is(.article-modal,.skill-modal,.knowledge-modal,.resume-modal) { min-width: 0; max-width: 100%; max-height: calc(var(--mobile-visual-height,100dvh) - 24px); overscroll-behavior: contain; }
  :is(.tool-dialog,.ency-dialog,.feedback-dialog,.skill-membership-dialog) { max-width: calc(100% - 16px); max-height: calc(var(--mobile-visual-height,100dvh) - 24px); }
  .ency-dialog { display: flex; flex-direction: column; }
  .ency-dialog:not([open]) { display: none; }
  .ency-dialog-bar { flex: none; }
  .ency-reading-scroll { min-height: 0; max-height: none; }
  :is(.modal-header,.tool-dialog-head,.feedback-head) { padding: 12px 16px; gap: 12px; }
  :is(.modal-header,.feedback-head) button { width: 44px; height: 44px; flex: none; }
  :is(.article-detail,.skill-detail,.knowledge-detail,.resume-detail,.tool-detail-body,.ency-reading) { padding: 24px 18px 32px; min-width: 0; }
  :is(.article-detail,.skill-detail,.knowledge-detail,.resume-detail,.ency-content) h1 { font-size: 24px; line-height: 1.6; overflow-wrap: anywhere; }
  :is(.article-content,.knowledge-content,.encyclopedia-prose) { font-size: 16px; line-height: 1.95; overflow-wrap: anywhere; }
  :is(.article-content,.knowledge-content,.encyclopedia-prose) :is(img,svg,video,iframe) { max-width: 100%; }
  :is(.article-content,.knowledge-content,.encyclopedia-prose) img { height: auto; }
  :is(.article-content,.knowledge-content,.encyclopedia-prose,.skill-detail) table { display: block; max-width: 100%; overflow: auto; }
  :is(.article-content,.knowledge-content,.encyclopedia-prose,.skill-detail,.knowledge-template) pre { max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
  :is(.skill-detail,.knowledge-detail) .section-title-row { flex-wrap: wrap; gap: 10px; }
  :is(.copy-button,.download-button,.feedback-remove) { min-height: 44px; max-width: 100%; white-space: normal; }
  .ency-toc-links { display: flex; flex-direction: column; gap: 0; }
  .ency-toc-link { font-size: 14px; min-height: 44px; }
  .feedback-label { flex-wrap: wrap; font-size: 14px; }
  .feedback-label small { white-space: nowrap; }
  :is(.auth-form input,.feedback-body textarea) { font-size: 16px; }
  .auth-form input[type=checkbox] { flex: none; }
  .auth-modal, #authModal.welcome-auth .auth-modal { max-height: calc(var(--mobile-visual-height,100dvh) - 24px); overscroll-behavior: contain; scroll-padding-block: 24px; }
  .toast-stack { top: calc(64px + max(8px,env(safe-area-inset-top))); bottom: auto; pointer-events: none; }
  /* Brief status updates must not pile up over the keyboard or primary action. */
  .toast-stack .toast:not(:last-child) { display: none; }
  body[data-mobile-keyboard="true"] dialog[open] { top: var(--mobile-visual-top,0px); bottom: auto; margin-top: 8px; }
  .welcome-page { padding: max(24px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left)); }
  .welcome-bottom { flex-wrap: wrap; }
  .welcome-bottom nav { flex-wrap: wrap; gap: 0 18px; flex-shrink: 1; }
}
@media (max-width: 359px) {
  #appPage { --shell-gutter: 12px; }
  #appPage .mobile-shell-brand .brand { font-size: 17px; gap: 6px; }
  #productWorkspace > .topbar .guest-actions { gap: 4px; }
  #productWorkspace > .topbar .guest-actions button { padding-inline: 8px; min-height: 44px; font-size: 12px; }
  #appPage .article-row { grid-template-columns: minmax(0,1fr); }
  #appPage .article-thumbnail { grid-row: 1; width: 100%; height: auto; aspect-ratio: 16/9; margin-top: 0; }
  #appPage .ency-item { grid-template-columns: minmax(0,1fr); }
  #appPage .ency-item > .semantic-concept { grid-row: 1; width: 100%; aspect-ratio: 5/3; margin: 0; }
  #appPage .resume-filters { grid-template-columns: minmax(0,1fr); }
  #appPage .skill-card h3 { margin-left: 0; }
  #appPage :is(.pagination,.tool-pagination,.ency-pagination) > span { flex-basis: 100%; text-align: center; order: -1; }
}
@media (max-width: 759px) and (max-height: 700px) {
  .welcome-content { margin-top: 30px; }
  .welcome-page { min-height: 100svh; }
}
