* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: #0C0D14;
  font-family: 'Courier New', monospace;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px;
  max-width: 480px;
  width: 100%;
}

/* -- Header -------------------------------------------------- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  color: #ffcc00;
  text-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
}

.scores {
  display: flex;
  gap: 10px;
}

.score-box {
  background: #1a1b26;
  border: 1px solid #2a2b3a;
  border-radius: 8px;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.score-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
}

.score-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

/* -- Stats Row ----------------------------------------------- */

.stats-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 4px;
}

.stat {
  font-size: 13px;
  color: #888;
  letter-spacing: 0.5px;
}

/* -- Board --------------------------------------------------- */

.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 12px;
  background: #1a1b26;
  border-radius: 12px;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  border: 1px solid #2a2b3a;
}

.cell {
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
  aspect-ratio: 1;
  border: none;
  outline: none;
}

.cell:active {
  transform: scale(0.93);
}

.cell.off {
  background: #1e2030;
  border: 1px solid #2a2b3a;
}

.cell.on {
  background: #ffcc00;
  box-shadow: 0 0 16px rgba(255, 204, 0, 0.4);
  border: 1px solid #ffdd44;
}

/* -- Buttons ------------------------------------------------- */

.buttons-row {
  display: flex;
  gap: 10px;
}

.action-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  background: #00ff88;
  color: #0C0D14;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-transform: uppercase;
}

.action-btn:hover {
  background: #33ffaa;
}

.action-btn:active {
  transform: scale(0.96);
}

.action-btn.secondary {
  background: #2a2b3a;
  color: #fff;
}

.action-btn.secondary:hover {
  background: #3a3b4a;
}

/* -- Overlay ------------------------------------------------- */

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(12, 13, 20, 0.85);
  border-radius: 12px;
  z-index: 100;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

.overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-text {
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  letter-spacing: -1px;
  color: #00ff88;
}

.overlay-sub {
  font-size: 16px;
  color: #aaa;
  text-align: center;
  line-height: 1.5;
}

.overlay-btn {
  padding: 12px 32px;
  border: none;
  border-radius: 8px;
  background: #00ff88;
  color: #0C0D14;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.15s, transform 0.1s;
}

.overlay-btn:hover {
  background: #33ffaa;
}

.overlay-btn:active {
  transform: scale(0.96);
}

/* -- Responsive ---------------------------------------------- */

@media (max-width: 420px) {
  .container {
    padding: 12px;
    gap: 10px;
  }
  .title {
    font-size: 22px;
  }
  .board {
    gap: 4px;
    padding: 8px;
    border-radius: 10px;
    max-width: 280px;
  }
  .cell {
    border-radius: 6px;
  }
}
