/* 顾顾OS V0.1 · 网页与微信内置浏览器适配层。
   只处理响应式、触控与安全区，不改变业务流程。 */

html {
  min-width: 320px;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(198, 161, 91, .18);
}

body {
  min-width: 320px;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

button,
a,
select,
input[type="button"],
input[type="submit"] {
  touch-action: manipulation;
}

img,
video,
canvas,
svg { max-width: 100%; }

.simple-advisor-mode .main,
#advisor-simple-root,
.zg-cockpit,
.zg-review,
.zg-mission,
.zg-guided-talk,
.zg-context-tool { min-width: 0; }

.zg-focus h1,
.zg-mission h1,
.zg-next-result h1,
.zg-tool-heading h1,
.zg-tool-primary-card h2,
.zg-delivery-hero h2,
.zg-champion-coach h1,
.zg-guided-card h1,
.zg-customer-picker small,
.zg-resume p,
.zg-resume small,
.zg-talk-result,
.zg-mission-question b,
.zg-live-prompt b,
.zg-next-result p,
.zg-review-outcome p,
.zg-tool-answer,
.zg-profile-conclusions,
.zg-download-links,
.zg-trusted-source small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@supports (min-height: 100dvh) {
  #advisor-simple-root,
  .auth-gate { min-height: 100dvh; }
}

@media (max-width: 720px) {
  body.simple-advisor-mode {
    background: var(--zg-ivory);
  }

  .simple-advisor-mode .main {
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: max(34px, env(safe-area-inset-bottom, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
  }

  .zg-brandbar {
    position: sticky;
    z-index: 18;
    top: 0;
    min-height: 58px;
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
    background: rgba(247, 243, 234, .94);
    box-shadow: 0 1px rgba(7, 63, 54, .1);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .zg-header-actions { min-width: 0; }
  .zg-text-button { min-height: 44px; }
  .zg-icon-button {
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .zg-header-lock {
    max-width: 54vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .zg-customer-context { padding-top: 17px; }
  .zg-customer-picker { width: calc(100% - 62px); }
  .zg-customer-picker select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding-right: 28px;
    font-size: 20px;
  }
  .zg-customer-picker small {
    width: 100%;
    max-width: 100%;
  }

  .zg-cockpit,
  .zg-review,
  .zg-mission,
  .zg-guided-talk,
  .zg-context-tool { width: 100%; }

  .zg-focus,
  .zg-mission-brief,
  .zg-guided-card,
  .zg-next-result.is-primary,
  .zg-tool-primary-card,
  .zg-delivery-hero,
  .zg-tool-answer { box-shadow: 0 15px 38px rgba(7, 63, 54, .11); }

  .zg-focus h1,
  .zg-mission h1 { font-size: clamp(24px, 7.2vw, 29px); }

  .zg-mission-steps {
    max-width: 100%;
    overflow: hidden;
  }
  .zg-mission-steps span { flex: 0 0 auto; }
  .zg-mission-steps i { min-width: 12px; flex: 1 1 20px; }

  .zg-primary,
  .zg-secondary,
  .zg-text-button,
  .zg-icon-button,
  .zg-link-button,
  .zg-prep-option,
  .zg-fact-choice button,
  .zg-speaker-switch button,
  .zg-context-prompts button,
  .zg-download-links a,
  .auth-submit,
  .auth-password button { min-height: 44px; }

  .zg-composer textarea,
  .zg-mission textarea,
  .zg-live-ask-row input,
  .zg-customer-picker select,
  .auth-form input,
  .modal-panel input,
  .modal-panel textarea,
  .modal-panel select {
    font-size: 16px !important;
  }

  .zg-composer-row {
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
  }
  .zg-composer-row > * { min-width: 0; }
  .zg-composer-row .zg-primary { min-height: 50px; }

  .zg-prep-options,
  .zg-fact-choice,
  .zg-outcome-buttons { gap: 9px; }
  .zg-prep-option,
  .zg-fact-choice button { flex: 1 1 132px; }

  .zg-source-menu {
    right: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: min(52vh, 360px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .zg-context-prompts,
  .zg-download-links,
  .delivery-download-actions {
    -webkit-overflow-scrolling: touch;
  }

  .modal {
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }
  .modal-panel,
  .modal-panel:has(.kyc-intake-workspace),
  .modal-panel:has(.kyc-profile) {
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .auth-gate {
    align-items: center;
    padding-top: max(18px, env(safe-area-inset-top, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
  }
  .auth-card {
    width: calc(100vw - 32px);
    min-width: 0;
    max-width: 460px;
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .auth-form,
  .auth-password,
  .auth-password input { min-width: 0; }
}

@media (max-width: 390px) {
  .zg-brandbar > div:first-child b { font-size: 19px; }
  .zg-text-button { padding-right: 5px; padding-left: 5px; font-size: 12px; }
  .zg-customer-picker select { font-size: 19px; }
  .zg-focus,
  .zg-mission-brief,
  .zg-guided-card { padding-right: 18px; padding-left: 18px; }
  .zg-resume { grid-template-columns: 66px minmax(0, 1fr); }
}

@media (hover: none) and (pointer: coarse) {
  #advisor-simple-root button:hover,
  #advisor-simple-root a:hover { transform: none; }
}
