/* ============================================================
   高考志愿填报辅助 H5 —— 全局样式（移动优先）
   设计：教育风 Indigo 渐变 + 卡片化布局
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #7c3aed;
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e9ebf2;
  --reach: #f97316;   /* 冲刺 */
  --match: #3b82f6;   /* 稳妥 */
  --safe: #10b981;    /* 保底 */
  --shadow: 0 6px 20px rgba(31, 36, 48, 0.08);
  --shadow-sm: 0 2px 8px rgba(31, 36, 48, 0.06);
  --radius: 14px;
  --tab-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #e6e8ef;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}
#topbar .back {
  font-size: 20px;
  width: 32px;
  cursor: pointer;
  opacity: .95;
  flex: none;
}
#topbar .back.hidden { visibility: hidden; }
#topbar .title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .5px;
}
#topbar .spacer { width: 32px; flex: none; }

/* ---------- 内容区 ---------- */
#view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tab-h) + 16px);
}
.view-pad { padding: 14px; }

/* ---------- 底部 Tab ---------- */
#tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--tab-h);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}
#tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  transition: color .2s;
}
#tabbar a .ic { font-size: 20px; line-height: 1; }
#tabbar a.active { color: var(--primary); font-weight: 600; }
#tabbar a.active .ic { transform: translateY(-1px); }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title::before {
  content: "";
  width: 4px; height: 15px;
  background: var(--primary);
  border-radius: 2px;
}
.muted { color: var(--muted); }
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  margin: 2px 4px 2px 0;
}
.tag.gray { background: #f1f2f6; color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--primary-soft); color: var(--primary-dark); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 搜索框 ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
}
.search-bar input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 15px;
  background: transparent;
  color: var(--text);
}

/* ---------- 首页 Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 22px 18px 26px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
}
.hero h1 { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.hero p { opacity: .92; margin-top: 6px; font-size: 13.5px; }
.hero .hero-search {
  margin-top: 16px;
  background: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.hero .hero-search input { border: none; outline: none; flex: 1; font-size: 14px; color: var(--text); }

/* 统计 */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: -16px;
  position: relative;
  z-index: 2;
  padding: 0 14px;
}
.stat {
  background: #fff;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat .num { font-size: 20px; font-weight: 800; color: var(--primary); }
.stat .lbl { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* 功能入口 */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.quick {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.quick .emoji {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--primary-soft);
}
.quick .qt { font-weight: 700; font-size: 15px; }
.quick .qs { font-size: 12px; color: var(--muted); }

/* ---------- 列表项 ---------- */
.list-item {
  background: #fff;
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}
.list-item:active { background: #fafbff; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 15.5px; font-weight: 700; }
.list-item .li-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.list-item .li-right { flex: none; text-align: right; font-size: 12.5px; }
.rank-badge {
  min-width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

/* ---------- 筛选 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
select.chip { appearance: none; }

/* ---------- 详情页 ---------- */
.detail-hero {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 18px 16px 20px;
}
.detail-hero h2 { font-size: 20px; font-weight: 800; }
.detail-hero .dh-sub { opacity: .92; font-size: 13px; margin-top: 6px; }
.detail-hero .dh-tags { margin-top: 10px; }
.detail-hero .dh-tags .tag { background: rgba(255,255,255,.18); color: #fff; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

/* 概率条 */
.prob { height: 6px; border-radius: 3px; background: #eef0f5; overflow: hidden; }
.prob > span { display: block; height: 100%; border-radius: 3px; }

/* ---------- 推荐三档 ---------- */
.tier {
  border-left: 4px solid var(--match);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.tier.reach { border-left-color: var(--reach); }
.tier.safe { border-left-color: var(--safe); }
.tier .tier-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.tier .tier-name { font-weight: 700; font-size: 15px; }
.tier .tier-prob { font-size: 13px; font-weight: 700; }
.tier .tier-meta { font-size: 12.5px; color: var(--muted); }

/* ---------- 问答 ---------- */
.chat-box { display: flex; flex-direction: column; gap: 12px; }
.bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
}
.bubble.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: #fff; color: var(--text); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.bubble.bot .b-inner { margin-top: 6px; }
.qa-input {
  position: fixed;
  bottom: var(--tab-h);
  left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  z-index: 35;
}
.qa-input input { flex: 1; border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px; font-size: 14px; outline: none; }
.qa-suggest { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.qa-suggest .chip { font-size: 12px; padding: 5px 11px; }

/* ---------- 空状态 / 加载 ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.loading { text-align: center; padding: 30px; color: var(--muted); }
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-sub { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }

/* 徽标小字 */
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* 提示横幅 */
.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #b45309;
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

/* 滚动加载更多 */
.load-more { text-align: center; padding: 14px; color: var(--muted); font-size: 13px; }
