:root {
  --navy: #1F2A44;
  --navy-2: #16203A;
  --blue: #2F6BFF;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --text: #1F2A44;
  --muted: #5C6675;
  --line: #E6EAF1;
  --ok: #1FA971;
  --warn: #D98A00;
  --bad: #E3504B;
  --gap: 16px;
}

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

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

header {
  background: linear-gradient(135deg, var(--navy) 0%, #283655 100%);
  color: #fff;
  padding: 22px 20px;
  text-align: center;
}
header h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: 1px; }
header p { margin: 6px 0 0; font-size: 13px; opacity: .72; letter-spacing: .3px; }

.container { max-width: 680px; margin: 0 auto; padding: 20px 16px 32px; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: var(--gap);
  box-shadow: 0 1px 4px rgba(31, 42, 68, .06);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  border-left: 3px solid var(--blue);
  padding-left: 10px;
  line-height: 1.4;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input, .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}

.row { display: flex; gap: 12px; }
.row .field { flex: 1; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.check input { width: 16px; height: 16px; flex: none; }

/* 按钮（iPhone 风：弹性按压 + 阴影分层） */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  background: var(--navy);
  color: #fff;
  width: 100%;
  box-shadow: 0 3px 12px rgba(31, 42, 68, .22), inset 0 1px 0 rgba(255, 255, 255, .12);
  /* 释放时弹性回弹 */
  transition: background .18s ease, box-shadow .18s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
  will-change: transform;
}
.btn:hover { background: var(--navy-2); box-shadow: 0 6px 18px rgba(31, 42, 68, .28), inset 0 1px 0 rgba(255, 255, 255, .12); }
/* 按下瞬间快速收缩，释放时靠上面的弹性曲线回弹 */
.btn:active {
  transform: scale(.955);
  background: var(--navy-2);
  box-shadow: 0 1px 4px rgba(31, 42, 68, .25), inset 0 2px 6px rgba(0, 0, 0, .18);
  transition: transform .06s ease, background .06s ease, box-shadow .06s ease;
}
.btn svg { width: 20px; height: 20px; flex: none; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1); }
.btn:active svg { transform: scale(.82); animation: iconPop .4s cubic-bezier(.34, 1.56, .64, 1); }
.btn.gray { background: #EEF1F6; color: var(--muted); box-shadow: none; }
.btn.gray:hover { background: #E6EAF1; }
.btn.gray:active { background: #DCE1EA; }

/* 结果区 */
.badge { display: inline-block; padding: 3px 9px; border-radius: 11px; font-size: 12px; font-weight: 600; }
.badge.ok { background: rgba(31, 169, 113, .14); color: var(--ok); }
.badge.warn { background: rgba(217, 138, 0, .14); color: var(--warn); }
.badge.bad { background: rgba(227, 80, 75, .14); color: var(--bad); }

.kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14.5px;
  line-height: 1.5;
}
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); flex: none; }
.kv .v { font-weight: 600; text-align: right; }

.note {
  font-size: 13px;
  color: var(--muted);
  background: #F7F9FC;
  border-radius: 9px;
  padding: 11px 13px;
  margin-top: 12px;
  line-height: 1.6;
}

/* 配对建议 */
.pairing {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  margin-top: 14px;
}
.pairing.best { border-left-color: var(--ok); }
.pairing.second { border-left-color: var(--warn); }
.pairing .tag { font-size: 12px; font-weight: 700; }
.tag.best { color: var(--ok); }
.tag.second { color: var(--warn); }
.tag.third { color: var(--muted); }
.pairing .msg { font-size: 13.5px; margin: 9px 0; line-height: 1.6; }
.pairing .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

.hidden { display: none !important; }

/* 响应式：小屏堆叠，避免拥挤错位 */
@media (max-width: 480px) {
  header { padding: 18px 16px; }
  header h1 { font-size: 17px; }
  .container { padding: 14px 12px 24px; }
  .card { padding: 16px; border-radius: 12px; }
  .row { flex-direction: column; gap: 0; }
  .row .field { margin-bottom: 14px; }
  .btn { font-size: 16px; padding: 13px 16px; }
}

/* 大屏：略增留白，保持居中不拉伸 */
@media (min-width: 900px) {
  .container { padding-top: 28px; }
}

/* ===== 流畅入场动画（柔和层次感） ===== */
@keyframes slideUpIn {
  0% { opacity: 0; transform: translateY(14px) scale(.98); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes iconPop {
  0% { transform: scale(.82); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes checkPulse {
  0% { transform: scale(.9); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* 计算成功：结果卡片柔和光环脉冲 + 轻微弹起（iPhone 风） */
@keyframes successRing {
  0% { box-shadow: 0 0 0 0 rgba(47, 107, 255, .38); }
  70% { box-shadow: 0 0 0 18px rgba(47, 107, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0); }
}
@keyframes successPop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-5px) scale(1.015); }
  100% { transform: translateY(0) scale(1); }
}
.result-pulse {
  animation: successRing .85s cubic-bezier(.22, 1, .36, 1) both,
             successPop .5s cubic-bezier(.34, 1.56, .64, 1) both !important;
}

/* 卡片：加载时轻轻上浮入场；悬浮时微抬升，营造层次 */
.card {
  animation: slideUpIn .5s cubic-bezier(.22, 1, .36, 1) both;
  transition: box-shadow .25s ease, transform .25s ease;
}
.card:nth-child(1) { animation-delay: .02s; }
.card:nth-child(2) { animation-delay: .08s; }
.card:nth-child(3) { animation-delay: .14s; }
.card:nth-child(4) { animation-delay: .20s; }
.card:hover { box-shadow: 0 6px 22px rgba(31, 42, 68, .12); transform: translateY(-2px); }

/* 配对建议卡片：动态插入时逐个弹入，带错落延迟 */
.pairing {
  animation: slideUpIn .45s cubic-bezier(.34, 1.56, .64, 1) both;
}
.pairing.best { animation-delay: .04s; }
.pairing.second { animation-delay: .12s; }
.pairing.third, .pairing:nth-child(3) { animation-delay: .20s; }
.pairing:hover { box-shadow: 0 4px 16px rgba(31, 42, 68, .1); }

/* 勾选框：勾选时轻微弹一下 */
.check input:active { animation: checkPulse .25s cubic-bezier(.34, 1.56, .64, 1); }

/* 尊重用户的「减少动态效果」系统设置 */
@media (prefers-reduced-motion: reduce) {
  .card, .pairing, .btn, .btn svg, .check input, .result-pulse {
    animation: none !important;
    transition: none !important;
  }
}
