/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --brand: #D92121;
  --brand-dark: #B51919;
  --brand-light: #FDECEC;
  --blue: #003366;
  --blue2: #004a8f;
  --text: #333;
  --text2: #666;
  --text3: #999;
  --bg: #F5F6F8;
  --card: #fff;
  --radius: 12px;
}
html, body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
}
.topbar .logo { width: 34px; height: 34px; border-radius: 8px; overflow: hidden; flex: none; }
.topbar .logo img { width: 100%; height: 100%; object-fit: contain; }
.topbar .t-name { font-size: 17px; font-weight: 700; color: var(--blue); }
.topbar .t-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }
.topbar .spacer { flex: 1; }
.topbar .back-btn {
  font-size: 13px; color: var(--blue); background: none; border: none; cursor: pointer;
  padding: 6px 4px;
}
.topbar .brand-tag { font-size: 11px; color: var(--brand); background: var(--brand-light); border-radius: 20px; padding: 3px 10px; }

/* ===== 主容器 ===== */
.page { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }

/* ===== 首页头部 ===== */
.hero {
  background: linear-gradient(135deg, #003366, #004a8f);
  color: #fff; border-radius: 14px; padding: 22px 20px; margin-bottom: 16px;
}
.hero .h-title { font-size: 21px; font-weight: 700; letter-spacing: 0.5px; }
.hero .h-sub { font-size: 13px; opacity: 0.85; margin-top: 5px; }
.hero .h-en { font-size: 11px; letter-spacing: 1px; opacity: 0.6; margin-top: 8px; text-transform: uppercase; }

/* ===== 搜索框 ===== */
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 6px 8px 6px 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 18px;
}
.search-box input {
  flex: 1; height: 40px; border: none; outline: none; font-size: 15px; background: transparent;
}
.search-btn {
  background: var(--blue); color: #fff; border: none; border-radius: 9px;
  padding: 9px 20px; font-size: 14px; cursor: pointer; flex: none;
}
.search-btn:active { background: var(--blue2); }

/* ===== 热门 ===== */
.section-title { font-size: 16px; font-weight: 700; color: var(--blue); margin: 18px 0 12px; display: flex; align-items: center; gap: 6px; }
.section-title .en { font-size: 11px; color: var(--text3); font-weight: 400; letter-spacing: 1px; }
.hot-list { display: flex; flex-wrap: wrap; gap: 10px; }
.hot-item {
  background: #fff; border-radius: 20px; padding: 8px 16px; font-size: 14px; color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); cursor: pointer; border: 1px solid #eee;
}
.hot-item:active { background: var(--brand-light); border-color: var(--brand); }

/* ===== 结果列表 ===== */
.result-count { font-size: 13px; color: var(--text3); margin: 4px 2px 12px; }
.chem-card {
  background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); cursor: pointer;
  display: block; text-decoration: none; color: var(--text);
  border-left: 4px solid transparent;
}
.chem-card:active { background: #fafafa; }
.chem-card .card-top { display: flex; justify-content: space-between; align-items: center; }
.chem-cn { font-size: 17px; font-weight: 700; color: var(--blue); }
.risk-tag { font-size: 12px; padding: 3px 10px; border-radius: 6px; color: #fff; font-weight: 600; }
.risk-H { background: #d32f2f; }
.risk-M { background: #f57c00; }
.risk-L { background: #388e3c; }
.risk-unk { background: #999; }
.card-sub { font-size: 12px; color: var(--text3); margin-top: 5px; line-height: 1.7; }
.card-sub .sep { color: #ddd; margin: 0 6px; }
.card-tags { margin-top: 8px; }
.filter-tag {
  background: #e8f5e9; color: #2e7d32; font-size: 12px; padding: 3px 10px; border-radius: 6px;
  display: inline-block;
}
.mask-tag {
  background: #e3f2fd; color: #1565c0; font-size: 12px; padding: 3px 10px; border-radius: 6px;
  display: inline-block; margin-left: 6px;
}
.hint-tag {
  background: #fff3e0; color: #e65100; font-size: 12px; padding: 3px 10px; border-radius: 6px;
  display: inline-block; margin-left: 6px;
}

.empty { text-align: center; padding: 60px 20px; color: var(--text3); font-size: 14px; }
.empty-hint { font-size: 12px; margin-top: 8px; display: block; color: #bbb; }

/* ===== 详情页 ===== */
.chem-header { border-radius: 14px; padding: 20px; color: #fff; margin-bottom: 14px; }
.risk-bg-H { background: linear-gradient(135deg, #c62828, #e57373); }
.risk-bg-M { background: linear-gradient(135deg, #ef6c00, #ffb74d); }
.risk-bg-L { background: linear-gradient(135deg, #2e7d32, #81c784); }
.risk-bg-unk { background: linear-gradient(135deg, #546e7a, #90a4ae); }
.chem-header .c-name { font-size: 24px; font-weight: 800; }
.chem-header .c-sub { font-size: 13px; opacity: 0.9; margin-top: 6px; line-height: 1.8; }
.risk-badge { display: inline-block; background: rgba(0,0,0,0.25); border-radius: 20px; padding: 4px 14px; font-size: 12px; margin-top: 10px; }

.section {
  background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.section-title { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--text); }
.section-title .ic { margin-right: 4px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed #f0f0f0; font-size: 14px; }
.info-row:last-child { border-bottom: none; }
.lbl { color: var(--text2); }
.val { font-weight: 600; }
.val.orange { color: #e65100; }
.val.red { color: #c62828; }
.val.blue { color: #1565c0; }
.mono { font-family: Consolas, Menlo, monospace; }

/* 推荐结论块 */
.rec-box { border: 1px solid #c8e6c9; background: #f1f8e9; border-radius: 10px; padding: 14px; }
.rec-main { font-size: 17px; font-weight: 700; color: #2e7d32; line-height: 1.6; }
.rec-reason { font-size: 13px; color: #558b2f; margin-top: 6px; }
.gb-box { border: 1px solid #bbdefb; background: #e3f2fd; border-radius: 10px; padding: 14px; }
.gb-main { font-size: 15px; font-weight: 700; color: #1565c0; }
.ax-tip { font-size: 13px; color: #e65100; background: #fff3e0; border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.scba-warning { background: #ffebee; border: 1px solid #ffcdd2; border-radius: 10px; padding: 16px; text-align: center; }
.scba-warning .w-title { font-size: 18px; font-weight: 800; color: #c62828; }
.scba-warning .w-sub { font-size: 13px; color: #e57373; margin-top: 6px; }
.scba-warning .w-red { font-size: 13px; font-weight: 700; color: #b71c1c; margin-top: 10px; }

/* 面罩选择 */
.gallery-title { font-size: 14px; color: var(--text2); margin: 14px 0 10px; }
.product-cards { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.prod-card {
  flex: none; width: 130px; border: 2px solid #eee; border-radius: 12px; text-align: center;
  padding: 12px 6px 10px; cursor: pointer; background: #fff; position: relative;
}
.prod-card.selected { border-color: var(--brand); background: var(--brand-light); }
.prod-card .img-box { width: 80px; height: 80px; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.prod-card img { max-width: 100%; max-height: 100%; object-fit: contain; }
.prod-name { font-size: 15px; font-weight: 700; margin-top: 6px; }
.prod-tier { display: inline-block; font-size: 11px; color: #fff; border-radius: 20px; padding: 2px 10px; margin-top: 4px; background: #999; }
.tier-flagship { background: linear-gradient(135deg,#1677ff,#69b1ff); }
.tier-classic { background: #52c41a; }
.tier-entry { background: #fa8c16; }
.tier-ffm { background: linear-gradient(135deg,#722ed1,#b37feb); }
.tier-7800 { background: linear-gradient(135deg,#eb2f96,#f759ab); }
.check-icon {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; line-height: 22px; text-align: center; display: none;
}
.prod-card.selected .check-icon { display: block; }
.mask-tip { font-size: 12px; color: var(--text3); margin-top: 10px; }

/* 按钮区 */
.btn-area { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  flex: 1; min-width: 150px; border: none; border-radius: 10px; padding: 13px; font-size: 15px;
  font-weight: 600; cursor: pointer; color: #fff; text-align: center;
}
.btn-main { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.btn-blue { background: linear-gradient(135deg, #003366, #004a8f); }
.btn-green { background: linear-gradient(135deg, #2e7d32, #4caf50); }
.btn:disabled { background: #ccc; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.pdf-tip { font-size: 12px; color: var(--text3); margin-top: 8px; text-align: center; }

/* ===== 计算器 ===== */
.calc-input-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed #f0f0f0; }
.calc-input-row label { font-size: 14px; color: var(--text2); }
.calc-input-row .ctrl { display: flex; align-items: center; gap: 6px; }
.calc-input-row input {
  width: 90px; height: 34px; border: 1px solid #ddd; border-radius: 8px; text-align: center;
  font-size: 14px; outline: none;
}
.calc-input-row input:focus { border-color: var(--blue); }
.calc-input-row .unit { font-size: 12px; color: var(--text3); width: 52px; }
.seg { display: flex; background: #f0f0f0; border-radius: 8px; padding: 3px; }
.seg button { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--text2); }
.seg button.on { background: #fff; color: var(--blue); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

.result-hero {
  text-align: center; padding: 22px 12px; border-radius: 12px; margin-top: 6px;
  background: linear-gradient(135deg,#f9f0ff,#fff); border: 1px solid #efdbff;
}
.result-hero .big { font-size: 44px; font-weight: 800; color: #722ed1; }
.result-hero .unit { font-size: 15px; color: #722ed1; }
.result-hero .sub { font-size: 13px; color: var(--text2); margin-top: 8px; }
.calc-params { margin-top: 12px; }
.calc-param { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 2px; color: var(--text2); }
.calc-param .cp-val { font-weight: 600; color: var(--text); }
.calc-disclaimer { font-size: 12px; color: var(--text3); margin-top: 12px; line-height: 1.7; padding: 10px; background: #fff8e1; border-radius: 8px; }

/* ===== 报告页 ===== */
.report-shell { max-width: 700px; margin: 0 auto; }
.report-actions { display: flex; gap: 10px; margin: 16px 0; }
.report {
  background: #fff; border-radius: 4px; padding: 0; box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  font-size: 14px; color: #222; overflow: hidden;
}
.report .r-head { background: linear-gradient(135deg,#0a1628,#1a3a5c); color: #fff; padding: 26px 28px; }
.report .r-head .r-logo { font-size: 20px; font-weight: 800; letter-spacing: 2px; }
.report .r-head .r-logo-sub { font-size: 11px; opacity: 0.7; letter-spacing: 1px; margin-top: 3px; }
.report .r-head .r-title { font-size: 18px; font-weight: 700; margin-top: 14px; }
.report .r-head .r-date { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.r-card { padding: 16px 22px; border-bottom: 1px solid #f0f0f0; }
.r-card .rc-title { font-size: 13px; font-weight: 700; color: #1677ff; margin-bottom: 10px; }
.r-card .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.r-card .row .label { color: #666; }
.r-card .row .value { font-weight: 600; }
.rc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.r-banner { background: #e6f7ff; }
.r-product { border-bottom: none; }
.r-product .config { font-size: 15px; font-weight: 700; color: #2e7d32; text-align: center; padding: 6px 0; }
.r-footer { padding: 14px 22px 20px; font-size: 11px; color: #999; text-align: center; line-height: 1.8; }
.r-danger-hi { color: #d32f2f; }
.r-calc-num { font-size: 30px; font-weight: 800; color: #722ed1; text-align: center; }

@media print {
  .topbar, .report-actions, .back { display: none !important; }
  body { background: #fff; }
  .report { box-shadow: none; border-radius: 0; }
  .page { max-width: none; padding: 0; }
}

/* 底部 */
.footer { text-align: center; padding: 26px 16px 40px; color: var(--text3); font-size: 12px; line-height: 2; }
.footer .brand { color: var(--brand); font-weight: 600; }
