:root {
  --paper: #f7f3ed;
  --paper-2: #f0ebe3;
  --paper-3: #f2ede5;
  --paper-q3: #ede7dd;
  --paper-4: #e8e0d6;
  --paper-5: #e5ddd3;
  --paper-6: #ebe3d9;
  --line: #d9d0c7;
  --ink: #5c4a3a;
  --ink-soft: #8b7b6b;
  --muted: #a09585;
  --wine: #a0524f;
  --amber: #c49a6c;
  --card: #eeebe5;
  --selected: #e8e0d6;
  --white: #fffaf4;
  --font: "Noto Sans SC", "Alibaba PuHuiTi", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  background: var(--paper);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

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

button:disabled {
  opacity: 0.45;
}

.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.app-shell {
  width: min(100vw, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: var(--paper);
  scrollbar-width: none;
}

.app-shell::-webkit-scrollbar {
  display: none;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.page {
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  position: relative;
}

.page::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(217, 208, 199, 0.58);
  pointer-events: none;
}

.intro-panel {
  display: grid;
  grid-template-rows: minmax(270px, 44dvh) auto auto auto 1fr;
  align-items: start;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 82%, rgba(160, 82, 79, 0.1) 0 64px, transparent 66px),
    radial-gradient(ellipse at 18% 20%, rgba(196, 154, 108, 0.12) 0 74px, transparent 76px),
    linear-gradient(rgba(247, 243, 237, 0.78), rgba(247, 243, 237, 0.9)),
    url("./assets/backgrounds/question_page_bg.png");
  background-size: auto, auto, cover, cover;
}

.intro-visual {
  grid-row: 1;
  position: relative;
  align-self: end;
  justify-self: center;
  width: min(72vw, 292px);
  height: min(72vw, 292px);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  animation: riseIn 420ms ease-out both;
}

.intro-visual img {
  position: absolute;
  object-fit: contain;
}

.intro-blob {
  width: 100%;
  opacity: 0.34;
  transform: rotate(-5deg) scale(1.12);
}

.intro-cup {
  width: 66%;
  opacity: 0.3;
  transform: rotate(3deg);
  filter: saturate(0.86);
}

.intro-title {
  grid-row: 2;
  margin: 0 auto;
  max-width: 320px;
  color: var(--ink);
  font-size: clamp(34px, 10vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  letter-spacing: 0;
  animation: riseIn 300ms ease-out both;
}

.intro-subtitle {
  grid-row: 3;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  animation: riseIn 300ms ease-out 60ms both;
}

.intro-start {
  grid-row: 4;
  justify-self: center;
  margin-top: 32px;
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  border: 1px solid var(--ink);
  border-radius: 24px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.btn:active {
  transform: scale(1.02);
}

.btn.primary {
  border-color: var(--wine);
  background: var(--wine);
  color: var(--white);
  font-size: 18px;
}

.btn.ghost {
  border-color: transparent;
  padding-inline: 10px;
}

.question-panel {
  overflow: hidden;
}

.question-panel.q1,
.question-panel.q14 {
  background: var(--paper);
}

.question-panel.q2 {
  background: var(--paper-3);
}

.question-panel.q3 {
  background: var(--paper-q3);
}

.question-panel.q15 {
  background: var(--paper-5);
}

.question-panel.q4 {
  background: linear-gradient(90deg, #f0ebe3 0 50%, #e8e0d6 50% 100%);
}

.question-panel.q5 {
  background: linear-gradient(90deg, #ede5da 0 50%, #f5f0e8 50% 100%);
}

.question-panel.q6 {
  background: linear-gradient(90deg, #e5ddd3 0 50%, #ece6dd 50% 100%);
}

.question-panel.q7 {
  background:
    linear-gradient(90deg, rgba(160, 82, 79, 0.08) 0 var(--sweet-pos, 50%), rgba(92, 74, 58, 0.08) var(--sweet-pos, 50%) 100%),
    #f2ede6;
}

.question-panel.q8 {
  background: var(--paper-4);
}

.question-panel.q9 {
  background: var(--paper-2);
}

.question-panel.q10 {
  background: var(--paper-6);
}

.question-panel.q11 {
  background: linear-gradient(180deg, #f0ebe3 0 50%, #e8e0d6 50% 100%);
}

.question-panel.q12 {
  background: linear-gradient(180deg, #ede5da 0 50%, #f5f0e8 50% 100%);
}

.question-panel.q13 {
  background: linear-gradient(180deg, #e5ddd3 0 50%, #ece6dd 50% 100%);
}

.question-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: minmax(170px, 34dvh) 1fr;
  gap: 18px;
}

.binary-page .question-inner {
  grid-template-rows: minmax(92px, 16dvh) 1fr;
}

.slider-page .question-inner,
.color-page .question-inner {
  grid-template-rows: minmax(160px, 24dvh) 1fr;
}

.question-title {
  align-self: end;
  margin: 0;
  color: var(--ink);
  font-size: clamp(29px, 8.6vw, 34px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
  animation: riseIn 300ms ease-out both;
}

.binary-page .question-title {
  align-self: center;
  text-align: center;
  font-size: 20px;
  line-height: 1.32;
}

.slider-page .question-title,
.color-page .question-title {
  align-self: end;
  text-align: center;
  font-size: clamp(24px, 6.4vw, 28px);
  line-height: 1.24;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-self: stretch;
  animation: riseIn 300ms ease-out 70ms both;
}

.options-grid.vertical-options {
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(72px, auto);
  align-self: start;
}

.option-card,
.binary-card,
.color-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: none;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    opacity 150ms ease;
}

.option-card {
  min-height: 132px;
  padding: 20px;
  text-align: left;
}

.option-icon {
  display: block;
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1;
  opacity: 0.72;
}

.vertical-options .option-card {
  min-height: 72px;
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  padding: 14px 18px;
}

.vertical-options .option-icon {
  margin: 0;
}

.option-text {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.48;
}

.vertical-options .option-text {
  font-size: 16px;
}

.option-card.selected,
.binary-card.selected,
.color-card.selected {
  transform: scale(1.02);
  border: 2px solid var(--wine);
  background: var(--selected);
}

.options-grid:has(.selected) .option-card:not(.selected),
.color-grid:has(.selected) .color-card:not(.selected) {
  opacity: 0.5;
}

.binary-grid {
  position: relative;
  align-self: stretch;
  display: grid;
  animation: riseIn 300ms ease-out 70ms both;
}

.binary-horizontal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.binary-horizontal::before {
  content: "/";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  color: rgba(92, 74, 58, 0.34);
  font-size: 44px;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.binary-vertical {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.binary-vertical::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 1px;
  background: rgba(92, 74, 58, 0.22);
}

.binary-card {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  border-color: transparent;
  border-radius: 0;
  background: transparent;
  text-align: center;
}

.binary-card strong {
  display: block;
  color: var(--ink);
  font-size: clamp(28px, 8.4vw, 39px);
  font-weight: 900;
  line-height: 1.1;
}

.binary-grid:has(.selected) .binary-card:not(.selected) {
  opacity: 0.3;
  transform: scale(0.96);
}

.binary-card.selected {
  transform: scale(1.06);
  border-color: transparent;
  background: rgba(160, 82, 79, 0.1);
}

.slider-wrap {
  align-self: center;
  display: grid;
  gap: 30px;
  padding: 0 8px 28px;
  animation: riseIn 300ms ease-out 80ms both;
}

.slider-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.slider-labels span:last-child {
  text-align: right;
}

.range {
  width: 100%;
  accent-color: var(--wine);
  appearance: none;
  background: transparent;
}

.range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: var(--line);
}

.range::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -12.5px;
  border: 2px solid rgba(255, 250, 244, 0.9);
  border-radius: 50%;
  background: var(--wine);
  box-shadow: 0 4px 10px rgba(92, 74, 58, 0.18);
}

.range::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: var(--line);
}

.range::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 250, 244, 0.9);
  border-radius: 50%;
  background: var(--wine);
  box-shadow: 0 4px 10px rgba(92, 74, 58, 0.18);
}

.slider-confirm {
  justify-self: center;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 100px));
  align-content: center;
  gap: 12px;
  animation: riseIn 300ms ease-out 80ms both;
}

.color-card {
  min-height: 88px;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
}

.color-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.18);
}

.color-card.selected {
  border-color: var(--white);
  box-shadow: inset 0 0 0 3px var(--white);
}

.color-grid:has(.selected) .color-card:not(.selected) {
  transform: scale(0.92);
}

.loading-panel {
  display: grid;
  grid-template-rows: 1fr auto auto 1fr;
  place-items: center;
  gap: 28px;
  background: var(--paper-2);
}

.loading-cup {
  grid-row: 2;
  position: relative;
  width: 116px;
  height: 156px;
  overflow: hidden;
  border: 4px solid rgba(92, 74, 58, 0.58);
  border-top: 0;
  border-radius: 10px 10px 46px 46px / 8px 8px 56px 56px;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 244, 0.52);
}

.loading-cup::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: -11px;
  height: 28px;
  border: 4px solid rgba(92, 74, 58, 0.58);
  border-radius: 50%;
  background: rgba(240, 235, 227, 0.76);
  z-index: 2;
}

.loading-cup::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 22px;
  bottom: 38px;
  width: 12px;
  border-radius: 999px;
  background: rgba(255, 250, 244, 0.28);
  z-index: 3;
}

.loading-liquid {
  position: absolute;
  left: -24%;
  right: -24%;
  bottom: -8%;
  height: 116%;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 250, 244, 0.36) 0 24px, transparent 26px),
    linear-gradient(160deg, rgba(160, 82, 79, 0.72), rgba(196, 154, 108, 0.58));
  transform: translateY(100%);
  animation: fillCup 3300ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.loading-liquid::before {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  top: -20px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 250, 244, 0.24);
  animation: waveCup 1200ms ease-in-out infinite alternate;
}

.loading-copy {
  grid-row: 3;
  position: relative;
  width: 100%;
  min-height: 34px;
  display: grid;
  place-items: center;
}

.loading-line {
  grid-area: 1 / 1;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.loading-line.one {
  animation: loadingOne 3400ms ease-in-out both;
}

.loading-line.two {
  opacity: 0;
  animation: loadingTwo 3400ms ease-in-out both;
}

.result-page {
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: center;
  min-height: 100dvh;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--paper);
}

.result-card,
.duo-result-card {
  position: relative;
  width: min(100%, calc((100dvh - 176px) * 9 / 16));
  aspect-ratio: 9 / 16;
  padding: 22px 22px;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: none;
  background-image:
    linear-gradient(rgba(247, 243, 237, 0.16), rgba(247, 243, 237, 0.28)),
    url("./assets/backgrounds/single_card_bg_clean.png");
  background-size: cover;
  background-position: center;
}

.result-card {
  display: grid;
  grid-template-rows: minmax(218px, 35%) auto auto auto auto minmax(0, 1fr);
  align-content: start;
}

.result-card::before,
.duo-result-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(217, 208, 199, 0.72);
  pointer-events: none;
}

.stamp {
  position: absolute;
  top: 30px;
  right: 28px;
  z-index: 3;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(160, 82, 79, 0.58);
  border-radius: 50%;
  color: var(--wine);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.08em;
  text-align: center;
  transform: rotate(-9deg);
}

.visual-stack {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 218px;
  animation: riseIn 300ms ease-out 80ms both;
}

.visual-stack img {
  position: absolute;
  object-fit: contain;
}

.visual-stack .blob {
  width: 100%;
  opacity: 0.74;
}

.visual-stack .cup {
  width: 72%;
  z-index: 2;
}

.visual-stack .garnish {
  width: 32%;
  z-index: 3;
  transform: translate(96px, -18px) rotate(7deg);
}

.visual-stack .garnish.second {
  transform: translate(-96px, 64px) rotate(-16deg);
}

.result-heading {
  text-align: center;
  animation: riseIn 300ms ease-out 250ms both;
}

.result-heading h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: clamp(25px, 7.2vw, 32px);
  font-weight: 900;
  line-height: 1.04;
}

.result-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.flavors {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 10px;
  padding: 0;
  list-style: none;
  animation: riseIn 300ms ease-out 420ms both;
}

.flavors li {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(247, 243, 237, 0.58);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.card-rule {
  width: 58%;
  height: 1px;
  justify-self: center;
  margin: 1px 0 10px;
  background: var(--line);
}

.persona-line {
  margin: 0;
  color: var(--ink);
  text-align: center;
  font-size: clamp(17px, 5vw, 20px);
  font-weight: 900;
  line-height: 1.34;
  animation: riseIn 300ms ease-out 620ms both;
}

.scene-line {
  align-self: end;
  margin: 8px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  animation: riseIn 300ms ease-out 820ms both;
}

.result-actions {
  width: min(100%, calc((100dvh - 176px) * 9 / 16));
  display: grid;
  gap: 8px;
  padding-bottom: 0;
}

.result-actions .btn {
  min-height: 42px;
  padding: 10px 24px;
  font-size: 15px;
}

.result-actions .btn.primary {
  font-size: 16px;
}

.result-actions .btn.ghost {
  min-height: 34px;
  padding: 6px 10px;
}

.duo-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  background:
    linear-gradient(rgba(247, 243, 237, 0.78), rgba(247, 243, 237, 0.94)),
    url("./assets/backgrounds/duo_card_bg.png");
  background-size: cover;
  background-position: center;
}

.duo-result-page {
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: center;
  min-height: 100dvh;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--paper);
}

.duo-panel h2 {
  margin: 54px 0 0;
  color: var(--ink);
  font-size: clamp(38px, 11vw, 50px);
  font-weight: 900;
  line-height: 1.02;
}

.duo-subtitle {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
}

.duo-form {
  display: grid;
  gap: 12px;
}

.duo-form textarea {
  min-height: 112px;
  resize: none;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
}

.duo-result-card {
  margin-top: 0;
  display: grid;
  grid-template-rows: auto minmax(188px, 38%) auto auto 1fr;
  gap: 10px;
  background-image:
    linear-gradient(rgba(247, 243, 237, 0.16), rgba(247, 243, 237, 0.28)),
    url("./assets/backgrounds/duo_card_bg.png");
}

.duo-names {
  margin: 62px 0 0;
  color: var(--wine);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.duo-cups {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.duo-cups img {
  width: 100%;
  max-height: 188px;
  object-fit: contain;
}

.duo-cups span {
  color: var(--wine);
  font-size: 30px;
  font-weight: 900;
}

.duo-result-card h3 {
  margin: 0;
  color: var(--ink);
  text-align: center;
  font-size: clamp(26px, 7.4vw, 32px);
  font-weight: 900;
  line-height: 1.04;
}

.duo-relation {
  margin: 0;
  color: var(--ink);
  text-align: center;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.5;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: ease-out;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 24px;
  background: rgba(160, 82, 79, 0.96);
  color: var(--white);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(100% + 48px));
  transition:
    opacity 180ms ease,
    transform 220ms ease;
  text-align: center;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 431px) {
  body {
    padding: 18px 0;
  }

  .app-shell {
    min-height: min(920px, calc(100dvh - 36px));
    border: 1px solid rgba(217, 208, 199, 0.72);
  }

  .page {
    min-height: min(920px, calc(100dvh - 36px));
  }

  .question-inner {
    min-height: calc(min(920px, 100dvh - 36px) - 36px);
  }
}

@media (max-width: 360px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .question-title {
    font-size: 28px;
  }

  .option-card {
    min-height: 118px;
    padding: 16px;
  }

  .option-text {
    font-size: 14px;
  }

  .result-card,
  .duo-result-card {
    padding: 20px 18px;
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes loadingOne {
  0%,
  38% {
    opacity: 1;
    transform: translateY(0);
  }

  52%,
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes loadingTwo {
  0%,
  48% {
    opacity: 0;
    transform: translateY(8px);
  }

  62%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fillCup {
  0% {
    transform: translateY(100%);
  }

  78%,
  100% {
    transform: translateY(12%);
  }
}

@keyframes waveCup {
  from {
    transform: translateX(-10px) rotate(-2deg);
  }

  to {
    transform: translateX(10px) rotate(2deg);
  }
}
