/* ============================================================
 * common.css —— SBTI 网页版全局样式
 * 设计基准 375px（小程序 750rpx ÷ 2），容器最大 480px 居中
 * 主色系：墨绿 #4d6a53 / 深绿 #1a4a2a / 浅底 #f6faf6
 * ============================================================ */

:root {
  --c-primary: #4d6a53;
  --c-deep: #1a4a2a;
  --c-text: #1e2a22;
  --c-sub: #6a786f;
  --c-border: #dbe8dd;
  --c-bg-soft: #edf6ef;
  --c-bg: #f6faf6;
  --c-hint: #97b59c;
  --c-card: rgba(255, 255, 255, 0.94);
}

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

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

body.wb-page {
  background: #e8efe9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--c-text);
  min-height: 100vh;
}

/* 页面容器 */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--c-bg);
  padding-bottom: 76px; /* 给 tabBar 留空间 */
  overflow-x: hidden;
}
#app.no-tab { padding-bottom: 24px; }
body.wb-page.has-topbar #app { padding-top: 0; }

/* ============ 顶部返回栏 ============ */
.wb-topbar {
  max-width: 480px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  height: 48px;
  background: #f6faf6;
  border-bottom: 1px solid #e4efe6;
}
.wb-topbar-back {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--c-deep);
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wb-topbar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  padding-right: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-topbar-right { width: 48px; }

/* ============ 底部 tabBar ============ */
.wb-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-top: 1px solid #edf3ee;
  display: flex;
  z-index: 999;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.wb-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 0;
  text-decoration: none;
  position: relative;
  transition: all .25s ease;
}
.wb-tabbar-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--c-deep);
}
.wb-tabbar-icon {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  object-fit: contain;
  transition: all .25s ease;
}
.wb-tabbar-icon.active { width: 26px; height: 26px; }
.wb-tabbar-label {
  font-size: 10px;
  color: #c5cbc7;
  line-height: 1.3;
  transition: all .25s ease;
}
.wb-tabbar-label.active {
  font-size: 12px;
  font-weight: 800;
  color: var(--c-deep);
}

/* ============ 通用组件 ============ */
.card {
  background: var(--c-card);
  border-radius: 16px;
  margin: 12px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(30, 42, 34, 0.05);
}
.shell { padding: 4px 0 12px; }

.page-header { padding: 20px 16px 8px; }
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--c-text);
  margin: 0;
  line-height: 1.3;
}
.page-subtitle {
  font-size: 13px;
  color: var(--c-sub);
  margin-top: 6px;
  line-height: 1.5;
}

.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 13px 0;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, #4d6a53 0%, #3a5540 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(77, 106, 83, 0.35);
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  background: #edf6ef;
  color: var(--c-deep);
  border: 1px solid #d5e6d9;
}
.btn-secondary:active { transform: scale(0.97); }
.btn-disabled { opacity: 0.5; pointer-events: none; }

.action-cluster { display: flex; gap: 10px; padding: 12px 16px; }
.action-cluster .btn-primary, .action-cluster .btn-secondary { flex: 1; }

.section { padding: 4px 16px; }
.section-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--c-text);
  margin: 14px 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title .badge { margin-left: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--c-bg-soft);
  color: var(--c-deep);
  border: 1px solid #d5e6d9;
}
.badge-level-H { background: #e8f5ec; color: #2e7d32; border-color: #cde9d4; }
.badge-level-M { background: #fff3e0; color: #e65100; border-color: #ffe0b2; }
.badge-level-L { background: #fdecea; color: #c62828; border-color: #f5c6c2; }

/* 进度条 */
.progress-track {
  height: 8px;
  background: #e4efe6;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6c8d71, #4d6a53);
  border-radius: 999px;
  transition: width .4s ease;
}

/* 题目选项 */
.options { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fbfefb;
  border: 1.5px solid #dbe8dd;
  border-radius: 14px;
  padding: 13px 14px;
  cursor: pointer;
  transition: all .18s ease;
  text-align: left;
}
.option:active { transform: scale(0.985); }
.option.selected {
  border-color: var(--c-primary);
  background: #edf6ef;
  box-shadow: 0 2px 10px rgba(77, 106, 83, 0.15);
}
.option-code {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #edf6ef;
  border: 1px solid #d5e6d9;
  color: var(--c-deep);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.option.selected .option-code { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.option-label { flex: 1; font-size: 15px; color: var(--c-text); line-height: 1.5; }
.option-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #c5cbc7;
  flex-shrink: 0;
  position: relative;
  transition: all .18s ease;
}
.option.selected .option-radio { border-color: var(--c-primary); }
.option.selected .option-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--c-primary);
}

/* 结果页通用 */
.result-type-card { text-align: center; }
.result-type-img {
  width: 180px;
  height: 180px;
  margin: 8px auto;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #edf6ef;
  background: #f3f8f4;
}
.type-code {
  font-size: 44px;
  font-weight: 900;
  color: var(--c-deep);
  letter-spacing: 2px;
  line-height: 1.2;
}
.type-cn {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-sub);
  margin-top: 2px;
}
.quote-card {
  background: linear-gradient(135deg, #f3f8f4, #eaf3ec);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--c-deep);
  font-weight: 600;
  line-height: 1.6;
  border-left: 4px solid var(--c-primary);
  margin: 12px;
}

/* 维度条 */
.dim-row { margin-bottom: 10px; }
.dim-row-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--c-sub);
  margin-bottom: 5px;
}
.dim-row-head b { color: var(--c-text); font-weight: 600; }
.dim-bar { height: 8px; background: #e4efe6; border-radius: 999px; overflow: hidden; }
.dim-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6c8d71, #4d6a53); }

/* 网格 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-hint);
}
.empty-state .empty-emoji { font-size: 44px; margin-bottom: 10px; }
.empty-state .empty-text { font-size: 14px; line-height: 1.6; }

/* ============ UI 反馈组件 ============ */
#wb-ui-root { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }
#wb-ui-root > * { pointer-events: auto; }

.wb-toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(30, 42, 34, 0.88);
  color: #fff;
  border-radius: 12px;
  padding: 14px 20px;
  max-width: 72vw;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  opacity: 1;
  transition: opacity .3s ease;
  z-index: 10000;
}
.wb-toast-ico { font-size: 22px; margin-bottom: 4px; color: #b9d8bf; }
.wb-toast-hide { opacity: 0; }

.wb-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  pointer-events: auto;
}
.wb-modal {
  width: 80%;
  max-width: 340px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  animation: wb-pop .2s ease;
}
@keyframes wb-pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wb-modal-title { font-size: 17px; font-weight: 700; text-align: center; padding: 20px 16px 6px; color: var(--c-text); }
.wb-modal-content { font-size: 14px; color: var(--c-sub); text-align: center; padding: 10px 18px 18px; line-height: 1.6; }
.wb-modal-btns { display: flex; border-top: 1px solid #eef1ef; }
.wb-modal-btn {
  flex: 1;
  border: none;
  background: #fff;
  padding: 14px 0;
  font-size: 16px;
  cursor: pointer;
  color: var(--c-text);
}
.wb-modal-cancel { color: var(--c-sub); border-right: 1px solid #eef1ef; }
.wb-modal-confirm { color: var(--c-deep); font-weight: 700; }

.wb-sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10001;
  pointer-events: auto;
}
.wb-sheet {
  width: 100%;
  max-width: 480px;
  background: #f5f7f6;
  border-radius: 16px 16px 0 0;
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0));
  animation: wb-sheet-up .25s ease;
}
@keyframes wb-sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.wb-sheet-list { background: #fff; border-radius: 12px; overflow: hidden; }
.wb-sheet-item {
  width: 100%;
  border: none;
  background: #fff;
  padding: 15px 0;
  font-size: 16px;
  color: var(--c-text);
  cursor: pointer;
  border-bottom: 1px solid #f0f2f1;
  text-align: center;
}
.wb-sheet-item:last-child { border-bottom: none; }
.wb-sheet-item:active { background: #f5f7f6; }
.wb-sheet-cancel {
  width: 100%;
  border: none;
  background: #fff;
  padding: 14px 0;
  font-size: 16px;
  color: var(--c-sub);
  cursor: pointer;
  margin-top: 8px;
  border-radius: 12px;
}

.wb-loading {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(30, 42, 34, 0.88);
  color: #fff;
  border-radius: 12px;
  padding: 18px 22px;
  text-align: center;
  z-index: 10002;
  font-size: 13px;
}
.wb-loading-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wb-spin .8s linear infinite;
}
@keyframes wb-spin { to { transform: rotate(360deg); } }

/* 图片容器 */
.wb-imgbox { overflow: hidden; }
.wb-imgbox img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 简单动画 */
.fade-in { animation: wb-fade .4s ease; }
@keyframes wb-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #c8d6cc; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
 * PC 响应式（≥768px）：全宽网站布局
 * 移动端保持手机壳原样；PC 上变为 网站头部 + 顶部导航 + 宽容器
 * ============================================================ */
@media (min-width: 768px) {
  /* 全站背景：浅绿渐变 + 光晕装饰 */
  body.wb-page {
    background:
      radial-gradient(1100px 420px at 8% -60px, rgba(77, 106, 83, 0.12), transparent 60%),
      radial-gradient(900px 380px at 92% -80px, rgba(38, 92, 54, 0.12), transparent 60%),
      linear-gradient(180deg, #eef5ef 0%, #e4eee6 100%);
  }

  /* 网站头部（JS 注入） */
  .wb-site-header {
    background: linear-gradient(135deg, #17412a 0%, #2d5f3a 55%, #4d7a5e 100%);
    color: #fff;
    padding: 30px 20px 26px;
    text-align: center;
  }
  .wb-site-header .wb-site-logo { font-size: 38px; line-height: 1; }
  .wb-site-header .wb-site-name {
    font-size: 30px; font-weight: 800; letter-spacing: 2px; margin-top: 10px;
  }
  .wb-site-header .wb-site-domain {
    display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600;
    color: #e8f0ea; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3);
    border-radius: 999px; padding: 3px 16px; letter-spacing: 1px;
  }
  .wb-site-header .wb-site-slogan {
    font-size: 18px; color: #fff; margin-top: 12px; letter-spacing: 2px; font-weight: 700;
  }
  .wb-site-header .wb-site-desc {
    font-size: 14px; color: rgba(255, 255, 255, 0.82); margin-top: 8px; letter-spacing: .5px;
  }
  .wb-site-header .wb-site-badges {
    margin-top: 14px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
  }
  .wb-site-header .wb-site-badge {
    font-size: 13px; font-weight: 600; color: #fff;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.32);
    border-radius: 999px; padding: 5px 16px;
  }

  /* 顶部导航（JS 将 tabBar 移到顶部并加 .wb-tabbar-desktop） */
  .wb-tabbar-desktop {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: none;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: none;
    border-bottom: 1px solid #e2ece4;
    box-shadow: 0 2px 14px rgba(30, 42, 34, 0.06);
    display: flex;
    justify-content: center;
    z-index: 999;
    padding: 0;
  }
  .wb-tabbar-desktop .wb-tabbar-item {
    flex: 0 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 136px;
    padding: 13px 0;
    border-bottom: 3px solid transparent;
  }
  .wb-tabbar-desktop .wb-tabbar-item:hover { background: #f2f8f3; }
  .wb-tabbar-desktop .wb-tabbar-item.active { border-bottom-color: #1a4a2a; }
  .wb-tabbar-desktop .wb-tabbar-item.active::before { display: none; }
  .wb-tabbar-desktop .wb-tabbar-icon { width: 20px; height: 20px; margin-bottom: 0; }
  .wb-tabbar-desktop .wb-tabbar-icon.active { width: 22px; height: 22px; }
  .wb-tabbar-desktop .wb-tabbar-label { font-size: 14px; color: #5b6a60; }
  .wb-tabbar-desktop .wb-tabbar-label.active { font-size: 15px; }

  /* 页面容器：全宽 1100px 卡片感 */
  #app {
    max-width: 1100px;
    margin: 28px auto;
    border-radius: 20px;
    border: 1px solid #e2ece4;
    box-shadow: 0 12px 44px rgba(30, 42, 34, 0.10);
    min-height: calc(100vh - 300px);
    padding-bottom: 60px;
  }
  #app.no-tab { padding-bottom: 40px; }

  /* 返回栏跟随容器宽度，吸顶时贴在顶部导航下方 */
  .wb-topbar {
    max-width: 1100px;
    border-radius: 20px 20px 0 0;
    background: #fbfdfb;
    top: 47px;
  }

  /* 弹层适当放宽 */
  .wb-sheet { max-width: 560px; }
  .wb-modal { max-width: 420px; }

  /* 通用网格 PC 放大间距 */
  .grid-2 { gap: 14px; }
  .grid-3 { gap: 14px; }
  .grid-4 { gap: 12px; }
  .card { margin: 16px 20px; }
  .section { padding: 4px 24px; }
  .action-cluster { padding: 14px 24px; }
  .quote-card { margin: 16px 20px; }
}
