/*
 * 手机端关键界面的独立兼容层。
 * 不经过 Tailwind/PostCSS，也不使用 CSS cascade layers、oklch 或 color-mix。
 * 荣耀等旧版 Chromium 内核即使忽略 Tailwind 4，仍能得到完整可用的 App 布局。
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
}

@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body {
    overscroll-behavior: none;
  }

  .assessment-app-shell,
  .result-app-shell,
  .app-loading-shell {
    box-sizing: border-box;
    display: flex;
    width: 100%;
    height: 100vh;
    height: var(--app-height, 100vh);
    min-height: 0 !important;
    flex-direction: column;
    overflow: hidden;
    background: var(--background, #fff9f4);
    color: var(--foreground, #42181b);
  }

  .brand-header {
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 50px;
    flex: 0 0 50px;
    border-bottom: 1px solid #f0d9cf;
    background: #fff9f4;
  }

  .brand-header-inner {
    box-sizing: border-box;
    display: flex;
    width: 100%;
    height: 50px !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px !important;
  }

  .brand-header-title {
    display: flex;
    min-width: 0;
    align-items: center;
    color: #42181b;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }

  .brand-header-icon {
    display: flex;
    width: 28px !important;
    height: 28px !important;
    margin-right: 7px;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff0e8;
    color: #ff625d;
  }

  .brand-header-meta {
    margin: 0 0 0 8px;
    color: #80615d;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
  }

  [data-slot="button"] {
    box-sizing: border-box;
    display: inline-flex;
    min-width: 0;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 0 17px;
    background: linear-gradient(135deg, #ff746b, #ff5753);
    box-shadow: 0 8px 20px rgba(255, 98, 93, 0.2);
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
  }

  [data-slot="button"] svg {
    display: block;
    margin-left: 6px;
    flex: 0 0 auto;
  }

  [data-slot="button"][data-variant="outline"] {
    border: 1px solid #f0d9cf;
    background: #fffefd;
    box-shadow: none;
    color: #42181b;
  }

  [data-slot="button"][data-variant="ghost"] {
    background: transparent;
    box-shadow: none;
    color: #80615d;
  }

  [data-slot="button"][data-variant="soft"] {
    background: #fff0e8;
    box-shadow: none;
    color: #6a403b;
  }

  [data-slot="button"][data-size="lg"] {
    min-height: 48px;
    padding: 0 20px;
    font-size: 15px;
  }

  [data-slot="button"]:active {
    transform: scale(0.98);
  }

  [data-slot="button"]:disabled {
    cursor: default;
    opacity: 0.42;
    transform: none;
  }

  .app-alert {
    position: absolute;
    z-index: 5;
    top: 56px;
    left: 12px;
    right: 12px;
    box-sizing: border-box;
    margin: 0 !important;
    border: 1px solid rgba(200, 67, 77, 0.35);
    border-radius: 12px;
    padding: 9px 12px !important;
    background: #fff3f3;
    color: #a32f3a;
    font-size: 12px;
    line-height: 1.4;
  }

  /* 首页在可用视口内完整呈现。 */
  .intro-screen {
    display: flex;
    min-height: 0 !important;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .intro-layout {
    box-sizing: border-box;
    display: flex !important;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    padding: 14px 18px 12px !important;
  }

  .intro-copy {
    width: 100%;
    max-width: none !important;
    flex: 0 0 auto;
  }

  .intro-kicker {
    margin: 0 0 7px !important;
    color: #ff625d;
    font-size: 14px;
    font-weight: 800;
  }

  .intro-title {
    margin: 0;
    color: #42181b;
    font-size: 30px !important;
    font-size: clamp(27px, 8.2vw, 32px) !important;
    font-weight: 900;
    letter-spacing: -0.035em;
    line-height: 1.14 !important;
  }

  .intro-actions {
    display: flex !important;
    margin-top: 16px !important;
    flex-direction: row !important;
  }

  .intro-actions > * {
    flex: 1 1 0;
  }

  .intro-actions > * + * {
    margin-left: 8px;
  }

  .intro-progress {
    margin: 7px 0 0 !important;
    color: #80615d;
    font-size: 12px;
  }

  .intro-meta {
    display: flex !important;
    margin: 9px 0 0 !important;
    align-items: center;
    color: #80615d;
    font-size: 12px;
  }

  .intro-meta svg {
    margin-right: 6px;
  }

  .intro-visual {
    box-sizing: border-box;
    width: 100%;
    max-width: none !important;
    margin: 14px 0 0 !important;
    flex: 0 1 150px;
    overflow: hidden;
  }

  .intro-visual .connection-visual {
    position: relative;
    box-sizing: border-box;
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 118px !important;
    max-height: 150px;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    border: 1px solid rgba(255, 112, 103, 0.18);
    border-radius: 18px !important;
    background: linear-gradient(145deg, #fff5ed, #ffe6dc);
    padding: 18px !important;
    box-shadow: 0 12px 30px rgba(132, 61, 48, 0.07);
  }

  .intro-visual .message-bubble {
    position: relative;
    z-index: 2;
    display: flex;
    width: 54px !important;
    height: 54px !important;
    align-items: center;
    justify-content: center;
    border-radius: 16px !important;
    color: #ff625d;
    box-shadow: 0 9px 20px rgba(255, 98, 93, 0.12);
  }

  .intro-visual .message-bubble-left {
    align-self: flex-start;
    background: #ffd5b9;
  }

  .intro-visual .message-bubble-right {
    align-self: flex-end;
    background: #ffb0a6;
  }

  .intro-visual .message-bubble svg {
    width: 34px;
    height: 34px;
  }

  .intro-visual .connection-path {
    position: absolute;
    right: 22%;
    bottom: 34%;
    left: 22%;
    height: 32px;
    border-bottom: 2px dashed rgba(255, 98, 93, 0.72);
    border-radius: 0 0 50% 50%;
  }

  .intro-visual .connection-heart {
    position: absolute;
    z-index: 3;
    bottom: 23%;
    left: 50%;
    color: #ff625d;
    transform: translateX(-50%);
  }

}

@media (max-width: 767px) and (max-height: 650px) {
  .brand-header,
  .brand-header-inner {
    height: 44px !important;
  }

  .brand-header {
    flex-basis: 44px;
  }

  .intro-layout {
    padding-top: 9px !important;
    padding-bottom: 8px !important;
  }

  .intro-title {
    font-size: 26px !important;
  }

  .intro-actions {
    margin-top: 11px !important;
  }

  .intro-visual {
    margin-top: 9px !important;
    flex-basis: 112px;
  }

  .intro-visual .connection-visual {
    min-height: 96px !important;
    max-height: 112px;
  }

  .question-screen {
    padding: 5px 8px 6px !important;
  }

  .question-progress-row {
    height: 24px;
    margin-bottom: 4px !important;
    flex-basis: 24px;
  }

  .question-form {
    padding: 8px !important;
  }

  .question-prompt {
    font-size: 16px !important;
    line-height: 1.22 !important;
  }

  .question-options {
    margin-top: 5px !important;
  }

  .question-option {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    font-size: 12px !important;
    line-height: 1.22 !important;
  }

  .question-option + .question-option {
    margin-top: 4px !important;
  }

  .question-actions {
    height: 39px;
    margin-top: 4px !important;
    padding-top: 4px !important;
    flex-basis: 39px;
  }

  .question-actions [data-slot="button"] {
    min-height: 34px;
    height: 34px !important;
  }
}

@media (max-width: 340px) {
  .brand-header-meta {
    display: none;
  }

  .intro-title {
    font-size: 26px !important;
  }

  .question-option {
    font-size: 12px !important;
  }
}

@media (max-width: 767px) and (max-height: 540px) {
  .intro-visual {
    display: none;
  }

  .brand-header-meta {
    display: none;
  }
}
