/* =============================================
   GOMOKU — style.css
   Dark theme matching triliza.net
   ============================================= */

/* ── Header ── */
.gm-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(6, 6, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-back-gm {
  color: var(--dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: 'DM Sans', sans-serif;
  transition: color var(--t);
  min-width: 90px;
}
.btn-back-gm:hover { color: var(--text); }

.gm-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.2rem, 4vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

/* ── Lang mini ── */
.lang-mini {
  display: flex;
  gap: 0.35rem;
  min-width: 90px;
  justify-content: flex-end;
}
.lang-mini-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--t), border-color var(--t);
}
.lang-mini-btn.active,
.lang-mini-btn:hover { opacity: 1; border-color: rgba(255, 255, 255, 0.3); }

/* ── Main ── */
.gm-main {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ── Controls ── */
.gm-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.gm-mode-bar {
  display: flex;
  gap: 0.5rem;
}

.gm-mode-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
}
.gm-mode-btn:hover {
  border-color: rgba(168, 85, 247, 0.5);
  color: var(--text);
}
.gm-mode-btn.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-color: transparent;
  color: #fff;
}

/* ── Difficulty bar ── */
.gm-diff-bar {
  display: flex;
  gap: 0.4rem;
}

.gm-diff-btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
}
.gm-diff-btn:hover {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(168, 85, 247, 0.1);
}
.gm-diff-btn.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-color: transparent;
}

/* ── Score bar ── */
.gm-scorebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 420px;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r);
}

.gm-score-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.gm-stone {
  font-size: 1.2rem;
  line-height: 1;
}

.gm-score-val {
  font-family: 'Syne', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  min-width: 1.5rem;
  text-align: center;
}

.gm-status {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--dim);
  text-align: center;
  flex: 1;
}

/* ── Board ── */
.gm-board-wrap {
  overflow-x: auto;
  width: 100%;
  display: flex;
  justify-content: center;
  -webkit-overflow-scrolling: touch;
}

.gm-board {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  width: min(600px, 95vw);
  height: min(600px, 95vw);
  background-color: #1a1a2e;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: calc(100% / 14) calc(100% / 14);
  background-position: calc(100% / 28) calc(100% / 28);
  border-radius: var(--rs);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

/* ── Cells ── */
.gm-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t);
}

/* Intersection dot for empty cells */
.gm-cell:not(.black):not(.white)::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: block;
}

/* Black stone */
.gm-cell.black::after {
  content: '';
  display: block;
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #666, #111);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.15);
  position: absolute;
}

/* White stone */
.gm-cell.white::after {
  content: '';
  display: block;
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #ccc);
  border: 1px solid #888;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  position: absolute;
}

/* Last-move marker */
.gm-cell.last-move::before {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  z-index: 2;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.8);
}
.gm-cell.black.last-move::before,
.gm-cell.white.last-move::before {
  /* keep ::before for red dot, ::after for stone */
  display: block;
}

/* Win cell glow */
.gm-cell.win-cell::after {
  box-shadow:
    0 0 0 3px rgba(251, 191, 36, 0.9),
    0 0 12px rgba(251, 191, 36, 0.6),
    0 0 24px rgba(251, 191, 36, 0.3);
  animation: gm-win-pulse 0.7s ease-in-out infinite alternate;
}

@keyframes gm-win-pulse {
  from { box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.7), 0 0 8px rgba(251, 191, 36, 0.5); }
  to   { box-shadow: 0 0 0 4px rgba(251, 191, 36, 1),   0 0 20px rgba(251, 191, 36, 0.8); }
}

/* Hover preview */
.gm-cell.hover-black:not(.black):not(.white):hover::after {
  content: '';
  display: block;
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #666, #111);
  opacity: 0.4;
  position: absolute;
}

.gm-cell.hover-white:not(.black):not(.white):hover::after {
  content: '';
  display: block;
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #ccc);
  border: 1px solid #888;
  opacity: 0.4;
  position: absolute;
}

/* Remove dot ::before when hovering with stone preview */
.gm-cell.hover-black:not(.black):not(.white):hover::before,
.gm-cell.hover-white:not(.black):not(.white):hover::before {
  display: none;
}

/* ── Actions ── */
.gm-actions {
  display: flex;
  justify-content: center;
}

.btn-gm-new {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
}
.btn-gm-new:hover {
  border-color: rgba(168, 85, 247, 0.5);
  color: var(--text);
  background: rgba(168, 85, 247, 0.08);
}

/* ── SEO section ── */
.gm-seo {
  margin-top: 0.5rem;
  text-align: center;
  max-width: 600px;
}
.gm-seo h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.gm-seo p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Overlay ── */
.gm-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 26, 0.75);
  backdrop-filter: blur(6px);
}

.gm-result-card {
  background: var(--bg2, #0d0d2b);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r);
  padding: 2rem 2.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
  animation: gm-card-in 0.25s ease;
}

@keyframes gm-card-in {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.gm-result-emoji {
  font-size: 3rem;
  line-height: 1;
}

.gm-result-card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

/* btn-primary (shared from style.css, redefined here for safety) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.6rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--t), transform var(--t);
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* ── Mobile ── */
@media (max-width: 480px) {
  .gm-board {
    width: 95vw;
    height: 95vw;
  }

  .gm-cell {
    min-width: 0;
    min-height: 0;
  }

  .gm-result-card {
    padding: 1.5rem 1.5rem;
    margin: 1rem;
  }
}
