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

body {
  background: #202124;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e8eaed;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

#back-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  color: #fff;
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #5f6368;
  transition: background 0.2s;
  line-height: 1;
}

#back-btn:hover {
  background: #80868b;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
}

#header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 400px;
  padding: 0 4px;
  font-size: 18px;
  font-weight: 500;
}

#high-score-display {
  color: #9aa0a6;
}

#board-canvas {
  border-radius: 12px;
  display: block;
}

#pieces-tray {
  display: flex;
  justify-content: center;
  gap: 20px;
  min-height: 100px;
  align-items: center;
}

.piece-holder {
  cursor: grab;
  touch-action: none;
  transition: transform 0.15s, opacity 0.15s;
}

.piece-holder:active {
  cursor: grabbing;
}

.piece-holder.dragging {
  opacity: 0.5;
  transform: scale(0.9);
}

.piece-holder.used {
  visibility: hidden;
}

.piece-canvas {
  display: block;
}

/* Overlay */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
}

#overlay.hidden {
  display: none;
}

#overlay-content {
  text-align: center;
  background: rgba(32, 33, 36, 0.95);
  padding: 48px 56px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#overlay-content h1 {
  font-size: 44px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #ff7043;
}

#overlay-message {
  font-size: 16px;
  color: #9aa0a6;
  margin-bottom: 28px;
}

#start-btn {
  background: #ff7043;
  color: #fff;
  border: none;
  padding: 14px 48px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#start-btn:hover {
  background: #f4511e;
  transform: scale(1.04);
}

#start-btn:active {
  transform: scale(0.97);
}

/* Floating drag piece */
#drag-preview {
  position: fixed;
  pointer-events: none;
  z-index: 100;
}

@media (max-width: 480px) {
  #header {
    font-size: 16px;
  }

  #pieces-tray {
    gap: 12px;
  }

  #overlay-content {
    padding: 32px 28px;
  }

  #overlay-content h1 {
    font-size: 32px;
  }
}
