/* 「你的本命城市」视觉系统：移动端竖屏优先、小红书式奶油底 + 高饱和点缀 + 圆角贴纸感。 */
:root {
  --bg: #FFF9F4;
  --surface: #FFFFFF;
  --ink: #2B2320;
  --muted: #8A7B72;
  --brand: #FF4E64;
  --brand-soft: #FFE7E9;
  --brand-deep: #D9364C;
  --line: rgba(43, 35, 32, 0.10);
  /* 结果页与海报共用主题色，由 app.js 按命中城市注入。 */
  --theme-bg: #FFF9F4;
  --theme-primary: #FF4E64;
  --theme-accent: #D9364C;
  --theme-ink: #2B2320;
  --radius-card: 22px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }

/* .screen 使用 flex 布局，必须强制覆盖 UA 的 [hidden] 表现，否则隐藏页仍会占位。 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #F3EEE9;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
}
@media (min-width: 600px) {
  .app {
    min-height: calc(100dvh - 64px);
    margin: 32px auto;
    border-radius: 32px;
    box-shadow: 0 18px 60px rgba(43, 35, 32, 0.14);
  }
}
.screen {
  position: relative;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  animation: fade-up 0.36s ease both;
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  width: 100%;
  color: #FFFFFF;
  background: var(--brand);
  box-shadow: 0 10px 24px rgba(255, 78, 100, 0.28);
}
.btn--primary:hover { background: var(--brand-deep); }
.btn--ghost {
  flex: 1;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  font-size: 14px;
}
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-deep); }

/* ---------- 封面 ---------- */
.screen--cover { background: linear-gradient(180deg, #FFF6EF 0%, #FFF9F4 62%); }
.sticker {
  position: absolute;
  display: block;
  pointer-events: none;
}
.sticker--a {
  top: 76px; right: -18px;
  width: 118px; height: 118px;
  border-radius: 50%;
  background: #FFE0B8;
  opacity: 0.75;
}
.sticker--b {
  top: 150px; left: -34px;
  width: 96px; height: 96px;
  border-radius: 28px;
  background: #FFD9DE;
  opacity: 0.7;
  transform: rotate(18deg);
}
.sticker--c {
  bottom: 138px; right: 26px;
  width: 54px; height: 54px;
  border-radius: 50% 50% 12px 50%;
  background: #FFC7CD;
  opacity: 0.8;
  transform: rotate(-12deg);
}
.sticker--d {
  bottom: 74px; left: 12px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 6px solid #FFE0B8;
}
.cover__inner { position: relative; z-index: 1; margin-top: auto; }
.cover__eyebrow {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand-deep);
}
.cover__eyebrow span { margin: 0 6px; }
.cover__title {
  margin: 0;
  font-size: clamp(52px, 14vw, 68px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.cover__title em {
  font-style: normal;
  color: var(--brand);
  background: linear-gradient(180deg, transparent 72%, #FFD9DE 72%);
}
.cover__subtitle {
  margin: 18px 0 0;
  font-size: 16px;
  color: var(--muted);
}
.cover__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 30px;
}
.cover__tags span {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--brand-deep);
}
.cover__note {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.cover__foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 40px;
  font-size: 12px;
  color: var(--muted);
}
.cover__foot-line { flex: 1; height: 1px; background: var(--line); }

/* ---------- 答题页 ---------- */
.q-header { display: flex; align-items: center; gap: 12px; }
.q-back {
  flex: 0 0 38px;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.q-back:hover { border-color: var(--brand); color: var(--brand-deep); }
.q-progress { flex: 1; }
.q-progress__meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}
.q-progress__meta span:first-child { font-weight: 700; color: var(--brand-deep); }
.q-progress__track {
  height: 6px;
  border-radius: 999px;
  background: #F0E7DF;
  overflow: hidden;
}
.q-progress__bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
  transition: width 0.32s ease;
}
.q-body { margin-top: 44px; }
.q-index {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--brand);
}
.q-title {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.4;
}
.q-hint { margin: 10px 0 26px; font-size: 13px; color: var(--muted); }
.q-options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 68px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  animation: fade-up 0.3s ease both;
}
.option:nth-child(2) { animation-delay: 0.05s; }
.option:nth-child(3) { animation-delay: 0.10s; }
.option:nth-child(4) { animation-delay: 0.15s; }
.option:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 8px 20px rgba(43, 35, 32, 0.07);
}
.option.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.option.is-picked { transform: scale(0.98); background: var(--brand-soft); border-color: var(--brand); }
.option__badge {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}
.option__badge--1 { background: #FFE1E5; color: #D9364C; }
.option__badge--2 { background: #FFF0D8; color: #C8891F; }
.option__badge--3 { background: #E4F1EC; color: #2E8B6B; }
.option__badge--4 { background: #E9EAF8; color: #5A5EA8; }
.option__label { flex: 1; font-size: 15px; line-height: 1.5; }
.option__arrow { flex: 0 0 auto; color: var(--muted); font-size: 15px; }
.q-foot {
  margin: auto 0 0;
  padding-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 过场 ---------- */
.screen--calculating { align-items: center; justify-content: center; }
.loading { text-align: center; }
.loading__ring {
  display: grid;
  place-items: center;
  width: 92px; height: 92px;
  margin: 0 auto 26px;
  border-radius: 50%;
  border: 5px solid var(--brand-soft);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}
.loading__ring span { font-size: 26px; color: var(--brand); animation: spin 0.9s linear infinite reverse; }
.loading__title { margin: 0; font-size: 17px; font-weight: 700; }
.loading__sub { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- 结果页 ---------- */
.screen--result { background: var(--theme-bg); color: var(--theme-ink); }
.result__inner { position: relative; z-index: 1; }
.result__eyebrow {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--theme-accent);
}
.result__city {
  margin: 2px 0 0;
  font-size: clamp(64px, 19vw, 88px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.result__archetype {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--theme-primary);
}
.result__match {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin: 22px 0 0;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--theme-primary);
  color: #FFFFFF;
}
.result__match strong { font-size: 30px; line-height: 1; }
.result__match span { font-size: 13px; }
.result__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.result__tags span {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 12px;
  color: var(--theme-accent);
  opacity: 0.9;
}
.result__motto {
  margin: 26px 0 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
}
.result__description {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.85;
  opacity: 0.86;
}
.result__scene {
  margin: 22px 0 0;
  padding: 18px 20px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.result__scene span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--theme-accent);
}
.result__scene p { margin: 0; font-size: 14px; line-height: 1.75; }
.result__runner {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--theme-accent);
  opacity: 0.85;
}
.result__actions { margin-top: auto; padding-top: 28px; }
.result__actions .btn--primary { background: var(--theme-primary); box-shadow: none; }
.result__actions .btn--ghost { color: var(--theme-ink); border-color: rgba(43, 35, 32, 0.16); }
.result__actions-row { display: flex; gap: 10px; margin-top: 10px; }
.result__tip { margin: 16px 0 0; text-align: center; font-size: 12px; opacity: 0.7; }

/* ---------- 浮层 ---------- */
.poster-fallback {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(43, 35, 32, 0.72);
}
.poster-fallback__panel {
  width: 100%;
  max-width: 360px;
  padding: 22px;
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}
.poster-fallback__title { margin: 0; font-size: 18px; font-weight: 800; }
.poster-fallback__hint { margin: 8px 0 14px; font-size: 13px; color: var(--muted); }
.poster-fallback__panel img { display: block; width: 100%; border-radius: 14px; margin-bottom: 14px; }
.poster-fallback__panel .btn { width: 100%; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100vw - 48px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(43, 35, 32, 0.92);
  color: #FFFFFF;
  font-size: 13px;
  text-align: center;
  animation: fade-up 0.24s ease both;
}
.fatal { padding: 40px 24px; text-align: center; font-size: 14px; color: var(--brand-deep); }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 360px) {
  .screen { padding-left: 18px; padding-right: 18px; }
  .q-title { font-size: 22px; }
  .result__city { font-size: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
