html {
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  font-family: sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Rotate Device Overlay - only shown on narrow/tall touch screens */
#rotateOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0d1b2a;
  z-index: 600;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
}

.rotate-icon {
  font-size: clamp(40px, 12vw, 64px);
  animation: rotateHint 1.6s ease-in-out infinite;
}

@keyframes rotateHint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

.rotate-text {
  margin-top: 18px;
  color: #ffffff;
  font-size: clamp(16px, 5vw, 24px);
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #000;
}

.rotate-subtext {
  margin-top: 8px;
  color: #94a3b8;
  font-size: clamp(12px, 3.5vw, 16px);
  font-weight: 600;
}

/* Show it only on phones/tablets in portrait orientation */
@media (max-aspect-ratio: 1/1) and (pointer: coarse) {
  #rotateOverlay {
    display: flex;
  }
}

#renderCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* HUD Overlay */
#ui {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
}

/* Bullet Counter (Top Left) */
#bulletCount {
  position: absolute;
  top: 15px;
  left: 20px;
  color: white;
  font-size: clamp(16px, 3vw, 24px);
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Boss Health Bar Container (Top Center) */
#bossHPBarContainer {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, 60vw);
  height: clamp(14px, 3vh, 24px);
  background: #333;
  border: 2px solid #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

#bossHPBar {
  width: 100%;
  height: 100%;
  background: #d33;
  transition: width 0.15s ease-out;
}

/* Coin Display (Top Right) */
#coinDisplay {
  position: absolute;
  top: 15px;
  right: 25px;
  font-family: 'Arial', sans-serif;
  font-size: clamp(16px, 3.2vw, 26px);
  font-weight: 800;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  gap: 8px;
}

#coinDisplay img {
  width: clamp(22px, 4.5vw, 34px);
  height: clamp(22px, 4.5vw, 34px);
  object-fit: contain;
}

/* Control Hint (bottom center, auto-fades after 4s) */
#controlHint {
  position: absolute;
  bottom: clamp(30px, 8vh, 60px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: clamp(8px, 2vw, 14px);
  background: rgba(0, 0, 0, 0.45);
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

#controlHint.show {
  opacity: 1;
}

.hint-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  color: #fff;
}

.hint-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
  margin: 4px 0;
}

.hint-label {
  font-size: clamp(11px, 2.2vw, 14px);
  font-weight: bold;
  letter-spacing: 1px;
  opacity: 0.85;
}

.hint-arrow {
  font-size: clamp(12px, 2.4vw, 16px);
  opacity: 0.7;
}

.hint-keys {
  display: flex;
  gap: 8px;
}

.hint-key {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(22px, 5vw, 30px);
  height: clamp(22px, 5vw, 30px);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  font-weight: bold;
  font-size: clamp(11px, 2.5vw, 15px);
}

.hint-swipe-icon {
  font-size: clamp(18px, 4vw, 26px);
}

.hint-or {
  font-size: clamp(9px, 1.8vw, 12px);
  opacity: 0.6;
  letter-spacing: 0.5px;
}

.hint-caption {
  font-size: clamp(10px, 2.2vw, 14px);
  opacity: 0.8;
  font-weight: 600;
}

.hint-key-wide {
  width: auto;
  min-width: 30px;
  padding: 0 6px;
}

/* Level Completed Result Screen Overlay */
#resultScreen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(13, 27, 42, 0.94);
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 40px 20px;
  box-sizing: border-box;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#resultScreen.show {
  opacity: 1;
  pointer-events: auto;
}

/* Top Banner Header */
.level-completed-header {
  width: 100%;
  max-width: 600px;
  background: linear-gradient(180deg, #1e3a8a 0%, #1d4ed8 100%);
  border: 3px solid #60a5fa;
  border-radius: 14px;
  color: #ffffff;
  font-size: clamp(18px, 4.5vw, 28px);
  font-weight: 800;
  text-align: center;
  padding: 18px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Earned Section Box */
.result-content-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.earned-label {
  color: #94a3b8;
  font-size: clamp(13px, 3vw, 18px);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0px #3b0764;
}

.earned-amount-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #334155;
  padding: clamp(8px, 2vh, 14px) clamp(16px, 5vw, 35px);
  border-radius: 18px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

#rewardAmountText {
  color: #ffffff;
  font-size: clamp(24px, 6vw, 40px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
}

.coin-icon {
  width: clamp(24px, 5vw, 38px);
  height: clamp(24px, 5vw, 38px);
  object-fit: contain;
}

/* Next Level Action Button */
#restartBtn.next-level-btn {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  border: 4px solid #86efac;
  border-radius: 30px;
  padding: clamp(10px, 3vh, 18px) 0;
  font-size: clamp(16px, 4vw, 26px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 8px 0 #14532d, 0 12px 25px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease, filter 0.2s;
  margin-bottom: 20px;
}

#restartBtn.next-level-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

#restartBtn.next-level-btn:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 #14532d, 0 6px 12px rgba(0, 0, 0, 0.5);
}

.sub-key {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 1px;
  color: #dcfce7;
  font-weight: 700;
}

.level-completed-header.defeat {
  background: linear-gradient(180deg, #7f1d1d 0%, #b91c1c 100%);
  border-color: #f87171;
}

/* Start Screen Overlay */
#startScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  z-index: 200;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.upgrade-card,
#restartBtn {
  touch-action: manipulation;
}

#tapToStartPrompt {
  margin-top: 15vh;
  color: #ffffff;
  font-size: clamp(18px, 6vw, 32px);
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.9), 0 0 15px rgba(255, 255, 255, 0.6);
  animation: pulsePrompt 1.2s infinite alternate;
}

@keyframes pulsePrompt {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.08); opacity: 1; }
}

/* Upgrade Card Container */
#upgradeContainer {
  display: flex;
  gap: clamp(8px, 2.5vw, 20px);
  margin-bottom: 12vh;
  pointer-events: auto;
  flex-wrap: nowrap;
}

/* Upgrade Cards Styling */
.upgrade-card {
  position: relative;
  width: clamp(90px, 22vw, 140px);
  height: clamp(110px, 27vw, 170px);
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  border: 4px solid #581c87;
  border-radius: 16px;
  box-shadow: 0 8px 0 #3b0764, 0 12px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  box-sizing: border-box;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif;
  transition: transform 0.1s ease, filter 0.2s;
}

.upgrade-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.1);
}

.upgrade-card:active {
  transform: scale(0.96);
}

.level-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  width: clamp(20px, 5vw, 30px);
  height: clamp(20px, 5vw, 30px);
  background: #666666;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  font-size: clamp(10px, 2.5vw, 15px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.card-title {
  color: #ffffff;
  font-size: clamp(11px, 2.8vw, 16px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
}

.card-icon {
  background: linear-gradient(135deg, #d8b4fe 0%, #a855f7 100%);
  border: 3px solid #7e22ce;
  border-radius: 16px;
  width: clamp(40px, 10vw, 60px);
  height: clamp(38px, 9.5vw, 55px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.card-icon img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.card-icon.no-bg {
  background: none;
  border: none;
  box-shadow: none;
}

.card-icon.no-bg img {
  width: 100%;
  height: 100%;
}

.card-val {
  color: #ffffff;
  font-size: clamp(12px, 3vw, 18px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
}

.buy-btn {
  width: 100%;
  padding: 6px 0;
  background: none;
  border: none;
  border-radius: 20px;
  color: #ffffff;
  font-size: clamp(13px, 3.2vw, 20px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.buy-btn-icon {
  width: clamp(16px, 4vw, 24px);
  height: clamp(16px, 4vw, 24px);
  object-fit: contain;
}

.buy-btn.disabled {
  filter: grayscale(0.8);
  opacity: 0.7;
  cursor: not-allowed;
}

@media (max-width: 480px), (max-height: 500px) {
  #bulletCount, #coinDisplay {
    font-size: 14px !important;
  }
  #bossHPBarContainer {
    width: 55vw !important;
    height: 12px !important;
  }
}

/* ===== Skins Shop Button (start screen only) ===== */
#skinsBtn.skins-open-btn {
  position: absolute;
  top: 50%;
  right: clamp(15px, 4vw, 25px);
  transform: translateY(-50%);
  pointer-events: auto;
  background: linear-gradient(180deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  border: 3px solid #581c87;
  border-radius: 14px;
  padding: clamp(6px, 1.5vh, 10px) clamp(12px, 3vw, 18px);
  font-size: clamp(12px, 2.8vw, 16px);
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
  box-shadow: 0 4px 0 #3b0764, 0 6px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.2s;
}

/* Invisible larger tap target so near-misses on mobile still hit SKINS
   instead of falling through to the start screen behind it. */
#skinsBtn.skins-open-btn::before {
  content: "";
  position: absolute;
  top: -14px;
  left: -14px;
  right: -14px;
  bottom: -14px;
}

#skinsBtn.skins-open-btn:hover {
  transform: translateY(calc(-50% - 2px));
  filter: brightness(1.1);
}

#skinsBtn.skins-open-btn:active {
  transform: translateY(calc(-50% + 3px));
  box-shadow: 0 1px 0 #3b0764, 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* ===== Sound Toggle Buttons (top-left, always visible/clickable) ===== */
.sound-toggle-btn {
  position: fixed;
  left: clamp(15px, 4vw, 25px);
  z-index: 5000;
  pointer-events: auto;
  background: linear-gradient(180deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  border: 3px solid #581c87;
  border-radius: 14px;
  padding: clamp(6px, 1.5vh, 10px) clamp(12px, 3vw, 18px);
  font-size: clamp(11px, 2.4vw, 14px);
  font-weight: 800;
  letter-spacing: 1px;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif;
  text-shadow: 2px 2px 0px #3b0764;
  box-shadow: 0 4px 0 #3b0764, 0 6px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.2s;
}

.sound-toggle-btn:hover {
  transform: translateY(-4px);
  filter: brightness(1.1);
}

.sound-toggle-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #3b0764, 0 3px 6px rgba(0, 0, 0, 0.4);
}

.sound-toggle-btn.muted {
  filter: grayscale(0.8);
  opacity: 0.7;
}

#sfxToggleBtn.sound-toggle-sfx {
  bottom: clamp(52px, 9vh, 66px);
}

#musicToggleBtn.sound-toggle-music {
  bottom: 15px;
}

/* ===== Skins Shop Overlay ===== */
#skinsScreen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(13, 27, 42, 0.96);
  flex-direction: column;
  align-items: center;
  padding: clamp(14px, 3vh, 28px) clamp(10px, 3vw, 24px);
  box-sizing: border-box;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, pointer-events 0s linear 0.2s;
  overflow-y: auto;
}

#skinsScreen.show {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease, pointer-events 0s linear 0s;
}

.skins-header {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(10px, 2.5vh, 20px);
}

.skins-back-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  border-radius: 10px;
  width: clamp(30px, 8vw, 40px);
  height: clamp(30px, 8vw, 40px);
  font-size: clamp(16px, 4vw, 20px);
  cursor: pointer;
}

.skins-title {
  color: #ffffff;
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0px #3b0764;
}

.skins-coin-display {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ffd700;
  font-size: clamp(14px, 3.5vw, 20px);
  font-weight: 800;
}

.skins-coin-display img {
  width: clamp(18px, 5vw, 26px);
  height: clamp(18px, 5vw, 26px);
  object-fit: contain;
}

.skins-grid-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 2vw, 12px);
  width: 100%;
  max-width: 600px;
}

.skins-page-arrow {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(24px, 7vw, 36px);
  cursor: pointer;
  padding: 4px 8px;
  flex-shrink: 0;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 2.5vw, 16px);
  width: 100%;
}

.skin-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: clamp(70px, 20vw, 100px);
  margin: 0 auto;
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  border: 3px solid transparent;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.skin-slot:hover {
  transform: translateY(-4px);
  filter: brightness(1.1);
}

.skin-slot:active {
  transform: scale(0.95);
}

.skin-slot.equipped {
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.skin-slot.selected {
  border-color: #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.skin-preview {
  width: 42%;
  height: 55%;
  border-radius: 40% 40% 15% 15% / 22% 22% 10% 10%;
  background: linear-gradient(180deg, var(--tip, #999) 0%, var(--tip, #999) 38%, var(--casing, #ccc) 46%, var(--casing, #ccc) 100%);
  box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.35), 0 2px 3px rgba(0, 0, 0, 0.4);
}

.skin-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4.5vw, 24px);
}

.skin-name-label {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  color: #ffffff;
  font-size: clamp(8px, 2vw, 11px);
  font-weight: 700;
  text-shadow: 1px 1px 0px #000;
  letter-spacing: 0.5px;
}

.skins-pagination {
  display: flex;
  gap: 8px;
  margin-top: clamp(10px, 2.5vh, 16px);
}

.skins-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.skins-dot.active {
  background: #ffffff;
}

.skins-action-btn {
  margin-top: clamp(12px, 3vh, 22px);
  width: 100%;
  max-width: 300px;
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  border: 4px solid #86efac;
  border-radius: 26px;
  padding: clamp(10px, 2.5vh, 16px) 0;
  font-size: clamp(15px, 3.5vw, 20px);
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0px #3b0764;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 6px 0 #14532d, 0 10px 18px rgba(0, 0, 0, 0.4);
}

.skins-action-btn img.buy-btn-icon {
  width: clamp(16px, 4vw, 22px);
  height: clamp(16px, 4vw, 22px);
}

.skins-action-btn:hover:not(.disabled) {
  transform: translateY(-4px);
  filter: brightness(1.1);
}

.skins-action-btn.disabled {
  filter: grayscale(0.7);
  opacity: 0.6;
  cursor: not-allowed;
}

/* Large screens (1400px+ / 1920x1080 etc): the clamp() maxes above were
   tuned for laptop-size windows and stop growing too early, so everything
   reads as tiny once the window gets big. This bumps the key UI pieces up. */
@media (min-width: 1400px) {
  .sound-toggle-btn { font-size: 16px; padding: 12px 20px; z-index: 500; }
  #sfxToggleBtn.sound-toggle-sfx { bottom: 74px; }
  #musicToggleBtn.sound-toggle-music { bottom: 15px; }
  #bulletCount { font-size: 32px; }
  #coinDisplay { font-size: 34px; }
  #coinDisplay img { width: 44px; height: 44px; }
  #bossHPBarContainer { width: 420px; height: 30px; }

  #tapToStartPrompt { font-size: 40px; }

  .upgrade-card { width: 190px; height: 230px; }
  .level-badge { width: 38px; height: 38px; font-size: 18px; }
  .card-title { font-size: 20px; }
  .card-icon { width: 80px; height: 74px; }
  .card-val { font-size: 22px; }
  .buy-btn { font-size: 24px; }
  .buy-btn-icon { width: 28px; height: 28px; }

  #skinsBtn.skins-open-btn { font-size: 20px; padding: 14px 24px; }

  .skins-header { max-width: 760px; }
  .skins-back-btn { width: 50px; height: 50px; font-size: 24px; }
  .skins-title { font-size: 32px; }
  .skins-coin-display { font-size: 24px; }
  .skins-coin-display img { width: 32px; height: 32px; }
  .skins-grid-wrap { max-width: 760px; }
  .skins-page-arrow { font-size: 44px; }
  .skin-slot { max-width: 130px; }
  .skin-name-label { font-size: 13px; }
  .skins-action-btn { max-width: 380px; font-size: 24px; padding: 16px 0; }
  .skins-action-btn img.buy-btn-icon { width: 26px; height: 26px; }

  .level-completed-header { font-size: 36px; max-width: 760px; }
  .earned-label { font-size: 22px; }
  #rewardAmountText { font-size: 52px; }
  .coin-icon { width: 46px; height: 46px; }
  #restartBtn.next-level-btn { max-width: 480px; font-size: 32px; padding: 18px 0; }
}

/* Short landscape phones (e.g. iPhone SE landscape ~375px tall):
   compress vertical spacing so the whole shop fits without scrolling. */
@media (max-height: 420px) {
  .sound-toggle-btn { font-size: 10px; padding: 4px 8px; }
  #sfxToggleBtn.sound-toggle-sfx { bottom: 44px; }
  #musicToggleBtn.sound-toggle-music { bottom: 10px; }

  #skinsScreen {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .skins-header {
    margin-bottom: 6px;
  }
  .skin-slot {
    max-width: clamp(46px, 14vw, 64px);
  }
  .skins-grid {
    gap: clamp(4px, 1.5vw, 8px);
  }
  .skins-pagination {
    margin-top: 6px;
  }
  .skins-action-btn {
    margin-top: 8px;
    padding: 6px 0;
  }
}

/* Extra safety margin for very old/small phones down to ~320px tall
   (e.g. iPhone 5/SE 1st-gen landscape) */
@media (max-height: 340px) {
  #skinsScreen {
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .skins-header {
    margin-bottom: 3px;
  }
  .skins-back-btn {
    width: clamp(22px, 6vw, 30px);
    height: clamp(22px, 6vw, 30px);
    font-size: clamp(12px, 3vw, 16px);
  }
  .skins-title {
    font-size: clamp(13px, 3.5vw, 18px);
  }
  .skins-coin-display {
    font-size: clamp(10px, 2.5vw, 14px);
  }
  .skin-slot {
    max-width: clamp(34px, 10vw, 48px);
  }
  .skin-name-label {
    font-size: clamp(6px, 1.5vw, 9px);
  }
  .skins-grid {
    gap: clamp(3px, 1vw, 6px);
  }
  .skins-pagination {
    margin-top: 3px;
  }
  .skins-dot {
    width: 5px;
    height: 5px;
  }
  .skins-action-btn {
    margin-top: 4px;
    padding: 4px 0;
    font-size: clamp(11px, 2.5vw, 15px);
  }
}