/* assets/css/base.css —— 设计变量、重置、字体、通用按钮/标签/提示/浮层 */

:root {
  /* 底色与文字 */
  --bg: #f4f0e6;
  --surface: #fffdf7;
  --surface-2: #f9f4e9;
  --header-bg: rgba(255, 253, 247, 0.95);
  --ink: #26231f;
  --ink-soft: #4b453d;
  --muted: #756d60;
  --line: #e0d6c4;
  --line-strong: #cbbfa9;

  /* 主色与状态色 */
  --accent: #2f6f4f;
  --accent-strong: #23543b;
  --accent-soft: #e3efe6;
  --accent-bright: #3c845f;
  --accent-ring: rgba(47, 111, 79, 0.28);
  --accent-ring-soft: rgba(47, 111, 79, 0.14);
  --on-accent: #ffffff;
  --danger: #a83a3a;
  --danger-soft: #f7e5e5;
  --danger-line: #e0b4b4;
  --warn: #9c6a15;
  --warn-soft: #fbf0d8;
  --warn-strong: #8a5d12;
  --warn-ink: #6b4a10;
  --warn-dot: #d9a13a;
  --warn-dot-border: #c08b26;

  /* 提示条三级配色 */
  --hint1-line: #4a8a6a;
  --hint1-bg: #eef5ef;
  --hint2-bg: #e7f1ea;
  --hint3-bg: #fdf3df;

  /* 棋子与棋盘 */
  --wood: #e6bd8b;
  --board-grid: #6a4c27;
  --board-star: #53381b;
  --board-coord: rgba(74, 52, 26, 0.6);
  --board-last: #d2472a;
  --board-hint-fill: rgba(47, 111, 79, 0.16);
  --board-hint-fill-strong: rgba(47, 111, 79, 0.22);
  --board-hint-line: #23663f;
  --board-wrong-fill: rgba(168, 58, 58, 0.32);
  --board-shadow: 0 10px 26px rgba(92, 68, 34, 0.22), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  --stone-black: #1d1d1d;
  --stone-black-ink: #f3efe2;
  --stone-white: #fcfbf6;
  --stone-white-ink: #25221e;
  --stone-white-line: #b7ae9d;

  /* 浮层与阴影 */
  --overlay-bg: rgba(30, 26, 20, 0.55);
  --toast-bg: rgba(38, 35, 31, 0.94);
  --toast-success: #245c40;
  --toast-warn: #8a5d12;
  --toast-error: #8f2f2f;
  --fatal-line: #e5c2c2;
  --fatal-ink: #6d2626;
  --brand-mark-light: #4c4c4c;
  --brand-mark-dark: #101010;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(60, 48, 30, 0.08);
  --shadow-hover: 0 8px 18px rgba(60, 48, 30, 0.12);
  --shadow-lg: 0 18px 44px rgba(38, 30, 18, 0.24);
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  /* 触摸设备：去掉系统点击高亮，保留组件自身的 :active 反馈 */
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
button, input { font-family: inherit; font-size: inherit; color: inherit; }
.btn, .chip, .site-nav__link, .link-back { touch-action: manipulation; }

.noscript { padding: 24px; text-align: center; color: var(--danger); }

.file-warning {
  padding: 12px 16px;
  background: var(--warn-soft);
  border-bottom: 1px solid var(--warn-soft);
  color: var(--warn-ink);
  font-size: 13px;
  line-height: 1.7;
}
.file-warning code {
  padding: 1px 5px;
  background: var(--accent-ring-soft);
  border-radius: 4px;
  font-size: 12px;
}

/* —— 按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
  text-align: center;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 2px; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.btn--sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }

/* —— 标签 —— */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag--ghost { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
.tag--done { background: var(--accent-soft); color: var(--accent-strong); }

/* —— 轻提示 —— */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--toast-bg);
  color: var(--on-accent);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease-out;
}
.toast--success { background: var(--toast-success); }
.toast--warn { background: var(--toast-warn); }
.toast--error { background: var(--toast-error); }
.toast--leave { opacity: 0; transform: translateY(6px); transition: opacity 0.24s, transform 0.24s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— 结算浮层 —— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--overlay-bg);
}
.overlay[hidden] { display: none; }
.overlay__card {
  width: min(420px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 22px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: card-in 0.2s ease-out;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.overlay__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.overlay__title { font-size: 20px; font-weight: 700; }
.overlay__subtitle { margin-top: 6px; color: var(--muted); font-size: 13.5px; }
.overlay__stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  margin: 18px 0;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 14px;
}
.overlay__stats dt { color: var(--muted); }
.overlay__stats dd { font-weight: 600; text-align: right; }
.overlay__actions { display: flex; flex-direction: column; gap: 8px; }
.overlay__actions .btn { width: 100%; }

/* —— 异常页 —— */
.view--fatal { max-width: 720px; }
.fatal-list {
  margin: 14px 0;
  padding: 14px 14px 14px 30px;
  background: var(--danger-soft);
  border: 1px solid var(--fatal-line);
  border-radius: 10px;
  color: var(--fatal-ink);
  font-size: 13.5px;
  line-height: 1.8;
}

/* 仅触摸设备（手机/平板）：热区不小于 44px，避免手指误触。
   必须放在文件末尾——同优先级的 .btn 基础规则在后面出现会覆盖它。 */
@media (pointer: coarse) {
  .btn { min-height: 46px; padding: 10px 18px; }
  .btn--sm { min-height: 40px; padding: 8px 14px; }
  .chip { min-height: 40px; padding: 8px 14px; }
  .search__input { min-height: 46px; }
  .move-table td { padding-top: 11px; padding-bottom: 11px; }
  .move-table tbody tr.move-table__row { min-height: 44px; }
}
