/* 快递费计算器 —— 响应式样式（移动端优先，PC 自适应） */

:root {
  --brand: #d94e80;          /* 品牌玫粉（按钮/强调） */
  --brand-dark: #bf3d6b;     /* 悬停加深 */
  --bg: #fdf4f7;             /* 柔和暖粉背景 */
  --card-bg: #ffffff;
  --text: #2b1620;           /* 偏暖的深色文字 */
  --muted: #9b8088;          /* 暖灰 */
  --border: #f0dde5;         /* 浅粉描边 */
  --ok-bg: #fdecf3;          /* 推荐结果卡背景 */
  --ok-text: #bd3a68;        /* 推荐/价格强调色 */
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --err: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(190, 24, 93, 0.10);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  padding: max(16px, env(safe-area-inset-top)) 16px
           max(16px, env(safe-area-inset-bottom));
}

.banner {
  width: 100%;
  max-width: 480px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  text-align: center;
}
.banner code {
  background: rgba(0, 0, 0, .08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
}

.card__header { text-align: center; margin-bottom: 24px; }
.card__logo {
  display: block;
  width: 190px;
  max-width: 62%;
  height: auto;
  margin: 0 auto 14px;
}
.card__header h1 { font-size: 24px; font-weight: 700; }
.card__subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; }

.form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 600; color: var(--text); }

select, input[type="number"] {
  width: 100%;
  font-size: 16px; /* >=16px 防止 iOS 自动放大 */
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23d94e80' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 38px;
}
select:focus, input:focus { outline: none; border-color: var(--brand); }

.quick-weights { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-weights button {
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #fdeef4;
  color: var(--brand-dark);
  border-radius: 999px;
  cursor: pointer;
}
.quick-weights button:active { background: #f6dbe6; }

.btn {
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }

.error { color: var(--err); font-size: 13px; text-align: center; }

.result {
  margin-top: 24px;
  background: var(--ok-bg);
  border-radius: 12px;
  padding: 20px;
}
/* 推荐条 */
.reco {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.reco__tag {
  background: var(--ok-text);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.reco__name {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(90deg,
    #ff2db5, #ff7a00, #ffd000, #2bff88, #00c2ff, #b14bff, #ff2db5);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: fx-flow 2.6s linear infinite;
}
.reco__hint { font-size: 13px; color: var(--ok-text); }

/* 推荐方案 */
.plan {
  margin-top: 14px;
  background: #fff;
  border: 1.5px solid var(--ok-text);
  border-radius: 12px;
  padding: 16px;
}
.plan__total { font-size: 15px; color: var(--text); }
.plan__total b { font-size: 26px; color: var(--ok-text); margin-left: 4px; }
.plan__split { font-size: 13px; color: var(--muted); margin-top: 4px; }
.plan__boxes {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  line-height: 1.6;
}

/* 两家对比 */
.compare {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}
.cmp {
  flex: 1;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}
/* ===== 推荐快递 · 超级特效 ===== */
@keyframes fx-spin { to { transform: rotate(1turn); } }
@keyframes fx-flow { to { background-position: 200% center; } }
@keyframes fx-glow {
  0%, 100% { box-shadow: 0 0 7px #ff2db5cc, 0 0 16px #ff2db566, 0 0 28px #00c2ff33; }
  50%      { box-shadow: 0 0 11px #00c2ffcc, 0 0 24px #00c2ff66, 0 0 40px #b14bff44; }
}
@keyframes fx-pop {
  0%   { transform: scale(.9);  opacity: .3; }
  60%  { transform: scale(1.04); }
  100% { transform: scale(1);   opacity: 1; }
}

.cmp--best {
  position: relative;
  z-index: 0;
  border-color: transparent;
  overflow: hidden;
  animation: fx-pop .45s ease both, fx-glow 2.4s ease-in-out .45s infinite;
}
.cmp--best::before {            /* 旋转彩虹光环 */
  content: "";
  position: absolute;
  inset: -65%;
  background: conic-gradient(from 0deg,
    #ff2db5, #ff7a00, #ffd000, #2bff88, #00c2ff, #b14bff, #ff2db5);
  animation: fx-spin 3s linear infinite;
  z-index: -2;
}
.cmp--best::after {             /* 内层白底，留出 3px 渐变描边 */
  content: "";
  position: absolute;
  inset: 3px;
  background: #fff;
  border-radius: 8px;
  z-index: -1;
}
.cmp--best .cmp__name { color: var(--brand-dark); }
.cmp__name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.cmp__badge {
  font-size: 11px;
  color: #fff;
  background: var(--ok-text);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
}
.cmp__price { display: block; font-size: 24px; font-weight: 800; color: var(--text); }
.cmp--best .cmp__price {
  background: linear-gradient(90deg,
    #ff2db5, #ff7a00, #ffd000, #2bff88, #00c2ff, #b14bff, #ff2db5);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: fx-flow 2.2s linear infinite;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25));
}
.cmp--best .cmp__badge {
  background: linear-gradient(90deg, #ff2db5, #00c2ff, #ffd000, #ff2db5);
  background-size: 200% auto;
  color: #fff;
  -webkit-text-fill-color: #fff;
  animation: fx-flow 1.6s linear infinite;
  box-shadow: 0 0 8px #ff2db599;
}
.cmp__sub { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.cmp__na { font-size: 15px; color: var(--muted); }

.result__breakdown {
  list-style: none;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(189, 58, 104, .30);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.result__breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ok-text);
}
.result__breakdown li span:last-child { text-align: right; }
.result__breakdown li.bd-sep {
  border-top: 1px dashed rgba(189, 58, 104, .30);
  margin: 4px 0;
  padding: 0;
}
.note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.price-table small { font-weight: 400; font-size: 11px; }

.card__footer { margin-top: 22px; }
.card__footer summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  user-select: none;
}
.price-table {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 13px;
}
.price-table .ptr {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.price-table .ptr:last-child { border-bottom: none; }
.price-table .ptr.head { background: #fdeef4; font-weight: 600; color: var(--brand-dark); }
.price-table .ptr > div { padding: 9px 10px; }
.price-table .ptr .zone { font-weight: 600; color: var(--text); }
.price-table .prov { font-size: 11px; color: var(--muted); font-weight: 400; }

/* PC 端：更宽的卡片与更大的留白 */
@media (min-width: 720px) {
  body { padding: 40px; justify-content: center; }
  .card { max-width: 540px; padding: 40px 44px; }
  .banner { max-width: 540px; }
  .card__logo { width: 220px; }
  .card__header h1 { font-size: 28px; }
}

/* 无障碍：用户偏好减少动效时，关闭所有特效动画但保留彩虹配色 */
@media (prefers-reduced-motion: reduce) {
  .cmp--best,
  .cmp--best::before,
  .cmp--best .cmp__price,
  .cmp--best .cmp__badge,
  .reco__name { animation: none !important; }
  .cmp--best { box-shadow: 0 0 10px #ff2db577; }
}
