/* ============================================
   奇棋网 base.css — 主题变量、排版、通用组件
   ============================================ */
:root {
  --primary: #b34700;        /* 棋盘木色主色 */
  --primary-deep: #8a3500;
  --accent: #2f6f4f;         /* 棋子绿 */
  --gold: #c9962e;
  --bg: #faf6ef;             /* 米白背景 */
  --bg-card: #ffffff;
  --text: #3a2e23;
  --text-light: #7a6a58;
  --border: #e8ddca;
  --shadow: 0 2px 10px rgba(120, 90, 40, .12);
  --shadow-lg: 0 6px 24px rgba(120, 90, 40, .18);
  --radius: 14px;
  --sidebar-w: 240px;
  --maxw: 1100px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: clamp(15px, 1.6vw, 17px);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }

h1, h2, h3, h4 { line-height: 1.3; color: var(--text); }

h1 { font-size: clamp(26px, 4vw, 38px); }
h2 { font-size: clamp(20px, 3vw, 27px); margin-bottom: .6em; margin-top: 2.4rem; }
.page > h2:first-child { margin-top: 0; }
h3 { font-size: clamp(17px, 2.2vw, 21px); margin-top: 1.6rem; }

section { margin-bottom: 2.6rem; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  padding: .55em 1.35em;
  border-radius: 999px;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
  min-height: 44px;
  text-decoration: none !important;
}
.btn:hover { background: var(--primary-deep); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: rgba(179, 71, 0, .08); }
.btn.small { padding: .3em 1em; min-height: 36px; font-size: .92rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; }

.tag {
  display: inline-block;
  padding: .12em .7em;
  border-radius: 999px;
  font-size: .82rem;
  background: rgba(47, 111, 79, .12);
  color: var(--accent);
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(58, 46, 35, .92);
  color: #fff;
  padding: .7em 1.4em;
  border-radius: 10px;
  font-size: .95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 900;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 引用角标 */
sup.ref {
  font-size: .68em;
  margin-left: 2px;
}
sup.ref a {
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  padding: 0 .38em;
  cursor: pointer;
  text-decoration: none !important;
}

/* 时间线 */
.timeline { list-style: none; position: relative; padding-left: 36px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 17px; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--border);
  border-radius: 2px;
}
.timeline li { position: relative; padding: 0 0 1.1rem .4rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -24px; top: .5em;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--gold);
}
.timeline .year { font-weight: 800; color: var(--primary); margin-right: .5em; }

/* 参考来源 */
.references { font-size: .9rem; color: var(--text-light); }
.references li { margin-bottom: .45em; word-break: break-all; }

/* 难度星 */
.stars { color: var(--gold); letter-spacing: 2px; white-space: nowrap; }

/* 移动端通用 */
@media (max-width: 480px) {
  .card { padding: 1.1rem 1rem; }
}
