/* ============================================================
   Gomoku — kbwen Lab
   Visual identity: warm artisanal go-board in a dark study
   Primary axis: surface-material (wood grain + stone pieces)
   ============================================================ */

/* --- Page atmosphere override --- */
.gomoku-page {
  background: #1a1510;
  color: #f0ead8;
}

.gomoku-page .site-header {
  background: rgba(20, 16, 10, 0.96);
  border-bottom: 1px solid rgba(180, 140, 60, 0.18);
  backdrop-filter: blur(12px);
}

.gomoku-page .site-brand {
  color: #d4a037;
}

.gomoku-page .site-footer {
  background: rgba(14, 11, 7, 0.96);
  border-top: 1px solid rgba(180, 140, 60, 0.14);
}

.gomoku-page .footer-title,
.gomoku-page .footer-copy {
  color: #a09880;
}

.gomoku-page .site-nav a {
  color: #a09880;
}

.gomoku-page .site-nav a:hover {
  color: #d4a037;
}

/* --- Cabinet wrapper --- */
.gomoku-cabinet {
  background: linear-gradient(160deg, #211a12 0%, #1a1510 50%, #140f0a 100%);
  border: 1px solid rgba(180, 140, 60, 0.2);
  border-radius: var(--radius-lg);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(212, 160, 55, 0.12);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}

.gomoku-cabinet::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(212, 160, 55, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

/* --- Top marquee bar --- */
.gomoku-marquee {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.gomoku-marquee__left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.gomoku-page .arcade-marquee__actions {
  display: grid;
  justify-items: end;
  gap: var(--space-2);
  margin-left: auto;
}

.gomoku-marquee__lang {
  justify-self: end;
}

.gomoku-marquee__buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.gomoku-page .arcade-marquee__pill {
  background: rgba(212, 160, 55, 0.12);
  border: 1px solid rgba(212, 160, 55, 0.25);
  color: #d4a037;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.gomoku-page .button-primary {
  background: linear-gradient(135deg, #d4a037, #b8882a);
  border: none;
  color: #1a1510;
  font-weight: 700;
}

.gomoku-page .button-primary:hover {
  background: linear-gradient(135deg, #e0b050, #c89a38);
}

.gomoku-page .button-secondary {
  background: rgba(212, 160, 55, 0.1);
  border: 1px solid rgba(212, 160, 55, 0.3);
  color: #d4a037;
}

.gomoku-page .button-secondary:hover {
  background: rgba(212, 160, 55, 0.2);
}

.gomoku-page .button-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* --- Stage: board + sidecar --- */
.gomoku-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 280px);
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 760px) {
  .gomoku-stage {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   BOARD
   ============================================================ */
.gomoku-board-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

/* Wood-grain background */
.gomoku-board {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: crosshair;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* Wood grain via multiple gradients */
  background-color: #c8a86e;
  background-image:
    repeating-linear-gradient(
      92deg,
      transparent,
      transparent 40px,
      rgba(160, 110, 40, 0.08) 40px,
      rgba(160, 110, 40, 0.08) 41px
    ),
    repeating-linear-gradient(
      88deg,
      transparent,
      transparent 28px,
      rgba(180, 130, 50, 0.06) 28px,
      rgba(180, 130, 50, 0.06) 29px
    ),
    linear-gradient(
      175deg,
      #d4b87e 0%,
      #c8a86e 30%,
      #b89858 60%,
      #c4a46a 100%
    );
}

/* Grid lines drawn via JS-injected SVG inside board,
   or we create them using absolute pseudo-element overlay */
.gomoku-board__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Intersection hit targets (rendered by JS) */
.gomoku-cell {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: crosshair;
  z-index: 2;
  /* Hit area slightly larger than stone for easy clicking */
  width: calc(var(--cell-size, 36px) * 0.9);
  height: calc(var(--cell-size, 36px) * 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gomoku-cell:hover .gomoku-cell__ghost {
  opacity: 1;
}

/* Ghost stone on hover */
.gomoku-cell__ghost {
  width: calc(var(--cell-size, 36px) * 0.78);
  height: calc(var(--cell-size, 36px) * 0.78);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

/* Ghost stone color determined by parent board class (1 DOM op vs 225) */
.gomoku-board--black-turn .gomoku-cell__ghost {
  background: radial-gradient(circle at 35% 35%, #5a5a5a, #1a1a1a 60%, #050505);
  box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
}

.gomoku-board--white-turn .gomoku-cell__ghost {
  background: radial-gradient(circle at 35% 35%, #ffffff, #e8e0d0 50%, #d0c8b8);
  box-shadow: 2px 2px 6px rgba(0,0,0,0.25);
}

.gomoku-cell:hover .gomoku-cell__ghost {
  opacity: 0.45;
}

/* Placed stones */
.gomoku-stone {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
}

.gomoku-stone--black {
  background: radial-gradient(circle at 35% 30%, #4a4a4a, #1a1a1a 55%, #050505);
  box-shadow:
    2px 3px 6px rgba(0,0,0,0.55),
    inset 0 1px 2px rgba(255,255,255,0.08),
    inset 0 -1px 2px rgba(0,0,0,0.3);
}

.gomoku-stone--white {
  background: radial-gradient(circle at 38% 32%, #ffffff, #f0e8d8 45%, #d8d0c0);
  box-shadow:
    2px 3px 6px rgba(0,0,0,0.3),
    inset 0 2px 4px rgba(255,255,255,0.6),
    inset 0 -1px 2px rgba(0,0,0,0.1);
}

/* Last move indicator dot */
.gomoku-stone::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 200ms ease;
}

.gomoku-stone--last::after {
  opacity: 1;
}

.gomoku-stone--black.gomoku-stone--last::after {
  background: rgba(255, 255, 255, 0.55);
}

.gomoku-stone--white.gomoku-stone--last::after {
  background: rgba(40, 30, 10, 0.45);
}

/* Stone placement animation */
@keyframes stone-drop {
  0%   { transform: translate(-50%, -50%) scale(0.72); opacity: 0.6; }
  65%  { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.gomoku-stone--animate {
  animation: stone-drop 200ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Invalid placement flash */
@keyframes cell-reject {
  0%, 100% { background: transparent; }
  40%       { background: rgba(248, 81, 73, 0.35); }
}

.gomoku-cell--reject {
  animation: cell-reject 320ms ease forwards;
}

/* ============================================================
   OVERLAY LAYERS
   ============================================================ */

/* Board patina — accumulates warmth over the game */
.gomoku-patina {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 4;
  mix-blend-mode: multiply;
}

/* Threat radar overlay */
.gomoku-threat-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 5;
}

.gomoku-threat-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}

/* Opportunity (yellow) */
.gomoku-threat-dot--opp {
  background: radial-gradient(circle, rgba(255, 210, 0, 0.55) 0%, transparent 70%);
  animation: threat-pulse 1.6s ease-out forwards;
}

/* Strong attack (orange) */
.gomoku-threat-dot--atk {
  background: radial-gradient(circle, rgba(255, 150, 0, 0.65) 0%, transparent 70%);
  animation: threat-pulse 1.6s ease-out forwards;
}

/* Block needed (blue) */
.gomoku-threat-dot--blk {
  background: radial-gradient(circle, rgba(80, 170, 255, 0.6) 0%, transparent 70%);
  animation: threat-pulse 1.6s ease-out forwards;
}

/* Immediate win (red) */
.gomoku-threat-dot--win {
  background: radial-gradient(circle, rgba(255, 60, 40, 0.7) 0%, transparent 70%);
  animation: threat-pulse 1.2s ease-out forwards;
}

@keyframes threat-pulse {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  70%  { opacity: 0.8; }
  100% { opacity: 0.12; transform: translate(-50%, -50%) scale(1); }
}

/* Move echo layer */
.gomoku-echo-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 6;
}

.gomoku-echo-stone {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  animation: echo-fade 1.4s ease-out forwards;
}

.gomoku-echo-stone--black {
  background: radial-gradient(circle at 35% 30%, rgba(80, 80, 80, 0.5), rgba(10, 10, 10, 0.3));
  border: 1.5px dashed rgba(200, 200, 200, 0.4);
}

.gomoku-echo-stone--white {
  background: radial-gradient(circle at 35% 30%, rgba(240, 232, 210, 0.5), rgba(200, 192, 170, 0.3));
  border: 1.5px dashed rgba(100, 80, 40, 0.4);
}

@keyframes echo-fade {
  0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(1.05); }
  30%  { opacity: 0.7; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* Move echo tooltip — floating reason near AI stone */
.gomoku-echo-tooltip {
  position: absolute;
  transform: translateX(-50%);
  background: rgba(26, 21, 16, 0.92);
  border: 1px solid rgba(212, 160, 55, 0.45);
  color: #d4b878;
  font-size: 11px;
  font-weight: 600;
  font-style: italic;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 8;
  animation: echo-tooltip-fade 2.2s ease-out forwards;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

@keyframes echo-tooltip-fade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(4px); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  70%  { opacity: 0.9; }
  100% { opacity: 0; }
}

/* Win layer */
.gomoku-win-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 7;
}

.gomoku-win-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, #ffd700, #ffd700, transparent);
  border-radius: 3px;
  transform-origin: left center;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.3);
  animation: win-trace 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes win-trace {
  0%   { opacity: 0; clip-path: inset(0 100% 0 0); }
  20%  { opacity: 1; }
  100% { opacity: 1; clip-path: inset(0 0% 0 0); }
}

/* Win stone pulse */
@keyframes win-stone-pulse {
  0%   { transform: translate(-50%, -50%) scale(1); }
  40%  { transform: translate(-50%, -50%) scale(1.15); filter: brightness(1.3); }
  100% { transform: translate(-50%, -50%) scale(1.05); }
}

.gomoku-stone--winner {
  animation: win-stone-pulse 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Board dim on win */
.gomoku-board-wrap--won .gomoku-stone:not(.gomoku-stone--winner) {
  opacity: 0.4;
  transition: opacity 0.5s ease;
}

/* ============================================================
   SIDECAR
   ============================================================ */
.gomoku-sidecar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  width: 100%;
}

.gomoku-score-strip {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
  min-width: 0;
}

.gomoku-page .score-card {
  flex: 1;
  min-width: 0;
  background: rgba(212, 160, 55, 0.08);
  border: 1px solid rgba(212, 160, 55, 0.18);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-2);
  text-align: center;
}

.gomoku-page .score-card__label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a09880;
  margin-bottom: 2px;
}

.gomoku-page .score-card__value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: #d4a037;
  font-variant-numeric: tabular-nums;
}

/* Reset stats button — small ✕ in the score strip */
.gomoku-reset-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(212, 160, 55, 0.2);
  border-radius: 50%;
  background: transparent;
  color: #a09880;
  font-size: 11px;
  cursor: pointer;
  transition: all 140ms ease;
  flex-shrink: 0;
  align-self: center;
}

.gomoku-reset-stats:hover {
  border-color: rgba(248, 81, 73, 0.5);
  color: #f85149;
  background: rgba(248, 81, 73, 0.1);
}

/* Custom confirm dialog */
.gomoku-confirm {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 21, 16, 0.75);
  border-radius: var(--radius-lg);
  animation: result-appear 0.2s ease-out;
}

.gomoku-confirm__card {
  background: linear-gradient(160deg, #2a2218, #1e1a12);
  border: 1px solid rgba(212, 160, 55, 0.35);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.gomoku-confirm__msg {
  color: #f0ead8;
  font-size: var(--text-md);
  margin-bottom: var(--space-4);
}

.gomoku-confirm__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

.gomoku-confirm__btn {
  padding: 6px 20px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 140ms ease;
}

.gomoku-confirm__btn--yes {
  background: rgba(248, 81, 73, 0.85);
  color: #fff;
}

.gomoku-confirm__btn--yes:hover {
  background: rgba(248, 81, 73, 1);
}

.gomoku-confirm__btn--no {
  background: rgba(212, 160, 55, 0.15);
  border: 1px solid rgba(212, 160, 55, 0.3);
  color: #d4a037;
}

.gomoku-confirm__btn--no:hover {
  background: rgba(212, 160, 55, 0.25);
}

/* Settings panel */
.gomoku-settings {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 160, 55, 0.14);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.gomoku-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
}

.gomoku-setting-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a09880;
  flex-shrink: 0;
  min-width: 82px;
}

/* Segmented control */
.gomoku-seg {
  display: flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 2px;
  min-width: 0;
  flex-wrap: nowrap;
}

.gomoku-seg__btn {
  padding: 3px 8px;
  border: none;
  border-radius: 6px;
  min-height: 34px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #a09880;
  background: transparent;
  transition: all 140ms ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gomoku-seg__btn.active {
  background: rgba(212, 160, 55, 0.85);
  color: #1a1510;
}

.gomoku-seg__btn:hover:not(.active) {
  color: #d4a037;
  background: rgba(212, 160, 55, 0.12);
}

/* Toggle button */
.gomoku-toggle {
  padding: 3px 12px;
  border: 1px solid rgba(212, 160, 55, 0.3);
  border-radius: 20px;
  min-height: 34px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #a09880;
  background: transparent;
  transition: all 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gomoku-toggle.active {
  background: rgba(212, 160, 55, 0.2);
  border-color: rgba(212, 160, 55, 0.5);
  color: #d4a037;
}

.gomoku-setting-row > .gomoku-seg,
.gomoku-setting-row > .gomoku-toggle {
  margin-left: auto;
}

/* Echo panel */
.gomoku-echo-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 160, 55, 0.14);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  min-height: 60px;
}

.gomoku-echo-panel__label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a09880;
  margin-bottom: var(--space-1);
}

.gomoku-echo-panel__reason {
  display: block;
  font-size: var(--text-sm);
  color: #d4b878;
  font-style: italic;
  line-height: 1.4;
}

/* Status message */
.gomoku-status {
  font-size: var(--text-sm);
  color: #c0b090;
  line-height: 1.5;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border-left: 3px solid rgba(212, 160, 55, 0.4);
}

/* ============================================================
   RESULT OVERLAY — positioned on top of board
   ============================================================ */
.gomoku-board-wrap .result-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 21, 16, 0.8);
  border-radius: var(--radius-md);
  animation: result-appear 0.35s ease-out;
}

@keyframes result-appear {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.gomoku-board-wrap .result-layer[hidden] {
  display: none;
}

.gomoku-result-card {
  background: linear-gradient(160deg, #2a2218, #1e1a12);
  border: 1px solid rgba(212, 160, 55, 0.35);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 40px rgba(212, 160, 55, 0.08);
  padding: var(--space-6);
  border-radius: var(--radius-md);
  text-align: center;
  max-width: 280px;
}

.gomoku-result-card .result-card__kicker {
  color: #a09880;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

.gomoku-result-card .result-card__title {
  color: #d4a037;
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.gomoku-result-card .result-card__body {
  color: #c0b090;
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.gomoku-result-card .result-card__actions {
  display: flex;
  justify-content: center;
}

/* ============================================================
   TOOL NOTES / CARDS
   ============================================================ */
.gomoku-page .tool-notes {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 160, 55, 0.14);
}

.gomoku-page .card-title {
  color: #d4a037;
}

.gomoku-page .card-text {
  color: #c0b090;
}

.gomoku-page .tool-discovery__title {
  color: #d4a037;
}

.gomoku-page .card-eyebrow {
  color: #a09878;
}

.gomoku-page .tool-discovery__card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 160, 55, 0.14);
}

.gomoku-page .tool-discovery__list li,
.gomoku-page .tool-discovery__faq dt,
.gomoku-page .tool-discovery__faq dd {
  color: #c0b090;
}

.gomoku-page .card-link {
  color: #d4a037;
}

.gomoku-page .card-link:hover {
  color: #e0b850;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 760px) {
  .gomoku-stage {
    gap: var(--space-3);
  }

  .gomoku-board-wrap {
    max-width: min(92vw, 480px);
  }

  .gomoku-sidecar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .gomoku-score-strip {
    grid-column: 1 / -1;
  }

  .gomoku-settings {
    grid-column: 1 / -1;
  }

  .gomoku-status {
    grid-column: 1 / -1;
  }

  /* Larger hit targets on touch */
  .gomoku-cell {
    width: calc(var(--cell-size, 36px) * 1.1);
    height: calc(var(--cell-size, 36px) * 1.1);
  }
}

@media (max-width: 480px) {
  .gomoku-cabinet {
    padding: var(--space-2) var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
  }

  /* Compact marquee: single row, small buttons */
  .gomoku-marquee {
    gap: var(--space-1);
    margin-bottom: var(--space-2);
  }

  .gomoku-marquee__left {
    flex-wrap: nowrap;
    gap: var(--space-1);
  }

  .gomoku-page .arcade-marquee__actions {
    width: 100%;
    justify-items: stretch;
  }

  .gomoku-marquee__lang {
    justify-self: start;
  }

  .gomoku-marquee__buttons {
    justify-content: flex-start;
  }

  .gomoku-page .arcade-marquee__pill {
    font-size: 10px;
    padding: 2px 7px;
  }

  .gomoku-page .button-primary,
  .gomoku-page .button-secondary {
    font-size: 12px;
    padding: 6px 12px;
  }

  .gomoku-seg__btn[data-lang] {
    font-size: 11px;
    padding: 4px 8px;
  }

  /* Sidecar: compact single column */
  .gomoku-sidecar {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  /* Score strip: small inline row */
  .gomoku-score-strip {
    gap: var(--space-2);
  }

  .gomoku-page .score-card {
    padding: var(--space-1) var(--space-2);
  }

  .gomoku-page .score-card__label {
    font-size: 9px;
  }

  .gomoku-page .score-card__value {
    font-size: var(--text-md);
  }

  /* Settings: tighter rows */
  .gomoku-settings {
    padding: var(--space-2);
    gap: var(--space-2);
  }

  .gomoku-setting-label {
    font-size: 10px;
  }

  .gomoku-seg__btn {
    font-size: 11px;
    padding: 4px 8px;
  }

  .gomoku-toggle {
    font-size: 11px;
    padding: 4px 10px;
  }

  /* Echo panel and status: compact */
  .gomoku-echo-panel {
    padding: var(--space-2);
    min-height: auto;
  }

  .gomoku-status {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .gomoku-score-strip {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .gomoku-reset-stats {
    order: 4;
    margin-left: auto;
    margin-top: 2px;
  }

  .gomoku-setting-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
  }

  .gomoku-page .arcade-marquee__actions {
    width: 100%;
    justify-items: stretch;
    margin-left: 0;
  }

  .gomoku-marquee__lang {
    justify-self: start;
  }

  .gomoku-marquee__buttons {
    justify-content: flex-start;
  }

  .gomoku-setting-row > .gomoku-seg,
  .gomoku-setting-row > .gomoku-toggle {
    margin-left: 0;
    max-width: 100%;
  }

  .gomoku-seg {
    width: 100%;
    flex-wrap: wrap;
  }

  .gomoku-seg__btn {
    flex: 0 0 auto;
    text-align: left;
  }
}

/* ============================================================
   THINKING INDICATOR
   ============================================================ */
@keyframes thinking-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

.gomoku-thinking-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d4a037;
  margin: 0 2px;
  animation: thinking-pulse 1s ease-in-out infinite;
}

.gomoku-thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.gomoku-thinking-dot:nth-child(3) { animation-delay: 0.3s; }

/* ============================================================
   AI THINKING OVERLAY (board dimmed while AI computes)
   ============================================================ */
.gomoku-board-wrap--thinking::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: rgba(26, 21, 16, 0.25);
  z-index: 10;
  pointer-events: none;
}

/* ============================================================
   STAR POINTS (hoshi) — rendered by JS as absolute divs
   ============================================================ */
.gomoku-hoshi {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(60, 40, 20, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .gomoku-stone--animate,
  .gomoku-threat-dot,
  .gomoku-echo-stone,
  .gomoku-win-line,
  .gomoku-stone--winner,
  .gomoku-thinking-dot {
    animation: none;
  }

  .gomoku-stone--animate {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  .gomoku-threat-dot {
    opacity: 0.25;
  }
}
