* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #f5f1e8;
  background:
    linear-gradient(rgba(10, 24, 18, 0.8), rgba(10, 24, 18, 0.94)),
    radial-gradient(circle at top, #2f7853, transparent 34%),
    #081510;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  width: min(100%, 880px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.topbar {
  display: grid;
  grid-template-columns: 96px 1fr 96px;
  align-items: center;
  gap: 16px;
}

.title-block {
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
}

#status {
  min-height: 28px;
  margin: 6px 0 0;
  color: #cfe3ce;
  font-weight: 800;
}

.back-link,
#resetBtn {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: #f5f1e8;
  background: rgba(19, 49, 36, 0.84);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.back-link:hover,
#resetBtn:hover {
  background: rgba(37, 100, 70, 0.92);
}

.score-row {
  width: min(100%, 540px);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.score-row span {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
}

#board {
  width: min(90vw, 70vh, 620px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0b4f35, #062616);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
  touch-action: manipulation;
  user-select: none;
}

.cell {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: linear-gradient(135deg, #188052, #0f5b37);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
}

.cell.valid::after {
  content: "";
  width: 24%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(244, 223, 126, 0.8);
  box-shadow: 0 0 14px rgba(244, 223, 126, 0.6);
}

.disc {
  width: 76%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 8px 10px rgba(255, 255, 255, 0.18), inset 0 -10px 14px rgba(0, 0, 0, 0.34), 0 10px 12px rgba(0, 0, 0, 0.3);
}

.disc.black {
  background: radial-gradient(circle at 35% 25%, #555, #080808 70%);
}

.disc.white {
  background: radial-gradient(circle at 35% 25%, #fff, #c9c5b8 72%);
}

@media (max-width: 620px) {
  .game-shell {
    padding: 14px;
    justify-content: start;
  }

  .topbar {
    grid-template-columns: 1fr 1fr;
  }

  .title-block {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .back-link,
  #resetBtn {
    grid-row: 2;
  }
}
