/* ============================================================
   拾光游戏厅 · gomoku.css
   五子棋：暖木棋墩 / 玻璃棋子 / 连胜高亮 / 状态栏 / 结果弹窗
   ============================================================ */

/* ---------------- 舞台与棋盘外框 ---------------- */
.gm-wrap {
  width: 100%;
}

.gm-stage {
  padding: clamp(12px, 1.9vw, 26px);
  background:
    radial-gradient(ellipse at 50% -4%, rgba(255, 219, 162, .12), transparent 58%),
    repeating-linear-gradient(93deg, rgba(30, 17, 8, .24) 0 2px, rgba(255, 230, 183, .014) 2px 5px, transparent 5px 21px),
    linear-gradient(155deg, #452c1a, #291a0f 80%);
}

.gm-stage-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gm-board-frame {
  position: relative;
  width: min(100%, 620px);
  padding: clamp(10px, 1.7vw, 20px);
  border-radius: 10px;
  border: 1px solid rgba(18, 9, 2, .9);
  background:
    linear-gradient(180deg, rgba(255, 218, 158, .2), transparent 14%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .11) 0 1px, transparent 1px 6px),
    linear-gradient(152deg, #74502e, #4d2f18 52%, #2e1c0d);
  box-shadow:
    0 26px 50px rgba(0, 0, 0, .54),
    0 5px 0 rgba(0, 0, 0, .34),
    inset 0 1px 0 rgba(255, 226, 176, .26),
    inset 0 -3px 9px rgba(0, 0, 0, .58);
}

/* 棋墩侧面与四角铜钉 */
.gm-board-frame::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 7px;
  border: 1px solid rgba(255, 220, 160, .1);
  pointer-events: none;
}

.gm-board-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background:
    radial-gradient(circle at 3% 3.5%, rgba(238, 208, 145, .6) 0 1.3px, transparent 2px),
    radial-gradient(circle at 97% 3.5%, rgba(238, 208, 145, .6) 0 1.3px, transparent 2px),
    radial-gradient(circle at 3% 96.5%, rgba(238, 208, 145, .5) 0 1.3px, transparent 2px),
    radial-gradient(circle at 97% 96.5%, rgba(238, 208, 145, .5) 0 1.3px, transparent 2px);
}

.gm-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  container-type: inline-size;
  touch-action: manipulation;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 25% 14%, rgba(255, 246, 216, .5), transparent 52%),
    radial-gradient(ellipse at 84% 92%, rgba(96, 52, 12, .2), transparent 62%),
    repeating-linear-gradient(0deg,
      rgba(122, 72, 24, .075) 0 1px,
      transparent 1px 4px,
      rgba(255, 236, 196, .05) 4px 5px,
      transparent 5px 13px),
    repeating-linear-gradient(91deg,
      rgba(122, 78, 30, .05) 0 1px,
      transparent 1px 26px),
    linear-gradient(137deg, #e2b371 0%, #d6a15f 36%, #c88f4b 68%, #b57b38 100%);
  box-shadow:
    inset 0 0 0 1px rgba(64, 34, 9, .52),
    inset 0 1px 0 rgba(255, 244, 212, .55),
    inset 0 0 40px rgba(100, 56, 14, .26);
}

.gm-board::before {
  content: "";
  position: absolute;
  inset: 1.9%;
  border: 1px solid rgba(88, 50, 16, .15);
  border-radius: 1px;
  pointer-events: none;
  z-index: 0;
}

.gm-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.gm-grid-lines line {
  stroke: rgba(56, 33, 11, .64);
  stroke-width: 1.7;
  stroke-linecap: square;
}

.gm-grid-stars circle {
  fill: rgba(38, 21, 5, .8);
}

.gm-grid-coords text {
  fill: rgba(76, 45, 14, .55);
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: .02em;
  font-size: 1.6cqw;
}

/* ---------------- 交叉点与棋子 ---------------- */
.gm-points {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.gm-pt {
  position: absolute;
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

.gm-board[data-phase="playing"] .gm-pt:not(.has-stone) { cursor: pointer; }

.gm-stone {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .16s ease, transform .2s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: none;
  z-index: 2;
}

.gm-pt.has-stone .gm-stone {
  opacity: 1;
  transform: scale(1);
}

/* 黑子：光泽玻璃质感 */
.gm-stone.is-black {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .72) 0%, rgba(220, 228, 232, .22) 8%, transparent 22%),
    radial-gradient(circle at 36% 30%, #7d858a 0%, #43484c 18%, #222528 44%, #0d0e0f 76%, #020202 100%);
  box-shadow:
    0 .38cqw .55cqw rgba(32, 15, 3, .52),
    0 .1cqw .14cqw rgba(0, 0, 0, .62),
    inset 0 -.3cqw .5cqw rgba(0, 0, 0, .7),
    inset .18cqw .2cqw .45cqw rgba(255, 255, 255, .12);
}

/* 白子：温润珠光 */
.gm-stone.is-white {
  background:
    radial-gradient(circle at 28% 20%, #ffffff 0%, rgba(255, 254, 248, .95) 13%, transparent 34%),
    radial-gradient(circle at 37% 31%, #fdf9ef 0%, #f7efdd 26%, #ebe0c9 52%, #d7c8a9 78%, #c2b08d 100%);
  box-shadow:
    0 .38cqw .55cqw rgba(44, 25, 7, .4),
    0 .1cqw .14cqw rgba(40, 22, 6, .3),
    inset 0 -.3cqw .5cqw rgba(126, 104, 66, .42),
    inset .16cqw .18cqw .4cqw rgba(255, 255, 255, .9);
}

/* 悬停预落子 */
.gm-board[data-phase="playing"] .gm-pt:not(.has-stone):hover::after,
.gm-board[data-phase="playing"] .gm-pt:not(.has-stone):focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: .42;
  pointer-events: none;
  z-index: 1;
}

.gm-board[data-phase="playing"].is-turn-black .gm-pt:not(.has-stone):hover::after,
.gm-board[data-phase="playing"].is-turn-black .gm-pt:not(.has-stone):focus-visible::after {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .55), transparent 30%),
    radial-gradient(circle at 38% 33%, #43484c, #17191b 62%, #000 100%);
  box-shadow: 0 .3cqw .5cqw rgba(0, 0, 0, .28);
}

.gm-board[data-phase="playing"].is-turn-white .gm-pt:not(.has-stone):hover::after,
.gm-board[data-phase="playing"].is-turn-white .gm-pt:not(.has-stone):focus-visible::after {
  background:
    radial-gradient(circle at 30% 22%, #ffffff, transparent 30%),
    radial-gradient(circle at 38% 33%, #f8f2e4, #e7dcc5 60%, #ccbd9d 100%);
  box-shadow: 0 .3cqw .5cqw rgba(46, 27, 8, .24);
}

/* 最后一手：朱红小点 */
.gm-pt.has-stone.is-last .gm-stone::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #c73b27;
  box-shadow:
    0 0 0 .4px rgba(255, 246, 224, .6),
    0 0 .7cqw rgba(178, 48, 32, .55);
  z-index: 3;
}

/* 获胜连线：棋子描金 + 光晕 */
.gm-pt.is-win .gm-stone {
  box-shadow:
    0 0 0 .35cqw rgba(240, 208, 132, .92),
    0 0 1.5cqw rgba(230, 190, 110, .7),
    0 .38cqw .55cqw rgba(32, 15, 3, .4);
  z-index: 3;
}

.gm-win-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.gm-win-line line {
  stroke: rgba(247, 217, 148, .95);
  stroke-width: 4.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(240, 205, 128, .85));
}

/* 非法落点反馈 */
.gm-board[data-phase="playing"] .gm-pt.is-invalid::before {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  border: 1.5px solid rgba(178, 58, 43, .9);
  box-shadow: 0 0 .9cqw rgba(178, 58, 43, .45);
  pointer-events: none;
  z-index: 4;
}

.gm-board[data-phase="finished"] .gm-pt { cursor: default; }

/* 棋盘铭牌 */
.gm-plate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 5px 14px 5px 7px;
  border-radius: 2px;
  border: 1px solid rgba(198, 160, 90, .32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 45%),
    linear-gradient(160deg, #2b2119, #181310);
  box-shadow: inset 0 1px 0 rgba(255, 230, 185, .1), 0 3px 8px rgba(0, 0, 0, .32);
}
.gm-plate-seal {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(198, 160, 90, .45);
  color: var(--brass-hi);
  font-family: var(--font-display);
  font-size: 11px;
  background: rgba(198, 160, 90, .08);
}
.gm-plate-text {
  color: rgba(230, 201, 130, .82);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: .22em;
}
.gm-plate-sub {
  color: rgba(198, 160, 90, .34);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .16em;
  padding-left: 9px;
  border-left: 1px solid rgba(198, 160, 90, .2);
}

/* ---------------- 侧栏 ---------------- */
.gm-side .paper-card { padding: 14px 15px; }
.gm-side .gm-rules-card { padding-bottom: 12px; }

.gm-status-body { min-height: 62px; }

.gm-turn-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 2px;
  border: 1px solid rgba(100, 67, 32, .2);
  background: rgba(255, 249, 232, .42);
}

.gm-swatch {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  position: relative;
}
.gm-swatch--black {
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, .5), transparent 22%),
    radial-gradient(circle at 38% 33%, #62686c, #24262a 48%, #000 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .45), inset 0 -2px 4px rgba(0, 0, 0, .65);
}
.gm-swatch--white {
  background:
    radial-gradient(circle at 32% 25%, #ffffff, transparent 34%),
    radial-gradient(circle at 38% 33%, #faf4e6, #e8ddc6 55%, #c8b795 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .28), inset 0 -2px 4px rgba(122, 100, 62, .35);
}

.gm-turn-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.gm-turn-text b {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .08em;
  color: #38250f;
}
.gm-turn-text small { color: rgba(80, 55, 27, .58); font-size: 10.5px; }

.gm-hints { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.gm-chip {
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid rgba(100, 67, 32, .22);
  background: rgba(255, 249, 232, .38);
  color: rgba(74, 48, 22, .72);
  font-size: 10px;
  letter-spacing: .03em;
  line-height: 1.5;
}
.gm-chip--quiet { color: rgba(80, 55, 27, .5); background: transparent; }

.gm-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 10px;
  border: 1px solid rgba(100, 67, 32, .2);
  border-radius: 2px;
  overflow: hidden;
  background: rgba(100, 67, 32, .16);
}
.gm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px;
  background: rgba(255, 249, 232, .42);
}
.gm-stat-k { color: rgba(80, 55, 27, .55); font-size: 9.5px; letter-spacing: .06em; }
.gm-stat-v {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.35;
  color: #3a2712;
}
.gm-stat-v.is-small { font-size: 10.5px; font-family: var(--font-body); letter-spacing: .02em; }

/* 最近落子 */
.gm-move-log {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed rgba(100, 67, 32, .2);
}
.gm-log-title {
  color: rgba(80, 55, 27, .5);
  font-size: 9px;
  letter-spacing: .08em;
  margin-right: 2px;
}
.gm-log-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid rgba(100, 67, 32, .18);
  background: rgba(255, 249, 232, .35);
  color: rgba(58, 39, 20, .72);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.6;
}
.gm-log-item em {
  font-style: normal;
  color: rgba(80, 55, 27, .42);
  padding-right: 2px;
  border-right: 1px solid rgba(100, 67, 32, .16);
}
.gm-log-item.is-black { box-shadow: inset 2px 0 0 rgba(28, 26, 24, .55); }
.gm-log-item.is-white { box-shadow: inset 2px 0 0 rgba(160, 140, 102, .65); }

/* 终局状态 */
.gm-result-band {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: 2px;
  border: 1px solid rgba(100, 67, 32, .24);
  background: rgba(255, 249, 232, .42);
}
.gm-result-seal {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #f7ead0;
  font-family: var(--font-display);
  font-size: 19px;
  background: linear-gradient(160deg, #b84a37, #7c2a1f);
  box-shadow: inset 0 1px 0 rgba(255, 214, 188, .4), 0 2px 5px rgba(80, 25, 15, .32);
}
.gm-result-band.is-white .gm-result-seal {
  color: #4a331d;
  background: linear-gradient(160deg, #f4ead5, #cbb993);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 2px 5px rgba(60, 38, 12, .28);
}
.gm-result-band.is-draw .gm-result-seal {
  background: linear-gradient(160deg, #6f8f83, #3f5c53);
}
.gm-result-text { display: flex; flex-direction: column; line-height: 1.35; }
.gm-result-text b {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: .07em;
  color: #38250f;
}
.gm-result-text small { color: rgba(80, 55, 27, .6); font-size: 10px; }
.gm-result-detail {
  margin-top: 8px;
  font-size: 10.5px;
  line-height: 1.75;
  color: rgba(58, 39, 20, .72);
}

/* 操作区 */
.gm-action-body { display: flex; flex-direction: column; gap: 7px; }
.gm-toolbar { display: flex; flex-wrap: wrap; gap: 6px; }
.gm-toolbar .btn { flex: 1 1 auto; min-height: 33px; padding: 6px 10px; font-size: 11px; }
.gm-toolbar .btn-block { flex: 1 1 100%; }
.gm-toolbar .btn svg { width: 13px; height: 13px; }

.gm-spec-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
  padding-top: 9px;
  border-top: 1px dashed rgba(100, 67, 32, .2);
}
.gm-spec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(80, 55, 27, .6);
  font-size: 10px;
  letter-spacing: .04em;
}
.gm-mini-stone {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 50%;
}
.gm-mini-stone--black {
  background: radial-gradient(circle at 34% 28%, #6b7175, #1d1f21 55%, #000 100%);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, .45);
}
.gm-mini-stone--white {
  background: radial-gradient(circle at 34% 28%, #fffdf7, #e9dfc9 55%, #c6b795 100%);
  box-shadow: 0 1px 1.5px rgba(60, 35, 10, .35), inset 0 0 0 .5px rgba(120, 98, 62, .4);
}

.gm-rules-en {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .16em;
  color: rgba(98, 67, 31, .4);
  padding-left: 8px;
}

/* ---------------- 结果弹窗 ---------------- */
.gm-result-modal .modal-body { padding-top: 8px; }

.gm-result-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2px 0 12px;
}
.gm-result-hero-stone {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  margin-bottom: 9px;
}
.gm-result-hero-stone.black {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .6), transparent 24%),
    radial-gradient(circle at 37% 32%, #6b7276, #232528 48%, #000 100%);
  box-shadow: 0 3px 7px rgba(0, 0, 0, .45), inset 0 -3px 6px rgba(0, 0, 0, .6);
}
.gm-result-hero-stone.white {
  background:
    radial-gradient(circle at 30% 22%, #ffffff, transparent 34%),
    radial-gradient(circle at 38% 33%, #fbf6ea, #e8ddc6 55%, #c8b795 100%);
  box-shadow: 0 3px 7px rgba(60, 35, 10, .3), inset 0 -3px 6px rgba(122, 100, 62, .3);
}
.gm-result-hero-stone.draw {
  background: linear-gradient(160deg, #6f8f83, #3f5c53);
  box-shadow: 0 3px 7px rgba(30, 50, 43, .3), inset 0 -3px 6px rgba(0, 0, 0, .3);
}
.gm-result-hero-title {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: .24em;
  color: #5c2a1c;
  line-height: 1.2;
  text-indent: .24em;
}
.gm-result-hero.is-white .gm-result-hero-title { color: #4a3a22; }
.gm-result-hero.is-draw .gm-result-hero-title { color: #3f5c53; }
.gm-result-hero-sub {
  margin-top: 5px;
  font-size: 10.5px;
  letter-spacing: .08em;
  color: rgba(80, 55, 27, .6);
}

.gm-receipt {
  margin-top: 4px;
  padding: 11px 13px;
  border: 1px solid rgba(100, 67, 32, .26);
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, rgba(110, 79, 40, .025) 0 1px, transparent 1px 3px),
    rgba(255, 250, 236, .5);
}
.gm-receipt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  margin-bottom: 7px;
  border-bottom: 1px dashed rgba(100, 67, 32, .28);
  color: #6a4c26;
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: .08em;
}
.gm-receipt-head em {
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: normal;
  letter-spacing: .16em;
  color: rgba(98, 67, 31, .42);
}
.gm-receipt-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 11px;
  color: rgba(58, 39, 20, .78);
}
.gm-receipt-row b {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #38250f;
  white-space: nowrap;
}

/* ---------------- 动效 ---------------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes gm-drop {
    0% { transform: scale(.5); opacity: .28; }
    62% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
  }
  .gm-pt.is-new .gm-stone { animation: gm-drop .24s cubic-bezier(.2, .9, .3, 1.15); }

  @keyframes gm-win-pulse {
    0%, 100% { box-shadow: 0 0 0 .35cqw rgba(240, 208, 132, .85), 0 0 1.2cqw rgba(230, 190, 110, .6), 0 .38cqw .55cqw rgba(32, 15, 3, .4); }
    50% { box-shadow: 0 0 0 .45cqw rgba(250, 224, 158, 1), 0 0 2.2cqw rgba(240, 200, 120, .85), 0 .38cqw .55cqw rgba(32, 15, 3, .4); }
  }
  .gm-pt.is-win .gm-stone { animation: gm-win-pulse 1.5s ease-in-out infinite; }

  @keyframes gm-line-in {
    from { stroke-dashoffset: 1000; opacity: 0; }
    to { stroke-dashoffset: 0; opacity: 1; }
  }
  .gm-win-line line {
    stroke-dasharray: 1000;
    animation: gm-line-in .5s ease-out both;
  }

  @keyframes gm-invalid {
    0%, 100% { transform: scale(1); opacity: 1; }
    40% { transform: scale(1.18); opacity: .55; }
  }
  .gm-board[data-phase="playing"] .gm-pt.is-invalid::before { animation: gm-invalid .4s ease-out; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .gm-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gm-rules-card { grid-column: 1 / -1; }
  .gm-stage { padding: clamp(10px, 2.4vw, 20px); }
}

@media (max-width: 640px) {
  .gm-side { grid-template-columns: minmax(0, 1fr); }
  .gm-stage { padding: 8px 7px 12px; }
  .gm-board-frame { padding: 7px; border-radius: 7px; }
  .gm-board-frame::after { display: none; }
  .gm-grid-coords text { font-size: 2.1cqw; }
  .gm-plate { margin-top: 12px; padding: 4px 11px 4px 6px; }
  .gm-plate-text { font-size: 11px; letter-spacing: .16em; }
  .gm-plate-sub { display: none; }
  .gm-side .paper-card { padding: 12px 13px; }
  .gm-result-hero-title { font-size: 26px; }
  .gm-stat-v { font-size: 14px; }
}

@media (max-width: 390px) {
  .gm-stage { padding: 6px 5px 10px; }
  .gm-board-frame { padding: 5px; }
  .gm-spec { font-size: 9.5px; }
}
