:root {
  --bg: #f4fbf7;
  --bg-grad: linear-gradient(180deg, #effaf4 0%, #fffcf4 52%, #f1f6fc 100%);
  --card: #ffffff;
  --border: #d8ece2;
  --ink: #2f463d;
  --ink-light: #647c72;
  --mint: #4aa383;
  --mint-deep: #2f7d61;
  --mint-soft: #e3f5ec;
  --cream: #fff5db;
  --amber-text: #a16214;
  --coral-soft: #ffecee;
  --coral-text: #c44754;
  --shadow: 0 10px 28px rgba(64, 128, 102, 0.1);
  --radius: 22px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-grad);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

.phone-shell {
  max-width: 460px;
  margin: 0 auto;
  padding: 16px 14px 44px;
  min-height: 100vh;
}

.view {
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.28s ease;
}

.view.active {
  display: flex;
}

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

.hidden {
  display: none !important;
}

.soft-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Hero */
.hero-card {
  background: linear-gradient(180deg, #ffffff 0%, #eaf8f0 100%);
  border: 1.5px solid #cde8da;
  border-radius: 26px;
  padding: 16px 16px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hero-badge {
  background: var(--mint-soft);
  color: var(--mint-deep);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
}

.hero-art-wrap {
  width: 100%;
  height: 182px;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid #d5ecdf;
  background: #f4fbf7;
}

.hero-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-title {
  font-size: 20.5px;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.35;
  margin-top: 2px;
}

.hero-sub {
  font-size: 13px;
  color: var(--ink-light);
  line-height: 1.65;
  padding: 0 4px;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}

.feature-pills span {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 600;
}

/* 温馨免责安全提示 */
.safety-notice {
  background: #fff9ec;
  border: 1.5px solid #f2dca8;
  border-radius: 16px;
  padding: 11px 13px;
  font-size: 12px;
  color: #7d5318;
  line-height: 1.6;
}

.safety-notice strong {
  color: #9e560b;
}

/* 主子信息登记 */
.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-uploader {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px dashed #92cbb4;
  background: #f2fbf6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--mint-deep);
  font-size: 18px;
  line-height: 1.2;
}

.avatar-placeholder small {
  font-size: 11px;
  font-weight: 700;
}

.avatar-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.soft-input {
  width: 100%;
  background: #f9fdfb;
  border: 1.5px solid #d4e8de;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  font-family: inherit;
}

.soft-input:focus {
  border-color: var(--mint);
  background: #fff;
}

/* 卡密门禁 */
.gate-card {
  background: linear-gradient(180deg, #ffffff 0%, #f1faf5 100%);
  border-color: #bfe2d1;
}

.gate-input-row {
  display: flex;
  gap: 8px;
}

.code-input {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.mint-btn {
  background: linear-gradient(135deg, #58b493, #358569);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(53, 133, 105, 0.25);
  transition: transform 0.14s ease;
}

.mint-btn:active {
  transform: scale(0.97);
}

.mint-btn.full-btn {
  width: 100%;
  padding: 13px 18px;
  font-size: 15px;
}

.mint-btn.sm-btn {
  padding: 8px 13px;
  font-size: 12.5px;
  border-radius: 99px;
}

.gate-msg {
  font-size: 12px;
  color: var(--ink-light);
  margin-top: 8px;
}

.gate-msg.err { color: var(--coral-text); font-weight: 700; }
.gate-msg.ok { color: var(--mint-deep); font-weight: 700; }

.preview-bypass {
  margin-top: 10px;
  border-top: 1px dashed #c8e3d6;
  padding-top: 8px;
  text-align: center;
}

.ghost-link-btn {
  background: transparent;
  border: none;
  color: var(--mint-deep);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* 双模式入口 */
.mode-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-section.locked {
  opacity: 0.55;
}

.mode-card {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-family: inherit;
  transition: transform 0.15s ease;
}

.mode-card:active {
  transform: scale(0.98);
}

.mode-learn {
  background: linear-gradient(135deg, #ffffff 0%, #e9f8f0 100%);
  border-color: #b4dfc9;
}

.mode-fast {
  background: linear-gradient(135deg, #ffffff 0%, #fff7e6 100%);
  border-color: #f0d7a7;
}

.mode-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.mode-info { flex: 1; }

.mode-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.mode-head strong { font-size: 16px; color: var(--ink); }

.mode-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--cream);
  color: var(--amber-text);
}

.mode-tag.hot {
  background: var(--mint-soft);
  color: var(--mint-deep);
}

.mode-info p { font-size: 12px; color: var(--ink-light); line-height: 1.5; }
.mode-arrow { font-size: 18px; color: var(--mint-deep); font-weight: 800; }

.owner-tools-bar {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-light);
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed var(--border);
}

.owner-tools-bar a { color: var(--mint-deep); font-weight: 700; text-decoration: none; }
.mini-reset-btn { background: transparent; border: none; color: var(--ink-light); font-size: 12px; cursor: pointer; text-decoration: underline; }

/* 答题页 */
.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pill-back-btn {
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--ink);
  border-radius: 99px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.mode-pill {
  font-size: 12px;
  font-weight: 700;
  background: var(--mint-soft);
  color: var(--mint-deep);
  padding: 5px 12px;
  border-radius: 99px;
}

.progress-counter { font-size: 13px; font-weight: 800; color: var(--ink-light); }

.paw-progress-track {
  height: 10px;
  background: #dceddf;
  border-radius: 99px;
  position: relative;
  margin: 2px 0 4px;
}

.paw-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #74c9a8, #3d9476);
  position: relative;
  transition: width 0.3s ease;
}

.paw-runner { position: absolute; right: -10px; top: -7px; font-size: 16px; }

.question-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
}

.q-meta { display: flex; align-items: center; justify-content: space-between; }

.dim-badge {
  background: var(--mint-soft);
  color: var(--mint-deep);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 99px;
}

.scene-tag { font-size: 12px; color: var(--ink-light); font-weight: 600; }
.q-title { font-size: 17px; font-weight: 800; line-height: 1.55; color: var(--ink); }

.q-options { display: flex; flex-direction: column; gap: 10px; }

.opt-btn {
  width: 100%;
  text-align: left;
  background: #f9fdfb;
  border: 1.5px solid #d5e8de;
  border-radius: 15px;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.14s ease;
}

.opt-btn:hover, .opt-btn.selected {
  background: #e8f7ef;
  border-color: var(--mint);
  color: #1f5e47;
  transform: translateY(-1px);
}

.opt-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid #b9d7c9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-light);
  flex-shrink: 0;
}

.opt-btn.selected .opt-dot {
  background: var(--mint);
  border-color: var(--mint);
  color: #fff;
}

.q-nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.text-nav-btn { background: transparent; border: none; color: var(--mint-deep); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.q-tip { font-size: 11.5px; color: var(--ink-light); }

/* 边测边学微科普卡 */
.science-pop {
  background: linear-gradient(180deg, #ffffff 0%, #effaf4 100%);
  border: 2px solid #a8d9c2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: popSlide 0.25s ease;
}

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

.science-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--mint-deep);
}

.sci-dim {
  font-size: 11.5px;
  background: #fff;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid #c6e5d6;
}

.sci-body { font-size: 13.5px; line-height: 1.75; color: var(--ink); }

.cat-translate-bubble {
  background: #fff;
  border: 1.5px solid #f0d7a7;
  border-radius: 16px;
  padding: 11px 13px;
}

.cat-bubble-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--amber-text);
  margin-bottom: 3px;
}

.cat-translate-bubble p { font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.55; }

/* 结果页 */
.result-top-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.result-hero {
  background: linear-gradient(180deg, #ffffff 0%, #edf9f2 100%);
  border: 2px solid #b5decb;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2.5px solid var(--mint-deep);
  color: var(--mint-deep);
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  transform: rotate(10deg);
}

.result-profile-row { display: flex; align-items: center; gap: 13px; padding-right: 58px; }

.result-avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(47, 125, 97, 0.22);
  background: var(--mint-soft);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.res-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.res-avatar-fallback { font-size: 34px; }

.change-photo-chip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(47, 70, 61, 0.75);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px 0;
}

.res-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--mint-deep);
  background: #fff;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid #bfe2d1;
  margin-bottom: 4px;
}

.result-name-box h2 { font-size: 16.5px; font-weight: 900; }

.res-score-row {
  font-size: 12.5px;
  color: var(--ink-light);
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}

.good-num { color: var(--mint-deep); font-size: 16px; }
.warn-num { color: #d17428; font-size: 16px; }
.sep { color: #b9cdc3; }

.res-archetype-title { font-size: 18.5px; font-weight: 900; color: var(--ink); text-align: center; }

.res-tagline {
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--mint-deep);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 8px 12px;
}

.res-summary { font-size: 13.5px; line-height: 1.75; color: var(--ink); }

.res-highlight {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber-text);
  background: var(--cream);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.6;
}

.radar-canvas-wrap { display: flex; justify-content: center; margin: 4px 0 8px; }
.dim-bars { display: flex; flex-direction: column; gap: 8px; }
.dim-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dim-bar-name { width: 82px; font-weight: 700; white-space: nowrap; }
.dim-bar-track { flex: 1; height: 9px; background: #e8f2ed; border-radius: 99px; overflow: hidden; }
.dim-bar-fill { height: 100%; border-radius: 99px; }
.dim-bar-val { width: 38px; text-align: right; font-weight: 800; color: var(--ink-light); }

.rx-intro { font-size: 12.5px; color: var(--ink-light); margin-bottom: 10px; }
.rx-list { display: flex; flex-direction: column; gap: 10px; }
.rx-item {
  background: #f9fdfb;
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--mint);
  border-radius: 14px;
  padding: 11px 13px;
}
.rx-item strong { display: block; font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.rx-item p { font-size: 12.5px; color: var(--ink-light); line-height: 1.65; }

.wiki-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.wiki-tab {
  background: #f3faf6;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-light);
  white-space: nowrap;
  cursor: pointer;
}
.wiki-tab.active { background: var(--mint); border-color: var(--mint); color: #fff; }
.wiki-list { display: flex; flex-direction: column; gap: 10px; }
.wiki-item { background: #fbfefc; border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.wiki-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.wiki-scene { font-weight: 800; color: var(--mint-deep); }
.wiki-ans-chip { font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.wiki-ans-chip.safe { background: var(--mint-soft); color: var(--mint-deep); }
.wiki-ans-chip.risk { background: var(--coral-soft); color: var(--coral-text); }
.wiki-q { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.wiki-sci { font-size: 12.5px; color: var(--ink-light); line-height: 1.65; }
.wiki-trans { font-size: 12.5px; font-weight: 700; color: var(--amber-text); background: var(--cream); border-radius: 10px; padding: 7px 10px; }

/* 海报弹窗（三层长按保存优化） */
.poster-modal {
  position: fixed;
  inset: 0;
  background: rgba(28, 48, 40, 0.72);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.poster-sheet {
  background: #fbfefc;
  border-radius: 22px;
  max-width: 420px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.poster-sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.close-x { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--ink); font-size: 14px; cursor: pointer; }

.poster-save-guide {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mint-deep);
  background: var(--mint-soft);
  border: 1px dashed #9dd2b9;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  line-height: 1.5;
}

.poster-img-box {
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: #fff;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.poster-img-box.pulse-guide {
  border-color: var(--mint-deep);
  box-shadow: 0 0 0 4px rgba(47, 125, 97, 0.28);
}

.poster-img-box img {
  width: 100%;
  display: block;
  -webkit-touch-callout: default !important;
  -webkit-user-select: auto !important;
  user-select: auto !important;
  pointer-events: auto !important;
  touch-action: auto;
}
