
:root {
  --bg: #fff7ea;
  --card: rgba(255, 253, 247, 0.96);
  --ink: #2d241f;
  --muted: #7a6859;
  --primary: #ff8a3d;
  --primary2: #ffc14f;
  --secondary: #fff0d8;
  --line: #efd5b9;
  --green: #73bd91;
  --shadow: 0 18px 44px rgba(128, 82, 34, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 195, 100, 0.48), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 165, 150, 0.42), transparent 30%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none;
}

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 16px 28px;
}

.screen {
  min-height: calc(100vh - 46px);
  display: flex;
  flex-direction: column;
}

.card {
  background: var(--card);
  border: 1px solid rgba(239, 213, 185, 0.92);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  width: 160px;
  height: 160px;
  background: rgba(255, 188, 91, 0.22);
  border-radius: 999px;
  position: absolute;
  right: -72px;
  top: -72px;
}

.hero-card {
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid rgba(240, 215, 187, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -70px;
  top: -70px;
  background: rgba(255, 179, 91, 0.25);
  border-radius: 999px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--secondary);
  color: #985316;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
}

.hero-title {
  font-size: 35px;
  line-height: 1.1;
  letter-spacing: -1px;
  margin: 18px 0 10px;
}

.title {
  margin: 20px 0 12px;
  font-size: 34px;
  line-height: 1.12;
}

.subtitle {
  font-size: 17px;
  color: #744b28;
  font-weight: 700;
  line-height: 1.55;
}

.hero-subtitle {
  color: #764316;
  font-size: 17px;
  line-height: 1.55;
  font-weight: 800;
}

.hero-desc,
.desc {
  color: var(--muted);
  line-height: 1.78;
  font-size: 15px;
}

.mascot {
  height: 138px;
  margin: 12px 0 2px;
  display: grid;
  place-items: center;
}

.beast {
  width: 126px;
  height: 126px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 35% 24%, #fff 0 6%, transparent 7%),
    linear-gradient(145deg, #ffbd6f, #ff7d56);
  position: relative;
  box-shadow: 0 16px 34px rgba(255, 125, 86, 0.24);
  transform: rotate(-3deg);
}

.beast::before,
.beast::after {
  content: "";
  position: absolute;
  top: -13px;
  width: 32px;
  height: 34px;
  background: #ff9f55;
  border-radius: 16px 16px 26px 26px;
}

.beast::before {
  left: 20px;
  transform: rotate(-22deg);
}

.beast::after {
  right: 20px;
  transform: rotate(22deg);
}

.spark {
  position: absolute;
  background: #fff1b6;
  border-radius: 999px;
}

.spark.s1 { width: 16px; height: 16px; left: -10px; top: 42px; }
.spark.s2 { width: 10px; height: 10px; right: -7px; top: 84px; }
.spark.s3 { width: 12px; height: 12px; left: 34px; bottom: -8px; }

.beast .face {
  left: 23px;
  right: 23px;
  top: 42px;
  height: 52px;
}

.beast .eye {
  width: 13px;
  height: 18px;
}

.beast .eye.left { left: 12px; }
.beast .eye.right { right: 12px; }

.beast .mouth {
  top: 29px;
  width: 40px;
  height: 22px;
}

.hero-visual {
  height: 190px;
  display: grid;
  place-items: center;
  margin: 16px 0 0;
}

.family-orb {
  width: 178px;
  height: 178px;
  border-radius: 44px;
  background: linear-gradient(145deg, #ffbd6f, #ff7d56);
  box-shadow: 0 22px 48px rgba(255, 125, 86, 0.28);
  transform: rotate(-3deg);
  position: relative;
}

.family-orb::before,
.family-orb::after {
  content: "";
  position: absolute;
  top: -18px;
  width: 44px;
  height: 46px;
  background: #ff9f55;
  border-radius: 16px 16px 26px 26px;
}

.family-orb::before {
  left: 28px;
  transform: rotate(-22deg);
}

.family-orb::after {
  right: 28px;
  transform: rotate(22deg);
}

.face {
  position: absolute;
  left: 35px;
  right: 35px;
  top: 58px;
  height: 78px;
}

.eye {
  position: absolute;
  width: 18px;
  height: 25px;
  background: #2b211c;
  border-radius: 999px;
  top: 0;
}

.eye.left { left: 18px; }
.eye.right { right: 18px; }

.mouth {
  position: absolute;
  left: 50%;
  top: 42px;
  width: 58px;
  height: 32px;
  transform: translateX(-50%);
  border-radius: 0 0 999px 999px;
  background: #2b211c;
}

.actions {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
}

.beast-intro-screen .hero-card {
  padding-bottom: 18px;
}

.beast-intro-screen .actions,
.keeper-entry-screen .actions {
  margin-top: 14px;
  padding-top: 0;
}

.keeper-entry-screen .card {
  padding-bottom: 18px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  width: 100%;
  border-radius: 18px;
  padding: 15px 16px;
  border: 0;
  font-weight: 900;
  transition: transform .15s ease, opacity .15s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: white;
  box-shadow: 0 12px 24px rgba(255, 138, 61, 0.26);
}

.secondary-btn {
  background: #fff7e8;
  color: #8b4b18;
  border: 1px solid var(--line);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.option:active {
  transform: scale(.985);
}

.entry-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.entry-card {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
}

.entry-card.main {
  border-color: #ffbd85;
  background: linear-gradient(135deg, #fff7e8, #fff0dc);
}

.entry-title {
  font-weight: 900;
  font-size: 20px;
  margin-bottom: 6px;
}

.entry-text {
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.progress-text {
  color: #96551c;
  font-weight: 900;
  font-size: 14px;
}

.progress-track {
  height: 10px;
  background: #f4dbc1;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff8a3d, #ffc14f);
  border-radius: 999px;
  transition: width .22s ease;
}

.question-title {
  font-size: 24px;
  line-height: 1.34;
  letter-spacing: -0.4px;
  margin: 8px 0 20px;
  position: relative;
}

.option-list {
  display: grid;
  gap: 12px;
  position: relative;
}

.option {
  width: 100%;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--ink);
  border-radius: 18px;
  padding: 15px 16px;
  line-height: 1.55;
}

.option.selected {
  border-color: var(--primary);
  background: #fff0da;
  box-shadow: 0 10px 18px rgba(255, 138, 61, .12);
}

.option-index {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #ffe0b3;
  color: #9a571e;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
}

.quiz-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  margin-top: 18px;
}

.loading-card {
  margin: auto 0;
  text-align: center;
}

.loader {
  width: 78px;
  height: 78px;
  border-radius: 999px;
  margin: 10px auto 22px;
  background: conic-gradient(from 0deg, #ff8a3d, #ffd16a, #ff8a3d);
  position: relative;
  animation: spin 1s linear infinite;
}

.loader::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: inherit;
  background: var(--card);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-card {
  text-align: left;
}

.result-head {
  text-align: center;
  position: relative;
}

.result-img-wrap {
  margin: 8px auto 12px;
  width: 178px;
  height: 178px;
  border-radius: 42px;
  background: #fff5e5;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: 0 18px 34px rgba(174, 105, 45, .13);
  overflow: hidden;
}

.result-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-name {
  margin: 6px 0 4px;
  font-size: 34px;
  line-height: 1.12;
}

.result-subtitle {
  color: #9a571e;
  font-weight: 900;
  font-size: 16px;
}

.quote {
  margin: 18px 0;
  padding: 14px 16px;
  background: #fff2dd;
  border-radius: 18px;
  color: #7b4719;
  font-weight: 900;
  line-height: 1.65;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.meta {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
}

.meta-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.meta-value {
  font-weight: 900;
  color: var(--ink);
}

.section {
  margin-top: 14px;
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 15px;
}

.section h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.section p {
  margin: 0;
  color: #5e5046;
  line-height: 1.75;
  font-size: 14px;
}

.share-box {
  margin-top: 15px;
  background: #fff8ea;
  border: 1px dashed #dba86e;
  border-radius: 18px;
  padding: 13px;
  color: #85501c;
  line-height: 1.68;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(39, 31, 26, .9);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 20;
}

.poster-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(45, 36, 31, 0.72);
  padding: 18px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-panel {
  width: min(100%, 430px);
  max-height: calc(100vh - 36px);
  background: #fffdf7;
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 22px 60px rgba(45, 36, 31, 0.32);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.poster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.poster-title {
  font-weight: 900;
  color: var(--ink);
}

.poster-tip {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.poster-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #fff0d8;
  color: #8b4b18;
  font-size: 24px;
  line-height: 1;
}

.poster-preview {
  width: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  border-radius: 18px;
  background: #fff7ea;
  border: 1px solid var(--line);
}

.poster-actions {
  display: grid;
  gap: 10px;
}

@media (max-width: 370px) {
  #app {
    padding: 14px 12px 22px;
  }
  .hero-title { font-size: 31px; }
  .question-title { font-size: 22px; }
  .card { padding: 20px; border-radius: 24px; }
  .result-name { font-size: 30px; }
}


/* v2 homepage optimization */
.home-screen {
  min-height: calc(100vh - 46px);
  justify-content: center;
}

.home-card {
  padding-bottom: 18px;
}

.home-screen .hero-title {
  margin-top: 14px;
  font-size: 32px;
}

.home-screen .hero-desc {
  margin-bottom: 12px;
}

.entry-grid.compact {
  margin-top: 14px;
  gap: 10px;
}

.clickable-entry {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  appearance: none;
  font: inherit;
  color: inherit;
}

.clickable-entry:active {
  transform: scale(.99);
}

.entry-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #fff2da;
  border-radius: 16px;
  font-size: 22px;
  box-shadow: inset 0 0 0 1px rgba(239, 213, 185, 0.9);
}

.entry-arrow {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}

.home-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.home-note {
  margin-top: 12px;
  color: #9a806a;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-height: 640px) {
  #app {
    padding-top: 12px;
    padding-bottom: 14px;
  }

  .home-screen {
    justify-content: flex-start;
  }

  .home-screen .hero-title {
    font-size: 29px;
    margin-bottom: 8px;
  }

  .home-screen .hero-subtitle {
    font-size: 15px;
  }

  .home-screen .hero-desc {
    font-size: 13px;
    line-height: 1.58;
  }

  .entry-card {
    padding: 13px;
    border-radius: 18px;
  }

  .entry-title {
    font-size: 17px;
  }

  .entry-text {
    font-size: 12px;
    line-height: 1.45;
  }

  .home-note {
    display: none;
  }

  .beast-intro-screen .hero-card {
    padding: 18px;
  }

  .beast-intro-screen .title {
    font-size: 29px;
    margin: 14px 0 8px;
  }

  .beast-intro-screen .subtitle {
    font-size: 15px;
  }

  .beast-intro-screen .desc {
    font-size: 13px;
    line-height: 1.6;
    margin-top: 12px;
  }

  .mascot {
    height: 116px;
    margin-top: 8px;
  }

  .beast {
    width: 108px;
    height: 108px;
    border-radius: 28px;
  }

  .beast::before,
  .beast::after {
    width: 28px;
    height: 30px;
  }

  .beast .face {
    left: 20px;
    right: 20px;
    top: 36px;
  }

  .beast .mouth {
    top: 25px;
  }

  .keeper-entry-screen .card {
    padding: 18px;
  }

  .keeper-entry-screen .hero-title {
    font-size: 29px;
  }

  .keeper-entry-screen .desc,
  .keeper-entry-screen .entry-text {
    font-size: 13px;
    line-height: 1.55;
  }

  .primary-btn, .secondary-btn, .ghost-btn {
    padding: 13px 14px;
  }
}
