/**
 * 基础样式与共用原件。
 *
 * 设计稿 2a/2b 是「去框」风格：只用留白和发丝线分区，没有一个卡片边框。
 * 因此这里刻意不提供 .card 之类的容器样式。
 */

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

html, body { height: 100%; }

/* 移动端点按不要泛蓝高亮。默认值在 Android Chrome 上是半透明蓝，
   在快速连点（落子、快捷短语）时会连续闪烁，非常干扰。 */
* { -webkit-tap-highlight-color: transparent; }

/* 选区用品牌色而非系统蓝。只影响真正可选中的文本（聊天、棋谱）， */
::selection { background: var(--accent-tint); color: var(--text); }

/* HTML 的 hidden 属性靠 UA 样式 [hidden]{display:none} 生效，优先级最低，
   任何一条 .cls{display:flex} 都能盖掉它。本项目多处用 el(..., {hidden:true})
   控制显隐（请求横幅、未读角标等），统一在这里兜底。
   —— 曾因此在手机端棋盘上方留下一个空的灰色方块。 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  /* 按钮文字不该被选中：移动端连点会把标签选中并高亮 */
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;      /* 连点按钮不触发双击缩放 */
}
button:disabled { cursor: not-allowed; opacity: .45; }

input {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* —— 发丝线：去框风格唯一的分隔手段 —— */
.hr { height: 1px; background: var(--hairline); border: 0; margin: 0; }
.vr { width: 1px; align-self: stretch; background: var(--hairline-strong); }

/* —— 按钮 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 500;
  transition: background-color .15s, color .15s, opacity .15s;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
/* 用亮度而非换色做 hover：换成 --accent-deep 时，夜墨主题下它与
   --on-accent 恰好同为 #14241E，文字会完全隐形。滤镜对所有主题
   与 5 种主色都安全，且不可能产生前后景同色。 */
.btn--primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn--primary:active:not(:disabled) { filter: brightness(.94); }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.btn--danger { color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: var(--surface); }
.btn--sm { padding: 5px 12px; font-size: 12.5px; border-radius: 6px; }

/* —— 头像：设计稿用渐变圆 + 昵称首字 —— */
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--avatar-grad);
  color: var(--on-accent);
  font: 600 12px/1 var(--font-serif);
  user-select: none;
}
.avatar--lg { width: 36px; height: 36px; font-size: 15px; }

/* —— 单色标签 —— */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-2);
  font: 500 11px/1.6 var(--font-mono);
}
.chip--accent { background: var(--accent-tint); color: var(--accent); }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* —— 屏幕阅读器专用 —— */
.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;
}

/* —— 弹窗 —— */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(20, 16, 12, .5);
  backdrop-filter: blur(2px);
}
.modal {
  width: min(420px, 100%);
  padding: 26px 28px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 24px 60px -20px rgba(15, 42, 63, .45);
}
.modal h2 { margin: 0 0 8px; font: 700 17px/1.3 var(--font-sans); }
.modal p { margin: 0 0 20px; color: var(--text-2); font-size: 13px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
