/* Keep the desktop hero balanced across window sizes and display scaling. */
@media screen and (min-width: 961px) {
  :root {
    --diagnosis-header-height: clamp(60px, 10.5svh, 78px);
    --diagnosis-hero-inset: clamp(12px, calc(5svh - 15px), 38px);
  }

  .container {
    width: min(1680px, calc(100% - clamp(48px, 12.5vw, 240px)));
  }

  .site-header {
    height: var(--diagnosis-header-height);
  }

  .hero-in {
    grid-template-columns: minmax(0, 1.07fr) minmax(0, 1fr);
    gap: clamp(24px, 3.7vw, 53px);
    min-height: calc(100svh - var(--diagnosis-header-height));
    padding-block: var(--diagnosis-hero-inset);
  }

  .hero-copy {
    padding-top: clamp(24px, 6svh, 62px);
  }

  .hero-copy h1 {
    font-size: clamp(34px, min(4.1vw, 7.2svh), 72px);
    line-height: 1.23;
    white-space: nowrap;
    margin-block: clamp(18px, 3.3svh, 24px) clamp(16px, 3svh, 22px);
  }

  .hero-lead {
    font-size: clamp(14px, 2.2svh, 16px);
  }

  .supported {
    margin-top: clamp(20px, 5svh, 45px);
  }

  .ai-icons {
    flex-wrap: nowrap;
    gap: clamp(8px, 1.1vw, 16px);
    max-width: 100%;
  }

  .ai-brand {
    min-width: 0;
    flex: 0 1 58px;
  }

  .ai-brand .tile {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .diag-card {
    padding: clamp(18px, 3.5svh, 29px) clamp(20px, 2.2vw, 31px) clamp(16px, 3svh, 22px);
  }

  .diag-header {
    margin-bottom: clamp(12px, calc(4svh - 12px), 21px);
  }

  .diag-header h2 {
    font-size: clamp(24px, 3.8svh, 28px);
  }

  .step-block {
    margin-bottom: clamp(10px, calc(4svh - 12px), 21px);
  }

  .hero-device {
    top: var(--diagnosis-hero-inset);
    height: clamp(260px, 48svh, 360px);
  }

  .hero-english {
    bottom: clamp(24px, 8svh, 88px);
  }
}

@media screen and (min-width: 1600px) and (min-height: 768px) {
  .diag-card {
    padding: 32px 36px 26px;
  }

  .diag-header h2 {
    font-size: 32px;
  }

  .diag-header p,
  .step-heading h3 {
    font-size: 16px;
  }

  .step-detail,
  .platform-option,
  .input-shell input,
  .input-shell .count,
  .add-mini,
  .suggest-trigger {
    font-size: 14px;
  }

  .platform-option {
    min-height: 44px;
  }

  .input-shell {
    min-height: 46px;
  }

  .detect-btn {
    min-height: 52px;
    font-size: 16px;
  }
}

/* Use a compact, readable form on short desktop browser windows. */
@media screen and (min-width: 961px) and (max-height: 650px) {
  .diag-header p {
    margin-top: 4px;
  }

  .round-step {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .step-detail {
    margin-left: 38px;
    margin-bottom: 8px;
  }

  .platform-option {
    min-height: 36px;
    padding-block: 4px;
  }

  .input-shell {
    min-height: 40px;
  }

  .input-shell input {
    height: 37px;
  }

  .detect-btn {
    min-height: 44px;
  }
}

@media screen and (min-width: 961px) and (max-height: 580px) {
  .diag-card {
    padding-block: 14px;
  }

  .diag-header {
    margin-bottom: 8px;
  }

  .diag-header h2 {
    font-size: 22px;
  }

  .step-heading {
    margin-bottom: 4px;
  }

  .step-block {
    margin-bottom: 8px;
  }

  .step-detail {
    margin-bottom: 6px;
  }

  .platform-list {
    gap: 6px;
  }

  .platform-option {
    min-height: 34px;
  }
}

/* Readable controls and balanced spacing on phones. */
@media screen and (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 76px; }
  body { overflow-wrap: break-word; }
  .container { width: calc(100% - 32px); }
  .hero-in { gap: 24px; padding-block: 20px 36px; }
  .hero-copy { padding-top: 14px; }
  .hero-copy h1 { font-size: clamp(28px, 7.8vw, 36px); line-height: 1.4; margin-block: 18px 14px; }
  .hero-lead { font-size: 15px; line-height: 1.85; }
  .supported { margin-top: 24px; }
  .supported-label { font-size: 13px; }
  .ai-icons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 320px; gap: 14px 12px; }
  .ai-brand { min-width: 0; width: auto; font-size: 12px; }
  .diag-card { padding: 24px 18px 20px; border-radius: 16px; }
  .diag-header { gap: 8px; margin-bottom: 22px; }
  .diag-header h2 { font-size: 24px; line-height: 1.4; }
  .diag-header p { font-size: 13px; line-height: 1.7; }
  .step-block { margin-bottom: 22px; }
  .step-heading h3 { font-size: 15px; line-height: 1.5; }
  .step-detail { font-size: 12px; line-height: 1.7; }
  .platform-list { gap: 10px; }
  .platform-option { min-height: 44px; padding: 8px; font-size: 13px; gap: 6px; }
  .platform-option span { min-width: 0; }
  .input-shell { min-height: 48px; }
  .input-shell input { height: 46px; font-size: 16px; min-width: 0; }
  .input-shell .count { font-size: 12px; }
  .add-mini, .suggest-trigger { min-height: 40px; font-size: 12px; }
  .detect-btn { min-height: 50px; font-size: 16px; }
  .section-heading h2 { font-size: clamp(24px, 6.6vw, 28px); line-height: 1.5; }
  .section-heading p, .process-card p, .dimension-card p { font-size: 14px; line-height: 1.85; }
  .process-card, .dimension-card { padding: 22px 20px; }
  .process-card h3, .dimension-card h3 { font-size: 17px; line-height: 1.5; }
  .contact-copy h2 { font-size: 28px; line-height: 1.5; }
  .contact-copy > p { font-size: 14px; line-height: 1.85; }
  .lead-card { padding: 24px 18px; }
  .lead-card label { font-size: 14px; }
  .lead-card :is(input, textarea, select), .modal :is(input, textarea, select) { font-size: 16px; }
  .modal-cover { padding: 16px 12px; }
  .modal { min-width: 0; max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; }
  .modal-title { align-items: flex-start; gap: 12px; }
  .modal-close { min-width: 40px; min-height: 40px; flex: none; }
  .keyword-modal .modal-title h2 { font-size: 21px; line-height: 1.5; }
  .keyword-modal .modal-actions { flex-wrap: wrap; gap: 10px; }
  .keyword-modal .modal-actions button { min-height: 44px; font-size: 14px; }
  .keyword-row { font-size: 13px; line-height: 1.6; }
  .keyword-select { font-size: 13px; min-height: 40px; }
  .report-table-wrap { max-width: 100%; overflow-x: auto; }
}
@media screen and (max-width: 359px) {
  .diag-card { padding-inline: 14px; }
  .platform-option { font-size: 12px; padding-inline: 6px; }
  .brandword strong { font-size: 16px; }
  .top-cta { padding-inline: 8px; font-size: 11px; }
}
