/* 少卿令 · 棋盘共用样式（游戏 index.html 与设计器 designer.html 共用，保证所见即所得） */
/* 由 index.html 抽出，勿在页面里重复定义棋盘规则 */
  .board {
    display: grid; gap: 0; margin: 0 auto; width: fit-content;
    position: relative;
    border: 3px solid var(--ink);
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
  }
  .cell {
    width: var(--cell, 62px); height: var(--cell, 62px);
    border-width: 0; border-style: solid; border-color: var(--ink);
    display: flex; align-items: center; justify-content: center;
    position: relative; font-size: 20px;
    cursor: pointer;
    transition: transform .12s;
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
  }
  .cell::before {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    border-top: 2px dashed rgba(43,33,24,.45);
    border-right: 2px dashed rgba(43,33,24,.45);
    pointer-events: none;
  }
  .cell .obj { position: relative; z-index: 1; }
  .cell .chip { position: relative; z-index: 1; }
  .cell:hover { transform: scale(1.04); z-index: 2; }
  .cell.blocked { cursor: default; }
  .cell.blocked .obj svg { opacity: 1; filter: none; }
  .cell.occupiable .obj svg { opacity: .45; }
  .cell.occupiable { box-shadow: inset 0 0 0 2px rgba(176,138,62,.65); }
  .cell.occupiable.occupied { box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 12px rgba(176,138,62,.25); }
  /* 房间名：贴格子下沿（草稿钉在左上角，两者分开；见 board_render.renderRegionLabels）。
     半透明纸底 + 细边，11px；格子太小（.cell-tiny）时整块隐藏，交给棋盘下方的房间图例。 */
  .region-label {
    position: absolute; z-index: 3;
    font-size: 11px; letter-spacing: 0; line-height: 1.2;
    color: #2b2118;
    background: rgba(250,244,230,.86);
    border: 1px solid rgba(43,33,24,.38);
    border-radius: 2px;
    padding: 1px 3px;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: none;
  }
  /* 注意：这里必须给 .obj 一个明确的宽高。
     原来只有 left:50% + transform，绝对定位元素按"剩余空间"收缩适应，
     于是里面的图最大只能拿到格子的一半宽（61px 的格子只画出 29px），
     CSS 里写 0.86/0.92 的比例完全不起作用 —— 素材看着就是偏小。 */
  .cell .obj {
    position: absolute; z-index: 1; flex: none; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: calc(var(--cell, 62px) * 1); height: calc(var(--cell, 62px) * 1);
    display: flex; align-items: center; justify-content: center;
    font-size: 0;
  }
  .cell .obj img { width: calc(var(--cell, 62px) * 0.84); height: calc(var(--cell, 62px) * 0.84); object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }
  .cell.blocked .obj img { opacity: 1; filter: none; }
  /* 可容纳格：虚线框 + 小图标，示意"这里能站人" */
  .cell.occupiable::after {
    content: "";
    position: absolute; inset: 4px;
    border: 2px dashed rgba(176,138,62,.9);
    border-radius: 4px;
    pointer-events: none;
  }
  .cell.occupiable .obj img { width: calc(var(--cell, 62px) * 0.92); height: calc(var(--cell, 62px) * 0.92); filter: none; opacity: .45; }
  .cell.occupiable .obj { opacity: 1; }
  /* 站人后：虚线变实线，露出头像 */
  .cell.occupied::after { border-style: solid; border-color: var(--gold); }
  .cell.occupied .obj { opacity: 0; }
  .cell.occupiable.occupied .obj { opacity: .55; }
  .cell.occupied { box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 12px rgba(176,138,62,.25); }
  .cell.marked .xmark {
    position: absolute; z-index: 1;
    font-size: 34px; font-weight: bold; line-height: 1;
    color: rgba(43,33,24,.75);
    text-shadow: 0 1px 0 rgba(255,255,255,.4);
    pointer-events: none;
  }
  .cell.pressing { transform: scale(1.06); box-shadow: inset 0 0 0 3px var(--cinnabar); }
  
  
  .cell.selected { box-shadow: inset 0 0 0 3px var(--cinnabar), inset 0 0 16px rgba(156,47,29,.25); }
  .cell .chip {
    position: absolute; z-index: 2; flex: none;
    left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: calc(var(--cell, 62px) * 0.58); height: calc(var(--cell, 62px) * 0.58);
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--gold);
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    background: #fff;
    display: block;
  }
  .cell .chip img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: pixelated; transform: scale(1.5) translateY(-4%); transform-origin: center 25%; pointer-events: none; -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; }
  .cell .chip.victim { border-color: #3f3429; }
  .cell .chip.victim img { filter: grayscale(1) contrast(1.1); }
  /* 姓氏草稿：小方块，钉在格子左上角（与正式版一致；抽 board.css 时漏掉了这几条，
     结果草稿变成大号默认文字——别再删） */
  .cell .drafts {
    position: absolute; top: 1px; left: 2px; z-index: 2;
    display: flex; gap: 1px; max-width: 90%; flex-wrap: wrap; justify-content: flex-start;
    pointer-events: none;
  }
  .cell .draft-char {
    font-size: 10px; line-height: 1.1; font-weight: bold;
    color: #fff;                     /* 底色 = 该角色的专属色（app.js 内联设置） */
    background: rgba(27,27,47,.85);
    border: 1px solid rgba(0,0,0,.4); border-radius: 2px; padding: 1px 3px;
    box-shadow: 0 1px 0 rgba(255,255,255,.35) inset;
  }
  .cell.occupied .drafts { display: none; }
  /* 大棋盘：房间名缩小、只留前两字（见 board_render.js），不再整块藏掉 */
  .board.cell-tiny .region-label { font-size: 9px; padding: 0 2px; border-width: 1px; }
  /* 更大棋盘（12×12 / 16×16 在手机上，格子 < 22px）：房间名收起（挤在一起反而看不清），
     草稿标记**保留但跟着格子缩放** —— 大关上就是靠这个标记记候选的，藏掉等于没法推理。
     所以标记文字现在一律一个字（app.js buildCharMarks：首字撞车时换名字里别的字，不拉长成两个字）。 */
  .board.cell-micro .region-label { display: none; }
  .board.cell-micro .cell .drafts { gap: 0; top: 0; left: 1px; max-width: 100%; }
  /* 大关（12×12 / 16×16）格子小，标记得压到能在**一格放好几个**：
     字号按格子缩放（约 1/3 格），去掉边框与内边距，贴着格子左上角排。
     12×12（手机上格子 30~34px）和 16×16（21~26px）都适用。 */
  /* 大关的草稿标记：字号约 1/3 格（还要看得清，所以不更小），去掉内边距/边框/阴影，
     从格子左上角贴边排 —— 这样**一格至少放得下两个**（16×16 手机上格子 22~26px：
     字 8px 左右、两个 16~18px，正好一排两个；四个则是两排）。
     内边距留 1px 就会把一排挤成"一个一行"，所以这里必须是 0。 */
  .board.cell-tiny .cell .drafts,
  .board.cell-micro .cell .drafts { gap: 0; top: 0; left: 0; width: 100%; }
  .board.cell-tiny .cell .draft-char,
  .board.cell-micro .cell .draft-char {
    font-size: calc(var(--cell, 24px) * 0.34);
    line-height: 1.05; padding: 0; border-width: 0; border-radius: 1px;
    box-shadow: none;
  }
  .board.cell-micro .cell.marked .xmark { font-size: calc(var(--cell, 22px) * 1.1); }
  .board.cell-micro .cell .chip { border-width: 1px; box-shadow: 0 1px 2px rgba(0,0,0,.3); }


/* 未归区域的格用中性底色，避免地图中间出现'空洞' */
.cell.blank { background: #efe3c8; }

@media (max-width: 600px) {
  :root { --cell: 68px; }
  .cell .obj img { width: calc(var(--cell) * 0.9); height: calc(var(--cell) * 0.9); }
  .region-label { font-size: 10px; padding: 0 2px; }
}
