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

body {
  background: #1a1a2e;
  color: #eee;
  font-family: "Segoe UI", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

h1 {
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: #e0e0ff;
}

#subtitle {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 20px;
}

#hud {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 20px;
}

#streak-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  padding: 10px 24px;
  text-align: center;
}

#streak-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
}

#streak-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: #e94560;
  line-height: 1.1;
}

#best-streak-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  padding: 10px 24px;
  text-align: center;
}

#best-streak-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
}

#best-streak-value {
  font-size: 2.4rem;
  font-weight: 700;
  color: #44ee88;
  line-height: 1.1;
}

#feedback {
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 1.4em;
  color: #f0c040;
}

#canvas-wrapper {
  background: #16213e;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 724px;
}

#piece-grid {
  display: grid;
  gap: 12px;
}

#count-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  padding: 10px 18px;
  text-align: center;
}

#count-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin-bottom: 4px;
}

#num-pieces-input {
  width: 52px;
  font-size: 1.6rem;
  font-weight: 700;
  color: #e0e0ff;
  background: transparent;
  border: none;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

#num-pieces-input::-webkit-outer-spin-button,
#num-pieces-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.piece-img {
  display: block;
  cursor: pointer;
  border-radius: 4px;
  transition: box-shadow 0.1s, transform 0.5s ease;
  width: 100%;
  aspect-ratio: 1;
}

.piece-img.selected         { box-shadow: 0 0 0 4px #f0c040; }
.piece-img.correct          { box-shadow: 0 0 0 4px #44ee88; }
.piece-img.feedback-correct { box-shadow: 0 0 0 5px #44ee88; }
.piece-img.feedback-wrong   { box-shadow: 0 0 0 5px #ff4444; }

#instructions {
  margin-top: 16px;
  font-size: 0.82rem;
  color: #666;
  text-align: center;
}

@media (max-width: 500px) {
  h1 { font-size: 1.1rem; }

  #hud {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  #streak-box,
  #best-streak-box,
  #count-box {
    padding: 8px 16px;
  }

  #streak-value,
  #best-streak-value {
    font-size: 1.8rem;
  }
}
