/* Mobile-only adjustments; keep the imported desktop interface unchanged. */
@media (max-width: 700px) {
  html, body, #root {
    height: 100%;
    margin: 0;
  }

  .portal-page {
    box-sizing: border-box;
    height: var(--portal-visible-height, 100dvh);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .portal-header {
    width: 100%;
    flex: none;
    padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
  }

  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-name { font-size: 14px; line-height: 1.5; }
  .brand-subtitle { font-size: 9px; }
  .portal-footer { display: none; }

  .portal-layout {
    box-sizing: border-box;
    width: 100%;
    max-width: 500px;
    flex: 1;
    min-height: 0;
    margin: 0 auto;
    padding: 4px 10px calc(6px + env(safe-area-inset-bottom));
  }

  .form-card {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    padding: 12px 16px;
    border-radius: 16px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .form-card form {
    box-sizing: border-box;
    min-height: 100%;
    padding-bottom: 72px;
  }

  .form-topline { margin-top: -4px; }
  .icon-button { width: 36px; height: 36px; }
  .progress-copy { margin-top: 3px; }
  .step-progress { margin-top: 6px; }
  .platform-badge { margin-top: 10px; padding: 3px 7px; }
  .step-title { margin-top: 12px; font-size: 20px; line-height: 1.5; }
  .platform-badge + .step-title { margin-top: 8px; }
  .step-hint { margin: 4px 0 12px; line-height: 1.7; }
  .platform-grid { gap: 6px; }
  .platform-option { min-height: 44px; padding: 6px 10px; }
  .platform-symbol { width: 26px; height: 26px; }
  .field-label { margin-bottom: 6px; }
  .input-shell { min-height: 48px; padding: 2px 10px; }
  .input-shell input { font-size: 16px; }
  .field-example, .field-error { margin-top: 5px; line-height: 1.7; }
  .connection-notice { margin-top: 8px; padding: 8px; line-height: 1.7; }

  /* Pin navigation above the keyboard/Telegram safe area, not below the form. */
  .form-actions {
    position: fixed;
    inset-inline: max(27px, calc((100vw - 446px) / 2));
    bottom: calc(var(--portal-keyboard-inset, 0px) + 8px + env(safe-area-inset-bottom));
    z-index: 20;
    flex-direction: row;
    gap: 8px;
    margin: 0;
    padding: 8px 0;
    background: var(--surface);
    box-shadow: 0 -6px 12px var(--surface);
  }

  .form-actions > button { flex: 1; width: auto; min-height: 44px; padding: 8px 12px; }
  .form-footnote { margin-top: 8px; line-height: 1.6; font-size: 9px; }
  .review-row { padding: 5px 10px; }
  .review-copy { gap: 0; }
  .edit-button { min-height: 36px; padding: 6px 4px; }
  .consent-box { margin-top: 10px; line-height: 1.7; }
  .intro-emblem { width: 60px; height: 60px; margin: 14px auto 12px; border-radius: 20px; }
  .intro-content > h2, .terminal-content h2 { font-size: 20px; }
  .intro-description { margin-top: 6px; line-height: 1.8; }
  .intro-facts { margin-top: 12px; gap: 12px; }
  .privacy-note { margin: 14px 0 12px; padding: 10px; }
  .privacy-note p, .outside-note p { line-height: 1.8; }
  .outside-note { padding: 10px; }
  .session-note { margin-top: 8px; line-height: 1.7; }
  .terminal-content { min-height: 100%; }
  .terminal-emblem { width: 60px; height: 60px; margin: 8px auto 14px; }

  /* Large text and exceptionally short viewports retain reachable content. */
  @media (max-height: 540px) {
    .portal-header { display: none; }
    .form-card { padding: 8px 14px; }
    .form-topline { height: 30px; }
    .step-title { margin-top: 7px; font-size: 18px; }
    .step-hint { margin-bottom: 8px; }
    .platform-badge { margin-top: 6px; }
    .intro-emblem { margin: 8px auto; width: 44px; height: 44px; }
  }
}
