/* 同频 · 兴趣圈层测评 — 样式
 * 移动端优先；主题色由 app.js 按结果类型注入 CSS 变量。
 */

:root {
  --bg: #FAF8F5;
  --card: #FFFFFF;
  --text: #1E1C1A;
  --muted: #8A8681;
  --line: #EAE6E1;
  --accent: #5A4A80;
  --accent-soft: #EFECF6;
  --radius: 16px;
  --tap: #F4F1ED;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 24px calc(48px + env(safe-area-inset-bottom));
}

/* ---------- 视图切换 ---------- */
.view { display: none; }
.view.is-active { display: block; animation: fade-up .28s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 首屏 ---------- */
.intro { padding-top: 88px; }

.intro-kicker {
  display: inline-block;
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 20px;
}

.intro h1 {
  font-size: 40px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: .02em;
  margin: 0 0 14px;
}

.intro-sub {
  font-size: 17px;
  color: #55524E;
  margin: 0 0 32px;
}

.intro-points {
  list-style: none;
  padding: 0;
  margin: 0 0 36px;
  border-top: 1px solid var(--line);
}

.intro-points li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.intro-points .k {
  flex: 0 0 76px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px 20px;
  font-size: 17px;
  font-weight: 500;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}

.btn:active { transform: scale(.985); opacity: .92; }

.btn-ghost {
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-line {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.btn + .btn { margin-top: 10px; }

.note {
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

/* ---------- 答题页 ---------- */
.quiz-top {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 22px 0 14px;
  z-index: 5;
}

.progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .3s cubic-bezier(.4, 0, .2, 1);
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.q-index { font-variant-numeric: tabular-nums; }

.q-text {
  font-size: 22px;
  line-height: 1.5;
  font-weight: 500;
  margin: 30px 0 26px;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}

.option:active { transform: scale(.99); }
.option.is-picked { border-color: var(--accent); background: var(--accent-soft); }

.option-letter {
  flex: 0 0 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--tap);
  color: var(--muted);
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.option.is-picked .option-letter { background: var(--accent); color: #fff; }

.quiz-back {
  margin: 22px 0 0;
  background: none;
  border: none;
  padding: 6px 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

/* ---------- 计算中 ---------- */
.loading {
  padding: 160px 0;
  text-align: center;
}

.dots { display: inline-flex; gap: 6px; margin-bottom: 22px; }

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s infinite ease-in-out;
}

.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-7px); opacity: 1; }
}

.loading p { font-size: 15px; color: var(--muted); margin: 0; }

/* ---------- 结果页 ---------- */
.result { padding-top: 44px; }

.result-kicker {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.type-name {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 12px;
}

.code-chip {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 18px;
}

.tagline {
  font-size: 17px;
  color: #55524E;
  margin: 0 0 22px;
}

.desc {
  font-size: 15px;
  margin: 0 0 8px;
}

.block { margin-top: 34px; }

.block-title {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 14px;
}

/* 四维条 */
.axis-row { margin-bottom: 14px; }

.axis-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.axis-head .on { font-weight: 500; color: var(--accent); }
.axis-head .off { color: var(--muted); }

.axis-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.axis-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .5s ease;
}

/* 兴趣画像 */
.profile-list { margin: 0; }

.profile-row {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.profile-row:first-child { border-top: 1px solid var(--line); }

.profile-row dt {
  flex: 0 0 44px;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.profile-row dd { margin: 0; font-size: 15px; }

/* 同类人 / 暗号 */
.same-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 15px;
}

.opener-box {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.opener-box .lead {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: .06em;
  margin-bottom: 8px;
}

.opener-box .line {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.45;
}

/* 找同类人步骤 */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }

.steps li {
  position: relative;
  padding: 0 0 16px 34px;
  font-size: 15px;
  counter-increment: s;
}

.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.steps li:last-child { padding-bottom: 0; }

/* 本机进度 + 全部圈层 */
.local-count {
  font-size: 15px;
  margin-bottom: 14px;
}

.local-count b { font-weight: 600; color: var(--accent); }

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.type-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
  background: var(--card);
}

.type-cell .c {
  display: block;
  font-size: 11px;
  letter-spacing: .04em;
  margin-top: 2px;
}

.type-cell.is-unlocked {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.type-cell.is-current {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* ---------- 海报浮层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 22, 20, .82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.overlay[hidden] { display: none; }

.poster-img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.overlay-tip {
  color: rgba(255, 255, 255, .9);
  font-size: 13px;
  text-align: center;
  margin: 14px 0 16px;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.overlay-actions .btn { padding: 13px 16px; font-size: 15px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translate(-50%, 12px);
  background: rgba(30, 28, 26, .92);
  color: #fff;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
}

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

.footer-note {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

/* ---------- 首屏：玩法选择 ---------- */
.modes { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }

.mode-card {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color .15s ease, transform .1s ease;
}

.mode-card:active { transform: scale(.99); }
.mode-card:hover { border-color: var(--accent); }

.mode-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 10px;
}

.mode-title {
  display: block;
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 6px;
}

.mode-desc {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  color: #55524E;
}

/* ---------- 韩剧选择页 ---------- */
#view-kd-pick { padding-bottom: 108px; }

.kd-top {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 20px 0 12px;
  z-index: 6;
}

.kd-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.q-back {
  background: none;
  border: none;
  padding: 4px 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.kd-tally { font-size: 12px; color: var(--muted); }
.kd-tally b { color: var(--accent); font-weight: 600; }

.kd-search {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  -webkit-appearance: none;
  appearance: none;
}

.kd-search::placeholder { color: var(--muted); }
.kd-search:focus { outline: none; border-color: var(--accent); }

.kd-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.kd-chips::-webkit-scrollbar { display: none; }

.kd-chip {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
}

.kd-chip.is-on {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.kd-chip-only { margin-left: auto; }

.kd-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 14px;
  line-height: 1.7;
}

.kd-list { display: flex; flex-direction: column; }

.kd-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 2px 0;
}

.kd-row.is-picked { background: var(--accent-soft); }

.kd-poster-thumb,
.kd-poster-placeholder {
  flex: 0 0 44px;
  width: 44px;
  height: 62px;
  margin-top: 8px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
}

.kd-poster-thumb { border: 1px solid var(--line); }

.kd-main {
  flex: 1 1 auto;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  padding: 12px 0;
  cursor: pointer;
  min-width: 0;
}

.kd-name {
  display: block;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kd-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kd-cast {
  display: block;
  font-size: 12px;
  color: var(--accent);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kd-mark {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  min-width: 34px;
  text-align: right;
}

.kd-row.is-picked .kd-mark { color: var(--accent); font-weight: 500; }

.kd-stars {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 0 12px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
}

.kd-star {
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  color: var(--line);
  background: none;
  border: none;
  padding: 4px 5px;
  cursor: pointer;
}

.kd-star.is-on { color: #D99A2B; }

.kd-clear {
  margin-left: auto;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 6px 2px;
  cursor: pointer;
}

.kd-stars-static {
  letter-spacing: 1px;
  color: #D99A2B;
}

/* 分享、对比与提示 */
.kd-warn {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 12px 0 0;
}

.kd-peer-input { margin: 14px 0 12px; }

.kd-fav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kd-fav-item {
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
}

.kd-fav-item i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  margin-left: 5px;
}

.kd-cmp-list { display: flex; flex-direction: column; }

.kd-cmp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.kd-cmp-row.is-strong { background: var(--accent-soft); }

.kd-cmp-name {
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kd-cmp-name i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  margin-left: 5px;
}

.kd-cmp-rate { flex: 0 0 auto; font-size: 12px; color: var(--muted); }

.kd-cmp-rate em {
  font-style: normal;
  margin-left: 8px;
  color: var(--accent);
}

.kd-more-wrap { padding: 18px 0 6px; text-align: center; }
.kd-total-line { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

.kd-empty {
  font-size: 14px;
  color: var(--muted);
  padding: 30px 0;
  text-align: center;
  line-height: 1.8;
}

.kd-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
}

.kd-bar .btn { max-width: 432px; margin: 0 auto; }
.kd-bar .btn:disabled { opacity: .45; }

/* ---------- 韩剧口味分析 ---------- */
.kd-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.kd-fact {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
}

.kd-fact b {
  display: block;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
}

.kd-fact span { font-size: 11px; color: var(--muted); }

.kd-line { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.7; }

.kd-stat { margin-bottom: 14px; }

.kd-stat-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.kd-stat-head span:last-child { color: var(--muted); font-size: 12px; }

.kd-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.kd-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .5s ease;
}
