/* =========================================================
   MBTI 可爱灵动风 · 响应式样式
   ========================================================= */

:root {
  --pink: #ff8fb1;
  --pink-soft: #ffe3ec;
  --purple: #9b6bd6;
  --purple-soft: #efe6ff;
  --blue: #6c9be0;
  --blue-soft: #e3eeff;
  --yellow: #ffd66b;
  --mint: #7fe0c4;
  --ink: #4a4458;
  --ink-soft: #8a8198;
  --card: #ffffff;
  --shadow: 0 12px 30px rgba(155, 107, 214, 0.18);
  --shadow-sm: 0 6px 16px rgba(155, 107, 214, 0.14);
  --radius: 26px;
  --radius-sm: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #ffe9f3 0%, #efe6ff 45%, #e3f4ff 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* 漂浮装饰 blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.5;
  z-index: 0;
  animation: float 9s ease-in-out infinite;
  pointer-events: none;
}
.blob.b1 { width: 160px; height: 160px; background: var(--pink); top: 12%; left: -40px; }
.blob.b2 { width: 120px; height: 120px; background: var(--blue); top: 60%; right: -30px; animation-delay: -2s; }
.blob.b3 { width: 90px; height: 90px; background: var(--yellow); bottom: 8%; left: 10%; animation-delay: -4s; }
.blob.b4 { width: 70px; height: 70px; background: var(--mint); top: 30%; right: 18%; animation-delay: -1s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-26px) rotate(12deg); }
}

/* 容器 */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

/* 顶部 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.logo {
  font-family: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  font-size: 26px;
  color: var(--purple);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 0 5px var(--pink-soft);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.nav button {
  border: none;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, color .15s, background .15s;
  font-family: inherit;
}
.nav button:hover { transform: translateY(-2px); color: var(--purple); }
.nav button.active { background: var(--purple); color: #fff; }

/* 视图切换 */
.view { display: none; animation: fadeUp .5s ease; }
.view.show { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 卡片通用 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px;
}

/* ---------- 首页 ---------- */
.resume-card {
  background: linear-gradient(135deg, #fff6fb, #efe6ff);
  border: 2px dashed var(--purple);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  animation: fadeUp .4s;
}
.resume-card p {
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 14px;
  line-height: 1.6;
}
.hero {
  text-align: center;
  padding: 48px 26px 40px;
  border-radius: 34px;
  background: linear-gradient(135deg, #fff 0%, #fff6fb 100%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero h1 {
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 46px;
  line-height: 1.2;
  color: var(--purple);
  margin-bottom: 10px;
}
.hero h1 .hl { color: var(--pink); }
.hero p {
  color: var(--ink-soft);
  font-size: 17px;
  margin: 10px auto 26px;
  max-width: 540px;
  line-height: 1.7;
}
.hero .emoji-row { font-size: 34px; margin-bottom: 14px; letter-spacing: 6px; }

.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  padding: 15px 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff;
  box-shadow: 0 10px 22px rgba(155,107,214,.4);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 14px 28px rgba(155,107,214,.5); }
.btn:active { transform: scale(.97); }
.btn.ghost {
  background: #fff;
  color: var(--purple);
  box-shadow: var(--shadow-sm);
}
.btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 26px;
}
.feature {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .15s;
}
.feature:hover { transform: translateY(-4px); }
.feature .ic { font-size: 32px; }
.feature h3 { font-size: 16px; margin: 8px 0 4px; color: var(--purple); }
.feature p { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }

/* ---------- 测试页 ---------- */
.test-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.test-head .qcount { color: var(--ink-soft); font-size: 14px; }
.progress {
  height: 14px;
  background: var(--purple-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 22px;
}
.progress .bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  border-radius: 999px;
  transition: width .4s cubic-bezier(.34,1.56,.64,1);
}
.question-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 28px;
  text-align: center;
}
.question-card .qnum {
  display: inline-block;
  background: var(--pink-soft);
  color: var(--pink);
  font-weight: 700;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.question-card h2 {
  font-size: 23px;
  line-height: 1.5;
  margin-bottom: 26px;
  color: var(--ink);
}
.options { display: flex; flex-direction: column; gap: 14px; }
.option {
  position: relative;
  border: 2px solid var(--purple-soft);
  background: #fbfaff;
  border-radius: 18px;
  padding: 18px 52px 18px 18px;
  cursor: pointer;
  font-size: 16px;
  text-align: left;
  transition: transform .12s, border-color .15s, background .15s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.option:hover { transform: translateY(-3px); border-color: var(--purple); background: var(--purple-soft); }
.option .emoji { font-size: 24px; }
.option.selected { border-color: var(--pink); background: var(--pink-soft); }
.option .check {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.option.selected .check { transform: translateY(-50%) scale(1); }
.option.neutral { border-style: dashed; }
.option.neutral.selected { border-style: solid; }
.test-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
}

/* ---------- 结果页 ---------- */
.result-hero {
  text-align: center;
  border-radius: var(--radius);
  padding: 40px 26px;
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.result-hero .big-emoji {
  font-size: 72px;
  animation: bob 2s ease-in-out infinite;
  display: inline-block;
}
@keyframes bob {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}
.result-hero .code {
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 54px;
  letter-spacing: 4px;
  margin: 6px 0;
}
.result-hero .name { font-size: 24px; font-weight: 700; }
.result-hero .tag { opacity: .92; margin-top: 8px; font-size: 15px; }

.dimension-bars {
  margin-top: 22px;
  display: grid;
  gap: 14px;
}
.dbar { }
.dbar .lab { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); margin-bottom: 5px; }
.dbar .track {
  height: 16px;
  background: var(--purple-soft);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.dbar .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  transition: width .8s cubic-bezier(.34,1.56,.64,1);
}
.dbar .mid {
  position: absolute; left: 50%; top: -3px; bottom: -3px;
  width: 2px; background: #fff; opacity: .8;
}

.section-title {
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 22px;
  color: var(--purple);
  margin: 30px 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-pill {
  background: var(--blue-soft);
  color: var(--blue);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.tag-pill.bad { background: #ffe9e3; color: #e8732b; }
.tag-pill.good { background: #e3fff2; color: #2bb673; }

.info-card {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.info-card h4 { color: var(--purple); font-size: 16px; margin-bottom: 8px; }
.info-card p { color: var(--ink-soft); line-height: 1.7; font-size: 15px; }

.result-actions { display: flex; gap: 14px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

/* ---------- 类型库 / 理论 ---------- */
.grid-types {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.type-card {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
  border-top: 6px solid var(--c, var(--purple));
}
.type-card:hover { transform: translateY(-5px) rotate(-1deg); box-shadow: var(--shadow); }
.type-card .temoji { font-size: 36px; }
.type-card .tcode { font-family: "ZCOOL KuaiLe", sans-serif; font-size: 22px; margin: 4px 0; }
.type-card .tname { font-size: 14px; color: var(--ink-soft); }

.theory-block {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.theory-block h3 { color: var(--purple); margin-bottom: 12px; font-size: 18px; }
.dim-row { display: flex; align-items: stretch; gap: 12px; margin-bottom: 12px; }
.dim-side {
  flex: 1;
  border-radius: 14px;
  padding: 14px;
  background: var(--purple-soft);
}
.dim-side.right { background: var(--blue-soft); }
.dim-side .t { font-weight: 700; color: var(--purple); }
.dim-side.right .t { color: var(--blue); }
.dim-side .d { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.dim-vs {
  display: flex; align-items: center; justify-content: center;
  font-family: "ZCOOL KuaiLe", sans-serif; color: var(--ink-soft); font-size: 14px;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(74,68,88,.45);
  display: none;
  align-items: center; justify-content: center;
  z-index: 50;
  padding: 18px;
  backdrop-filter: blur(3px);
}
.modal-mask.show { display: flex; animation: fadeUp .3s; }
.modal {
  background: #fff;
  border-radius: 26px;
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 30px 26px;
  position: relative;
  box-shadow: var(--shadow);
  animation: pop .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop {
  from { transform: scale(.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal .close {
  position: absolute; top: 16px; right: 18px;
  border: none; background: var(--purple-soft); color: var(--purple);
  width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer;
}
.modal-head { text-align: center; margin-bottom: 16px; }
.modal-head .me { font-size: 56px; }
.modal-head .mc { font-family: "ZCOOL KuaiLe", sans-serif; font-size: 40px; color: var(--c, var(--purple)); }
.modal-head .mn { font-size: 20px; font-weight: 700; }
.modal-head .mt { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }

.share-tip {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 16px;
}

footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 40px;
  line-height: 1.8;
}

/* ===================== 响应式 ===================== */
@media (max-width: 760px) {
  .hero h1 { font-size: 34px; }
  .feature-grid { grid-template-columns: 1fr; }
  .grid-types { grid-template-columns: repeat(2, 1fr); }
  .nav { gap: 6px; }
  .nav button { font-size: 13px; padding: 7px 12px; }
  .logo { font-size: 21px; }
  .question-card { padding: 26px 18px; }
  .question-card h2 { font-size: 20px; }
  .option { font-size: 15px; padding: 15px; }
  .result-hero .code { font-size: 42px; }
  .result-hero .big-emoji { font-size: 56px; }
  .dim-row { flex-direction: column; }
  .dim-vs { padding: 4px 0; }
  .btn { font-size: 16px; padding: 13px 30px; }
  .section-title { font-size: 19px; }
}

@media (max-width: 380px) {
  .grid-types { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 29px; }
}

/* ===================== 新增组件 ===================== */
.night-btn {
  border: none;
  background: var(--card);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-size: 17px;
  transition: transform .15s;
  flex-shrink: 0;
}
.night-btn:hover { transform: scale(1.1); }

.radar-card { display: flex; justify-content: center; padding: 22px; }

.pair-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pair-card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border-top: 5px solid var(--c, var(--purple));
  transition: transform .15s;
}
.pair-card:hover { transform: translateY(-4px); }
.pair-card .pe { font-size: 30px; }
.pair-card .pc { font-family: "ZCOOL KuaiLe", sans-serif; font-size: 20px; margin-top: 2px; }
.pair-card .pn { font-size: 13px; color: var(--ink-soft); }
.pair-card .pw { font-size: 12px; color: var(--ink-soft); margin-top: 6px; line-height: 1.5; }

.history-list { display: flex; flex-wrap: wrap; gap: 10px; }
.history-item {
  background: var(--card);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s;
}
.history-item:hover { transform: translateY(-2px); }

.share-card { text-align: center; }
#share-qr { margin-top: 14px; border-radius: 12px; width: 132px; height: 132px; }

.toast {
  position: fixed; left: 50%; bottom: 36px;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 11px 24px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow);
  z-index: 99; animation: fadeUp .3s;
}

@media (max-width: 760px) {
  .pair-grid { grid-template-columns: 1fr; }
}

/* ===================== 夜间模式 ===================== */
body.night {
  --ink: #ece7f4;
  --ink-soft: #a89fb8;
  --card: #2a2438;
  --pink-soft: #43314d;
  --purple-soft: #3a2f4d;
  --blue-soft: #2c3854;
  --shadow: 0 12px 30px rgba(0,0,0,.45);
  --shadow-sm: 0 6px 16px rgba(0,0,0,.35);
  background: linear-gradient(135deg, #221d30 0%, #2a2140 45%, #1d2738 100%);
  background-attachment: fixed;
}
body.night .blob { opacity: .18; }
body.night .hero { background: linear-gradient(135deg, var(--card), #352a4c); }
body.night .option { background: #332b46; }
body.night .resume-card { background: linear-gradient(135deg, #352a4c, #2c3854); }
body.night .nav button { background: var(--card); }
body.night .btn.ghost { background: var(--card); }
body.night .feature, body.night .type-card, body.night .theory-block,
body.night .info-card, body.night .question-card, body.night .modal {
  background: var(--card);
}
body.night .tag-pill { background: #2c3854; color: #8fb8ff; }
body.night .tag-pill.good { background: #1f3a2e; color: #6fe3a5; }
body.night .tag-pill.bad { background: #3f2b22; color: #ff9d6e; }
