:root {
  --color-primary: #00B894;
  --color-secondary: #55EFC4;
  --color-accent: #FDCB6E;
  --color-background: #0A1F1C;
  --color-surface: #122926;
  --color-text: #ffffff;
  --color-text-muted: #a0aec0;

  --radius: 12px;
  --font-family: 'Inter', sans-serif;
}

body {
  margin: 0;
  padding: 20px 0;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-family);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.container {
  width: 500px;
  margin: 0 auto;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.title {
  font-size: 80px;
  font-weight: 700;
  margin: 0;
  color: var(--color-primary);
  text-shadow: 0 0 10px rgba(0, 184, 148, 0.3);
}

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

.score-container, .best-container {
  background: var(--color-surface);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-container::before { content: "SCORE"; font-size: 10px; color: var(--color-text-muted); }
.best-container::before { content: "BEST"; font-size: 10px; color: var(--color-text-muted); }

.above-game {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.game-intro {
  margin: 0;
  color: var(--color-text-muted);
}

.restart-button {
  background: var(--color-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, background 0.2s;
  user-select: none;
}

.restart-button:hover {
  background: var(--color-secondary);
  transform: translateY(-2px);
}

.game-container {
  position: relative;
  width: 500px;
  height: 500px;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 15px; /* Padding for the grid background */
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  touch-action: none; /* Prevent default touch actions like scrolling */
}

#game-canvas {
  width: 100%;
  height: 100%;
  border-radius: 6px; /* Inner radius */
  display: block;
}

.game-message {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(10, 31, 28, 0.8); /* Glassmorphism background */
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--radius);
  backdrop-filter: blur(4px);
}

.game-message p {
  font-size: 60px;
  font-weight: bold;
  margin-bottom: 20px;
}

.game-message.game-won {
  display: flex;
  color: var(--color-accent);
}

.game-message.game-over {
  display: flex;
  color: var(--color-text);
}

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

.retry-button, .keep-playing-button {
  background: var(--color-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  user-select: none;
}

.game-explanation {
  margin-top: 30px;
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

@media screen and (max-width: 520px) {
  .container {
    width: 320px; /* Mobile width */
  }
  .title {
    font-size: 40px;
  }
  .game-container {
    width: 320px;
    height: 320px;
  }
}
