:root {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --accent-color: #bb86fc;
  --secondary-color: #03dac6;
  --surface-color: #1e1e1e;
  --tile-color: #2c2c2c;
  --tile-text-color: #ffffff;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  background: radial-gradient(circle at center, #2e2e2e 0%, #121212 100%);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 500px;
  padding: 20px;
  text-align: center;
  position: relative;
}

header {
  margin-bottom: 20px;
}

h1 {
  font-weight: 300;
  margin-bottom: 10px;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(187, 134, 252, 0.3);
}

.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

button, select {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background-color: var(--surface-color);
  background: linear-gradient(145deg, #2e2e2e, #1e1e1e);
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 3px 3px 6px rgba(0,0,0,0.4), -1px -1px 4px rgba(255,255,255,0.05);
}

button:hover, select:hover {
  background: linear-gradient(145deg, #3e3e3e, #2e2e2e);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.5), inset -2px -2px 5px rgba(255,255,255,0.05);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#solve-btn {
  background: linear-gradient(145deg, #03dac6, #018786);
  color: #000;
  font-weight: bold;
}

#solve-btn:hover {
  filter: brightness(1.1);
  background: linear-gradient(145deg, #03dac6, #018786);
}

.stats-bar {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  background-color: var(--surface-color);
  background: rgba(30, 30, 30, 0.8);
  backdrop-filter: blur(5px);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.stat {
  display: flex;
  flex-direction: column;
}

.label {
  font-size: 0.8rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.value {
  font-size: 1.4rem;
  font-weight: bold;
  color: #fff;
}

.game-area {
  display: flex;
  justify-content: center;
}

canvas {
  background-color: var(--surface-color);
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  max-width: 100%;
}

#win-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(18, 18, 18, 0.95);
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  z-index: 100;
  border: 2px solid var(--accent-color);
  box-shadow: 0 0 30px rgba(187, 134, 252, 0.2);
  width: 90%;
  max-width: 400px;
  backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}

#win-message h2 {
  color: var(--accent-color);
  margin-bottom: 20px;
  font-size: 2rem;
}

#win-message p {
  margin-bottom: 10px;
  font-size: 1.2rem;
  color: #ccc;
}

#win-message span {
    color: #fff;
    font-weight: bold;
}

#play-again-btn {
  margin-top: 25px;
  background: linear-gradient(145deg, #bb86fc, #9a67ea);
  color: #000;
  font-weight: bold;
  width: 100%;
  padding: 12px;
}

#play-again-btn:hover {
    filter: brightness(1.1);
}
