/* base.css：底子：字体、全局变量、根字号（尺寸都是 rem，跟着窗口变）、[hidden]、整窗那张卡片和氛围层。
   这些文件按 index.html 里的顺序叠（后面的盖前面的），顺序别换；分区注释以「── 名字 ──」开头，先 Grep "── " 拿目录再分段读。
   风格（色板、氛围、棋盘和子）在 theme.css、go-theme.css、xiangqi-theme.css，排在这些后面。 */

@font-face {
  font-family: "BG XiaoWei";
  src: url("../fonts/xiaowei.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "BG Serif";
  src: url("../fonts/serif.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "BG Cormorant";
  src: url("../fonts/cormorant.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "BG Brush";
  src: url("../fonts/mashan.woff2") format("woff2");
  font-display: swap;
}
/* 终局大字（web/feel-end.js）：智莽行，只切了「胜负和认输」 */
@font-face {
  font-family: "BG Big";
  src: url("../fonts/brush-big.woff2") format("woff2");
  font-display: block;
}

/* 颜色、氛围、棋盘和子的样子都在 theme.css（换风格只换那一个文件）；这里只管版式和动效。
   theme.css 要给的变量见它开头的说明。 */

:root {
  --font-scene: "BG Cormorant", "BG XiaoWei", "BG Serif", "Songti SC", "STSong", "SimSun", serif;
  /* 宋体：界面上的字、旧话、长讲解 */
  --font-song: "BG Serif", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-small: var(--font-song);
  /* 书法：只给她最新那一句、短的斗嘴、印章、小笺 */
  --font-brush: "BG Brush", "STKaiti", "KaiTi", serif;
  /* 坐标、数字：正常字体（书法里的 G7、J9 会变形；Cormorant 的旧式数字「1」像「I」） */
  --font-num: "BG Serif", "Noto Serif SC", Georgia, serif;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* 字号和窗口（docs/board-games-ui.md「字号和窗口」）：这个文件里的尺寸都是 rem，1rem 是「一个单位」——
   窗口 1080 × 720（默认）时约 12px，往小拖跟着小，到 865 × 620 左右停在 10px（写死的那一套，窄窗口也是它），
   往大拖跟着大（到 17px 为止；大屏幕上放大、拉大以后字不再跟着大）。宽、高谁先不够照谁算（1.1556vw = 宽 900 时 10.4px；1.6774vh = 高 620 时 10.4px）。
   设置「棋盘 ▸ 字号」小 · 中 · 大 再乘 0.9 · 1 · 1.12（main.js 在 <html> 上挂 data-text）。棋盘、子、坐标是画布按盘的大小画的，跟着棋盘走。 */
html {
  --text-k: 1;
  font-size: clamp(calc(10px * var(--text-k)), calc(min(1.1556vw, 1.6774vh) * var(--text-k)), calc(17px * var(--text-k)));
}
html[data-text="s"] {
  --text-k: 0.9;
}
html[data-text="l"] {
  --text-k: 1.12;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: transparent;
}
body {
  font: 1.3rem/1.5 var(--font-song);
  font-variant-numeric: lining-nums;
  color: var(--text);
  user-select: none;
}
[hidden] {
  display: none !important;
}

/* ── 卡片和氛围 ── */
.card {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* clip 不是 hidden：hidden 的盒子照样能被 focus()、scrollIntoView 卷动——伸出去的光照画布、摆件让它多出几像素宽，
     一聚焦（没写 preventScroll 的）整张桌子就往左挪几像素，正中的小笺跟着偏 */
  overflow: clip;
  background: var(--bg-grad);
  /* 小窗是透明无边框的，卡片自己收一个很小的圆角，外沿一道很淡的线 */
  border-radius: var(--card-radius, 0.6rem);
  box-shadow: inset 0 0 0 1px var(--edge);
}
.atmo,
.atmo > div {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* 底色也铺一层在这里：.atmo 自成一层（z-index），里面的混合（宣纸的 soft-light、multiply）只和这一层里的东西混，没有底色就混不上 */
.atmo {
  z-index: -1;
  background: var(--glows), var(--bg-grad);
}
/* 星点：main.js 生成一次 SVG；用不用、多亮看主题 */
.stars {
  opacity: var(--stars-opacity, 0);
  background-size: 100% 100%;
}
/* 雾：分形噪声，只留浓的地方；画一次不漂 */
.mist {
  opacity: var(--mist-opacity, 0);
  filter: var(--mist-filter, none);
  mix-blend-mode: var(--mist-blend, normal);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='640'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.008 0.013' numOctaves='4' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0.62 0 0 0 0 0.55 0 0 0 0 0.48 0 0 0 2.2 -0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E")
    center / cover;
}
/* 宣纸：主题给了 --paper-tex（一张贴图）就用它；没给的（options 里另两份）用老的横向长纤维。浓淡、叠法看 --paper-opacity、--paper-blend */
.paper {
  opacity: var(--paper-opacity, 0);
  mix-blend-mode: var(--paper-blend, normal);
  background: var(
    --paper-tex,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.035 0.11' numOctaves='3' seed='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E")
  );
}
/* 主题自己的一层（水墨的晕、竹席的纹……） */
.wash {
  background: var(--wash, none);
}
/* 主题给的一层淡色（--veil）；不叫 .veil，免得套上菜单蒙层（menu.css 的 #veil）的糊和纸色 */
.tint {
  background: var(--veil, transparent);
}

/* ── 只给读屏的字（看不见、占不了地方）：导出那一行的完整位置（bond-view.js 的 showFull） ── */
.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;
}

/* ── 加载页（#boot）：小窗一打开就盖着，和卡片同一张纸、同一个圆角；中间一枚「枰」印、底下「摆棋盘」三个点一呼一吸。
   main.js 的 bootDone 加 .gone 淡掉、再 hidden；点得穿（不挡页面测试点按钮）。脚本出错收不到偏好时，boot-fail 12 秒后自己淡掉。
   动效「关」：pages.css 停掉所有动画，三个点就静着，bootDone 直接藏 ── */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.4rem;
  background: var(--bg-grad);
  border-radius: var(--card-radius, 0.6rem);
  box-shadow: inset 0 0 0 1px var(--edge);
  pointer-events: none;
  animation: boot-fail 0.4s ease 12s forwards;
  transition: opacity 0.32s ease;
}
.boot.gone {
  opacity: 0;
}
.boot-seal {
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 4px;
  background: var(--vermilion);
  color: #fbeee4;
  font: 400 2.3rem/1 var(--font-scene);
  rotate: -4deg;
  animation: boot-seal 0.5s ease-out both;
}
.boot-say {
  font: 400 1.2rem/1 var(--font-scene);
  letter-spacing: 0.3em;
  color: var(--muted);
}
.boot-say i {
  display: inline-block;
  width: 0.28rem;
  height: 0.28rem;
  margin-left: 0.22rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  animation: boot-dot 1.2s ease-in-out infinite;
}
.boot-say i:nth-child(2) {
  animation-delay: 0.2s;
}
.boot-say i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes boot-seal {
  from {
    opacity: 0;
    scale: 1.15;
  }
}
@keyframes boot-dot {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}
@keyframes boot-fail {
  to {
    opacity: 0;
    visibility: hidden;
  }
}
/* 动效「关」也要留着这道保险（只是不淡，到点直接藏） */
:root[data-motion="off"] .boot {
  animation: boot-fail 0s 12s forwards !important;
}
