:root {
  color-scheme: light;
  --paper: #fffdf9;
  --shell: #f6eee8;
  --ink: #342a24;
  --muted: #b3a297;
  --line: #eee5dd;
  --cream: #fff6e9;
  --peach: #ffb28f;
  --peach-2: #ffd8c6;
  --green: #bddcaf;
  --blue: #d4e5f7;
  --yellow: #ffe6a9;
  --brown: #3b2d26;
  --shadow: 0 24px 80px rgba(80, 57, 42, 0.12);
  font-family:
    "PingFang SC",
    "Noto Sans CJK SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 22% 16%, rgba(255, 191, 166, 0.33), transparent 25%),
    radial-gradient(circle at 75% 10%, rgba(255, 230, 169, 0.3), transparent 26%),
    linear-gradient(135deg, #fff6f1 0%, #fffaf4 48%, #f6efe8 100%);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.phone {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
}

@media (min-width: 560px) {
  body {
    padding: 28px 0;
  }

  .phone {
    min-height: calc(100vh - 56px);
    border: 8px solid #211c19;
    border-radius: 42px;
    overflow: hidden;
    box-shadow: var(--shadow);
  }
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 34px 28px 28px;
  background: var(--paper);
}

@media (min-width: 560px) {
  .screen {
    min-height: calc(100vh - 72px);
  }
}

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

.screen.chat-screen.is-active {
  display: flex;
  flex-direction: column;
}

.home-center,
.loading-center {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: calc(100vh - 68px);
  text-align: center;
}

.seal {
  display: grid;
  width: 140px;
  height: 140px;
  margin-bottom: 34px;
  place-items: center;
  border-radius: 50%;
  background: #ffc3ad;
  box-shadow: 0 18px 50px rgba(255, 178, 143, 0.22);
  font-size: 58px;
}

.tiny-text {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 9px;
  text-indent: 9px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 44px;
  line-height: 1.12;
  letter-spacing: 5px;
  text-indent: 5px;
}

.home-copy {
  margin: 34px 0 62px;
  color: #83736a;
  font-size: 18px;
  line-height: 1.9;
  font-weight: 600;
}

.main-button {
  min-width: 190px;
  min-height: 58px;
  padding: 0 28px;
  border-radius: 32px;
  color: #fffdf9;
  background: var(--brown);
  box-shadow: 0 18px 36px rgba(59, 45, 38, 0.22);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 6px;
  text-indent: 6px;
}

.main-button.sticky {
  position: sticky;
  bottom: 20px;
  width: 100%;
  margin-top: 22px;
}

.main-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  margin-bottom: 26px;
}

.chat-screen {
  height: 100vh;
  min-height: 100vh;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 218, 188, 0.38), transparent 34%),
    linear-gradient(180deg, #fffdf9 0%, #fffaf5 42%, #fff3e8 100%);
}

@media (min-width: 560px) {
  .chat-screen {
    height: calc(100vh - 72px);
    min-height: calc(100vh - 72px);
  }
}

.chat-header {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 26px 22px 16px;
  border-bottom: 1px solid rgba(238, 229, 221, 0.64);
  background: rgba(255, 253, 249, 0.82);
  backdrop-filter: blur(22px);
}

.coach-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.coach-avatar,
.message-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fffdf9;
  background: linear-gradient(145deg, #ffb28f 0%, #f7c66d 100%);
  font-weight: 950;
}

.coach-avatar {
  width: 46px;
  height: 46px;
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(255, 178, 143, 0.26);
}

.chat-header h2 {
  margin: 0;
  max-width: none;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: 0;
}

.chat-header p {
  margin-top: 4px;
  overflow: hidden;
  color: #ad9b90;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-context {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 22px 8px;
  color: #aa978a;
  font-size: 12px;
  font-weight: 850;
}

.chat-context span:first-child {
  padding: 6px 10px;
  border-radius: 999px;
  color: #f07e59;
  background: #ffe6a9;
}

.back-button,
.quiet-link {
  color: #c7b8ae;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
}

.quiet-link {
  color: #ff9d78;
}

.progress-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 18px;
  padding: 0 13px;
  border-radius: 999px;
  color: #ff8f69;
  background: #ffe6a9;
  font-weight: 900;
  letter-spacing: 2px;
}

h2 {
  max-width: 330px;
  font-size: 28px;
  line-height: 1.32;
  font-weight: 900;
  letter-spacing: 0;
}

.hint {
  margin-top: 10px;
  color: #baa89c;
  font-size: 15px;
  line-height: 1.6;
  font-weight: 700;
}

.chat-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  margin: 0;
  padding: 18px 20px 20px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.message-row.user {
  justify-content: flex-end;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 11px;
  font-size: 13px;
}

.message-row.user .message-avatar {
  background: linear-gradient(145deg, #bddcaf 0%, #83c6a3 100%);
}

.bubble {
  max-width: min(84%, 326px);
  padding: 16px 18px;
  border-radius: 22px 22px 22px 8px;
  color: #4b3d35;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 38px rgba(95, 71, 53, 0.09);
  font-size: 16px;
  line-height: 1.75;
  font-weight: 650;
  white-space: pre-wrap;
}

.bubble.user {
  border-radius: 20px 20px 8px 20px;
  background: linear-gradient(145deg, #ffe9df 0%, #fff4e8 100%);
}

.bubble.coach {
  justify-self: start;
}

.bubble.is-pending {
  color: #a99588;
}

.chat-form {
  display: grid;
  gap: 8px;
  padding: 10px 16px 18px;
  border-top: 1px solid rgba(238, 229, 221, 0.8);
  background: rgba(255, 253, 249, 0.88);
  box-shadow: 0 -20px 44px rgba(95, 71, 53, 0.08);
  backdrop-filter: blur(22px);
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

textarea {
  width: 100%;
  min-height: 138px;
  padding: 20px;
  border: 1px solid transparent;
  border-radius: 20px;
  outline: 0;
  resize: vertical;
  color: #44352e;
  background: #fff5e7;
  box-shadow: inset 0 0 0 1px rgba(111, 83, 65, 0.04);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 650;
}

.composer-row textarea {
  min-height: 54px;
  max-height: 132px;
  padding: 14px 16px;
  border-radius: 20px;
  resize: none;
  background: rgba(255, 248, 238, 0.96);
  font-size: 15.5px;
  line-height: 1.55;
}

.send-button {
  display: grid;
  min-width: 64px;
  min-height: 54px;
  padding: 0 16px;
  place-items: center;
  border-radius: 20px;
  color: #fffdf9;
  background: var(--brown);
  box-shadow: 0 10px 26px rgba(59, 45, 38, 0.18);
  font-size: 14px;
  font-weight: 950;
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

textarea:focus {
  border-color: rgba(255, 157, 120, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 178, 143, 0.16);
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}

.choice-row:empty {
  display: none;
}

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: start;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(215, 200, 189, 0.58);
  border-radius: 999px;
  color: #5f4d42;
  background: rgba(255, 253, 249, 0.72);
  box-shadow: none;
  text-align: left;
}

.choice.is-primary {
  border-color: rgba(255, 157, 120, 0.62);
  background: linear-gradient(180deg, #fff0e8 0%, #ffe2d4 100%);
}

.choice-kicker {
  display: grid;
  min-height: 22px;
  padding: 0 8px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 229, 204, 0.72);
  color: #f07e59;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
}

.choice-text {
  display: -webkit-box;
  overflow: hidden;
  color: #46372f;
  font-size: 12.5px;
  font-weight: 850;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.choice.is-selected {
  color: #fffdf9;
  border-color: #ff9d78;
  background: #ff9d78;
}

.loading-center h2 {
  margin-top: 32px;
}

.loading-center p {
  max-width: 260px;
  margin-top: 16px;
  color: #9a887d;
  font-size: 16px;
  line-height: 1.8;
  font-weight: 700;
}

.soft-loader {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: #ffc3ad;
}

.soft-loader span {
  position: absolute;
  inset: 42px;
  border-radius: 50%;
  background: #fff8ee;
  animation: pulse 1.35s ease-in-out infinite;
}

.soft-loader span:nth-child(2) {
  inset: 30px;
  opacity: 0.42;
  animation-delay: 0.18s;
}

.soft-loader span:nth-child(3) {
  inset: 18px;
  opacity: 0.25;
  animation-delay: 0.36s;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.82);
  }
  50% {
    transform: scale(1);
  }
}

.made-for {
  margin: 16px 0 44px;
  color: #c0b0a6;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 9px;
  text-indent: 9px;
}

.message-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 492px;
  border-radius: 26px;
  background: transparent;
  perspective: 1200px;
}

.card-side {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 278px 1fr;
  overflow: hidden;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 26px 72px rgba(65, 46, 35, 0.14);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card-back {
  transform: rotateY(180deg);
}

.message-card.is-flipped .card-front {
  transform: rotateY(180deg);
}

.message-card.is-flipped .card-back {
  transform: rotateY(360deg);
}

.card-art {
  overflow: hidden;
  background: #ffe6a9;
}

.card-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-text {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 28px;
  text-align: left;
}

.card-text strong {
  color: #342a24;
  font-size: 29px;
  line-height: 1.35;
  font-weight: 950;
}

.card-text span {
  color: #75665c;
  font-size: 16px;
  line-height: 1.72;
  font-weight: 700;
}

.card-text small {
  color: #c2b2a8;
  text-align: right;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 5px;
}

.flip-hint {
  margin-top: 22px;
  color: #c0b0a6;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 7px;
  text-indent: 7px;
}

.coach-note {
  margin-top: 28px;
  padding: 20px;
  border-radius: 20px;
  background: #fff5e7;
}

.note-label {
  margin-bottom: 8px;
  color: #ff9d78;
  font-weight: 900;
}

.coach-note p:last-child {
  color: #64544a;
  font-size: 15px;
  line-height: 1.7;
  font-weight: 700;
}

.result-actions {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.option-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  min-height: 84px;
  padding: 17px;
  border-radius: 20px;
  color: #342a24;
  background: #fff6e8;
  text-align: left;
}

.option-card span {
  grid-row: 1 / 3;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: #fff;
  font-size: 22px;
}

.option-card strong {
  align-self: end;
  font-size: 17px;
  font-weight: 900;
}

.option-card small {
  color: #ae9d92;
  font-size: 13px;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 9;
  min-width: 190px;
  padding: 13px 16px;
  border-radius: 999px;
  color: #fffdf9;
  background: rgba(59, 45, 38, 0.94);
  text-align: center;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

button:focus-visible,
textarea:focus-visible {
  outline: 4px solid rgba(255, 178, 143, 0.35);
  outline-offset: 3px;
}

@media (max-width: 420px) {
  .screen {
    padding: 30px 22px 24px;
  }

  .chat-screen {
    padding: 0;
  }

  .message-card {
    min-height: 468px;
  }

  .card-side {
    grid-template-rows: 250px 1fr;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
