:root {
  --primary: #00CEC9;
  --secondary: #81ECEC;
  --accent: #E17055;
  --background: #0A1A1A;
  --surface: #1e293b;
  --surface-glass: rgba(30, 41, 59, 0.7);
  --text: #ffffff;
  --text-muted: #94a3b8;
  --radius: 12px;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--background);
  color: var(--text);
  font-family: var(--font-family);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 600px; /* Constrain on large screens */
  max-height: 800px;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 10px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.stats {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-item span {
  color: var(--text);
  font-weight: 600;
}

/* Canvas */
canvas {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  touch-action: none; /* Prevent scrolling on mobile */
  margin: auto;
  flex-grow: 1; /* Allow it to take available space */
  max-height: 600px; /* Limit height */
  width: 100%; /* Responsive width */
}

/* Controls */
#controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 20px;
}

button {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  padding: 12px;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

button.primary {
  background: var(--primary);
  color: #000;
  border: none;
}

button.primary:hover {
  background: var(--secondary);
}

button.active {
  background: var(--secondary);
  color: #000;
  border-color: var(--secondary);
}

/* Number Pad (Optional, if we want on-screen numbers) */
#numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  margin-top: 10px;
}

#numpad button {
  padding: 10px 0;
  font-size: 1.2rem;
}

/* Overlay */
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 26, 26, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: var(--radius);
}

#overlay h2 {
  font-size: 2rem;
  margin-bottom: 30px;
  color: var(--text);
}

.difficulty-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 200px;
}

.difficulty-btn {
  padding: 15px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 1.1rem;
}

.difficulty-btn:hover {
  background: var(--primary);
  color: #000;
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 500px) {
  #numpad {
    grid-template-columns: repeat(5, 1fr);
  }
  #numpad button:nth-child(10) {
    grid-column: span 1; /* Adjust if needed */
  }
}
