/* ===== 重置与基础 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --board-bg: #f4e4c1;
  --board-line: #8b4513;
  --red-piece: #c0392b;
  --black-piece: #1a1a1a;
  --gold: #f8d568;
  --primary: #8b4513;
  --primary-hover: #6b3410;
  --secondary: #5a6e7f;
  --secondary-hover: #445566;
  --bg: #faf6ee;
  --text: #2c1a0e;
  --text-light: #7a5c3c;
  --border: #d4b483;
  --shadow: rgba(0,0,0,0.15);
  --radius: 8px;
  --tab-active: #8b4513;
  --tab-bg: #f0e0c0;
  --header-h: 46px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'SimHei', sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: none;
  border-radius: var(--radius);
  transition: background 0.2s, transform 0.1s;
}
button:active {
  transform: scale(0.97);
}

select {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 5px 10px;
  cursor: pointer;
}

/* ===== 通栏顶部导航 ===== */
.site-header {
  width: 100%;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
  height: var(--header-h);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
}

.brand-link:hover {
  color: #fff;
  text-decoration: none;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo img {
  display: block;
}

.site-name {
  font-size: 17px;
  font-weight: bold;
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-right a {
  color: #f8d568;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid rgba(248,213,104,0.7);
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.2s;
}
.header-right a:hover {
  background: rgba(248,213,104,0.2);
  text-decoration: none;
}

/* ===== 整体容器 ===== */
.app-container {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 8px;
}

/* ===== 首屏区（棋盘+广告，撑满视口高度） ===== */
.game-screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--header-h));
  flex-shrink: 0;
}

/* ===== 第二屏区（信息面板+页脚，撑满视口高度） ===== */
.second-screen {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(139, 69, 19, 0.10);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 6px 0 8px;
}

/* ===== 主内容区 ===== */
.main-content {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 10px 0 6px;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

/* ===== 棋盘区 ===== */
.board-section {
  flex: 0 0 auto;
  width: 70%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 0;
}

.board-section h1 {
  font-size: 18px;
  color: var(--primary);
  text-align: center;
  font-weight: bold;
}

.board-subtitle {
  font-size: 14px;
  color: var(--text-light);
  text-align: center;
  font-weight: normal;
  margin-top: -2px;
  margin-bottom: 4px;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  /* 宽度取「最大上限」与「视口高度推算值」中较小者，确保棋盘高度不超出首屏 */
  max-width: min(600px, calc((100dvh - var(--header-h) - 100px) * 0.9));
}

#chessCanvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  box-shadow: 0 4px 16px var(--shadow);
  cursor: pointer;
  touch-action: none;
}

.board-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  padding: 4px 8px;
}

.turn-indicator {
  font-size: 15px;
  font-weight: bold;
  color: var(--primary);
  padding: 3px 12px;
  background: #fff7e6;
  border: 1px solid var(--border);
  border-radius: 20px;
}

.turn-indicator.black-turn {
  color: #222;
  background: #f0f0f0;
  border-color: #aaa;
}

.game-status {
  font-size: 14px;
  color: var(--text-light);
}

.game-status.check {
  color: #fff;
  background: #e74c3c;
  font-weight: bold;
  font-size: 15px;
  padding: 3px 14px;
  border-radius: 20px;
  animation: checkPulse 0.65s ease-in-out infinite alternate;
}

@keyframes checkPulse {
  from { transform: scale(1);    box-shadow: 0 0 0 0 rgba(231,76,60,0.6); }
  to   { transform: scale(1.07); box-shadow: 0 0 0 7px rgba(231,76,60,0); }
}

.canvas-wrapper.in-check #chessCanvas {
  animation: checkBorder 0.55s ease-in-out infinite alternate;
}

@keyframes checkBorder {
  from { box-shadow: 0 4px 16px var(--shadow); }
  to   { box-shadow: 0 0 0 4px #e74c3c, 0 4px 20px rgba(231,76,60,0.45); }
}

/* ===== 控制区 ===== */
.control-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* 玩家信息 */
.player-info {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.2s;
}

.player-row.active {
  background: #fff7e6;
}

.player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.red-dot { background: var(--red-piece); }
.black-dot { background: var(--black-piece); }

.player-label {
  flex: 1;
  font-size: 14px;
}

.player-timer {
  font-size: 14px;
  font-family: monospace;
  color: var(--text-light);
}

/* 控制组 */
.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.control-group label {
  font-size: 14px;
  color: var(--text-light);
  white-space: nowrap;
}

.btn-group {
  gap: 6px;
}

.btn {
  padding: 7px 14px;
  font-size: 14px;
  border-radius: var(--radius);
  font-weight: 500;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #f0e8d8;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #e8d8c0;
}

.btn-danger {
  background: #fdecea;
  color: #c0392b;
  border: 1px solid #e6b0aa;
}
.btn-danger:hover {
  background: #f8d7d3;
}
.btn-danger:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 棋谱 */
.move-history {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.move-history h3 {
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  flex-shrink: 0;
}

.move-history-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-top: 2px;
  padding-right: 2px;
}

.move-list-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.9;
  white-space: pre-wrap;
  font-family: 'PingFang SC','Microsoft YaHei',monospace;
}

.move-item {
  display: inline-block;
  width: 100%;
  line-height: 1.9;
  font-family: 'PingFang SC','Microsoft YaHei',monospace;
  font-size: 13px;
}

.move-red {
  color: #c0392b;
  font-weight: 500;
}

.move-black {
  color: #1a1a1a;
}

.empty-hint {
  font-size: 13px;
  color: #aaa;
  text-align: center;
  padding: 10px 0 2px;
}

/* AI 评语 */
.ai-comment {
  background: #fffbf0;
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  min-height: 40px;
  line-height: 1.6;
  display: none;
}

.ai-comment.visible {
  display: block;
}

@media (min-width: 768px) {
  .game-screen {
    height: calc(100dvh - var(--header-h));
  }

  /* 第二屏撑满视口 */
  .second-screen {
    height: calc(100dvh - var(--header-h));
  }

  .second-screen .content-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    overflow: hidden;
  }

  .second-screen .hero-cont {
    flex-shrink: 0;
  }

  .second-screen .info-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .second-screen .info-panel .bottom-tabs {
    flex-shrink: 0;
  }

  .second-screen .info-panel .tab-content.active {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .second-screen .site-footer {
    flex-shrink: 0;
    margin-top: 0;
  }

  body.focus-mode {
    overflow: hidden;
    background: var(--bg);
  }

  body.focus-mode .site-header,
  body.focus-mode .ad-placeholder,
  body.focus-mode .hero-cont,
  body.focus-mode .info-panel,
  body.focus-mode .site-footer,
  body.focus-mode .board-section h1,
  body.focus-mode .board-subtitle {
    display: none;
  }

  body.focus-mode .app-container {
    max-width: none;
    height: 100dvh;
    padding: 0;
  }

  body.focus-mode .game-screen {
    height: 100dvh;
    min-height: 100dvh;
    justify-content: center;
  }

  body.focus-mode .main-content {
    width: min(1280px, 100%);
    height: 100dvh;
    margin: 0 auto;
    padding: 18px 24px;
    gap: 18px;
    align-items: center;
  }

  body.focus-mode .board-section {
    width: auto;
    flex: 1 1 auto;
  }

  body.focus-mode .canvas-wrapper {
    max-width: min(760px, calc((100dvh - 116px) * 0.9));
  }

  body.focus-mode .control-section {
    flex: 0 0 300px;
    height: calc(100dvh - 36px);
    max-height: calc(100dvh - 36px);
    padding: 14px;
    border: 1px solid rgba(139,69,19,0.22);
    border-radius: 14px;
    background: rgba(255,250,238,0.94);
    box-shadow: 0 12px 36px rgba(0,0,0,0.16);
  }

  body.focus-mode .btn-group .btn {
    flex: 1 1 calc(50% - 6px);
  }

  body.focus-mode #focusModeBtn {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }

  body.focus-mode .move-history {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: none;
  }

  body.focus-mode .move-history-scroll {
    min-height: 0;
  }

  body.focus-mode .ai-comment {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    white-space: normal;
  }

  .ai-comment {
    display: block;
    min-height: 72px;
    visibility: hidden;
    opacity: 0;
  }

  .ai-comment.visible {
    visibility: visible;
    opacity: 1;
  }
}

/* ===== 温馨提示（广告位预留） ===== */
.ad-placeholder {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #fef9ee 0%, #fdf3d6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  margin: 6px 0;
  padding: 12px 16px;
  flex-shrink: 0;
}

.ad-placeholder span {
  font-size: 14px;
  color: #8b6914;
  text-align: center;
  line-height: 1.8;
}

/* 统一卡片容器：将 hero-cont 与 info-panel 融为一体 */
.content-card {
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  margin: 0;
}

.hero-cont {
  background: linear-gradient(135deg, #fffaf0 0%, #f6e1b8 100%);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.hero-cont h2 {
  font-size: 17px;
  color: var(--primary);
  margin-bottom: 8px;
}

.hero-cont p {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
}

/* ===== 面包屑导航 ===== */
.breadcrumb {
  padding: 8px 4px 2px;
  font-size: 13px;
  color: var(--text-light);
  flex-shrink: 0;
}

.breadcrumb a {
  color: var(--primary);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  margin: 0 6px;
  color: #bbb;
}

.breadcrumb-current {
  color: var(--text);
}

/* ===== 信息面板 ===== */
.info-panel {
  background: #fff;
  flex-shrink: 0;
}

/* Bottom Tabs */
.bottom-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--tab-bg);
  overflow-x: auto;
  scrollbar-width: none;
}

.bottom-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  font-size: 14px;
  text-decoration: none;
  background: transparent;
  color: var(--text-light);
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(139,69,19,0.08);
  color: var(--primary);
  text-decoration: none;
}

.tab-btn.active {
  color: var(--tab-active);
  font-weight: bold;
  border-bottom-color: var(--tab-active);
  background: #fff;
}

/* Tab 内容 */
.tab-content {
  display: none;
  padding: 18px 20px;
}

.tab-content.active {
  display: block;
}

/* 内容块 */
.content-block {
  margin-bottom: 20px;
}

.content-block:last-child {
  margin-bottom: 0;
}

.content-block p {
  font-size: 14px;
  line-height: 1.85;
  margin-bottom: 10px;
  color: var(--text);
}

.content-block p:last-child {
  margin-bottom: 0;
}

/* 文本列表 */
.text-list {
  padding-left: 18px;
  line-height: 1.85;
  font-size: 14px;
  color: var(--text);
}

.text-list li {
  margin-bottom: 6px;
}

.text-list li:last-child {
  margin-bottom: 0;
}

/* 示例步骤 */
.example-steps {
  padding-left: 22px;
  line-height: 2;
  font-size: 14px;
  color: var(--text);
  background: #fdf9f0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 18px 12px 36px;
  margin: 8px 0;
}

.example-steps li {
  margin-bottom: 3px;
}

/* 棋子卡片网格 */
.piece-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.piece-card {
  background: #fdf9f0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.piece-card h4 {
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 6px;
  font-weight: bold;
}

.piece-card p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  margin: 0;
}

/* 信息面板标题 */
.info-panel h2 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.info-panel h3 {
  font-size: 15px;
  color: var(--primary);
  margin-bottom: 8px;
}

/* FAQ */
.faq-list {
  font-size: 14px;
  line-height: 1.8;
}

.faq-list dt {
  font-weight: bold;
  color: var(--primary);
  margin-top: 14px;
  margin-bottom: 4px;
}

.faq-list dt:first-child {
  margin-top: 0;
}

.faq-list dd {
  margin-left: 0;
  color: var(--text);
  margin-bottom: 6px;
}

/* 保留旧的规则列表兼容 */
.rule-list {
  padding-left: 16px;
  line-height: 2;
  font-size: 14px;
}

.rule-list li {
  margin-bottom: 4px;
}

.tab-content p {
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 8px;
  color: var(--text);
}

/* ===== 页脚 ===== */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.85);
  text-align: center;
  padding: 14px 16px;
  font-size: 13px;
  border-radius: 0;
  line-height: 2;
  flex-shrink: 0;
  margin-top: auto;
}

.footer-main {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 2px;
}

.footer-links a {
  color: inherit;
  margin: 0 8px;
  font-size: 13px;
}

.footer-links a:hover {
  color: inherit;
}

.footer-copy {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

/* ===== 弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 10px;
}

.modal-result {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
}

.modal-comment {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 18px;
  line-height: 1.6;
}

.modal-box .btn {
  margin: 4px 6px;
}
/* ===== AI 思考指示 ===== */
.thinking-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-light);
  justify-content: center;
  padding: 4px 0;
}

.thinking-indicator.visible {
  display: flex;
}

.dot-anim span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  margin: 0 2px;
  animation: bounce 1.2s infinite;
}
.dot-anim span:nth-child(2) { animation-delay: 0.2s; }
.dot-anim span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ===== 滚动条美化 ===== */
.move-history-scroll::-webkit-scrollbar,
.second-screen .tab-content::-webkit-scrollbar {
  width: 4px;
}
.move-history-scroll::-webkit-scrollbar-thumb,
.second-screen .tab-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ===== 响应式 移动端 ===== */
@media (max-width: 767px) {
  .app-container {
    padding: 0 4px;
  }

  .game-screen {
    min-height: calc(100dvh - var(--header-h));
  }

  .main-content {
    flex-direction: column;
    gap: 8px;
    padding: 6px 0;
  }

  .board-section {
    width: 100%;
  }

  .board-section h1 {
    font-size: 16px;
  }

  .board-subtitle {
    font-size: 13px;
  }

  .canvas-wrapper {
    max-width: 100% !important;
  }

  /* 单DOM控制区：移动端紧凑两行布局 */
  .control-section {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    overflow-y: visible;
    padding: 0 0 4px;
  }

  /* 隐藏移动端不需要的块（棋谱、玩家计时器） */
  .control-section .player-info,
  .control-section .move-history {
    display: none;
  }

  /* 难度 / 执子 各占半行，标签与下拉框保持在同一列内 */
  .control-section .control-group:not(.btn-group) {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .control-section .control-group:not(.btn-group) label {
    line-height: 1.3;
  }

  .control-section .control-group:not(.btn-group) select {
    width: 100%;
    min-width: 0;
    height: 34px;
  }

  /* 专注模式按钮在移动端隐藏 */
  #focusModeBtn {
    display: none;
  }

  /* 按钮组改为横向滑动 */
  .control-section .btn-group {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    padding-bottom: 2px;
  }

  .control-section .btn-group::-webkit-scrollbar {
    display: none;
  }

  .control-section .btn-group .btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* 画布高度需为控制区留出空间 */
  .canvas-wrapper {
    max-width: min(100%, calc((100dvh - var(--header-h) - 200px) * 0.9)) !important;
  }

  /* 移动端温馨提示 */
  .ad-placeholder {
    padding: 10px 12px;
  }
  .ad-placeholder span {
    font-size: 13px;
  }

  .content-card {
    margin: 0;
  }

  .hero-cont {
    padding: 12px 14px;
  }

  .hero-cont h2 {
    font-size: 15px;
  }

  .hero-cont p {
    font-size: 13px;
    line-height: 1.75;
  }

  .header-inner {
    padding: 0 10px;
  }

  .site-name {
    font-size: 15px;
  }

  .header-right {
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 1;
    min-width: 0;
  }

  .header-right::-webkit-scrollbar {
    display: none;
  }

  .header-right a {
    font-size: 12px;
    padding: 3px 7px;
    flex-shrink: 0;
  }

  .tab-btn {
    font-size: 12px;
    padding: 9px 3px;
    white-space: nowrap;
  }

  .tab-content {
    padding: 14px 12px;
  }

  .board-info {
    gap: 10px;
  }

  .turn-indicator {
    font-size: 14px;
    padding: 2px 10px;
  }

  .modal-box {
    padding: 20px 18px;
  }

  .modal-title {
    font-size: 18px;
  }
}

/* ===== 极小屏适配 ===== */
@media (max-width: 380px) {
  .site-name {
    font-size: 14px;
  }

  .header-right a:first-child {
    display: none;
  }

  .tab-btn {
    font-size: 11px;
    padding: 8px 2px;
  }
}

/* ===== 打印 ===== */
@media print {
  .site-header, .control-section, .ad-placeholder,
  .bottom-tabs, .mobile-controls, .site-footer {
    display: none !important;
  }
}

/* ===== 复盘回放 ===== */
.move-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.move-history-header h3 {
  margin: 0;
}

.btn-icon {
  background: none;
  border: 1px solid #c8a06e;
  border-radius: 6px;
  color: #8b4513;
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: #f4dea8;
  color: #5a2d0c;
}

.replay-bar {
  background: #fdf6e3;
  border: 1px solid #e0c080;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.replay-bar[hidden] {
  display: none;
}

.replay-seek {
  display: flex;
  align-items: center;
}

.replay-seek input[type="range"] {
  flex: 1;
  width: 100%;
  accent-color: #8b4513;
  height: 4px;
  cursor: pointer;
}

.replay-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.replay-btn {
  background: #fff8ee;
  border: 1px solid #c8a06e;
  border-radius: 6px;
  color: #8b4513;
  font-size: 18px;
  line-height: 1;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.replay-btn:hover {
  background: #f4dea8;
}

.replay-btn.replay-play {
  font-size: 14px;
  width: 38px;
}

.replay-progress {
  font-size: 13px;
  color: #8b4513;
  margin-left: 4px;
  white-space: nowrap;
}

.replay-speed {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8b6030;
}

.replay-speed input[type="range"] {
  flex: 1;
  accent-color: #8b4513;
  height: 4px;
  cursor: pointer;
}

.replay-exit {
  font-size: 12px;
  padding: 5px 10px;
  align-self: flex-start;
}

.move-item.replay-current {
  background: rgba(255, 160, 0, 0.22);
  border-radius: 3px;
  font-weight: bold;
}

.canvas-wrapper.board-replaying::after {
  content: '复盘中';
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(139, 69, 19, 0.82);
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}
