/* =============== 基础 =============== */
:root {
  --bg: #f7f8fb;
  --bg-elev: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --line: #e6e8ee;
  --line-2: #eef0f5;
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --blue: #2563eb;
  --red: #ef4444;
  --green: #10b981;
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

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

button { font-family: inherit; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

/* =============== 顶部栏 =============== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  background: none;
  border: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(59, 130, 246, .25);
}
.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .2px;
}
.brand-sub {
  font-size: 12px;
  color: var(--ink-3);
}
.topnav {
  display: flex;
  gap: 4px;
}
.navlink {
  background: none;
  border: 0;
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.navlink:hover { background: var(--line-2); color: var(--ink); }
.navlink.active { background: var(--ink); color: #fff; }

/* =============== 通用 =============== */
main { padding: 36px 28px 80px; }
.section { margin-top: 56px; }
.section-head { margin-bottom: 20px; }
.section-head h2 {
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: .2px;
}
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

.grid {
  display: grid;
  gap: 18px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
}

/* =============== 按钮 =============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.btn:hover { border-color: #cbd5e1; transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover { background: #1e293b; border-color: #1e293b; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
.btn-block {
  width: 100%;
  margin-top: 10px;
}
.btn-mini {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

/* =============== 首页 Hero =============== */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: center;
  padding: 40px 0 20px;
}
.kicker {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
}
.hero h1 {
  font-size: 44px;
  line-height: 1.18;
  margin: 16px 0 14px;
  letter-spacing: -.5px;
}
.hero .lead {
  font-size: 16px;
  color: var(--ink-2);
  max-width: 560px;
  margin: 0 0 26px;
}
.hero-actions { display: flex; gap: 12px; }
.hero-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  box-shadow: var(--shadow-md);
}
.stat-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.5px;
}
.stat-label {
  font-size: 13px;
  color: var(--ink-3);
}

/* =============== 主题卡片 =============== */
.theme-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 22px;
  text-align: left;
  cursor: pointer;
  transition: all .2s ease;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.theme-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--c, var(--brand));
}
.theme-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--c);
}
.theme-icon {
  font-size: 32px;
  margin-bottom: 14px;
}
.theme-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}
.theme-desc {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 14px;
  min-height: 36px;
}
.theme-tag {
  display: inline-block;
  background: var(--bg);
  color: var(--ink-2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.theme-blue   { --c: var(--blue); }
.theme-red    { --c: var(--red); }
.theme-green  { --c: var(--green); }
.theme-purple { --c: var(--purple); }
.theme-blue-text   { color: var(--blue); }
.theme-red-text    { color: var(--red); }
.theme-green-text  { color: var(--green); }
.theme-purple-text { color: var(--purple); }

/* =============== 信息卡 =============== */
.info-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}
.info-num {
  color: var(--ink-3);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
}
.info-title {
  font-size: 17px;
  font-weight: 700;
  margin: 8px 0 6px;
}
.info-text {
  color: var(--ink-3);
  font-size: 14px;
}

/* =============== 页内头部 =============== */
.page-head {
  margin: 8px 0 24px;
}
.page-kicker {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.page-head h1 {
  font-size: 32px;
  margin: 6px 0 8px;
  letter-spacing: -.3px;
}

/* =============== 通用横幅 =============== */
.banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 22px;
}
.banner-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.banner-icon { font-size: 20px; }
.banner-title { font-weight: 700; color: #92400e; }
.banner-text { font-size: 13px; color: #92400e; }

/* =============== 双栏布局 =============== */
.layout-2 {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 960px) {
  .layout-2 { grid-template-columns: 1fr; }
}

.form-card,
.result-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.form-card h3, .result-card h3 {
  margin: 0 0 16px;
  font-size: 16px;
}

.field {
  display: block;
  margin-bottom: 16px;
}
.field > span {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.field input[type=text],
.field input[type=number],
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.field input:focus, .field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
}
.checks label:has(input:checked) {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.tip {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 12px;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
}

/* 结果区 */
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.result-actions { display: flex; gap: 8px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.chip {
  background: #f1f5f9;
  color: var(--ink-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
}
.chip:hover { background: #e2e8f0; }
.chip.active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 720px) { .items { grid-template-columns: 1fr; } }

.item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all .15s;
}
.item:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
}
.item-name {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.item-emoji { font-size: 20px; }
.item-qty { color: var(--ink-3); font-size: 13px; }
.item-risk {
  align-self: flex-start;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 4px;
  font-weight: 600;
}
.risk-1 { background: #fee2e2; color: #b91c1c; }
.risk-2 { background: #fef3c7; color: #b45309; }
.risk-3 { background: #dcfce7; color: #15803d; }

.knowledge {
  margin-top: 22px;
  padding: 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
}
.knowledge-title {
  font-weight: 700;
  color: #075985;
  margin-bottom: 8px;
  font-size: 14px;
}
.knowledge ul {
  margin: 0;
  padding-left: 20px;
  color: #0c4a6e;
  font-size: 13px;
}
.knowledge li { margin: 4px 0; }

/* =============== 闯关游戏 =============== */
.layout-game .game-stage {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  min-height: 480px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.stage-title {
  font-size: 13px;
  color: var(--red);
  font-weight: 700;
  letter-spacing: .5px;
}
.stage-q {
  font-size: 22px;
  font-weight: 700;
  margin: 10px 0 22px;
  line-height: 1.4;
}
.stage-desc {
  background: #fef2f2;
  border-left: 3px solid var(--red);
  padding: 14px 16px;
  border-radius: 8px;
  color: #7f1d1d;
  font-size: 14px;
  margin-bottom: 22px;
}
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.option {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 14px;
}
.option:hover {
  border-color: #fca5a5;
  background: #fff7f7;
}
.option.correct {
  border-color: #34d399;
  background: #ecfdf5;
  color: #065f46;
}
.option.wrong {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}
.option-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
}
.feedback {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
}
.feedback.ok { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.feedback.bad { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.next-btn {
  margin-top: 18px;
  align-self: flex-end;
}

.game-side { display: flex; flex-direction: column; gap: 14px; }
.side-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.side-card h4 {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink-2);
}
.bar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--ink-3);
}
.bar-value { color: var(--ink); font-weight: 600; }
.hearts { display: flex; gap: 3px; }
.heart { color: var(--red); font-size: 16px; }
.heart.lost { color: #e2e8f0; }
.progress {
  height: 6px;
  background: var(--line-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 12px;
}
.progress-fill {
  height: 100%;
  background: var(--red);
  width: 100%;
  transition: width .3s;
}
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.badge.earned {
  background: #fef3c7;
  border: 1px solid #fbbf24;
}
.side-tip { background: #fffbeb; border-color: #fde68a; }

/* 游戏结束界面 */
.game-end {
  text-align: center;
  padding: 40px 20px;
}
.game-end .end-icon { font-size: 56px; }
.game-end h2 { font-size: 26px; margin: 14px 0 6px; }
.game-end p { color: var(--ink-3); }
.game-end .btn { margin-top: 18px; }

/* =============== 症状自查 =============== */
.symptoms {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.symptom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  background: #fff;
}
.symptom:has(input:checked) {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}
.symptom input { accent-color: var(--green); }

.health-result .empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-3);
}
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.diag {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
}
.diag-name {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.diag-conf {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font-weight: 600;
}
.diag-desc {
  color: var(--ink-3);
  font-size: 14px;
  margin: 8px 0 12px;
}
.diag-advice {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

/* =============== 诈骗识别聊天 =============== */
.chat-shell {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  max-width: 720px;
  margin: 0 auto;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  padding: 18px 22px;
}
.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.chat-name { font-weight: 700; }
.chat-status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: .92;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.chat-body {
  padding: 24px 22px;
  min-height: 360px;
  max-height: 480px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg {
  display: flex;
  gap: 10px;
  max-width: 80%;
}
.msg.bot .bubble {
  background: #fff;
  border: 1px solid var(--line);
}
.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg.user .bubble {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
}
.bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  border: 1px solid transparent;
  line-height: 1.55;
}
.bubble strong { font-weight: 700; }
.bubble ul { margin: 6px 0 0; padding-left: 18px; }
.bubble li { margin: 2px 0; }
.risk-high {
  border-left: 4px solid var(--red) !important;
  padding-left: 14px;
  background: #fff5f5;
}
.risk-mid {
  border-left: 4px solid var(--amber) !important;
  padding-left: 14px;
  background: #fffbeb;
}
.risk-low {
  border-left: 4px solid var(--green) !important;
  padding-left: 14px;
  background: #f0fdf4;
}
.risk-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 6px;
}
.risk-tag.high { background: #fee2e2; color: #b91c1c; }
.risk-tag.mid  { background: #fef3c7; color: #b45309; }
.risk-tag.low  { background: #dcfce7; color: #15803d; }

.chat-input {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.chat-input input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.chat-input input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .12);
}
.chat-suggest {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 18px 18px;
  background: #fff;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.chat-suggest .sg {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-2);
}
.chat-suggest .sg:hover { background: #ede9fe; color: #5b21b6; }

/* =============== 页脚 =============== */
.footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
  background: #fff;
}

/* =============== 滚动条美化 =============== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d6dae3; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b8bdc7; }
::-webkit-scrollbar-track { background: transparent; }
