html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #111;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #2a2a32;
}

.hud {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  left: 0;
  right: 0;
  padding: 12px 20px;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

#loot-count {
  display: inline-block;
  padding: 8px 20px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffe34d;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 1px;
  border-radius: 999px;
  border: 3px solid #ffe34d;
  text-shadow: 2px 2px 0 #000;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  z-index: 10;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.92));
  color: #fff;
  text-align: center;
}

.overlay.win {
  background: radial-gradient(circle at center, rgba(30, 120, 40, 0.92), rgba(0, 40, 10, 0.96));
}

.overlay.lose {
  background: radial-gradient(circle at center, rgba(160, 30, 30, 0.92), rgba(40, 0, 0, 0.96));
}

.overlay h1 {
  margin: 0;
  font-size: clamp(56px, 12vw, 128px);
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 0.9;
  text-shadow: 4px 4px 0 #000, 8px 8px 20px rgba(0, 0, 0, 0.6);
}

.overlay p {
  margin: 0;
  font-size: clamp(20px, 3.2vw, 32px);
  line-height: 1.35;
  max-width: 720px;
}

.big-btn {
  padding: 22px 44px;
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 900;
  letter-spacing: 2px;
  border: 4px solid #fff;
  border-radius: 20px;
  background: #ffd43b;
  color: #111;
  box-shadow: 0 8px 0 #b88d00, 0 12px 30px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}

.big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #b88d00, 0 6px 15px rgba(0, 0, 0, 0.5);
}

.bank {
  padding: 12px 28px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffe34d;
  font-size: clamp(22px, 3.8vw, 40px);
  font-weight: 900;
  letter-spacing: 2px;
  border: 3px solid #ffe34d;
  border-radius: 16px;
  text-shadow: 2px 2px 0 #000;
}

.big-score {
  font-size: clamp(64px, 12vw, 128px) !important;
  font-weight: 900;
  color: #ffe34d;
  text-shadow: 4px 4px 0 #000, 0 0 30px rgba(255, 227, 77, 0.5);
  letter-spacing: 3px;
  margin: 0 !important;
  line-height: 1;
}

.bank-line {
  font-size: clamp(22px, 3.4vw, 34px) !important;
  color: #fff;
  opacity: 0.9;
  letter-spacing: 1px;
  margin: 0 !important;
}

.shop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(560px, 94vw);
}

.shop-title {
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffd43b;
  text-shadow: 2px 2px 0 #000;
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.upgrade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.upgrade.affordable {
  border-color: #ffd43b;
  background: rgba(255, 212, 59, 0.14);
}

.upgrade.affordable:active {
  transform: translateY(2px);
}

.upgrade.owned {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  cursor: default;
}

.upgrade.locked {
  opacity: 0.55;
  cursor: default;
}

.upgrade-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-name {
  font-size: clamp(16px, 2.6vw, 22px);
  font-weight: 900;
  letter-spacing: 1px;
}

.upgrade-desc {
  font-size: clamp(12px, 1.8vw, 16px);
  opacity: 0.85;
}

.upgrade-right {
  font-size: clamp(16px, 2.4vw, 22px);
  font-weight: 900;
  letter-spacing: 1px;
  white-space: nowrap;
}

.upgrade.affordable .upgrade-right { color: #ffd43b; }
.upgrade.owned .upgrade-right { color: #4ade80; }

.control-toggle {
  padding: 10px 22px;
  font-size: clamp(14px, 2.2vw, 20px);
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.15s ease;
}

.control-toggle:active {
  transform: translateY(2px);
  background: rgba(255, 255, 255, 0.18);
}

.credit {
  margin-top: 8px;
  font-size: clamp(14px, 1.8vw, 18px);
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255, 227, 77, 0.85);
  text-shadow: 1px 1px 0 #000;
  text-transform: uppercase;
}

.version-toast {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  background: #ffd43b;
  color: #1a1a20;
  font-weight: 900;
  font-size: clamp(18px, 3vw, 28px);
  letter-spacing: 3px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  z-index: 20;
  pointer-events: none;
  animation: versionToast 3.5s forwards;
}

@keyframes versionToast {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  85%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

.hidden {
  display: none !important;
}
