/* 奇棋网 detail.css — 详情页、首页卡片、棋子 tab、时间线等 */

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 2.6rem 1.6rem 2.2rem; margin-bottom: 2.2rem; background: linear-gradient(135deg, #fffdf8 0%, #fdf3e0 100%); }
.hero .site-name { color: var(--primary); }
.hero-sub { max-width: 620px; margin: .8rem auto 1.3rem; color: var(--text-light); }
.hero .btn-row { justify-content: center; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
.game-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.game-card-img { display: block; margin-bottom: .6rem; }
.game-card-img img { width: 128px; height: 128px; border-radius: 10px; border: 1px solid var(--border); background: #fff; transition: transform .15s; }
.game-card-img:hover img { transform: scale(1.06) rotate(-2deg); }
.game-card h3 { margin-bottom: .15rem; }
.game-card h3 a { color: var(--text); text-decoration: none !important; }
.game-card h3 a:hover { color: var(--primary); }
.game-card .tagline { color: var(--text-light); font-size: .92rem; margin-bottom: .45rem; }
.game-card .meta { display: flex; gap: .6rem; align-items: center; justify-content: center; margin-bottom: .8rem; }
.game-card .btn-row { margin-top: auto; }

.benefit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.benefit { text-align: center; }
.benefit .b-ico { font-size: 2.2rem; }
.benefit p { color: var(--text-light); font-size: .93rem; }

.footnote { text-align: center; color: var(--text-light); font-size: .85rem; margin-top: 2.5rem; }

/* 校园棋社板块 */
.club-card p { line-height: 1.9; }
.club-join {
  text-align: center; font-size: .95rem; color: var(--text);
  background: #fffdf6; border: 1.5px dashed var(--primary);
  border-radius: 12px; padding: .9rem 1.2rem; margin-top: 1.2rem;
}

@media (max-width: 899px) {
  .game-grid, .benefit-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .game-grid, .benefit-grid { grid-template-columns: 1fr; }
}

/* ---------- 详情页通用 ---------- */
.top-title h1 { font-size: clamp(24px, 4vw, 34px); }
.top-title .sub { margin-top: .2rem; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 1.4rem;
  align-items: start;
}
@media (max-width: 899px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.step-list { counter-reset: step; list-style: none; }
.step-list li {
  counter-increment: step;
  position: relative;
  padding: .55rem 0 .55rem 3.1rem;
}
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: .55rem;
  width: 2.2rem; height: 2.2rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.rule-card { border-left: 5px solid var(--accent); }
.term { border-bottom: 1.5px dashed var(--gold); cursor: help; }

/* 棋子对比表 */
.pieces-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pieces-compare .side { text-align: center; }
.pieces-compare .side h4 { margin-bottom: .4rem; }
@media (max-width: 560px) { .pieces-compare { grid-template-columns: 1fr; } }

/* ---------- 棋子子页签（象棋/国象） ---------- */
.piece-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1.2rem;
  align-items: start;
}
@media (max-width: 899px) {
  .piece-layout { grid-template-columns: 1fr; }
}

.piece-tabs { display: flex; flex-direction: column; gap: .45rem; }
.piece-tabs .ptab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .5rem .7rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  min-height: 48px;
  transition: border-color .12s, background .12s;
}
.piece-tabs .ptab:hover { border-color: var(--primary); }
.piece-tabs .ptab.active {
  border-color: var(--primary);
  background: rgba(179, 71, 0, .09);
  box-shadow: var(--shadow);
}
.piece-tabs .ptab img { width: 36px; height: 36px; flex: none; }

/* 移动端：横向 chip 行 */
@media (max-width: 899px) {
  .piece-tabs {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: .4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .piece-tabs .ptab { flex: none; }
}

.piece-panel .piece-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}
.piece-panel .piece-head img { width: 74px; height: 74px; }
.piece-panel .role { color: var(--text-light); font-size: .95rem; }

.demo-board { margin: .6rem 0 1rem; }
.demo-board .board-wrap { position: relative; }
.board-wrap svg { width: min(100%, 460px); height: auto; display: block; border-radius: 8px; }

.demo-tip {
  background: rgba(201, 150, 46, .12);
  border-left: 4px solid var(--gold);
  padding: .5rem .9rem;
  border-radius: 0 8px 8px 0;
  font-size: .9rem;
  margin: .5rem 0;
}

/* 棋盘高亮标记 */
.hl-move { fill: rgba(47, 160, 79, .5); }
.hl-move-dot { fill: rgba(47, 160, 79, .75); }
.hl-capture { fill: none; stroke: #d33; stroke-width: 3.5; }
.hl-selected { fill: rgba(201, 150, 46, .4); }
@keyframes piece-pop {
  0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); }
}
.pop { animation: piece-pop .45s ease; transform-origin: center; transform-box: fill-box; }

/* ---------- 围棋 widget ---------- */
.go-widget { margin: .8rem 0; }
.go-widget .controls { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }

/* 棋盘生成容器统一 */
.board-gen { display: flex; justify-content: center; }
.board-gen svg { width: min(92vw, 560px); height: auto; border-radius: 8px; }

/* 详情页补充样式 */
.intro { font-size: 1.05rem; }
.pieces-intro { color: var(--text-light); margin-bottom: 1rem; }

.tip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tip h4 { color: var(--primary); margin-bottom: .3rem; }
.tip p { font-size: .93rem; color: var(--text-light); }

.player-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.player h4 { color: var(--primary); }
.player small { color: var(--text-light); font-weight: 400; }
.player p { font-size: .92rem; color: var(--text-light); margin-top: .3rem; }

/* 象棋自绘棋子预览（页签/面板中） */
.xq-demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #fcdb9e;
  font-family: KaiTi, STKaiti, serif;
  font-weight: bold;
  font-size: 26px;
  border: 2.5px solid #b02020;
  color: #b02020;
  flex: none;
}
.xq-demo.black { border-color: #222; color: #111; }
.xq-demo.small { width: 34px; height: 34px; font-size: 20px; }
.xq-pieces-pair { display: flex; gap: 12px; align-items: center; }
.piece-panel .piece-head img { border-radius: 6px; }

.special-card { margin: .7rem 0; border-left: 5px solid var(--gold); }
.special-card h4 { color: var(--primary); margin-bottom: .25rem; }
.sp-demo { margin-top: .8rem; }
.sp-demo .board-gen svg { width: min(92vw, 420px); }

.demo-tip .hl { font-weight: 700; }

.board-demo-wrap { display: flex; flex-direction: column; gap: .6rem; }
.accessed { margin-top: .6rem; font-size: .85rem; }

/* 锚点偏移（棋子 hash 跳转） */
h2, h3 { scroll-margin-top: 84px; }

/* ---------- 页内锚点导航（单页棋类） ---------- */
.sub-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  overflow-x: auto;
  padding: 0 .3rem;
  margin: 0 0 1.6rem;
  background: rgba(250, 246, 237, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1.5px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav a {
  flex: none;
  position: relative;
  padding: .68rem 1.15rem;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text-light);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: color .15s, box-shadow .15s;
}
/* 相邻项之间用竖线分割 */
.sub-nav a + a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 1.15em;
  background: var(--border);
}
.sub-nav a:hover { color: var(--primary); }
.sub-nav a.on { color: var(--primary); font-weight: 700; box-shadow: inset 0 -2.5px 0 var(--primary); }

@media (max-width: 899px) {
  /* 移动端顶栏也是 sticky，锚点导航排在其下 */
  .sub-nav { top: 52px; }
  h2, h3 { scroll-margin-top: 116px; }
}

/* 棋子家族总览（概览子页） */
.family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .7rem;
  margin-top: .8rem;
}
.family-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .55rem .7rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
  transition: border-color .12s, transform .12s;
}
.family-card:hover { border-color: var(--primary); transform: translateY(-2px); color: var(--primary); }
.family-card .xq-pieces-pair { transform: scale(.8); transform-origin: left center; }
.family-card img { width: 34px; height: 34px; }
