/* ============================================================
   花札物语 · 45山月随人归公会  —  统一设计系统 v2.4
   精致浅绿主题：暖纸底 + 山林绿主色 + 花札暖金点缀。
   覆盖全站配色 / 字体 / 卡片 / 按钮 / 表格 / 表单 / 页脚 / 顶栏。
   所有图标均用 CSS 绘制，不含任何 emoji。
   ============================================================ */

:root {
  --wb-bg: #ecf3ee;
  --wb-bg-2: #e1ece4;
  --wb-bg-glow: #f4f9f5;
  --wb-surface: #ffffff;
  --wb-surface-2: #f4f9f5;
  --wb-border: #d9e6df;
  --wb-border-strong: #c4d8cc;
  --wb-text: #1f2e28;
  --wb-text-soft: #5f7268;
  --wb-text-faint: #8a9a90;
  --wb-primary: #1e8c5a;
  --wb-primary-d: #14623e;
  --wb-primary-soft: #e3f3ea;
  --wb-accent: #c79a3e;
  --wb-accent-soft: #f7efda;
  --wb-success: #2f9e6b;
  --wb-shadow: 0 14px 38px rgba(20, 60, 40, 0.10);
  --wb-shadow-sm: 0 3px 12px rgba(20, 60, 40, 0.07);
  --wb-shadow-xs: 0 1px 3px rgba(20, 60, 40, 0.06);
  --wb-radius: 16px;
  --wb-radius-sm: 10px;
  --wb-radius-lg: 22px;
  --wb-maxw: 1080px;
  --wb-font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--wb-font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--wb-text);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--wb-bg-glow) 0%, transparent 60%),
    linear-gradient(165deg, var(--wb-bg) 0%, var(--wb-bg-2) 100%);
  background-attachment: fixed;
  padding-bottom: 64px; /* 为固定页脚预留空间 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- 排版 ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--wb-text);
  line-height: 1.35;
  font-weight: 700;
  margin: 1.1em 0 .55em;
}
h1 { font-size: 1.9rem; letter-spacing: .5px; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.22rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small { color: var(--wb-text-soft); }
img { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--wb-border); margin: 1.6em 0; }
ul, ol { padding-left: 1.4em; }

a {
  color: var(--wb-primary);
  text-decoration: none;
  transition: color .2s ease;
}
a:hover { color: var(--wb-primary-d); text-decoration: underline; }

.wb-muted { color: var(--wb-text-soft); }
.wb-center { text-align: center; }

/* ---------- 顶栏（由页面引用；首页使用） ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--wb-border);
}
/* 子页面注入的顶栏：固定定位，避免与部分页面 body 的 flex 布局冲突 */
.site-header-sub {
  position: fixed;
  box-shadow: var(--wb-shadow-sm);
}
/* 子页面统一返回按钮（右上角，全站同一位置） */
.site-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 15px;
  border: 1px solid var(--wb-border);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--wb-text-soft);
  background: var(--wb-surface);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.site-back:hover {
  background: var(--wb-primary-soft);
  color: var(--wb-primary-d);
  border-color: var(--wb-border-strong);
  text-decoration: none;
}
.site-back .arr {
  width: 7px; height: 7px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: 1px;
}
.site-header-inner {
  max-width: var(--wb-maxw);
  margin: 0 auto;
  height: 60px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--wb-text);
  font-weight: 800;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--wb-primary), var(--wb-primary-d));
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: var(--wb-shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--wb-text-faint);
}
.site-nav { display: flex; gap: 6px; }
.site-nav a {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--wb-text-soft);
}
.site-nav a:hover {
  background: var(--wb-primary-soft);
  color: var(--wb-primary-d);
  text-decoration: none;
}

/* ---------- 容器 ---------- */
.wb-container {
  max-width: var(--wb-maxw);
  margin: 0 auto;
  padding: 28px 16px 72px;
}

/* ---------- 卡片 / 面板 ---------- */
.card, .panel, .wb-card {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  padding: 22px 24px;
  box-shadow: var(--wb-shadow-sm);
}

/* ---------- 章节标题（左侧色条） ---------- */
.section-title {
  position: relative;
  padding-left: 14px;
  margin: 0 0 16px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .5px;
}
.section-title::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 5px; height: 1.05em;
  border-radius: 4px;
  background: linear-gradient(var(--wb-primary), var(--wb-primary-d));
}

/* ---------- 特性卡片网格（首页） ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.feature-card {
  position: relative;
  display: block;
  padding: 20px 22px 20px 22px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  box-shadow: var(--wb-shadow-xs);
  color: var(--wb-text);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.feature-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: var(--wb-border-strong);
  box-shadow: var(--wb-shadow);
  color: var(--wb-text);
}
.fc-index {
  display: block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--wb-text-faint);
  margin-bottom: 8px;
}
.fc-title {
  display: block;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--wb-primary-d);
  margin-bottom: 6px;
}
.fc-desc {
  display: block;
  font-size: 13.5px;
  color: var(--wb-text-soft);
  line-height: 1.6;
}
.fc-arrow {
  position: absolute;
  right: 18px; top: 50%;
  width: 9px; height: 9px;
  border-top: 2px solid var(--wb-text-faint);
  border-right: 2px solid var(--wb-text-faint);
  transform: translateY(-50%) rotate(45deg);
  transition: right .2s ease, border-color .2s ease;
}
.feature-card:hover .fc-arrow {
  right: 13px;
  border-color: var(--wb-primary);
}

/* ---------- 表格（全站最明显的统一项） ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
  box-shadow: var(--wb-shadow-xs);
}
thead th {
  background: var(--wb-primary-soft);
  color: var(--wb-primary-d);
  font-weight: 700;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--wb-border);
  white-space: nowrap;
}
tbody th {
  background: var(--wb-surface-2);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--wb-border);
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--wb-border);
  vertical-align: top;
}
tbody tr:nth-child(even) { background: var(--wb-surface-2); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }
tbody tr:hover { background: var(--wb-primary-soft); }

/* ---------- 按钮 / 表单（含 CSS 箭头，无 emoji） ---------- */
button, .btn, .button,
input[type="submit"], input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  background: linear-gradient(135deg, var(--wb-primary) 0%, var(--wb-primary-d) 100%);
  border: none;
  border-radius: var(--wb-radius-sm);
  padding: 11px 22px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
  box-shadow: var(--wb-shadow-sm);
}
button:hover, .btn:hover, .button:hover,
input[type="submit"]:hover, input[type="button"]:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--wb-shadow);
}
button:active, .btn:active, .button:active { transform: translateY(0); }

/* 带右侧箭头的按钮（CSS 绘制，非 emoji） */
.btn-arrow { position: relative; padding-right: 44px; }
.btn-arrow::after {
  content: "";
  position: absolute;
  right: 18px; top: 50%;
  width: 7px; height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
  opacity: .75;
  transition: right .2s ease, opacity .2s ease;
}
.btn-arrow:hover::after { right: 14px; opacity: 1; }

.btn-secondary, .button-secondary {
  background: var(--wb-surface);
  color: var(--wb-primary-d);
  border: 1px solid var(--wb-border);
  box-shadow: none;
}
.btn-secondary:hover, .button-secondary:hover {
  background: var(--wb-primary-soft);
  color: var(--wb-primary-d);
}

input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="search"], input[type="date"],
input:not([type]), select, textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--wb-text);
  background: #fff;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius-sm);
  padding: 9px 12px;
  width: 100%;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--wb-primary);
  box-shadow: 0 0 0 3px var(--wb-primary-soft);
}
textarea { resize: vertical; min-height: 80px; }

label { font-weight: 600; color: var(--wb-text); }

/* ---------- 首页 hero / 统计 / 历史 ---------- */
.home { max-width: var(--wb-maxw); margin: 0 auto; padding: 40px 18px 72px; }
.hero { text-align: center; padding: 18px 0 30px; }
.hero-eyebrow {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--wb-primary);
  background: var(--wb-primary-soft);
  border: 1px solid var(--wb-border);
  padding: 5px 14px;
  border-radius: 999px;
  margin: 0 0 18px;
}
.hero-title {
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 1px;
  margin: 0 0 12px;
  background: linear-gradient(120deg, var(--wb-primary-d) 0%, var(--wb-primary) 45%, var(--wb-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--wb-primary-d);
}
.hero-sub { color: var(--wb-text-soft); font-size: 15px; letter-spacing: 1px; margin: 0 0 18px; }

.stats-pill {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  box-shadow: var(--wb-shadow-sm);
  font-size: 13.5px;
  color: var(--wb-text-soft);
  font-weight: 600;
}
.stats-pill .stat { display: inline-flex; align-items: baseline; gap: 6px; }
.stats-pill .stat b { color: var(--wb-primary-d); font-size: 16px; font-weight: 800; }
.stats-pill .stat-sep { color: var(--wb-border-strong); }
.stats-below { display: flex; justify-content: center; margin-top: 28px; }

.history-block { margin-top: 34px; }
.history-toggle {
  width: 100%;
  padding: 14px 20px;
  border: 1px solid var(--wb-border);
  background: var(--wb-surface);
  color: var(--wb-primary-d);
  border-radius: var(--wb-radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .2s ease, border-color .2s ease;
}
.history-toggle:hover { background: var(--wb-primary-soft); border-color: var(--wb-border-strong); }
.history-toggle .chev {
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .3s ease;
}
.history-toggle[aria-expanded="true"] .chev { transform: rotate(-135deg); }
.history-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height .4s ease, opacity .3s ease;
  opacity: 0;
}
.history-content.active { max-height: 1200px; opacity: 1; margin-top: 14px; }
.history-list { display: grid; gap: 10px; }
.history-list a {
  display: block;
  padding: 13px 18px;
  border-radius: var(--wb-radius-sm);
  background: var(--wb-surface-2);
  border: 1px solid var(--wb-border);
  color: var(--wb-text);
  font-weight: 600;
  transition: background .2s ease, transform .15s ease;
}
.history-list a:hover { background: var(--wb-primary-soft); text-decoration: none; transform: translateX(3px); color: var(--wb-primary-d); }

.back-link {
  display: inline-block;
  margin-top: 30px;
  color: var(--wb-text-soft);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--wb-border);
  background: var(--wb-surface);
  transition: all .2s ease;
}
.back-link:hover { color: var(--wb-primary-d); border-color: var(--wb-border-strong); text-decoration: none; }

/* ---------- 全站页脚（common.js 注入，固定底部） ---------- */
.site-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9999;
  text-align: center;
  font-size: 12.5px;
  color: var(--wb-text-soft);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--wb-border);
  padding: 9px 12px;
  line-height: 1.7;
}
.site-footer .footer-line { display: block; }
.site-footer a { color: var(--wb-text-soft); text-decoration: none; transition: color .2s ease; }
.site-footer a:hover { color: var(--wb-primary); text-decoration: underline; }
.site-footer .sep { margin: 0 7px; opacity: .45; }
.site-footer .footer-meta { margin-top: 1px; }
.site-footer .footer-author { color: var(--wb-text-faint); }
.site-footer .ver {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--wb-primary-soft);
  color: var(--wb-primary-d);
  font-weight: 700;
  font-size: 11.5px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  body { font-size: 15px; }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.3rem; }
  .wb-container { padding: 18px 12px 72px; }
  .home { padding: 24px 14px 72px; }
  .site-nav a { padding: 6px 10px; font-size: 13px; }
  table { font-size: 13px; }
  thead th, tbody th, td { padding: 9px 10px; }
  button, .btn, .button { width: 100%; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .site-header-inner { padding: 0 12px; }
}

/* ---------- 尊重系统「减少动态效果」 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
