:root {
  --bg: #fff7ee;
  --bg-grad: linear-gradient(180deg, #fff5eb 0%, #fff0f2 52%, #fff8eb 100%);
  --card: #ffffff;
  --card-warm: #fffbf5;
  --border: #f3dfd2;
  --cocoa: #593e31;
  --cocoa-light: #8d6e60;
  --peach: #f28b96;
  --peach-deep: #e06d7b;
  --peach-soft: #ffe8eb;
  --butter: #ffefc8;
  --butter-deep: #f0ae54;
  --mint-soft: #e7f6ee;
  --mint-text: #3d8b65;
  --shadow: 0 10px 28px rgba(176, 117, 94, 0.11);
  --radius: 22px;
}

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

body {
  background: var(--bg-grad);
  color: var(--cocoa);
  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(--cocoa);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 首页 Hero */
.hero-card {
  background: linear-gradient(180deg, #fffdf9 0%, #fff4f5 100%);
  border: 1.5px solid #f4d6d9;
  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(--butter);
  color: #9e621c;
  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 #f8e4d4;
  background: #fff9f0;
}

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

.hero-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--cocoa);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.hero-sub {
  font-size: 13px;
  color: var(--cocoa-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(--cocoa);
  font-weight: 600;
}

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

.avatar-uploader {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px dashed #eab0b8;
  background: #fff7f8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.avatar-uploader:active {
  transform: scale(0.95);
}

.avatar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--peach-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: #fffaf5;
  border: 1.5px solid #eedad0;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--cocoa);
  outline: none;
  font-family: inherit;
}

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

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

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

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

.peach-btn {
  background: linear-gradient(135deg, #f69ca7, #e47180);
  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(228, 113, 128, 0.28);
  transition: transform 0.14s ease, filter 0.14s ease;
}

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

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

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

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

.gate-msg.err {
  color: #d64550;
  font-weight: 700;
}

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

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

.ghost-link-btn {
  background: transparent;
  border: none;
  color: #b0732e;
  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 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-family: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

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

.mode-learn {
  background: linear-gradient(135deg, #fffdf9 0%, #fff0f2 100%);
  border-color: #f4bcc4;
}

.mode-fast {
  background: linear-gradient(135deg, #fffdf9 0%, #fff6e2 100%);
  border-color: #f3d7a3;
}

.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(--cocoa);
}

.mode-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--butter);
  color: #9e621c;
}

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

.mode-info p {
  font-size: 12px;
  color: var(--cocoa-light);
  line-height: 1.5;
}

.mode-arrow {
  font-size: 18px;
  color: var(--peach-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(--cocoa-light);
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px dashed var(--border);
}

.owner-tools-bar a {
  color: var(--peach-deep);
  font-weight: 700;
  text-decoration: none;
}

.mini-reset-btn {
  background: transparent;
  border: none;
  color: var(--cocoa-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(--cocoa);
  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(--peach-soft);
  color: var(--peach-deep);
  padding: 5px 12px;
  border-radius: 99px;
}

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

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

.paw-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f7b874, #f18996);
  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(--butter);
  color: #8f5616;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 99px;
}

.scene-tag {
  font-size: 12px;
  color: var(--cocoa-light);
  font-weight: 600;
}

.q-title {
  font-size: 17.5px;
  font-weight: 800;
  line-height: 1.55;
  color: var(--cocoa);
}

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

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

.opt-btn:hover, .opt-btn.selected {
  background: #fff0f2;
  border-color: var(--peach);
  color: #a63d4c;
  transform: translateY(-1px);
}

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

.opt-btn.selected .opt-dot {
  background: var(--peach);
  border-color: var(--peach);
  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(--peach-deep);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.q-tip {
  font-size: 11.5px;
  color: var(--cocoa-light);
}

/* 边测边学微科普卡 */
.science-pop {
  background: linear-gradient(180deg, #fffdf9 0%, #fff4e8 100%);
  border: 2px solid #f5caa0;
  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: #a6621c;
}

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

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

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

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

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

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

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

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

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

.result-avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(224, 109, 123, 0.25);
  background: var(--butter);
  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(89, 62, 49, 0.72);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px 0;
}

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

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

.res-score-line {
  font-size: 13px;
  color: var(--cocoa-light);
}

.res-score-line strong {
  font-size: 18px;
  color: var(--peach-deep);
}

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

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

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

.res-highlight {
  font-size: 13px;
  font-weight: 700;
  color: #8f5616;
  background: var(--butter);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.6;
}

.poster-cta {
  margin-top: 2px;
}

/* 雷达图 */
.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: 78px;
  font-weight: 700;
  white-space: nowrap;
}

.dim-bar-track {
  flex: 1;
  height: 9px;
  background: #f5e7de;
  border-radius: 99px;
  overflow: hidden;
}

.dim-bar-fill {
  height: 100%;
  border-radius: 99px;
}

.dim-bar-val {
  width: 36px;
  text-align: right;
  font-weight: 800;
  color: var(--cocoa-light);
}

/* 3 条亲密处方 */
.rx-intro {
  font-size: 12.5px;
  color: var(--cocoa-light);
  margin-bottom: 10px;
}

.rx-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rx-item {
  background: #fffaf5;
  border: 1.5px solid #f3dfd2;
  border-left: 4px solid var(--peach);
  border-radius: 14px;
  padding: 11px 13px;
}

.rx-item strong {
  display: block;
  font-size: 14px;
  color: var(--cocoa);
  margin-bottom: 4px;
}

.rx-item p {
  font-size: 12.5px;
  color: var(--cocoa-light);
  line-height: 1.65;
}

/* 完整百科图鉴 */
.wiki-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.wiki-tab {
  background: #fff7f0;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--cocoa-light);
  white-space: nowrap;
  cursor: pointer;
}

.wiki-tab.active {
  background: var(--peach);
  border-color: var(--peach);
  color: #fff;
}

.wiki-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wiki-item {
  background: #fffdf9;
  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(--peach-deep);
}

.wiki-ans-chip {
  font-size: 11px;
  background: var(--mint-soft);
  color: var(--mint-text);
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
}

.wiki-q {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--cocoa);
}

.wiki-sci {
  font-size: 12.5px;
  color: var(--cocoa-light);
  line-height: 1.65;
}

.wiki-trans {
  font-size: 12.5px;
  font-weight: 700;
  color: #9e4856;
  background: #fff2f4;
  border-radius: 10px;
  padding: 7px 10px;
}

/* 海报弹窗 */
.poster-modal {
  position: fixed;
  inset: 0;
  background: rgba(54, 34, 26, 0.72);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.poster-sheet {
  background: #fffbf6;
  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(--cocoa);
  font-size: 14px;
  cursor: pointer;
}

.poster-tip {
  font-size: 12px;
  color: var(--cocoa-light);
  text-align: center;
}

.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(--peach-deep);
  box-shadow: 0 0 0 4px rgba(224, 109, 123, 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;
}

.poster-save-guide {
  font-size: 12.5px;
  font-weight: 700;
  color: #a64a58;
  background: #fff0f2;
  border: 1px dashed #f0b6bf;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  line-height: 1.5;
}
