* { box-sizing: border-box; }

:root {
  --brand: #4a1f2e;
  --brand-light: #7a3a4d;
  --bg: #fdfaf5;
  --ground: #4a1f2e;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

#game-wrap {
  position: relative;
  width: min(900px, 96vw);
  border: 3px solid var(--brand);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(74, 31, 46, 0.15);
}

#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
}

#highscore {
  opacity: 0.6;
  font-size: 14px;
  flex: 1 1 auto;
}

#score {
  flex: 0 0 auto;
  text-align: right;
}

#mute-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--brand);
}

#mute-btn:hover {
  background: rgba(74, 31, 46, 0.08);
}

#stage {
  position: relative;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 1;
  background: #ffffff;
  touch-action: manipulation;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  gap: 8px;
  padding: 20px;
}

#overlay.hidden {
  display: none;
}

#overlay-logo {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(74, 31, 46, 0.2));
}

#overlay-title {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: 2px;
}

#overlay-msg {
  margin: 0;
  font-size: 14px;
  opacity: 0.75;
}

@media (max-width: 480px) {
  #hud { font-size: 14px; padding: 8px 10px; }
  #highscore { font-size: 11px; }
  #mute-btn { font-size: 15px; padding: 3px 6px; }
  #overlay-title { font-size: 15px; letter-spacing: 1px; }
  #overlay-msg { font-size: 12px; }
  #overlay-logo { width: 56px; height: 56px; }
  #overlay { gap: 6px; padding: 12px; }
}

@media (max-width: 340px) {
  #hud { font-size: 12px; }
  #highscore { display: none; }
}
