:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f0f3f8;
  --text: #1f2937;
  --muted: #758096;
  --primary: #4f86f7;
  --primary-deep: #2f67df;
  --primary-soft: #e8f0ff;
  --stroke: #e7eaf0;
  --good: #16a085;
  --warn: #f59e0b;
  --danger: #ef5f72;
  --shadow: 0 18px 48px rgba(30, 55, 90, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(246, 247, 251, 0.96)),
    var(--bg);
  box-shadow: 0 0 0 1px rgba(231, 234, 240, 0.7);
}

.screen {
  min-height: 100vh;
  padding: max(24px, env(safe-area-inset-top)) 22px max(26px, env(safe-area-inset-bottom));
}

.is-hidden {
  display: none !important;
}

.intro-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.brand-mark,
.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #16324f;
  font-weight: 800;
}

.intro-top h1 {
  margin: 22px 0 0;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

.intro-top p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.intro-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-stat {
  min-height: 88px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.panel-stat strong {
  color: var(--primary-deep);
  font-size: 28px;
  line-height: 1;
}

.panel-stat span {
  color: var(--muted);
  font-size: 12px;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 54px;
  border-radius: 999px;
  font-weight: 800;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 14px 32px rgba(79, 134, 247, 0.28);
}

.secondary-btn {
  color: var(--text);
  background: var(--surface-soft);
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.restore-btn {
  margin-top: -8px;
}

.quiz-screen {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.quiz-header {
  z-index: 5;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px 14px;
  background: rgba(246, 247, 251, 0.88);
  backdrop-filter: blur(14px);
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(30, 55, 90, 0.08);
}

.icon-btn span {
  transform: translateY(-1px);
  font-size: 34px;
  line-height: 1;
}

.progress-wrap {
  flex: 1;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.progress-meta span:first-child {
  color: var(--text);
  font-weight: 800;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e7f0;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #74b5ff);
  transition: width 0.28s ease;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 26px 16px max(34px, env(safe-area-inset-bottom));
  scroll-behavior: smooth;
}

.message-row {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
  animation: card-in 0.24s ease both;
}

.message-row.no-animate {
  animation: none;
}

.bot-line {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.bot-avatar {
  background: #18324c;
  box-shadow: 0 8px 18px rgba(24, 50, 76, 0.16);
}

.question-card {
  padding: 24px 18px 20px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  position: relative;
}

.question-card::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 22px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--surface);
  transform: rotate(45deg);
}

.question-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.question-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.36;
  letter-spacing: 0;
}

.user-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  justify-items: end;
  margin: 8px 0 34px;
}

.user-bubble {
  min-width: 82px;
  min-height: 58px;
  padding: 0 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 30px 8px 30px 30px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 14px 30px rgba(79, 134, 247, 0.26);
  font-size: 22px;
  font-weight: 800;
  position: relative;
}

.user-bubble::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 12px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--primary);
  transform: rotate(45deg);
}

.user-avatar {
  width: 42px;
  height: 42px;
  color: #38506a;
  background:
    radial-gradient(circle at 50% 35%, #f7d6b1 0 22%, transparent 23%),
    radial-gradient(circle at 44% 46%, #283b54 0 4%, transparent 5%),
    radial-gradient(circle at 58% 46%, #283b54 0 4%, transparent 5%),
    linear-gradient(135deg, #d9ecff, #f5f0c8);
  border: 2px solid #fff;
  box-shadow: 0 10px 22px rgba(30, 55, 90, 0.14);
}

.end-card h2 {
  margin-bottom: 20px;
}

.end-options {
  display: grid;
  gap: 13px;
}

.option-list {
  display: grid;
  gap: 13px;
  margin-top: 26px;
}

.option-btn {
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 999px;
  color: #2f3747;
  background: #f2f3f5;
  text-align: left;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease;
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.is-selected {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
}

.option-btn:disabled {
  cursor: default;
}

.option-code {
  flex: 0 0 auto;
  width: 26px;
  font-weight: 800;
}

.option-label {
  min-width: 0;
  font-size: 17px;
  line-height: 1.35;
}

.result-screen {
  padding: 0 0 max(24px, env(safe-area-inset-bottom));
  background: #f6f6f6;
}

.report-cover {
  min-height: 300px;
  padding: 72px 22px 86px;
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.16), transparent 18%),
    linear-gradient(160deg, #11184c 0%, #1d2769 58%, #223077 100%);
}

.report-cover h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 22px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
}

.report-paper {
  width: calc(100% - 34px);
  margin: -74px auto 0;
  padding: 0 18px 28px;
  border: 1px solid #e2e2e2;
  border-radius: 8px 8px 0 0;
  background: #fff;
  position: relative;
}

.report-ribbon {
  width: min(78%, 300px);
  min-height: 54px;
  margin: 0 auto;
  transform: translateY(-1px);
  display: grid;
  place-items: center;
  border-radius: 0 0 14px 14px;
  color: #fff;
  background: #5368f4;
  font-size: 22px;
  font-weight: 800;
}

.result-hero {
  padding: 42px 0 20px;
}

.result-art {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 225, 92, 0.82), rgba(255, 225, 92, 0) 22%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 28%),
    #aeb9c8;
  overflow: hidden;
  position: relative;
}

.result-art::before,
.result-art::after {
  content: "";
  position: absolute;
  width: 108px;
  height: 108px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.result-art::before {
  right: 24px;
  top: 32px;
}

.result-art::after {
  left: 34px;
  bottom: 30px;
  transform: scale(0.72);
}

.result-art-name {
  writing-mode: vertical-rl;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-shadow: 0 2px 10px rgba(25, 35, 70, 0.18);
  position: relative;
  z-index: 1;
}

.result-art-subtitle {
  max-width: 78%;
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.result-hero p {
  margin: 34px 0 0;
  color: #28304b;
  font-size: 22px;
  line-height: 2.05;
}

.report-card {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.report-card {
  padding: 24px 0 0;
}

.report-card h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.report-card p {
  margin: 0;
  color: #28304b;
  font-size: 21px;
  line-height: 2.05;
}

.report-section {
  display: grid;
  gap: 28px;
  margin-top: 34px;
}

.report-tag {
  width: fit-content;
  margin: 0 auto !important;
  padding: 7px 18px 9px;
  border-radius: 10px;
  color: #fff;
  background: #aeb9c8;
  box-shadow: 0 8px 0 rgba(174, 185, 200, 0.18);
  font-size: 21px !important;
  line-height: 1.3;
  letter-spacing: 0.08em;
  position: relative;
}

.report-tag::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -8px;
  border-bottom: 2px dotted rgba(174, 185, 200, 0.55);
}

.report-section p + p {
  margin-top: 4px;
}

.report-lead {
  text-align: center;
  font-weight: 700;
}

.report-alpha strong {
  display: block;
  margin-bottom: 6px;
  color: #19223f;
  font-weight: 900;
}

.report-closing {
  padding-top: 4px;
  border-top: 0;
}

.save-tip {
  margin-top: 40px;
  padding: 16px 18px;
  border-radius: 8px;
  color: #5c4b18;
  background: #fff7da;
  border: 1px solid rgba(229, 184, 68, 0.36);
}

.save-tip strong {
  display: block;
  font-size: 16px;
}

.save-tip p {
  margin-top: 8px;
  color: #6b5a25;
  font-size: 14px;
  line-height: 1.7;
}

.consult-card {
  margin-top: 40px;
  padding: 18px;
  border-radius: 8px;
  color: #1f2c46;
  background:
    linear-gradient(135deg, rgba(232, 240, 255, 0.96), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(127, 165, 234, 0.34);
}

.consult-card span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--primary-deep);
  background: #dce9ff;
  font-size: 12px;
  font-weight: 800;
}

.consult-card h3 {
  margin: 12px 0 0;
  font-size: 18px;
  line-height: 1.4;
}

.consult-card p {
  margin-top: 10px;
  color: #4d5a70;
  font-size: 14px;
}

.consult-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(79, 134, 247, 0.24);
  display: grid;
  place-items: center;
  cursor: default;
  user-select: none;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: calc(100% - 34px);
  margin: 16px auto 0;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 360px) {
  .intro-top h1 {
    font-size: 30px;
  }

  .question-card h2 {
    font-size: 21px;
  }

  .option-label {
    font-size: 16px;
  }
}
