/* ========== 菊花泉·弈 — 仙侠主题 ========== */
:root {
  --paper: #F5F0E1;       /* 宣纸 */
  --paper-2: #EDE5D2;
  --ink: #3A3128;         /* 浓墨 */
  --ink-light: #6f6353;
  --gold: #B8860B;        /* 菊金 */
  --gold-soft: #c8a951;
  --cinnabar: #8B3A2B;    /* 朱砂 */
  --jade: #4A7C59;        /* 翠玉 */
  --wood: #D4A574;
  --wood-dark: #B8860B;
  --shadow: rgba(58, 49, 40, 0.18);
  --maxw: 1080px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Noto Serif SC", "Songti SC", "STSong", serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cinnabar); text-decoration: none; }
img { max-width: 100%; }

/* ========== 通用布局 ========== */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }
.page { padding: 28px 0 80px; min-height: 70vh; }
.card {
  background: #fff;
  border: 1px solid rgba(184, 134, 11, 0.25);
  border-radius: 14px;
  box-shadow: 0 8px 26px var(--shadow);
  padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; border-radius: 24px;
  padding: 10px 22px; font-size: 15px; font-family: inherit;
  background: var(--gold); color: #fff; transition: .18s;
  box-shadow: 0 4px 12px rgba(184,134,11,.3);
}
.btn:hover { background: #a5780a; transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink-light); box-shadow: none; }
.btn.jade { background: var(--jade); box-shadow: 0 4px 12px rgba(74,124,89,.3); }
.btn.cinnabar { background: var(--cinnabar); box-shadow: 0 4px 12px rgba(139,58,43,.3); }
.btn.sm { padding: 6px 14px; font-size: 13px; }

.title-x { font-size: 26px; letter-spacing: 4px; color: var(--ink); margin: 0 0 4px; }
.subtitle-x { color: var(--ink-light); font-size: 14px; letter-spacing: 1px; margin: 0 0 18px; }
.divider {
  height: 1px; background: linear-gradient(90deg, transparent, var(--gold-soft), transparent);
  margin: 14px 0;
}

/* ========== 顶栏 ========== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: rgba(245, 240, 225, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(184,134,11,.25);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand .seal {
  width: 34px; height: 34px; border-radius: 8px;
  background: radial-gradient(circle at 35% 30%, var(--gold-soft), var(--gold));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; box-shadow: 0 3px 8px rgba(184,134,11,.4);
}
.brand .name { font-size: 19px; letter-spacing: 3px; color: var(--ink); font-weight: 600; }
.nav-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav-links a {
  padding: 6px 12px; border-radius: 20px; color: var(--ink-light); font-size: 14px;
  cursor: pointer; transition: .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: rgba(184,134,11,.14); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.user-pill {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px;
  background: rgba(74,124,89,.12); border-radius: 20px; font-size: 13px; color: var(--jade);
}
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--jade); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}

/* ========== 首页 hero ========== */
.hero {
  position: relative; width: 100%; height: 100vh; min-height: 560px;
  overflow: hidden; background: linear-gradient(180deg, #f3e3c0 0%, #e9d3a6 36%, #cfe0c4 72%, #b9d3b6 100%);
}
.hero svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero .hero-copy {
  position: absolute; left: 0; right: 0; bottom: 16%;
  text-align: center; z-index: 5; pointer-events: none;
}
.hero .hero-title {
  font-size: 44px; letter-spacing: 12px; color: var(--ink);
  text-shadow: 0 2px 10px rgba(245,240,225,.8);
}
.hero .hero-poem {
  margin-top: 10px; font-size: 17px; letter-spacing: 3px; color: var(--ink-light);
}
.gate {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 6; cursor: pointer; text-align: center;
  transition: transform .25s;
}
.gate:hover { transform: translate(-50%, -50%) scale(1.04); }
.gate .gate-label {
  margin-top: 10px; font-size: 16px; letter-spacing: 4px; color: var(--ink);
  background: rgba(245,240,225,.7); padding: 4px 14px; border-radius: 16px; display: inline-block;
}
.gate .gate-hint { font-size: 12px; color: var(--ink-light); margin-top: 6px; }

/* 落瓣飘落 */
.petal {
  position: absolute; top: -20px; z-index: 7; pointer-events: none;
  width: 12px; height: 12px; background: var(--gold-soft);
  border-radius: 60% 0 60% 0; opacity: .8;
  animation: fall linear infinite;
}
@keyframes fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  10% { opacity: .85; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: .1; }
}

.scroll-cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 6; color: var(--ink-light); font-size: 12px; letter-spacing: 2px; text-align: center;
}
.scroll-cue .arrow { display: block; margin: 6px auto 0; width: 14px; height: 14px;
  border-right: 2px solid var(--ink-light); border-bottom: 2px solid var(--ink-light);
  transform: rotate(45deg); animation: bob 1.6s infinite; }
@keyframes bob { 0%,100%{ transform: rotate(45deg) translate(0,0);} 50%{ transform: rotate(45deg) translate(4px,4px);} }

/* ========== 内容枢纽 ========== */
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 8px; }
.hub-card {
  position: relative; cursor: pointer; border-radius: 16px; overflow: hidden;
  min-height: 200px; padding: 22px; color: #fff;
  box-shadow: 0 10px 28px var(--shadow); transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.hub-card:hover { transform: translateY(-4px); box-shadow: 0 16px 36px var(--shadow); }
.hub-card .hub-icon { font-size: 40px; margin-bottom: 8px; }
.hub-card h3 { margin: 0 0 4px; font-size: 22px; letter-spacing: 3px; }
.hub-card p { margin: 0; font-size: 13px; opacity: .9; }
.hub-card.locked { filter: grayscale(.5) brightness(.92); }
.hub-card .lock-badge {
  position: absolute; top: 14px; right: 14px; background: rgba(0,0,0,.35);
  padding: 3px 10px; border-radius: 12px; font-size: 12px;
}
.hub-articles { background: linear-gradient(135deg, #8B3A2B, #b9553f); }
.hub-kifu { background: linear-gradient(135deg, #4A7C59, #6ba07d); }
.hub-tower { background: linear-gradient(135deg, #B8860B, #d8a93a); }

/* ========== 列表 / 卡片 ========== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.list-item {
  display: block; background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(184,134,11,.2); box-shadow: 0 6px 18px var(--shadow);
  cursor: pointer; transition: .18s;
}
.list-item:hover { transform: translateY(-3px); box-shadow: 0 12px 26px var(--shadow); }
.list-item.locked { opacity: .6; cursor: not-allowed; }
.list-item.locked:hover { transform: none; box-shadow: 0 6px 16px var(--shadow); }

/* ========== 棋盘配色选择器（会员页） ========== */
.theme-swatches { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 14px; }
.theme-swatch { width: 76px; cursor: pointer; text-align: center; transition: .15s; }
.theme-swatch .sw-inner {
  height: 46px; border-radius: 8px; border: 2px solid transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.theme-swatch .sw-name { font-size: 12px; margin-top: 5px; color: var(--ink-light); }
.theme-swatch.active .sw-inner { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,134,11,.35); }
.theme-swatch.active .sw-name { color: var(--gold); font-weight: 600; }
.theme-preview { display: flex; justify-content: center; }
.theme-preview .board-stage { width: 240px; max-width: 100%; }
.list-item .cover {
  height: 130px; background: linear-gradient(135deg, var(--paper-2), var(--gold-soft));
  display: flex; align-items: center; justify-content: center; font-size: 30px; color: #fff;
}
.list-item .body { padding: 12px 14px; }
.list-item .body h4 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.list-item .body .meta { font-size: 12px; color: var(--ink-light); }
.tag {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px;
  background: rgba(184,134,11,.15); color: var(--gold); margin-right: 4px;
}

/* 棋盘样式切换条：挂在每个棋盘下方，就地点击切换、全站同步 */
.board-theme-picker {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0 4px; padding: 8px 12px;
  background: rgba(245,240,225,.55); border: 1px solid rgba(184,134,11,.2);
  border-radius: 10px;
}
.btp-label { font-size: 12px; color: var(--ink-light); white-space: nowrap; letter-spacing: 1px; }
.btp-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.btp-swatch {
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer; padding: 0;
  border: 2px solid transparent; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: .15s;
}
.btp-swatch:hover { transform: translateY(-1px); }
.btp-swatch.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(184,134,11,.4); }
.tag.jade { background: rgba(74,124,89,.15); color: var(--jade); }
.tag.cinnabar { background: rgba(139,58,43,.15); color: var(--cinnabar); }
.tag.gold { background: rgba(184,134,11,.15); color: var(--gold); }
.tag.ghost { background: rgba(154,141,122,.15); color: var(--ink-light); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select {
  font-family: inherit; font-size: 14px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid rgba(184,134,11,.35); background: #fff; color: var(--ink);
}
.toolbar input[type=text], .toolbar input[type=search] { min-width: 200px; }

/* ========== 文章详情 ========== */
.article-detail { max-width: 760px; margin: 0 auto; }
.article-detail h1 { font-size: 28px; letter-spacing: 2px; }
.article-detail .content { font-size: 16px; color: #2f281f; }
.article-detail .content img { border-radius: 10px; margin: 10px 0; }
.back-link { color: var(--ink-light); cursor: pointer; font-size: 14px; }

/* ========== 棋谱播放器 ========== */
.player-wrap { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.player-main { flex: 1 1 360px; max-width: 520px; }
.board-stage {
  background: var(--board-stage-bg, linear-gradient(135deg, #F2E4C4 0%, #E7D2A6 100%));
  border-radius: 12px; padding: 8px; box-shadow: inset 0 2px 10px rgba(0,0,0,.12);
  overflow: hidden;
}
.board-stage canvas { display: block; width: 100%; height: auto; border-radius: 0; }
.player-side { flex: 1 1 260px; min-width: 240px; }
.move-controls { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.move-dot { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; max-height: 120px; overflow: auto; }
.move-dot span {
  width: 26px; height: 26px; border-radius: 6px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid rgba(184,134,11,.3); color: var(--ink);
}
.move-dot span.active { background: var(--gold); color: #fff; }
.move-dot span.black::after { content: '●'; }
.move-dot span.white::after { content: '○'; }

/* ========== 试炼塔 ========== */
.limit-bar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  background: rgba(74,124,89,.1); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px;
}
.limit-item { display: flex; flex-direction: column; }
.limit-item .lv { font-size: 12px; color: var(--ink-light); }
.limit-item .lval { font-size: 18px; color: var(--jade); font-weight: 600; }
.limit-level { margin-left: auto; font-size: 14px; color: var(--gold); }

.paper-card { cursor: pointer; }
.paper-card .mode-badge {
  display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 12px; margin-right: 6px;
}
.mode-formal { background: rgba(184,134,11,.18); color: var(--gold); }
.mode-practice { background: rgba(74,124,89,.18); color: var(--jade); }
.paper-card.locked { opacity: .65; }
.lb-badge { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: rgba(139,58,43,.15); color: var(--cinnabar); }
.lb-view-btn {
  margin-top: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(184,134,11,.12);
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.lb-view-btn:hover { background: var(--gold); color: #fff; }
.lb-mask {
  position: fixed; inset: 0;
  background: rgba(58,49,40,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 18px;
}
.lb-modal {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(184,134,11,.3);
  box-shadow: 0 12px 40px var(--shadow);
  width: 100%; max-width: 420px;
  max-height: 80vh; overflow-y: auto;
  padding: 18px;
}
.lb-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lb-modal-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.lb-close { font-size: 22px; color: var(--ink-light); cursor: pointer; line-height: 1; }
.lb-close:hover { color: var(--cinnabar); }
.lb-list .answer-line.lb-me { background: rgba(184,134,11,.10); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.lb-name { flex: 1; }

.quiz-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.q-meta { font-size: 13px; color: var(--ink-light); }
.q-text { font-size: 16px; margin: 6px 0 10px; }
.selected-dot { font-size: 13px; color: var(--jade); margin-bottom: 8px; }

.result-box { text-align: center; }
.result-score { font-size: 52px; color: var(--gold); font-weight: 700; }
.answer-line { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(184,134,11,.25); }
.answer-line .ok { color: var(--jade); font-weight: 600; }
.answer-line .no { color: var(--cinnabar); font-weight: 600; }

/* ========== 会员 / 表单 ========== */
.auth-box { max-width: 380px; margin: 40px auto; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--ink-light); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; font-family: inherit; font-size: 15px; padding: 11px 14px;
  border-radius: 10px; border: 1px solid rgba(184,134,11,.35); background: #fff; color: var(--ink);
}
.form-row textarea { resize: vertical; min-height: 90px; }
.err-msg { color: var(--cinnabar); font-size: 13px; margin: 6px 0; }
.ok-msg { color: var(--jade); font-size: 13px; margin: 6px 0; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-head .avatar-lg { width: 56px; height: 56px; border-radius: 50%; background: var(--jade); color:#fff; display:flex; align-items:center; justify-content:center; font-size: 24px; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid rgba(184,134,11,.25); margin-bottom: 16px; }
.tabs span { padding: 8px 14px; cursor: pointer; color: var(--ink-light); border-bottom: 2px solid transparent; }
.tabs span.active { color: var(--ink); border-bottom-color: var(--gold); }

.feedback-list .fb {
  background: #fff; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid rgba(184,134,11,.2);
}
.feedback-list .fb .fb-meta { font-size: 12px; color: var(--ink-light); margin-top: 6px; }
.status-pill { font-size: 11px; padding: 1px 8px; border-radius: 10px; }
.status-open { background: rgba(184,134,11,.18); color: var(--gold); }
.status-resolved { background: rgba(74,124,89,.18); color: var(--jade); }

/* ========== 页脚 ========== */
.footer {
  padding: 26px 18px; text-align: center; color: var(--ink-light); font-size: 13px;
  border-top: 1px solid rgba(184,134,11,.2); background: var(--paper-2);
}
.footer .seal-mini { color: var(--gold); letter-spacing: 3px; }

.center { text-align: center; }
.muted { color: var(--ink-light); }
.loading { text-align: center; padding: 40px; color: var(--ink-light); }
.empty { text-align: center; padding: 40px; color: var(--ink-light); }

/* ========== 响应式 ========== */
@media (max-width: 720px) {
  .hero .hero-title { font-size: 32px; letter-spacing: 8px; }
  .hub-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .title-x { font-size: 22px; }

  /* 棋盘移动端满屏出血：外框贴手机屏幕左右边缘，两侧不留白 */
  .board-stage {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }
  /* 切换器保留少量内边距，避免贴边 */
  .board-stage .board-theme-picker { margin: 8px; }
}

/* ========== 排行榜总览（试炼塔） ========== */
.ranks-board-row {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: stretch;
}
.rank-col {
  flex: 0 0 300px; width: 300px; min-width: 300px;
  background: #fff; border: 1px solid rgba(184,134,11,.22); border-radius: 12px;
  display: flex; flex-direction: column; max-height: 72vh; overflow: hidden;
}
.rank-col.placeholder {
  flex: 0 0 220px; width: 220px; min-width: 220px;
  border: 2px dashed rgba(184,134,11,.35); background: rgba(184,134,11,.04);
  align-items: center; justify-content: center; color: var(--ink-light);
}
.ph-text { text-align: center; line-height: 1.8; letter-spacing: 1px; }
.rank-col-head {
  padding: 12px 14px; border-bottom: 1px solid rgba(184,134,11,.18);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rank-col-kind { font-size: 11px; color: var(--ink-light); background: rgba(184,134,11,.12); padding: 1px 7px; border-radius: 8px; }
.rank-col-name { font-size: 15px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; }
.period-tabs { display: flex; gap: 6px; padding: 8px 12px 0; }
.period-tabs span {
  font-size: 12px; padding: 4px 10px; border-radius: 8px; cursor: pointer;
  color: var(--ink-light); background: rgba(184,134,11,.08); border: 1px solid transparent;
}
.period-tabs span.active { color: #fff; background: var(--gold); border-color: var(--gold); }
.rank-list { padding: 6px 12px 12px; overflow-y: auto; flex: 1; }
.rank-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 6px;
  border-bottom: 1px dashed rgba(184,134,11,.2); font-size: 14px;
}
.rank-row .rk { width: 34px; color: var(--ink-light); font-variant-numeric: tabular-nums; }
.rank-row .rn { flex: 1; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .rs { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-row .rt { width: 60px; flex: none; text-align: right; color: var(--ink-light); font-size: 12px; font-variant-numeric: tabular-nums; }
.rank-row.lb-me { background: rgba(184,134,11,.10); border-radius: 8px; }
.rank-row.my-rank { background: rgba(74,124,89,.10); border-bottom: none; border-radius: 8px; margin-top: 4px; }
.rank-row.my-rank .rn { color: var(--jade); font-weight: 600; }
.pad { padding: 14px 6px; }
.lb-me-line {
  margin: 8px 12px; padding: 8px 10px; border-radius: 8px;
  background: rgba(74,124,89,.10); color: var(--jade); font-size: 13px; text-align: center;
}

/* ========== 对弈AI 页 ========== */
.tab-chip {
  display: inline-block; padding: 4px 13px; border-radius: 16px; cursor: pointer;
  font-size: 13px; color: var(--ink-light);
  background: rgba(184,134,11,.08); border: 1px solid transparent; user-select: none;
}
.tab-chip:hover { color: var(--ink); }
.tab-chip.on { color: #fff; background: var(--gold); border-color: var(--gold); }
.tab-chip[disabled], .tab-chip.on { cursor: default; }
.thinking { color: var(--gold); }
.ai-result { font-weight: 600; color: var(--jade); }
