.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 0;
  background: var(--board-line);
  border: 3px solid var(--board-border-outer);
  width: min(88vw, 88vh, 480px);
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  border-radius: 10px;
  box-shadow:
    0 16px 48px rgba(0,0,0,0.5),
    0 4px 16px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.14);
  aspect-ratio: 1 / 1;
  transition: opacity 0.4s ease;
  flex-shrink: 0;
  cursor: default;
  overflow: hidden;
}

.board::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(140deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 40%, transparent 70%);
  pointer-events: none;
  z-index: 2;
}

.board::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(circle, rgba(0,0,0,0.5) 2.5px, transparent 2.5px) calc(100%/8*2 + 100%/16) calc(100%/8*2 + 100%/16),
    radial-gradient(circle, rgba(0,0,0,0.5) 2.5px, transparent 2.5px) calc(100%/8*6 + 100%/16) calc(100%/8*2 + 100%/16),
    radial-gradient(circle, rgba(0,0,0,0.5) 2.5px, transparent 2.5px) calc(100%/8*2 + 100%/16) calc(100%/8*6 + 100%/16),
    radial-gradient(circle, rgba(0,0,0,0.5) 2.5px, transparent 2.5px) calc(100%/8*6 + 100%/16) calc(100%/8*6 + 100%/16);
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.board.shake {
  animation: boardShake 0.5s ease-in-out;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  background: var(--cell-bg);
  border-right: 1px solid var(--board-line);
  border-bottom: 1px solid var(--board-line);
  transition: background 0.18s ease;
  overflow: visible;
}

.cell:nth-child(8n) { 
  border-right: none;
}

.cell:nth-last-child(-n+8) { 
  border-bottom: none;
}

.cell:hover { 
  background: var(--cell-hover-bg);
}

.cell.valid-move {
  cursor: pointer;
  background: var(--valid-cell-bg);
}

.cell.valid-move::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 28%,
    var(--valid-glow-overlay) 62%
  );
  animation: validCellGlow 1.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

.cell.valid-move:hover {
  background: var(--valid-cell-hover-bg);
}

.cell.valid-move:hover::after {
  animation: none;
  opacity: 0.9;
}

.cell.preview-placing { background: var(--cell-bg) !important;
}

.cell.preview-placing::after { opacity: 0 !important; 
  animation: none !important;
}

.disc-scale-wrapper {
  position: absolute;
  width: 82%;
  height: 82%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  filter:
    drop-shadow(0 4px 8px rgba(0,0,0,0.7))
    drop-shadow(0 1px 3px rgba(0,0,0,0.5))
    drop-shadow(0 0 1px rgba(0,0,0,0.3));
  z-index: 2;
  transition: opacity 0.2s ease;
}

.disc-scale-wrapper.place-anim {
  animation: placeDiscWrapper 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  transform-style: preserve-3d;
}

.disc.is-flipping {
  animation-duration: 0.36s;
  animation-timing-function: cubic-bezier(0.35, 0, 0.25, 1);
  animation-fill-mode: forwards;
}

.disc.flip-to-white { 
  animation-name: flipToWhite;
}

.disc.flip-to-black { 
  animation-name: flipToBlack;
}

.disc-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.disc-black {
  background: #111111;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(0,0,0,0.7),
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 2px 4px rgba(0,0,0,0.4);
}

.disc-white {
  transform: rotateY(180deg);
  background: #f5f5f5;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(0,0,0,0.14),
    inset 0 0 0 1px rgba(0,0,0,0.07),
    0 2px 4px rgba(0,0,0,0.18);
}


.disc-ghost-wrapper {
  position: absolute;
  width: 82%;
  height: 82%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.15s ease;
  will-change: opacity;
}

.disc-ghost-wrapper.ghost-visible {
  opacity: 0.92;
}

.disc-ghost-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.disc-ghost-black {
  background: #111111;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(0,0,0,0.7),
    inset 0 0 0 1px rgba(255,255,255,0.08);
}

.disc-ghost-white {
  background: #f5f5f5;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(0,0,0,0.14),
    inset 0 0 0 1px rgba(0,0,0,0.07);
}

.info {
  margin: 36px 0 3px;
  font-weight: 600;
  font-size: 0.9rem;
  min-height: 1.6em;
  color: var(--text);
  transition: opacity 0.2s ease;
}

.score-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 12px;
  width: auto;
  max-width: 480px;
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  flex: 1;
  max-width: 160px;
}

.score-pill.black-pill {
  justify-content: flex-start;
}

.score-pill.white-pill {
  justify-content: flex-end;
}

.score-pill-disc {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

.black-pill .score-pill-disc {
  background: #000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  outline: 1px solid var(--border);
}

.white-pill .score-pill-disc {
  background: #f2f2f2;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  outline: 1px solid rgba(0,0,0,0.1);
}

.score-pill-count {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  min-width: 28px;
  text-align: center;
  line-height: 1;
}

.score-pill-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 24px;
}

.gamebutton-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 0;
  flex-wrap: wrap;
}

.sub-info {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--meta-text);
  overflow: hidden;
  max-height: 0;
  margin: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease;
}

.sub-info.has-text {
  max-height: 3em;
  margin: 2px 0 4px;
  opacity: 1;
}