:root {
  --paper: #f4efe4;
  --paper-deep: #e8deca;
  --ink: #20201e;
  --muted: #716d64;
  --line: #c9beaa;
  --tomato: #ef6547;
  --mint: #9bc9b8;
  --yellow: #f0c94e;
  --blue: #536b89;
  --white: #fffdf8;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: #d8d0c1;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(rgba(32, 32, 30, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 32, 30, 0.04) 1px, transparent 1px),
    #d8d0c1;
  background-size: 20px 20px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: 100%;
  max-width: 1280px;
  height: 100vh;
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 318px 1fr;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(53, 44, 32, 0.25);
}

.side-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 42px 34px 28px;
  overflow: hidden;
  color: var(--white);
  background: var(--ink);
}

.side-panel::before,
.side-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.side-panel::before {
  width: 190px;
  height: 190px;
  right: -90px;
  top: -70px;
  border: 24px solid var(--tomato);
}

.side-panel::after {
  width: 90px;
  height: 90px;
  left: -42px;
  bottom: 80px;
  background: var(--yellow);
}

.brand-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--mint);
  color: var(--ink);
  font-size: 26px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--tomato);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.brand-row .eyebrow {
  color: var(--mint);
}

.brand-row h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.side-copy {
  position: relative;
  margin: 28px 0 32px;
  color: #cfc9bd;
  font-size: 15px;
  line-height: 1.8;
}

.step-list {
  position: relative;
  display: grid;
  gap: 6px;
}

.step-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #8c887f;
  text-align: left;
  transition: 180ms ease;
}

.step-item:not(:disabled) {
  cursor: pointer;
}

.step-item span {
  font-size: 12px;
  letter-spacing: 0.12em;
}

.step-item strong {
  font-size: 15px;
}

.step-item.is-active {
  background: var(--white);
  color: var(--ink);
  transform: translateX(5px);
}

.step-item.is-done {
  color: var(--mint);
}

.mini-profile {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
}

.mini-profile div {
  min-width: 0;
  padding: 12px 7px;
  border: 1px solid #4d4c47;
  border-radius: 12px;
}

.mini-profile span,
.mini-profile strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-profile span {
  margin-bottom: 5px;
  color: #8d8a82;
  font-size: 10px;
}

.mini-profile strong {
  font-size: 14px;
}

.content-panel {
  display: grid;
  min-width: 0;
  grid-template-rows: 96px 1fr 82px;
  background:
    radial-gradient(circle at 92% 12%, rgba(240, 201, 78, 0.28) 0 90px, transparent 91px),
    var(--paper);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 46px;
  border-bottom: 1px solid var(--line);
}

.top-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-wrap > span {
  width: 38px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.progress-track {
  width: 170px;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--tomato);
  transition: width 260ms ease;
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.question-screen {
  position: absolute;
  inset: 0;
  display: none;
  padding: 36px 54px 28px;
  animation: enter 260ms ease both;
}

.question-screen.is-active {
  display: block;
}

[data-screen="0"] {
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 30px;
}

[data-screen="0"].is-active {
  display: grid;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-badge {
  display: inline-flex;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  font-size: 13px;
  font-weight: 800;
}

.hero-copy h2 {
  margin: 22px 0 18px;
  font-size: clamp(48px, 5vw, 72px);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.hero-copy h2 em {
  color: var(--tomato);
  font-style: normal;
}

.hero-copy p {
  max-width: 480px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.primary-button,
.secondary-button,
.back-button {
  min-height: 54px;
  padding: 0 24px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--tomato);
  color: var(--white);
  box-shadow: 5px 5px 0 var(--ink);
}

.primary-button:hover,
.secondary-button:hover,
.back-button:hover:not(:disabled) {
  transform: translate(-2px, -2px);
}

.primary-button:active,
.secondary-button:active,
.back-button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.primary-button.small {
  min-height: 48px;
  box-shadow: 3px 3px 0 var(--ink);
}

.secondary-button {
  background: var(--white);
  color: var(--ink);
}

.hero-art {
  position: relative;
  width: 330px;
  height: 330px;
  margin: auto;
}

.sun {
  position: absolute;
  inset: 62px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 14px 14px 0 var(--mint);
  font-family: Georgia, serif;
  font-size: 34px;
  font-style: italic;
  font-weight: 900;
  transform: rotate(-8deg);
}

.orbit {
  position: absolute;
  inset: 20px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.orbit-one {
  transform: scaleY(0.48) rotate(26deg);
}

.orbit-two {
  transform: scaleX(0.48) rotate(26deg);
}

.spark {
  position: absolute;
  color: var(--tomato);
  font-size: 46px;
}

.spark-one {
  right: 4px;
  top: 40px;
}

.spark-two {
  bottom: 22px;
  left: 34px;
  color: var(--blue);
  font-size: 30px;
}

.question-heading {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 36px;
}

.compact-heading {
  margin-bottom: 22px;
}

.question-number {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--mint);
  font-weight: 900;
}

.question-heading p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 14px;
}

.question-heading h2 {
  margin: 0;
  font-size: 34px;
}

.choice-grid {
  display: grid;
  gap: 18px;
}

.gender-grid {
  grid-template-columns: repeat(3, 1fr);
}

.choice-card {
  display: grid;
  min-height: 250px;
  padding: 24px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 20px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 7px 7px 0 var(--paper-deep);
  transition: 180ms ease;
}

.choice-card:hover,
.choice-card.is-selected {
  transform: translateY(-6px);
  box-shadow: 7px 13px 0 var(--ink);
}

.choice-card.is-selected {
  background: var(--yellow);
}

.choice-icon {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  font-size: 50px;
  font-weight: 300;
}

.choice-card strong {
  font-size: 26px;
}

.choice-card small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.age-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) 1fr;
  align-items: center;
  gap: 52px;
  min-height: 300px;
}

.age-input-wrap {
  padding: 34px;
  border: 1px solid var(--ink);
  border-radius: 22px;
  background: var(--white);
  box-shadow: 8px 8px 0 var(--mint);
}

.age-input-wrap > span:first-child {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.age-value-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.age-value-row input {
  width: 190px;
  border: 0;
  border-bottom: 3px solid var(--ink);
  outline: 0;
  background: transparent;
  color: var(--tomato);
  font-size: 82px;
  font-weight: 900;
}

.age-value-row b {
  font-size: 26px;
}

.quick-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.quick-options button,
.hobby-chips button {
  min-height: 64px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.quick-options button:hover,
.quick-options button.is-selected,
.hobby-chips button:hover,
.hobby-chips button.is-selected {
  background: var(--yellow);
}

.zodiac-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.zodiac-grid button {
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  min-height: 83px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--ink);
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition: 150ms ease;
}

.zodiac-grid button:hover,
.zodiac-grid button.is-selected {
  border-color: var(--ink);
  background: var(--mint);
  transform: translateY(-2px);
}

.zodiac-grid button > span {
  grid-row: 1 / 3;
  color: var(--tomato);
  font-size: 28px;
}

.zodiac-grid small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.likes-layout {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 24px;
}

.text-field,
.hobby-block {
  display: block;
  padding: 24px;
  border: 1px solid var(--ink);
  border-radius: 18px;
  background: var(--white);
}

.featured-field {
  box-shadow: 7px 7px 0 var(--yellow);
}

.text-field > span,
.field-title {
  display: block;
  margin-bottom: 18px;
  font-size: 16px;
  font-weight: 900;
}

.text-field input,
.inline-input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--ink);
  outline: 0;
  background: transparent;
}

.text-field input {
  padding: 18px 4px 12px;
  color: var(--tomato);
  font-size: 36px;
  font-weight: 900;
}

.text-field small {
  display: block;
  margin-top: 14px;
  color: var(--muted);
}

.hobby-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hobby-chips button {
  min-height: 42px;
  padding: 0 16px;
}

.inline-input {
  margin-top: 22px;
  padding: 13px 2px;
  font-size: 16px;
}

.motto-card {
  position: relative;
  display: block;
  max-width: 720px;
  margin: 12px auto 0;
  padding: 32px 48px 24px;
  border: 1px solid var(--ink);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 9px 9px 0 var(--blue);
}

.motto-card > span {
  position: absolute;
  left: 18px;
  top: 8px;
  color: var(--yellow);
  font-family: Georgia, serif;
  font-size: 74px;
}

.motto-card textarea {
  width: 100%;
  min-height: 140px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.6;
}

.motto-card small {
  display: block;
  color: var(--muted);
  text-align: right;
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 46px;
  border-top: 1px solid var(--line);
}

.bottom-actions.is-hidden {
  visibility: hidden;
}

.back-button {
  background: transparent;
  color: var(--ink);
}

.back-button:disabled {
  opacity: 0.35;
  cursor: default;
}

#validation-message {
  flex: 1;
  margin: 0;
  color: #b83b25;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.next-button {
  min-width: 156px;
}

.report-screen.is-active {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  align-items: center;
  gap: 38px;
  padding-top: 24px;
  padding-bottom: 24px;
}

.report-intro h2 {
  margin: 8px 0 14px;
  font-size: 40px;
  line-height: 1.15;
}

.report-intro > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.8;
}

.report-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.report-card {
  position: relative;
  min-height: 486px;
  padding: 30px 34px 22px;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--white);
  box-shadow: 10px 10px 0 var(--yellow);
}

.report-card::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -82px;
  top: -92px;
  border-radius: 50%;
  background: var(--mint);
}

.report-stamp {
  position: absolute;
  right: 18px;
  top: 60px;
  color: var(--tomato);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  transform: rotate(8deg);
}

.report-no {
  margin: 0 0 20px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.report-label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 13px;
}

.report-card h3 {
  max-width: 78%;
  margin: 0 0 16px;
  font-size: 32px;
}

.report-card h3 span {
  color: var(--tomato);
}

.report-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.report-tags span {
  padding: 6px 12px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.report-tags span + span {
  background: var(--mint);
}

.report-section {
  padding: 16px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.report-section small {
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.report-section p {
  margin: 8px 0 0;
  font-size: 17px;
  line-height: 1.7;
}

.report-section strong {
  color: var(--tomato);
}

.report-card blockquote {
  position: relative;
  margin: 18px 0;
  padding-left: 22px;
  font-family: Georgia, "KaiTi", serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.6;
}

.report-card blockquote::before {
  content: "“";
  position: absolute;
  left: 0;
  top: -8px;
  color: var(--tomato);
  font-size: 34px;
}

.report-card footer {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 960px), (max-height: 680px) {
  body {
    overflow: auto;
  }

  .app-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    grid-template-columns: 230px 1fr;
  }

  .side-panel {
    padding: 26px 22px;
  }

  .side-copy,
  .mini-profile {
    display: none;
  }

  .content-panel {
    min-height: 680px;
  }

  .question-screen {
    padding: 24px 32px;
  }

  .choice-card {
    min-height: 210px;
  }

  .hero-art {
    transform: scale(0.82);
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .side-panel {
    display: none;
  }

  .content-panel {
    min-height: 100vh;
    grid-template-rows: 86px minmax(650px, 1fr) 78px;
  }

  .top-bar,
  .bottom-actions {
    padding-left: 20px;
    padding-right: 20px;
  }

  .progress-track {
    width: 90px;
  }

  [data-screen="0"].is-active,
  .report-screen.is-active,
  .age-layout,
  .likes-layout {
    display: block;
  }

  .hero-art {
    display: none;
  }

  .gender-grid {
    grid-template-columns: 1fr;
  }

  .choice-card {
    grid-template-columns: 70px 1fr;
    min-height: 110px;
    text-align: left;
  }

  .choice-icon {
    grid-row: 1 / 3;
    width: 64px;
    height: 64px;
    font-size: 34px;
  }

  .zodiac-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .age-input-wrap,
  .hobby-block {
    margin-bottom: 22px;
  }

  .report-card {
    margin-top: 28px;
  }
}

/*
 * Android 7.1 设备可能仍使用不支持 CSS Grid 的旧版系统 WebView。
 * 竖屏宽度为 800px 时统一使用 Flexbox，避免页面只显示标题而无法操作。
 */
@media (max-width: 1100px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    width: 100%;
    height: 160vw;
    min-height: 160vw;
    max-height: none;
  }

  .side-panel {
    display: none;
  }

  .content-panel {
    display: flex;
    width: 100%;
    height: 160vw;
    min-height: 160vw;
    flex-direction: column;
  }

  .top-bar {
    height: 86px;
    min-height: 86px;
    flex: 0 0 86px;
    padding: 0 24px;
  }

  .stage {
    min-height: 0;
    flex: 1 1 auto;
  }

  .bottom-actions {
    height: 78px;
    min-height: 78px;
    flex: 0 0 78px;
    padding: 0 24px;
  }

  .question-screen {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    padding: 28px 34px;
    -webkit-overflow-scrolling: touch;
  }

  [data-screen="0"].is-active {
    display: flex;
    align-items: center;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .hero-copy {
    width: 100%;
  }

  .hero-copy h2 {
    font-size: 56px;
  }

  .hero-art {
    display: none;
  }

  .choice-grid,
  .gender-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
  }

  .choice-card {
    display: flex;
    min-width: 0;
    min-height: 220px;
    flex: 1 1 28%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 8px;
  }

  .choice-icon,
  .question-number,
  .brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .age-layout,
  .likes-layout,
  .report-screen.is-active {
    display: flex;
    flex-direction: column;
  }

  .age-layout {
    align-items: stretch;
  }

  .age-input-wrap,
  .hobby-block {
    margin-bottom: 24px;
  }

  .quick-options,
  .zodiac-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -5px;
  }

  .quick-options button {
    min-width: 30%;
    flex: 1 1 30%;
    margin: 5px;
  }

  .zodiac-grid button {
    display: block;
    width: 23%;
    min-height: 92px;
    margin: 5px 1%;
    text-align: center;
  }

  .zodiac-grid button > span,
  .zodiac-grid small {
    display: block;
  }

  .report-screen.is-active {
    align-items: stretch;
  }

  .report-card {
    margin-top: 24px;
  }
}

@media print {
  body {
    background: white;
    overflow: visible;
  }

  body * {
    visibility: hidden !important;
  }

  #a40i-print-report,
  #a40i-print-report * {
    visibility: visible !important;
  }

  #a40i-print-report {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    min-height: 0;
    box-shadow: none;
  }
}
