:root {
  --bg: #1e1e1e;
  --text: #fff;
  --tile: #4caf50;
  --panel: #2c2c2c;
}

body.light {
  --bg: #f5f5f5;
  --text: #111;
  --tile: #2196f3;
  --panel: #fff;
}

body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  margin: 0;
  padding: 20px;
}

h1 {
  margin-bottom: 15px;
  font-size: 2em;
}

.info span {
  margin: 0 10px;
  display: inline-block;
  font-size: 1em;
}

.controls {
  margin: 15px 0;
}

button {
  padding: 8px 16px;
  margin: 0 5px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-size: 1em;
}

.puzzle {
  width: 90vw;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  margin: 20px auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.tile {
  background: var(--tile);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5vw;
  font-weight: bold;
  border-radius: 6px;
  user-select: none;
  transition: transform 0.3s ease;
}

.empty {
  background: transparent;
}

/* Win Screen */
.win-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-box {
  background: var(--panel);
  padding: 20px 30px;
  border-radius: 10px;
  width: 80%;
  max-width: 350px;
}

.hidden {
  display: none;
}

/* Responsive text */
@media (max-width: 500px) {
  h1 {
    font-size: 1.5em;
  }
  button {
    font-size: 0.9em;
    padding: 6px 12px;
  }
  .tile {
    font-size: 8vw;
  }
}
