* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #2c2c2c; color: #eee;
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 16px;
}
h1 { font-size: 20px; letter-spacing: 8px; text-align: center; color: #f0c060;
     padding-bottom: 10px; border-bottom: 1px solid #4a4a4a; }
.container { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.board-wrap {
  background: #d8b06a; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  padding: 30px;               /* 留出坐标标尺空间 */
  max-width: calc(100vw - 32px);
}
.board-frame { position: relative; display: inline-block; max-width: 100%; }
.coord { position: absolute; color: #6b5433; font-size: 12px; line-height: 1; user-select: none; pointer-events: none; }
.coord span { position: absolute; transform: translate(-50%, -50%); }
.coord-top { top: -19px; left: 0; width: 100%; height: 12px; }
.coord-left { left: -21px; top: 0; height: 100%; width: 12px; }
canvas { display: block; cursor: pointer; border-radius: 2px; max-width: 100%; height: auto; }
.panel {
  background: #3a3a3a; border-radius: 8px; padding: 16px;
  width: 250px; max-width: 100%; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.panel h2 { font-size: 14px; color: #f0c060; }
.info { font-size: 14px; line-height: 1.8; }
.turn-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  vertical-align: -2px; margin-right: 6px; border: 1px solid #888;
}
.turn-dot.black { background: #000; }
.turn-dot.white { background: #fff; }
button {
  background: #f0c060; color: #222; border: none; border-radius: 6px;
  padding: 8px 12px; font-size: 14px; cursor: pointer; font-weight: 600;
}
button:hover { background: #ffd479; }
button.danger { background: #c96a5a; color: #fff; }
button.danger:hover { background: #e08476; }
button.secondary { background: #5a5a5a; color: #eee; }
button.secondary:hover { background: #6d6d6d; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.record-actions { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.record-actions .secondary { padding: 7px 4px; font-size: 12px; width: 100%; }
.popover-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; }
.popover-mask[hidden] { display: none; }
.popover { background: #3a3a3a; border: 1px solid #555; border-radius: 10px;
  padding: 16px 18px; max-width: 320px; width: calc(100vw - 48px);
  box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.popover p { font-size: 14px; line-height: 1.6; margin-bottom: 14px; color: #eee; }
.popover-btns { justify-content: flex-end; }
.settings { display: grid; grid-template-columns: repeat(2, auto);
  gap: 10px 12px; justify-content: space-between; align-items: center;
  font-size: 13px; color: #ccc; }
.settings label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
select {
  background: #4a4a4a; color: #eee; border: 1px solid #666;
  border-radius: 6px; padding: 4px; font-size: 13px;
}
.msg { min-height: 20px; font-size: 13px; color: #ffd479; line-height: 1.5; }
.captured { font-size: 13px; color: #aaa; }
.history {
  font-size: 12px; color: #aaa; max-height: 180px; overflow-y: auto;
  background: #2e2e2e; border-radius: 6px; padding: 8px; line-height: 1.8;
}
.hitem { cursor: pointer; padding: 0 4px; border-radius: 4px; }
.hitem:hover { background: #444; color: #fff; }
.hitem.cur { color: #ffd479; font-weight: 600; }
.hitem.live { margin-top: 4px; border-top: 1px dashed #555; padding-top: 4px; color: #8fd3a8; }
.hitem.cp { color: #9fd0ff; }
.review-bar { margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.rv-nav { display: flex; align-items: center; justify-content: center; gap: 6px; }
.rv-nav button { padding: 4px 10px; }
#rvPos { font-size: 13px; color: #ffd479; min-width: 72px; text-align: center; font-weight: 600; }
.review-bar .secondary { padding: 6px; font-size: 12px; width: 100%; }
.hitem.dim { cursor: default; color: #777; }
.hitem.dim:hover { background: none; color: #777; }
@media (max-width: 640px) {
  body { padding: 8px; }
  h1 { font-size: 17px; letter-spacing: 6px; }
  .panel { width: 100%; padding: 12px; }
}
