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

html, body {
  height: 100%;
  background: #1b1440;
  overflow: hidden;
  font-family: 'Trebuchet MS', 'Segoe UI', Arial, sans-serif;
  color: #2d2450;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 480px;
  max-width: 100vw;
  height: 720px;
  max-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, #fff6e6 0%, #ffe9d6 100%);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#hud {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  font-size: 15px;
  font-weight: bold;
  color: #4a3a8a;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

#livesBox {
  display: flex;
  gap: 4px;
  font-size: 18px;
}

#prompt-banner {
  position: absolute;
  top: 46px;
  left: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid #ff8a3d;
  border-radius: 14px;
  padding: 10px 14px 8px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

#prompt-banner.hidden {
  display: none;
}

#promptText {
  font-size: 22px;
  font-weight: 800;
  color: #d1420e;
  letter-spacing: 1px;
  display: inline-block;
}

#timerBar {
  margin-top: 6px;
  height: 8px;
  border-radius: 6px;
  background: #f0d9c8;
  overflow: hidden;
}

#timerFill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #6de08b, #ffd35f, #ff5f5f);
  border-radius: 6px;
  transition: width 0.08s linear;
}

#muteBtn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.85);
  color: #4a3a8a;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 5;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(27,20,64,0.94), rgba(45,36,80,0.94));
  text-align: center;
  padding: 24px;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 1px;
  color: #ffd35f;
  text-shadow: 0 0 18px rgba(255, 211, 95, 0.6);
}

.overlay .sub {
  color: #d8d2f5;
  max-width: 340px;
  font-size: 14px;
  line-height: 1.5;
}

.level-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 360px;
}

.chip {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  color: #fff;
}

#finalScore {
  font-size: 22px;
  color: #7fe8ff;
  letter-spacing: 1px;
}

.overlay h1.gold {
  color: #ffd35f;
  text-shadow: 0 0 24px rgba(255, 211, 95, 0.85), 0 0 50px rgba(255, 211, 95, 0.4);
}

.score-line {
  font-size: 20px;
  color: #7fe8ff;
  letter-spacing: 1px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

button.secondary {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.5);
  box-shadow: none;
  color: #fff;
}

#newBest {
  color: #ffd35f;
  font-size: 14px;
  letter-spacing: 2px;
}

#newBest.hidden {
  display: none;
}

button {
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 1px;
  padding: 12px 26px;
  background: linear-gradient(180deg, #ff8a3d, #ff5f5f);
  border: none;
  border-radius: 24px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 95, 95, 0.45);
  transition: transform 0.1s ease;
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

@media (max-width: 500px) {
  #game-container {
    width: 100vw;
    height: 100vh;
  }
}
