/* Basic reset & box-sizing */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body styling */
body {
  font-family: 'Trebuchet MS', Helvetica, sans-serif;
  background: linear-gradient(135deg, #333 0%, #111 100%);
  color: #f4f4f4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* Title */
.retro-title {
  font-size: 2rem;
  margin-bottom: 15px;
  color: #fffb00;
  text-shadow: 2px 2px #333;
}

/* Game Wrapper */
.game-wrapper {
  background: #222;
  border: 2px solid #555;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
  margin-bottom: 20px;
}

/* Controls (slider) */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}
.controls label {
  font-weight: bold;
}
#numCansRange {
  width: 120px;
}

/* Stats row */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 15px;
}
.stat {
  font-weight: bold;
  font-size: 1rem;
}

/* Cans Container */
.cans-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 120px;
  margin-bottom: 20px;
}

/* The "can" look */
.can {
  width: 50px;
  height: 90px;
  background: #999;
  border-radius: 10px;
  position: relative;
  cursor: grab;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
}
.can:hover {
  transform: scale(1.05);
}
/* The color overlay (the can's actual color) */
.can::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 4px;
  right: 4px;
  bottom: 8px;
  background: currentColor;
  border-radius: 6px;
}
/* The top ring of the can */
.can::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: linear-gradient(to bottom, #eee 0%, #ccc 100%);
  border-radius: 10px 10px 0 0;
}
/* Dragging state */
.can.dragging {
  opacity: 0;
  cursor: grabbing;
}
.can.touch-dragging {
  opacity: 0.5; /* Semi-transparent but still visible */
}
.can.touch-hover {
  opacity: 0.7;
  transform: scale(1.05);
  transition: all 0.1s ease;
}
.drag-preview {
  pointer-events: none; /* So it doesn't interfere with the touch events */
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* Action Buttons */
.actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
}
.actions button {
  padding: 8px 12px;
  border: 2px solid #fffb00;
  background: #444;
  color: #fff;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}
.actions button:hover {
  background: #666;
}

/* Name form */
.name-form {
  display: none; /* shown only after winning */
  text-align: center;
  margin-bottom: 10px;
}

/* Match button styles used elsewhere */
.name-form button {
  padding: 8px 12px;
  border: 2px solid #fffb00;
  background: #444;
  color: #fff;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: 8px;
}

.name-form button:hover {
  background: #666;
}

/* Match input sizing and dark background theme */
.name-form input[type="text"] {
  padding: 8px 12px;
  border-radius: 4px;
  border: none;
  font-size: 1rem;
  background: #444;
  color: #fff;
}
/* Scoreboard */
.scoreboard {
  max-width: 600px;
  width: 100%;
}
.scoreboard h2 {
  text-align: center;
  margin-bottom: 10px;
  color: #fffb00;
}
.scoreboard-list {
  background: #222;
  border: 2px solid #555;
  border-radius: 8px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
}
.scoreboard-list table {
  width: 100%;
  border-collapse: collapse;
  color: #f4f4f4;
}
.scoreboard-list th, .scoreboard-list td {
  text-align: left;
  padding: 5px;
  border-bottom: 1px solid #444;
}
.scoreboard-list tr:hover {
  background: #2e2e2e;
}

/* Responsive: remove the "box" on smaller screens */
@media (max-width: 600px) {
  .game-wrapper {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 10px;
  }
  .retro-title {
    font-size: 1.6rem;
  }
  .can {
    width: 40px;
    height: 70px;
  }
  .stats-row {
    gap: 15px;
  }
  .actions {
    margin-bottom: 10px;
  }
  .scoreboard {
    max-width: 100%;
  }
}
