/* ==========================================================================
   小喜 · 全站 UI 基座  xjly-ui.css
   统一设计令牌 / 基础排版 / 公共组件 / 无障碍 / 响应式
   对比度：正文≥4.5:1，白字按钮底 5.9:1，次要文字 4.9:1
   ========================================================================== */

:root {
  /* 品牌（白字底 5.9:1 / 文字色 7.5:1，均达 WCAG AA） */
  --brand: #17705c;
  --brand-ink: #14614f;
  --brand-mid: #1b8069;
  --brand-soft: #eafaf4;
  --brand-line: #cdeede;

  /* 中性 */
  --bg: #f5f7f6;
  --card: #ffffff;
  --line: #e6ebe9;
  --txt: #1c2b27;
  --muted: #5a6b66;
  --muted-2: #65746d;
  --warn-bg: #fff8e6;
  --warn-line: #f0c419;
  --danger-bg: #fff1f0;
  --danger-line: #ffccc7;
  --danger-txt: #a8071a;

  /* 尺寸 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 16px;
  --r-pill: 999px;
  --tap: 44px;
  --wrap: 960px;

  --sh-1: 0 1px 2px rgba(16, 40, 34, .04);
  --sh-2: 0 6px 20px rgba(23, 112, 92, .10);
  --sh-3: 0 8px 24px rgba(23, 112, 92, .18);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: rgba(23, 112, 92, .12);
}

img, svg, video { max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

/* 键盘可见焦点（鼠标点击不显示，避免视觉噪声） */
:focus-visible {
  outline: 3px solid #7fd3bd;
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: #cdeede; color: #0d3d32; }

/* 屏幕阅读器专用 */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* 跳到主内容 */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  z-index: 10000;
  background: var(--brand); color: #fff;
  padding: 12px 18px; border-radius: 0 0 var(--r-sm) 0;
  font-size: 14px;
}
.skip-link:focus { left: 0; }

/* ---------- 顶栏 ---------- */
.top {
  background: linear-gradient(120deg, var(--brand), var(--brand-mid));
  color: #fff;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 56px;
}
.top h1 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
.top .sub { font-size: 12.5px; opacity: .92; margin-left: 6px; }
.top a {
  color: #fff;
  font-size: 13.5px;
  min-height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 8px;
}
.top a:hover { background: rgba(255, 255, 255, .14); }
.top .spacer { margin-left: auto; }

/* ---------- 容器 ---------- */
.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 18px 16px 48px;
}
.wrap-narrow { max-width: 760px; }

/* ---------- 面包屑 ---------- */
.bread {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.bread a {
  color: var(--brand-ink);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
}
.bread .sep { opacity: .55; }

/* ---------- 标题 ---------- */
.sec-title {
  font-size: 18px; font-weight: 700;
  margin: 26px 4px 14px;
  display: flex; align-items: center; gap: 8px;
}
.sec-title::before {
  content: ""; width: 4px; height: 18px;
  background: var(--brand); border-radius: 2px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: var(--sh-1);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.card h3 { font-size: 16px; margin: 10px 0 6px; }
.card p { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--brand-ink); }
.btn:active { transform: scale(.985); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand-ink); border-color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 48px; font-size: 15.5px; }

/* ---------- 标签 / 徽标 ---------- */
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 6px 14px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-ink);
  border-radius: var(--r-pill);
  font-size: 13.5px;
  cursor: pointer;
}
.chip[aria-pressed="true"], .chip.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.badge {
  display: inline-block; padding: 2px 9px;
  background: var(--brand-soft); color: var(--brand-ink);
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
}
.badge.warn { background: var(--warn-bg); color: #7a5b00; }

/* ---------- 提示条 ---------- */
.alert, .notice {
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 12px 0;
}
.notice { background: var(--brand-soft); border: 1px solid var(--brand-line); color: #0f5343; }
.alert { background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger-txt); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #6b4e00; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 14px; }
.empty a { color: var(--brand-ink); font-weight: 600; }

/* ---------- 键值表 ---------- */
.kv { border-top: 1px solid var(--line); }
.kv > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.kv dt, .kv .k { color: var(--muted); }
.kv dd, .kv .v { margin: 0; font-weight: 600; }

/* ---------- 页脚 ---------- */
.foot {
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
  padding: 26px 16px calc(28px + env(safe-area-inset-bottom));
  line-height: 1.8;
}
.foot a { color: var(--brand-ink); }
.foot b { color: var(--brand-ink); }
.foot .links { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; margin-bottom: 8px; }
.foot .links a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 2px; }

/* ---------- 唯一 AI 悬浮入口 ---------- */
.ai-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 9990;
  width: 56px; height: 56px;
  border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-mid));
  color: #fff;
  font-size: 13px; font-weight: 700;
  font-family: var(--font);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1.1;
  box-shadow: var(--sh-3);
  cursor: pointer;
  transition: transform .15s ease;
}
.ai-fab:hover { transform: scale(1.06); }
.ai-fab small { font-size: 11px; font-weight: 400; opacity: .95; line-height: 1.2; }

/* ---------- 分页 / 元信息 ---------- */
.meta { font-size: 12.5px; color: var(--muted-2); }
.price-lg { font-size: 28px; font-weight: 800; color: var(--brand-ink); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  :root { --wrap: 100%; }
  .top { padding-left: 14px; padding-right: 14px; }
  .top .sub { display: none; }
  .wrap { padding-left: 14px; padding-right: 14px; }
  .grid { grid-template-columns: 1fr; }
  .sec-title { margin-top: 20px; }
}

/* ---------- 动效克减 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 打印 ---------- */
@media print {
  .top, .foot, .ai-fab, .skip-link, .act, .btn { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .card, .day { break-inside: avoid; border-color: #ccc; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
}
