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

html, body {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #232946, #12121f 75%);
  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(12, 16, 34, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: 8px;
  text-align: center;
  padding: 20px;
}

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

h1 {
  font-size: 2.6rem;
  letter-spacing: 1px;
  color: #ffd94a;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.35),
    0 0 22px rgba(255, 220, 80, 0.35);
}

h2 {
  font-size: 2.1rem;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.hint {
  opacity: 0.85;
}

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

@keyframes bounce {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50% { opacity: 0.5; transform: translateY(4px); }
}

.score-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 22px;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 1.05rem;
}

.score-row span:last-child {
  font-weight: bold;
  color: #ffd94a;
}

.new-best {
  color: #ffd84d;
  font-weight: bold;
  text-shadow: 0 0 14px rgba(255, 216, 77, 0.6);
  animation: bounce 1s ease-in-out infinite;
}

.upload-panel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  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: 7px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffd23f, #e0a800);
  color: #3a2c00;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.1s, box-shadow 0.1s;
}

#reset-images:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}

#reset-images:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
