/* v48: scoped screen-only layout. No scoring, report-image or print changes. */
@media screen {
  .portal-page { font-size: 1.125rem; }
  .portal-page .page-shell { width: min(76rem, calc(100% - 32px)); padding: 20px 0 24px; }
  .portal-page .portal-header { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: 16px; margin-bottom: 24px; }
  .portal-page .brand-bar { padding: 0; }
  .portal-page .brand-name { max-width: none; font-size: .875rem; line-height: 1.45; overflow-wrap: anywhere; }
  .portal-page .brand-logo-wrap { width: 34px; height: 34px; flex-basis: 34px; }
  .portal-page .brand-unit { gap: 7px; padding: 0; min-height: 44px; text-align: left; }
  .portal-page .brand-divider { min-width: 12px; font-size: 1rem; }
  .portal-page .hero { padding: 0; }
  .portal-page .hero h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.3; letter-spacing: 0; }
  .portal-page .hero p { display: block; margin-top: 6px; font-size: 1rem; line-height: 1.5; }
  .portal-page .utility-row { min-height: 0; }
  .portal-page .theme-toggle { position: static; width: 48px; min-width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 14px; box-shadow: none; }
  .portal-page .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .portal-page .version-grid { align-items: start; grid-auto-rows: auto; gap: 24px; }
  .portal-page .version-card { min-height: 0; padding: 26px; border-radius: 24px; box-shadow: var(--shadow-soft); }
  .portal-page .version-card::before { height: 5px; }
  .portal-page .version-card::after { content: none; }
  .portal-page .card-head { flex-wrap: wrap; gap: 8px; }
  .portal-page .version-badge { min-height: 32px; padding: 4px 10px; font-size: 1rem; }
  .portal-page .version-time { white-space: normal; font-size: 1rem; }
  .portal-page .version-card h2 { margin: 16px 0 6px; font-size: 2rem; line-height: 1.3; }
  .portal-page .card-subtitle { margin: 0; color: var(--muted); font-size: 1.125rem; line-height: 1.6; font-weight: 500; }
  .portal-page .card-action { margin-top: 22px; }
  .portal-page .version-button { min-height: 56px; padding: 12px; border-radius: 14px; box-shadow: 0 3px 0 var(--button-shadow); font-size: 1.25rem; }
  .portal-page .advanced .version-button { background: #996020; }
  .portal-page .advanced .version-badge { color: #8a4e17; }
  .portal-page .quick .version-badge { color: #315f40; }
  html[data-theme="dark"] .portal-page .version-button { background: var(--card-accent); color: #152019; }
  html[data-theme="dark"] .portal-page .advanced .version-badge { color: var(--advanced); }
  html[data-theme="dark"] .portal-page .quick .version-badge { color: var(--quick); }
  .portal-page .version-details { margin-top: 12px; border-top: 1px solid var(--line); }
  .portal-page .version-details summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 12px; padding-top: 6px; color: var(--muted); font-size: 1.125rem; cursor: pointer; list-style: none; }
  .portal-page .version-details summary::-webkit-details-marker { display: none; }
  .portal-page .version-details summary::after { content: "+"; font-size: 1.4rem; flex-shrink: 0; }
  .portal-page .version-details[open] summary::after { content: "−"; }
  .portal-page .version-details summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
  .portal-page .feature-list { margin: 12px 0 4px; gap: 10px; }
  .portal-page .feature-list li { min-width: 0; grid-template-columns: 22px minmax(0, 1fr); font-size: 1.125rem; line-height: 1.55; }
  .portal-page .library-entry { min-height: 48px; width: fit-content; max-width: 100%; margin: 20px auto 0; padding: 8px 16px; border: 0; background: transparent; box-shadow: none; color: var(--ink); font-size: 1.125rem; text-align: center; }
  .portal-page :is(h1, h2, p, a, summary, li) { overflow-wrap: anywhere; }

  /* Keep theme controls in normal header flow, away from answers and actions. */
  .assessment-header { grid-template-columns: minmax(0, 1fr) auto 48px; gap: 12px; }
  .assessment-header .assessment-theme-toggle { position: static; align-self: center; box-shadow: none; backdrop-filter: none; }
  .assessment-header .assessment-brand strong { font-size: 1.25rem; }
  .assessment-header .assessment-brand small { font-size: 1rem; }
  .assessment-header .assessment-chip { font-size: 1.125rem; }
  .assessment-intro { min-height: 0; padding: clamp(24px, 3vw, 40px); }
  .assessment-intro-copy h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.25; letter-spacing: 0; }
  .assessment-intro-description { min-height: 0; font-size: 1.125rem; }
  .assessment-feature-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
  .assessment-feature-row span { min-height: 0; padding: 6px 10px; font-size: 1.125rem; border-radius: 10px; }
  .assessment-start-button.button.large { height: auto; min-height: 56px; padding: 12px 18px; font-size: 1.25rem; }
  .assessment-intro-stack article { min-height: 0; }
  body.quick-page .page-frame { min-height: 0; }
  body.quick-page .app-shell { min-height: 0; }
  .assessment-intro, .assessment-intro > *, .assessment-brand, .quick-question-title > div { min-width: 0; }
  .skip-link:not(:focus) { width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  html { scroll-padding-bottom: 130px; }
  .choice-button, .quick-option, .quick-scale-button, .field { scroll-margin-bottom: 130px; }
  .quick-question-card, .main-panel { scroll-margin-bottom: 110px; }
  .quick-question-card .form-actions, .screen-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-question-card .form-actions .button, .screen-actions .button { min-width: 0; white-space: normal; height: auto; min-height: 56px; font-size: 1.125rem; overflow-wrap: anywhere; }
  body.quick-page .quick-question-card .form-actions .button { width: 100%; margin-left: 0; font-size: 1.125rem; }
  body.quick-page .quick-question-card .quick-option,
  body.quick-page .quick-question-card .quick-scale-button,
  body.quick-page .quick-question-card .quick-matrix-row legend { font-size: 1.125rem; }
  .quick-question-card .quick-option, .quick-question-card .quick-scale-button { font-size: 1.125rem; min-height: 56px; height: auto; overflow-wrap: anywhere; }
  .quick-question-card .quick-matrix-row legend { font-size: 1.125rem; }
  .screen :is(.choice-copy strong, .field input, .field select, .field > span) { font-size: 1.125rem; }
  .screen .choice-button { min-height: 56px; }
  .screen .choice-copy { line-height: 1.4; }
  .screen .choice-copy small { font-size: 1rem; line-height: 1.4; }
  .screen .choice-grid.scale { grid-template-columns: repeat(auto-fit, minmax(min(100%, 6.5rem), 1fr)); }
  .screen .field input, .screen .field select { min-width: 0; max-width: 100%; }
  .screen-actions { background: var(--assessment-surface); backdrop-filter: none; }

  @media (max-width: 1100px) {
    .portal-page .portal-header { grid-template-columns: minmax(0, 1fr) 48px; gap: 12px; }
    .portal-page .brand-bar { width: min(100%, 430px); justify-self: start; }
    .portal-page .utility-row { grid-column: 2; grid-row: 1; }
    .portal-page .hero { grid-row: 2; grid-column: 1 / -1; }
  }
  @media (max-width: 760px) {
    .assessment-intro { grid-template-columns: minmax(0, 1fr); width: 100%; left: auto; transform: none; padding: 22px 18px; }
    .assessment-intro-description { min-height: 0; }
    .assessment-feature-row { margin: 14px 0 18px; }
    .assessment-intro-copy h1 { font-size: 2rem; }
    .assessment-header { width: calc(100% - 24px); }
    body.quick-page .page-frame { padding: 10px 12px 20px; }
    body[data-app-context="v2"] .app-frame { width: calc(100% - 24px); }
  }
  @media (max-width: 600px) {
    .portal-page .page-shell { width: calc(100% - 24px); padding: 10px 0 18px; }
    .portal-page .portal-header { gap: 10px; margin-bottom: 14px; }
    .portal-page .brand-lockup { gap: 4px; }
    .portal-page .brand-name { font-size: .75rem; line-height: 1.4; }
    .portal-page .brand-logo-wrap { width: 28px; height: 28px; flex-basis: 28px; }
    .portal-page .brand-unit { gap: 5px; }
    .portal-page .brand-divider { min-width: 8px; }
    .portal-page .hero h1 { font-size: 1.5rem; }
    .portal-page .hero p { margin-top: 3px; font-size: 1rem; }
    .portal-page .version-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .portal-page .version-card { padding: 14px 16px 4px; border-radius: 20px; }
    .portal-page .version-card h2 { margin: 8px 0 4px; font-size: 1.5rem; }
    .portal-page .card-subtitle { font-size: 1.125rem; line-height: 1.45; }
    .portal-page .card-action { margin-top: 12px; }
    .portal-page .version-button { min-height: 52px; padding: 10px; font-size: 1.125rem; }
    .portal-page .version-details { margin-top: 10px; }
    .portal-page .version-details summary { min-height: 44px; padding: 0; }
    .portal-page .library-entry { margin-top: 12px; }
    .assessment-header { grid-template-columns: minmax(0, 1fr) 48px; gap: 4px 10px; margin-top: 0; }
    .assessment-header .assessment-theme-toggle { grid-row: 1 / 3; grid-column: 2; }
    .assessment-header .assessment-brand { gap: 8px; }
    .assessment-header .assessment-brand img { width: 36px; height: 36px; flex-basis: 36px; }
    .assessment-header .assessment-brand strong { font-size: 1.125rem; line-height: 1.4; }
    .assessment-header .assessment-brand small { display: none; }
    .assessment-header .assessment-chip { justify-self: start; min-height: 28px; padding: 2px 8px; font-size: 1rem; border: 0; border-radius: 6px; }
    .quick-question-card .quick-scale { grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.5rem), 1fr)); gap: 8px; }
    .quick-question-card .quick-option-grid, .quick-question-card .quick-option-grid.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
    .quick-question-card .form-actions { display: grid; position: sticky; z-index: 30; bottom: 0; margin-top: 16px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--assessment-surface); }
    .screen-actions { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
    .quick-question-card .form-actions .button, .screen-actions .button { padding-inline: 8px; }
    .screen .choice-grid.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
    .screen .choice-grid.scale { grid-template-columns: minmax(0, 1fr); }
    .screen-title, body.quick-page .quick-question-card .quick-question-title h1 { font-size: 1.5rem; line-height: 1.4; }
  }
  @media (min-width: 900px) and (orientation: landscape) {
    .assessment-intro { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
    .screen .choice-copy strong, .screen .field input, .screen .field select,
    .quick-question-card .quick-option, .quick-question-card .quick-scale-button { font-size: 1.25rem; }
  }
  @media (max-height: 680px) and (min-width: 900px) and (orientation: landscape) {
    .portal-page .page-shell { padding-top: 12px; }
    .portal-page .portal-header { margin-bottom: 14px; }
    .portal-page .version-card { padding: 18px 22px 8px; }
    .portal-page .card-action { margin-top: 14px; }
    .assessment-intro { padding: 22px 26px; }
  }
}
