/* ==========================================================================
   base.css — 重置、字体栈、全局排版与触摸基线
   规范依据：设计方案 3.5 触摸通用规则、7.3 字体、7.5 间距
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 禁用浏览器原生长按菜单 / 文本选择带来的干扰，避免孩子长按弹出系统菜单 */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  /* 避免双指缩放把界面搞乱；棋盘尺寸由适配逻辑决定 */
  touch-action: manipulation;
}

input,
select {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

/* ---- 可访问性：仅屏幕阅读器可见 ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- 触摸反馈基线：任何触摸在 100ms 内产生按下态 ---- */
.pressable {
  transition: transform var(--dur-press) var(--ease-out),
              box-shadow var(--dur-press) var(--ease-out),
              background-color var(--dur-press) var(--ease-out);
}

.pressable:active {
  transform: scale(.98);
}

/* 焦点可见性（键盘用户） */
:focus-visible {
  outline: 3px solid var(--hint-move);
  outline-offset: 2px;
}

/* ---- 动效降级 ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
