/*
 * 围棋棋盘样式。
 * 所有选择器使用 go- 前缀，只作用于本模块，不依赖全局棋盘类名。
 */

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

.go-board {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 620px;
  min-width: 0;
  margin: 0 auto;
}

.go-board__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  container-type: inline-size;
  border: 1px solid #b49d72;
  border-radius: 12px;
  background-color: #e3cfa8;
  background-image:
    radial-gradient(
      circle at 30% 16%,
      rgba(255, 255, 255, 0.34),
      transparent 46%
    ),
    repeating-linear-gradient(
      112deg,
      rgba(110, 76, 34, 0.035) 0,
      rgba(110, 76, 34, 0.035) 2px,
      transparent 2px,
      transparent 8px
    ),
    linear-gradient(135deg, #f0e2c6 0%, #e4cfa5 52%, #d4b982 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.32),
    inset 0 0 60px rgba(93, 66, 30, 0.14),
    0 10px 24px rgba(64, 48, 25, 0.15);
}

.go-board__grid {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.go-board__frame-line {
  fill: none;
  stroke: #76552d;
  stroke-width: 5;
  opacity: 0.55;
}

.go-board__line {
  stroke: #5f421f;
  stroke-width: 2.2;
  stroke-linecap: round;
  opacity: 0.82;
}

.go-board__star {
  fill: #4f371a;
  opacity: 0.9;
}

.go-board__points {
  position: absolute;
  inset: 0;
}

/* -------------------------------------------------------------------------- */
/* 交叉点、棋子与交互                                                          */
/* -------------------------------------------------------------------------- */

.go-point {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 5.35%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  font: inherit;
  line-height: 1;
  transform: translate(-50%, -50%);
  cursor: default;
  touch-action: manipulation;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.go-point:disabled {
  cursor: default;
  opacity: 1;
}

.go-point--playable {
  cursor: pointer;
}

.go-point:focus-visible {
  z-index: 6;
  outline: 2px solid #1f6f5a;
  outline-offset: -3px;
}

.go-hover {
  position: absolute;
  z-index: 1;
  width: 82%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.go-hover--black {
  background: radial-gradient(
    circle at 36% 30%,
    #626262 0%,
    #1b1b1b 48%,
    #000 100%
  );
}

.go-hover--white {
  border: 1px solid rgba(108, 99, 84, 0.5);
  background: radial-gradient(
    circle at 34% 28%,
    #ffffff 0%,
    #f2f0e9 54%,
    #d6d1c5 100%
  );
}

.go-point--playable:hover .go-hover {
  opacity: 0.42;
}

.go-stone {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 88%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  pointer-events: none;
}

.go-stone--black {
  background: radial-gradient(
    circle at 35% 28%,
    #6e6e6e 0%,
    #2b2b2b 38%,
    #0a0a0a 72%,
    #000 100%
  );
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.45),
    inset -1px -2px 4px rgba(0, 0, 0, 0.5);
}

.go-stone--white {
  border: 1px solid rgba(112, 103, 88, 0.5);
  background: radial-gradient(
    circle at 34% 27%,
    #ffffff 0%,
    #fbfaf5 36%,
    #e9e4d8 72%,
    #cfc8b8 100%
  );
  box-shadow:
    0 1px 2px rgba(73, 60, 38, 0.28),
    inset -1px -2px 4px rgba(120, 108, 86, 0.22);
}

.go-stone--last::after {
  width: 24%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #c2473a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
  content: "";
}

.go-ko {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 62%;
  aspect-ratio: 1 / 1;
  border: 1px dashed #9b3e34;
  border-radius: 50%;
  color: #8c352b;
  background: rgba(250, 239, 224, 0.82);
  font-family: var(--serif);
  font-size: clamp(7px, 1.9cqw, 13px);
  line-height: 1;
}

.go-point--ko {
  outline: 1px dashed rgba(155, 62, 52, 0.45);
  outline-offset: 1px;
}

/* -------------------------------------------------------------------------- */
/* 对局信息与停着                                                              */
/* -------------------------------------------------------------------------- */

.go-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.go-meta__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid rgba(87, 67, 39, 0.16);
  border-radius: 7px;
  background: rgba(255, 250, 240, 0.42);
}

.go-meta__item small {
  overflow: hidden;
  color: #7c6c55;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.go-meta__item strong {
  color: #403526;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.go-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.go-pass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 33px;
  padding: 0 13px;
  border: 1px solid rgba(70, 54, 32, 0.28);
  border-radius: 8px;
  color: #fbf8f0;
  background: #4f4128;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    opacity 150ms ease;
}

.go-pass span {
  color: rgba(247, 243, 234, 0.58);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.go-pass:hover:not(:disabled) {
  border-color: #2f2717;
  background: #2f2717;
}

.go-pass:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.go-status {
  flex: 1;
  min-width: 0;
  color: #75654d;
  font-size: 10px;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .go-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .go-actions {
    flex-wrap: wrap;
  }

  .go-status {
    flex-basis: 100%;
  }
}
