/* Mobile spacing follows the 24.375rem design. Each row can grow with its content. */
@media (max-width: 600px), (orientation: landscape) and (pointer: coarse) and (max-height: 500px) {
  :is(#modal[data-kind], #recovery-modal[data-step], #account-flow-modal[data-flow]) {
    --dialog-gutter: 1.1875rem;
    --dialog-edge: max(1rem, env(safe-area-inset-left), env(safe-area-inset-right));
    --dialog-top: max(1.125rem, env(safe-area-inset-top));
    --dialog-bottom: max(1.125rem, env(safe-area-inset-bottom));
    --dialog-height: var(--auth-viewport-height, 100dvh);
    position: fixed;
    inset: auto var(--dialog-edge) calc(var(--auth-viewport-bottom, 0px) + var(--dialog-bottom));
    width: calc(100% - 2 * var(--dialog-edge));
    height: auto;
    min-height: 0;
    max-width: none;
    max-height: max(0px, calc(var(--dialog-height) - var(--dialog-top) - var(--dialog-bottom)));
    margin: 0 auto;
    overflow: hidden auto;
    overscroll-behavior: contain;
    scroll-padding-block: 0.75rem;
  }

  :is(#modal[data-kind], #recovery-modal[data-step], #account-flow-modal[data-flow]) :is(h2, h3, p, button, label) {
    overflow-wrap: anywhere;
  }

  #modal[data-kind]:not([data-kind="sign-in"], [data-kind="create-profile"], [data-kind="account"], [data-kind="sign-out"], [data-kind="rename-list"], [data-kind="pitch-deck-pdf"]) > h2 {
    width: auto;
    height: auto;
    margin-inline: 0;
    padding-inline: 0 3.375rem;
    font-size: 1.4375rem;
    line-height: 1.875rem;
  }

  #modal[data-kind]:not([data-kind="sign-in"], [data-kind="create-profile"], [data-kind="account"], [data-kind="sign-out"], [data-kind="pitch-deck-pdf"]) .modal-info {
    font-size: 0.9375rem;
    line-height: 1.5rem;
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"], #modal[data-kind="account"]) > h2,
  #recovery-modal[data-step] .recovery-header,
  #account-flow-modal[data-flow] .account-flow-header {
    position: static;
    width: auto;
    height: auto;
    min-height: 5.125rem;
    margin: 0;
    padding: 1.0625rem 3.375rem 0.625rem var(--dialog-gutter);
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"], #modal[data-kind="account"]) > h2,
  #modal[data-kind="sign-out"] h2,
  #recovery-modal[data-step] .recovery-header h2,
  #account-flow-modal[data-flow] .account-flow-header h2 {
    font-size: 1.3125rem;
    line-height: 1.875rem;
  }

  #recovery-modal[data-step] .recovery-header :is(h2, p),
  #account-flow-modal[data-flow] .account-flow-header :is(h2, p) {
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) > h2::after,
  #recovery-modal[data-step] .recovery-header p,
  #account-flow-modal[data-flow] .account-flow-header p,
  #modal[data-kind="account"] .account-modal-subtitle {
    position: static;
    display: block;
    margin: 0.1875rem 0 0;
    font-size: 0.75rem;
    line-height: 1.3125rem;
  }
  #modal[data-kind="sign-in"] > h2::after { content: "Access your intro lists"; }
  #modal[data-kind="create-profile"] > h2::after { content: "Create an account with Google or email"; }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) > :is(.brand, .social[data-provider="apple"]) { display: none; }

  #modal[data-kind="sign-in"] {
    --google-gap: 1.5625rem;
    --divider-gap: 1rem;
    --auth-form-gap: 1.25rem;
    --auth-field-gap: 1.0625rem;
    --auth-error-gap: 0.3125rem;
    --auth-footer-gap: 1.5625rem;
    padding: 0 0 2.625rem;
  }

  #modal[data-kind="create-profile"] {
    --google-gap: 1.1875rem;
    --divider-gap: 1.125rem;
    --auth-form-gap: 0.625rem;
    --auth-field-gap: 0.125rem;
    --auth-error-gap: 0.5rem;
    --auth-footer-gap: 0.875rem;
    padding: 0 0 2.3125rem;
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .social[data-provider="google"] {
    position: relative;
    inset: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 2 * var(--dialog-gutter));
    height: auto;
    min-height: 2.875rem;
    margin: var(--google-gap) var(--dialog-gutter) 0;
    padding-block: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .social[data-provider="google"] b {
    top: 50%;
    transform: translateY(-50%);
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .divider {
    position: static;
    width: auto;
    height: auto;
    min-height: 1.6875rem;
    margin: var(--divider-gap) var(--dialog-gutter) 0;
    font-size: 0.75rem;
    line-height: 1.3125rem;
  }
  #modal[data-kind="sign-in"] .divider {
    min-height: 1.875rem;
    grid-template-columns: minmax(0, 95fr) minmax(0, 10.3125rem) minmax(0, 55fr);
    column-gap: 0;
  }
  #modal[data-kind="create-profile"] .divider { font-size: 0.8125rem; }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) form[data-auth-form] {
    position: static;
    display: grid;
    width: auto;
    margin: var(--auth-form-gap) var(--dialog-gutter) 0;
    padding: 0;
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) form[data-auth-form]
    :is(.signup-name-row, .signup-name-field, label, #auth-first_name, #auth-last_name, #auth-email, #auth-password,
        #auth-first_name-error, #auth-last_name-error, #auth-email-error, #auth-password-error, .signup-policy, .text-link[data-action="forgot"]) {
    position: static;
    inset: auto;
    translate: none;
    width: auto;
    height: auto;
    margin: var(--auth-row-margin, 0);
  }

  #modal[data-kind="create-profile"] .signup-name-row,
  #modal[data-kind="create-profile"] .signup-name-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.125rem;
  }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) label {
    min-height: 1.5625rem;
    font-size: 0.875rem;
    line-height: 1.5625rem;
  }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) form[data-auth-form] [data-auth-field] {
    min-height: 3rem;
    --auth-row-margin: 0.25rem 0 0;
    font-size: 0.875rem;
    line-height: 1.375rem;
  }
  #modal[data-kind="create-profile"] form[data-auth-form] .signup-name-field [data-auth-field] { --auth-row-margin: 0.125rem 0 0; }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) form[data-auth-form] :is(label[for="auth-password"], .signup-name-row + label) {
    --auth-row-margin: var(--auth-field-gap) 0 0;
  }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) form[data-auth-form] .field-error {
    padding-top: 0.25rem;
    overflow-wrap: anywhere;
    font-size: 0.6875rem;
    line-height: 1rem;
  }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .field-error:empty { display: none; }
  #modal #auth-email-error[data-duplicate-email] button { min-height: 1.5rem; font-size: inherit; }
  #modal[data-kind="sign-in"] form[data-auth-form] .text-link[data-action="forgot"] {
    justify-self: end;
    min-height: 2.0625rem;
    --auth-row-margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.3125rem;
  }
  #modal[data-kind="create-profile"] form[data-auth-form] .signup-policy {
    --auth-row-margin: 0.75rem 0 0;
    font-size: 0.75rem;
    line-height: 1.25rem;
  }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) form[data-auth-form] > .error {
    position: static;
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    min-height: 0.875rem;
    font-size: 0.6875rem;
    line-height: 1rem;
  }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) form[data-auth-form] > .primary {
    position: static;
    display: block;
    width: 100%;
    margin: var(--auth-error-gap) 0 0;
    translate: none;
    height: auto;
    min-height: 2.875rem;
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .modal-bottom {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0 0.375rem;
    width: auto;
    height: auto;
    min-height: 2.0625rem;
    margin: var(--auth-footer-gap) var(--dialog-gutter) 0;
    padding: 0;
  }

  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .modal-bottom,
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .modal-bottom button {
    font-size: 0.8125rem;
    line-height: 1.3125rem;
  }
  :is(#modal[data-kind="sign-in"], #modal[data-kind="create-profile"]) .modal-bottom button { min-height: 1.5rem; }
  #modal[data-kind="sign-in"] .modal-bottom { min-height: 2.25rem; }

  #modal[data-kind="sign-out"] h2 { height: auto; }
  #modal[data-kind="sign-out"] :is(.signout-warning, .signout-confirm-button) {
    height: auto;
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }

  /* Only the fields scroll when the software keyboard reduces the viewport. */
  #modal[data-kind="rename-list"][open] {
    --rename-block-padding: clamp(0.5rem, calc((var(--dialog-height) - 12rem) / 8), var(--dialog-gutter));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0;
    overflow: hidden;
  }
  #modal[data-kind="rename-list"] > h2 {
    min-height: max(58px, 4.125rem);
    margin: 0;
    padding: 1.0625rem 3.375rem 0.625rem var(--dialog-gutter);
    color: inherit;
    font-size: 1.3125rem;
    line-height: 1.875rem;
  }
  #modal[data-kind="rename-list"] > form {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 0;
  }
  #modal[data-kind="rename-list"] .rename-list-fields {
    display: block;
    min-height: 0;
    padding: var(--rename-block-padding) var(--dialog-gutter) 0.25rem;
    overflow: auto;
    overscroll-behavior: contain;
  }
  #modal[data-kind="rename-list"] .rename-list-fields label {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }
  #modal[data-kind="rename-list"] .rename-list-fields input {
    min-height: max(48px, 3rem);
    margin-top: 0.25rem;
    border-color: var(--sheet-grid);
    border-radius: 3px;
    font-size: max(16px, 1rem);
  }
  #modal[data-kind="rename-list"] .rename-list-fields .error { font-size: 0.875rem; }
  #modal[data-kind="rename-list"] > form > .primary {
    width: auto;
    height: auto;
    min-height: max(46px, 2.875rem);
    margin: 0.5rem var(--dialog-gutter) var(--rename-block-padding);
    padding: 0.5rem 0.75rem;
    border-radius: 3px;
    color: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3125rem;
  }

  @media (max-width: 360px) {
    #recovery-modal[data-step] .recovery-header h2,
    #account-flow-modal[data-flow] .account-flow-header h2 { font-size: 1.125rem; }
  }
  #modal[data-kind="account"] { padding: 0 0 4.125rem; }
  #modal[data-kind="account"] > h2 {
    min-height: 0;
    padding-block-end: 0;
    border-bottom: 0;
  }
  #modal[data-kind="account"] .account-modal-subtitle {
    margin: 0;
    padding: 0.1875rem 3.375rem 0.625rem var(--dialog-gutter);
    border-bottom: 1px solid #e2e4e7;
    background: #f6f7f8;
  }

  #modal[data-kind="account"] :is(.account-settings, .account-bug-form) {
    display: grid;
    width: auto;
    margin: 0;
  }
  #modal[data-kind="account"] .account-settings { padding: 1.25rem var(--dialog-gutter) 0; }

  #modal[data-kind="account"] :is(.account-email-heading, .account-email-cell, .account-verification-heading,
    .account-verification-button, .account-row, .account-divider, .account-bug-divider, .account-bug-form > *) {
    position: static;
    inset: auto;
    width: auto;
    min-width: 0;
    margin: 0;
  }
  #modal[data-kind="account"] .account-email-heading,
  #modal[data-kind="account"] .account-verification-button,
  #modal[data-kind="account"] .account-row {
    height: auto;
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }
  #modal[data-kind="account"] .account-email-heading { min-height: 1.5625rem; line-height: 1.5625rem; }
  #modal[data-kind="account"] .account-email-cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    height: auto;
    min-height: 3rem;
    margin-top: 0.3125rem;
    padding-block: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.3125rem;
  }
  #modal[data-kind="account"] .account-email-cell span {
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #modal[data-kind="account"] .account-email-cell strong { font-size: 0.75rem; line-height: 1.3125rem; }
  #modal[data-kind="account"] .account-verification-heading {
    margin-top: 0.1875rem;
    font-size: 0.75rem;
    line-height: 1.1875rem;
  }
  #modal[data-kind="account"] .account-verification-button { min-height: 2.875rem; margin-top: 1px; }
  #modal[data-kind="account"] .account-divider { margin: 1.5rem 0 1.0625rem; }
  #modal[data-kind="account"] .account-row { min-height: 3.375rem; gap: 0.5rem; padding-block: 0.375rem; }
  #modal[data-kind="account"] .account-row b { flex: none; }
  #modal[data-kind="account"] .account-row + .account-row { margin-top: 0.9375rem; }
  #modal[data-kind="account"] .account-bug-divider { margin: 1.375rem 0 1.3125rem; }
  #modal[data-kind="account"] .account-bug-form h3 { font-size: 1rem; line-height: 1.9375rem; }
  #modal[data-kind="account"] .account-bug-form > p:not(.error) { font-size: 0.8125rem; line-height: 1.5625rem; }
  #modal[data-kind="account"] .account-bug-form > .error:not(:empty) { margin-top: 0.5rem; }
  #modal[data-kind="account"] .account-bug-compose {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: space-between;
    height: auto;
    min-height: 9.6875rem;
    margin-top: 0.5625rem;
    padding-bottom: 0.75rem;
  }
  #modal[data-kind="account"] .account-bug-compose textarea {
    position: static;
    height: auto;
    min-height: 6.1875rem;
    max-height: 14rem;
    margin: 0;
    padding: 0.8125rem 0.6875rem 0;
    font-size: 0.875rem;
    line-height: 1.375rem;
    field-sizing: content;
  }
  #modal[data-kind="account"] .account-bug-compose > button {
    position: static;
    justify-self: end;
    width: auto;
    height: auto;
    min-width: 4.75rem;
    min-height: 2.5625rem;
    margin-inline-end: 0.8125rem;
    padding-inline: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.3125rem;
  }

  /* Both account and recovery steps use content-sized rows below the header. */
  #recovery-modal[data-step] .recovery-body,
  #account-flow-modal[data-flow] > :is(form, div) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: var(--body-start, 1.1875rem) var(--dialog-gutter) var(--body-end, 1.625rem);
  }

  #recovery-modal[data-step] .recovery-body form {
    display: grid;
    position: static;
    height: auto;
    width: auto;
    margin: 0;
    padding: 0;
  }

  #recovery-modal[data-step] .recovery-body :is(form > *, .recovery-body > p, .recovery-body > button, .recovery-success-title, .recovery-success-icon, #recovery-email) {
    position: var(--recovery-row-position, static);
    inset: auto;
    width: var(--recovery-row-width, auto);
    height: auto;
    min-width: 0;
    margin: var(--recovery-row-margin, 0);
  }
  #account-flow-modal[data-flow] > :is(form, div) > :is(p, h3, img, label, div, button, .account-flow-primary),
  #account-flow-modal[data-flow] .account-flow-actions > button {
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    min-width: 0;
    margin: 0;
  }

  #recovery-modal[data-step] .recovery-body :is(p, label, button),
  #account-flow-modal[data-flow] > :is(form, div) > :is(p, label, button),
  #account-flow-modal[data-flow] .account-flow-actions > button {
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }

  #recovery-modal[data-step] .recovery-body form > label,
  #account-flow-modal[data-flow] .account-password-copy + label { line-height: 1.5625rem; }

  #recovery-modal[data-step] :is(#recovery-email, .recovery-password-control input),
  #account-flow-modal[data-flow] .account-password-control input {
    min-height: var(--dialog-input-height, 3rem);
    height: auto;
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.375rem;
  }

  #recovery-modal[data-step] .recovery-password-control { --recovery-row-position: relative; }
  #account-flow-modal[data-flow] form > .account-password-control { position: relative; inset: auto; }
  #recovery-modal[data-step] .recovery-password-control,
  #account-flow-modal[data-flow] form > .account-password-control {
    --dialog-input-height: calc(3rem - 2px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border: 1px solid #e2e4e7;
    border-radius: 3px;
  }
  #recovery-modal[data-step] .recovery-password-control input,
  #account-flow-modal[data-flow] .account-password-control input {
    min-height: calc(3rem - 2px);
    padding-inline-end: 0.6875rem;
    border: 0;
  }
  #recovery-modal[data-step] .recovery-password-control button,
  #account-flow-modal[data-flow] .account-password-control button {
    position: static;
    width: auto;
    min-width: 3.75rem;
    height: auto;
    min-height: 0;
    font-size: 0.75rem;
    line-height: 1.3125rem;
  }
  #recovery-modal[data-step] .recovery-password-control button { min-width: 2rem; margin-right: 0.6875rem; }

  #recovery-modal[data-step] .recovery-body .recovery-primary,
  #account-flow-modal[data-flow] :is(.account-flow-primary, .account-flow-actions > button:last-child) {
    height: auto;
    min-height: 2.875rem;
    padding-block: 0.375rem;
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }
  #recovery-modal[data-step] .recovery-body .recovery-link,
  #recovery-modal[data-step] .recovery-body .recovery-resend-button,
  #account-flow-modal[data-flow] :is(.account-resend, .account-flow-back-link, .account-flow-actions > button:first-child) {
    height: auto;
    min-height: 2rem;
    font-size: 0.8125rem;
    line-height: 1.3125rem;
  }

  #recovery-modal[data-step] .recovery-body .recovery-error:not(:empty),
  #account-flow-modal[data-flow] > :is(form, div) > .account-flow-error:not(:empty) {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.125rem;
  }
  #recovery-modal[data-step] .recovery-error:empty,
  #account-flow-modal[data-flow] .account-flow-error:empty { display: none; }
  #recovery-modal[data-step] .recovery-body:has(.recovery-error:not(:empty)),
  #account-flow-modal[data-flow]:has(.account-flow-error:not(:empty)) > :is(form, div) { padding-bottom: 1.5rem; }

  #recovery-modal[data-step="email"] { --body-start: 1.375rem; --body-end: 3.625rem; }
  #recovery-modal[data-step="email"] .recovery-copy { min-height: 4rem; }
  #recovery-modal[data-step="email"] .recovery-body form { margin-top: 1.375rem; }
  #recovery-modal[data-step="email"] #recovery-email { --recovery-row-margin: 0.25rem 0 0; }
  #recovery-modal[data-step="email"] .recovery-body .recovery-primary { --recovery-row-margin: 2.3125rem 0 0; }
  #recovery-modal[data-step="email"] .recovery-body .recovery-link { --recovery-row-margin: 1.125rem 0 0; }

  #recovery-modal[data-step="verify"] { --body-start: 1.0625rem; --body-end: 1.6875rem; }
  #recovery-modal[data-step="verify"] .recovery-instruction { min-height: 2.25rem; }
  #recovery-modal[data-step="verify"] .recovery-email { min-height: 1.9375rem; --recovery-row-margin: 1px 0 0; }
  #recovery-modal[data-step="verify"] .recovery-body form { margin-top: 1.3125rem; }
  #recovery-modal[data-step="verify"] .recovery-body .recovery-code-control {
    --recovery-row-width: min(100%, 19.3125rem);
    --recovery-row-position: relative;
    min-height: 3.25rem;
  }
  #account-flow-modal[data-flow] > :is(form, div) > .account-code-inputs {
    width: min(100%, 19.3125rem);
    min-height: 3.25rem;
  }
  #recovery-modal[data-step] .recovery-code-cells,
  #account-flow-modal[data-flow] .account-code-inputs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  #recovery-modal[data-step] .recovery-code-cells span,
  #account-flow-modal[data-flow] .account-code-inputs :is(input, span) {
    width: 100%;
    height: auto;
    min-height: 3.25rem;
    font-size: 1.375rem;
    line-height: 1;
  }
  #recovery-modal[data-step] .recovery-code-input { height: 100%; }
  #recovery-modal[data-step="verify"] .recovery-body .recovery-resend { --recovery-row-margin: 2.5625rem 0 0; }
  #recovery-modal[data-step="verify"] .recovery-body .recovery-resend-button { justify-self: end; --recovery-row-margin: 0.375rem 0 0; }
  #recovery-modal[data-step="verify"] .recovery-body .recovery-primary { --recovery-row-margin: 3.1875rem 0 0; }
  #recovery-modal[data-step="verify"] .recovery-body .recovery-link { --recovery-row-margin: 0.3125rem 0 0; min-height: 2.1875rem; }

  #recovery-modal[data-step="password"] { --body-start: 1.3125rem; --body-end: 4.9375rem; }
  #recovery-modal[data-step="password"] .recovery-copy { min-height: 4rem; }
  #recovery-modal[data-step="password"] .recovery-body form { margin-top: 1px; }
  #recovery-modal[data-step="password"] .recovery-body .recovery-password-control { --recovery-row-margin: 0.25rem 0 0; }
  #recovery-modal[data-step="password"] .recovery-body .recovery-help { min-height: 3.25rem; --recovery-row-margin: 0.9375rem 0 0; font-size: 0.8125rem; }
  #recovery-modal[data-step="password"] .recovery-body .recovery-primary { --recovery-row-margin: 1.9375rem 0 0; }

  #recovery-modal[data-step="success"] { --body-start: 1.5rem; --body-end: 1.6875rem; }
  #recovery-modal[data-step="success"] .recovery-body .recovery-success-icon {
    --recovery-row-width: 1.5625rem;
    justify-self: center;
    height: 1.5625rem;
  }
  #account-flow-modal[data-flow] .account-flow-success > img { justify-self: center; width: 1.5625rem; height: 1.5625rem; }
  #recovery-modal[data-step="success"] .recovery-body .recovery-success-title { min-height: 3.3125rem; --recovery-row-margin: 2rem 0 0; }
  #recovery-modal[data-step="success"] .recovery-body .recovery-success-copy { min-height: 3.125rem; --recovery-row-margin: 0.375rem 0 0; }
  #recovery-modal[data-step="success"] .recovery-body .recovery-primary { --recovery-row-margin: 0.8125rem 0 0; }
  #recovery-modal[data-step] .recovery-body .recovery-success-title,
  #account-flow-modal[data-flow] .account-flow-success h3 { font-size: 1.0625rem; line-height: 1.5625rem; text-align: center; }
  #recovery-modal[data-step] .recovery-body .recovery-success-copy,
  #account-flow-modal[data-flow] .account-flow-success p { font-size: 0.8125rem; line-height: 1.3125rem; text-align: center; }

  /* Email addresses may wrap to as many lines as needed. */
  #recovery-modal[data-step] .recovery-body .recovery-email,
  #account-flow-modal[data-flow] > :is(form, div) > .account-code-email {
    display: block;
    align-content: center;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #account-flow-modal[data-flow] .account-timer,
  #recovery-modal[data-step] .recovery-resend {
    display: flex;
    align-items: center;
    gap: 0.1875rem;
    min-height: 2.3125rem;
    font-size: 0.8125rem;
    line-height: 1.3125rem;
  }
  #account-flow-modal[data-flow] .account-timer strong,
  #recovery-modal[data-step] .recovery-resend strong {
    flex-shrink: 0;
    margin-inline-start: auto;
    height: auto;
    min-height: 2.3125rem;
    font-size: 1rem;
    line-height: 2.3125rem;
  }
  #account-flow-modal[data-flow] .account-timer span,
  #recovery-modal[data-step] .recovery-resend span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #account-flow-modal[data-flow] > :is(form, div) > .account-code-instruction { min-height: var(--code-instruction-height, 2.1875rem); }
  #account-flow-modal[data-flow] > :is(form, div) > .account-code-email {
    min-height: var(--code-email-height, 1.9375rem);
    margin-top: var(--code-email-gap, 1px);
    font-size: var(--code-email-size, 0.9375rem);
  }
  #account-flow-modal[data-flow] > :is(form, div) > .account-code-inputs { margin-top: var(--code-cell-gap, 1.8125rem); }
  #account-flow-modal[data-flow] > :is(form, div) > .account-timer { margin-top: var(--code-timer-gap, 2.125rem); }
  #account-flow-modal[data-flow] > :is(form, div) > .account-resend { justify-self: end; margin-top: 0.375rem; }
  #account-flow-modal[data-flow] > :is(form, div) > .account-flow-helper {
    min-height: var(--code-help-height, 1.9375rem);
    margin-top: var(--code-help-gap, 0.25rem);
    font-size: 0.75rem;
    line-height: 1.25rem;
  }

  #account-flow-modal[data-flow] > :is(form, div) > .account-flow-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: var(--account-action-gap, 0.375rem);
    margin-top: var(--account-action-top, 1.125rem);
  }

  #account-flow-modal[data-flow="email-code"] {
    --body-end: 1.625rem;
  }
  #account-flow-modal[data-flow="email-code"] form > .account-flow-primary { margin-top: 3.5rem; }
  #account-flow-modal[data-flow="email-code"] form > .account-flow-back-link { margin-top: 0.5rem; }

  #account-flow-modal[data-flow="change-password"] {
    --body-start: 1.25rem;
    --body-end: 1.375rem;
    --account-action-top: 2.375rem;
    --account-action-gap: 0.1875rem;
  }
  #account-flow-modal[data-flow="change-password"] .account-password-copy { min-height: 4.8125rem; }
  #account-flow-modal[data-flow="change-password"] .account-password-copy + label { margin-top: 0.6875rem; }
  #account-flow-modal[data-flow="change-password"] form > .account-password-control { margin-top: 0.3125rem; }
  #account-flow-modal[data-flow="change-password"] form > .account-password-help {
    min-height: 2.375rem;
    margin-top: 1rem;
    font-size: 0.75rem;
    line-height: 1.3125rem;
  }

  #account-flow-modal[data-flow="password-code"] {
    --body-start: 1.125rem;
    --body-end: 1.3125rem;
    --code-cell-gap: 1.4375rem;
    --code-timer-gap: 2.4375rem;
    --code-help-height: 2.5rem;
    --account-action-top: 0.4375rem;
    --account-action-gap: 0.875rem;
  }

  #account-flow-modal[data-flow="delete-confirm"] {
    --body-start: 1.0625rem;
    --body-end: 2.125rem;
    --account-action-top: 1.375rem;
  }
  #account-flow-modal[data-flow="delete-confirm"] .account-delete-confirm {
    grid-template-columns: 1.5rem minmax(0, 1fr);
    column-gap: 0.8125rem;
  }
  #account-flow-modal[data-flow="delete-confirm"] .account-delete-confirm > img {
    width: 1.5rem;
    height: 1.5rem;
    align-self: center;
  }
  #account-flow-modal[data-flow="delete-confirm"] .account-delete-confirm > h3 { min-height: 4.25rem; }
  #account-flow-modal[data-flow="delete-confirm"] .account-delete-confirm > :is(p, div) { grid-column: 1 / -1; }
  #account-flow-modal[data-flow="delete-confirm"] .account-delete-confirm > p:not(.account-flow-error) {
    height: auto;
    min-height: 7.375rem;
    margin-top: 1.125rem;
  }

  #account-flow-modal[data-flow="delete-code"] {
    --body-start: 0.1875rem;
    --body-end: 0.6875rem;
    --code-instruction-height: 1.4375rem;
    --code-email-gap: 0.1875rem;
    --code-cell-gap: 2.5625rem;
    --code-timer-gap: 2.6875rem;
    --code-help-gap: 1.125rem;
    --account-action-top: 1.5rem;
    --account-action-gap: 0.75rem;
  }
  #account-flow-modal[data-flow="delete-verified"] {
    --body-start: 0.5625rem;
    --body-end: 1.9375rem;
    --code-instruction-height: 1.375rem;
    --code-email-height: 1.5625rem;
    --code-email-size: 0.875rem;
    --code-email-gap: 0.3125rem;
    --code-cell-gap: 1rem;
    --account-action-top: 1.125rem;
    --account-action-gap: 1.0625rem;
  }
  #account-flow-modal[data-flow="delete-verified"] .account-code-inputs.is-verified,
  #account-flow-modal[data-flow="delete-verified"] .account-code-inputs.is-verified span { min-height: 2.9375rem; }
  #account-flow-modal[data-flow="delete-verified"] .account-code-inputs.is-verified span { font-size: 1.0625rem; }
  #account-flow-modal[data-flow="delete-verified"] .account-delete-verified > .account-verified-message {
    position: relative;
    inset: auto;
    min-height: 4.0625rem;
    margin: 0.75rem 0.25rem 0 2.125rem;
    font-size: 1rem;
    line-height: 1.5625rem;
  }
  #account-flow-modal[data-flow="delete-verified"] .account-delete-verified > .account-final-warning { min-height: 4.3125rem; margin-top: 1.9375rem; }
  #account-flow-modal[data-flow="delete-verified"] .account-flow-actions > button.account-delete-final { min-height: 2.9375rem; }

  #account-flow-modal[data-flow="password-success"] { --body-start: 1.5rem; --body-end: 1.6875rem; }
  #account-flow-modal[data-flow="delete-success"] { --body-start: 1.3125rem; --body-end: 1.625rem; }
  #account-flow-modal[data-flow] .account-flow-success h3 {
    min-height: 3.1875rem;
    margin-top: 2rem;
  }
  #account-flow-modal[data-flow] .account-flow-success p {
    min-height: 3.125rem;
    margin-top: 0.125rem;
  }
  #account-flow-modal[data-flow] .account-flow-success .account-flow-primary { margin-top: 0.875rem; }
  #account-flow-modal[data-flow="delete-success"] .account-flow-success h3 { margin-top: 1.9375rem; min-height: 3.25rem; }
  #account-flow-modal[data-flow="delete-success"] .account-flow-success p { margin-top: 0.8125rem; min-height: 2.1875rem; }
  #account-flow-modal[data-flow="delete-success"] .account-flow-success .account-flow-primary { margin-top: 0.5rem; }

  /* Errors add their own row rather than inheriting the empty-state spacer. */
  #recovery-modal[data-step] .recovery-body .recovery-error:not(:empty) ~ .recovery-primary,
  #account-flow-modal[data-flow] > :is(form, div) > .account-flow-error:not(:empty) ~ :is(.account-flow-primary, .account-flow-actions) {
    margin-top: 0.75rem;
  }

  /* Keep the PDF and introduction controls inside their own scrolling surfaces. */
  #modal[data-kind="pitch-deck-pdf"] {
    --pitch-top: clamp(var(--dialog-top), calc(var(--dialog-height) - 26.3125rem), 19.0625rem);
    top: calc(var(--auth-viewport-top, 0px) + var(--pitch-top));
    bottom: auto;
    height: auto;
    max-height: max(0px, calc(var(--dialog-height) - var(--pitch-top) - var(--dialog-bottom)));
    padding: 0 0 0.8125rem;
  }
  #modal[data-kind="pitch-deck-pdf"][data-state="uploaded"] {
    --pitch-top: clamp(var(--dialog-top), calc(var(--dialog-height) - 16.375rem), 27rem);
    top: calc(var(--auth-viewport-top, 0px) + var(--pitch-top));
    height: auto;
    padding-bottom: 1.375rem;
  }
  #modal[data-kind="pitch-deck-pdf"] h2 {
    position: static;
    height: auto;
    min-height: 4.0625rem;
    padding-inline-end: 3.375rem;
    font-size: 1.25rem;
    line-height: 1.875rem;
  }
  #modal[data-kind="pitch-deck-pdf"] :is(.upload-form, .uploaded-file, .delete-pdf) {
    position: static;
    width: auto;
    height: auto;
    margin: 1.5625rem var(--dialog-gutter) 0;
  }
  #modal[data-kind="pitch-deck-pdf"] .upload-form { display: grid; }
  #modal[data-kind="pitch-deck-pdf"] .upload-drop {
    display: grid;
    justify-items: center;
    align-content: start;
    width: auto;
    height: auto;
    min-height: 9.0625rem;
    padding: 0.8125rem 0.375rem 0;
  }
  #modal[data-kind="pitch-deck-pdf"] .upload-drop :is(img, strong, .upload-constraints, .browse-files) {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
  }
  #modal[data-kind="pitch-deck-pdf"] .upload-drop > img { width: 1.3125rem; height: 1.3125rem; }
  #modal[data-kind="pitch-deck-pdf"] .upload-drop strong:first-of-type { margin-top: 1.1875rem; font-size: 0.875rem; line-height: 1.3125rem; }
  #modal[data-kind="pitch-deck-pdf"] .upload-drop .upload-constraints { margin-top: 0.6875rem; font-size: 0.75rem; line-height: 1.25rem; }
  #modal[data-kind="pitch-deck-pdf"] .upload-drop .browse-files {
    min-width: min(100%, 7.125rem);
    min-height: 1.8125rem;
    margin-top: 0.8125rem;
    font-size: 0.75rem;
    line-height: 1.6875rem;
  }
  #modal[data-kind="pitch-deck-pdf"] :is(.upload-file-status, .upload-error, .upload-progress, .upload-actions) {
    position: static;
    width: auto;
    height: auto;
  }
  #modal[data-kind="pitch-deck-pdf"] .upload-file-status,
  #modal[data-kind="pitch-deck-pdf"] .upload-error {
    min-height: 1.625rem;
    margin: 0.9375rem 0 0;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.75rem;
    line-height: 1.25rem;
  }
  #modal[data-kind="pitch-deck-pdf"] .upload-error:empty,
  #modal[data-kind="pitch-deck-pdf"]:has(.upload-error:not(:empty)) .upload-file-status { display: none; }
  #modal[data-kind="pitch-deck-pdf"] .upload-progress:not([hidden]) { margin-top: 0.375rem; }
  #modal[data-kind="pitch-deck-pdf"] .upload-actions { margin-top: 0.875rem; }
  #modal[data-kind="pitch-deck-pdf"] .upload-actions button {
    height: auto;
    padding-block: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
  }
  #modal[data-kind="pitch-deck-pdf"][data-state="uploaded"] .uploaded-file {
    position: static;
    width: auto;
    height: auto;
    min-height: 4.1875rem;
    padding-block: 0.375rem;
  }
  #modal[data-kind="pitch-deck-pdf"][data-state="uploaded"] .uploaded-file :is(strong, span) {
    height: auto;
  }
  #modal[data-kind="pitch-deck-pdf"][data-state="uploaded"] .deck-file-meta.is-error { white-space: normal; overflow-wrap: anywhere; }
  #modal[data-kind="pitch-deck-pdf"][data-state="uploaded"] .uploaded-file strong { min-height: 1.5625rem; }
  #modal[data-kind="pitch-deck-pdf"][data-state="uploaded"] .delete-pdf {
    position: static;
    width: calc(100% - 2 * var(--dialog-gutter));
    height: auto;
    min-height: 2.75rem;
    margin: 1.3125rem var(--dialog-gutter) 0;
  }

  .intro-popover:is(.intro-popover--template, .intro-popover--custom) {
    --intro-available-height: max(0px, calc(var(--auth-viewport-height, 100dvh) - 2rem));
    display: grid;
    height: auto;
    min-height: min(var(--intro-design-height), var(--intro-available-height));
    padding: 2.875rem 1.1875rem 0.375rem;
    overscroll-behavior: contain;
    scroll-padding-block: 0.75rem;
    overflow-y: auto;
  }
  .intro-popover:is(.intro-popover--template, .intro-popover--custom) :is(.intro-popover-editor, .intro-custom-editor, .intro-character-count, .intro-popover-divider, .intro-guidance, .intro-popover-save) {
    position: static;
    inset: auto;
    width: auto;
    max-width: none;
    height: auto;
    margin: 0;
  }
  .intro-popover--template {
    --intro-design-height: 39.4375rem;
    grid-template-rows: auto auto minmax(min-content, 1fr) auto;
  }

  .intro-popover--template .intro-template-popover-editor {
    min-height: 23.875rem;
    font-size: 0.875rem;
    line-height: 1.4375rem;
    overflow-wrap: anywhere;
  }
  .intro-popover.intro-popover--template .intro-popover-divider { margin-top: 0.375rem; }
  .intro-popover.intro-popover--template .intro-guidance { margin-top: 0.875rem; }
  .intro-popover:is(.intro-popover--template, .intro-popover--custom) .intro-guidance {
    font-size: 0.75rem;
    line-height: 1.25rem;
  }
  .intro-popover:is(.intro-popover--template, .intro-popover--custom) .intro-popover-save {
    position: relative;
    justify-self: end;
    min-height: 2.625rem;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.3125rem;
  }
  .intro-popover--custom {
    --intro-text-height: 24.75rem;
    --intro-design-height: 35.9375rem;
    grid-template-rows: auto auto auto minmax(min-content, 1fr) auto;
  }
  .intro-popover.intro-popover--custom { padding: 2rem 1.1875rem 0.75rem; }
  .intro-popover.intro-popover--custom .intro-custom-editor {
    min-height: 7.5rem;
    height: clamp(7.5rem, calc(var(--auth-viewport-height, 100dvh) - 13.3125rem), var(--intro-text-height));
    font-size: 0.875rem;
    line-height: 1.4375rem;
  }
  .intro-popover.intro-popover--custom .intro-character-count { margin-top: 0.5rem; }
  .intro-popover.intro-popover--custom .intro-popover-divider { margin-top: 0.8125rem; }
  .intro-popover.intro-popover--custom .intro-guidance { margin-top: 0.875rem; }
  .intro-popover.intro-popover--custom .intro-popover-save { margin-top: 0.625rem; }

  .profile-contact-popover form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .profile-contact-popover input,
  .profile-contact-popover form > button,
  .reader-phone-number { font-size: 0.875rem; }

  @media (max-width: 359px) {
    .intro-popover--template { --intro-design-height: 42.1875rem; }
    .intro-popover--custom { --intro-design-height: 36.9375rem; }
  }
}

@media (width > 600px) and (orientation: landscape) and (pointer: coarse) and (max-height: 500px) {
  :is(#modal[data-kind], #recovery-modal[data-step], #account-flow-modal[data-flow]) {
    max-width: 35rem;
  }
  #modal[data-kind="sign-in"] .divider { display: grid; text-align: center; }
  #recovery-modal[data-step] .recovery-header,
  #account-flow-modal[data-flow] .account-flow-header { border-bottom: 1px solid #e2e4e7; }
  #account-flow-modal[data-flow] .account-flow-header h2,
  #recovery-modal[data-step] .recovery-header h2 { color: #29333b; }
}
