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

html, body {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #fff;
}

#game-wrap {
  position: relative;
  height: 96dvh;
  aspect-ratio: 2 / 3;
  max-width: 100vw;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Mobile: fill the whole screen */
@media (pointer: coarse), (max-width: 600px) {
  #game-wrap {
    width: 100vw;
    height: 100dvh;
    aspect-ratio: auto;
  }

  canvas,
  .overlay {
    border-radius: 0;
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  text-align: center;
  padding: 20px;
}

.overlay.hidden,
.hidden {
  display: none;
}

h1 {
  font-size: 2.4rem;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

h2 {
  font-size: 2rem;
}

.hint {
  opacity: 0.85;
}

.tap-prompt {
  font-weight: bold;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.upload-panel {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.upload-row label {
  min-width: 90px;
  text-align: left;
}

.upload-row input[type="file"] {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  color: #ddd;
}

.preview {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.3);
}

.badge {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #73bf2e;
  color: #fff;
  font-size: 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
}

.error {
  color: #ff7b7b;
  font-size: 0.8rem;
}

#reset-images {
  align-self: center;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: #e0a800;
  color: #222;
  font-weight: bold;
  cursor: pointer;
}

#reset-images:hover {
  background: #ffc107;
}
