* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #2a1a0a;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

canvas {
  display: block;
  touch-action: none;
}

/* HUD */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 6px 10px;
  z-index: 10;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.5);
}

.hud-item {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.hud-item .val {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: block;
}

.hud-item .val.gold {
  color: #ffd700;
}

.hud-item .val.red {
  color: #ff5252;
}

/* Mobile buttons */
.mobile-controls {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  z-index: 10;
  pointer-events: none;
}

.mobile-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.1s;
}

.mobile-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.9);
}

.mobile-btn.hidden {
  display: none;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.modal {
  background: linear-gradient(135deg, #3e2723, #5d4037);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  border: 2px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: #ffd700;
}

.modal p {
  color: rgba(255, 255, 255, 0.7);
  margin: 6px 0;
  font-size: 14px;
}

.modal .big-score {
  font-size: 42px;
  font-weight: 900;
  color: #ffd700;
  margin: 6px 0;
}

.modal .stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
}

.modal .stat-label {
  color: rgba(255, 255, 255, 0.5);
}

.modal .stat-value {
  color: #ffd700;
  font-weight: 700;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 10px;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, #ffd700, #ff8f00);
  color: #3e2723;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Shop */
.shop-items {
  margin: 12px 0;
  text-align: left;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(255, 215, 0, 0.15);
}

.shop-item-info {
  flex: 1;
}

.shop-item-name {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.shop-item-desc {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.shop-item-price {
  font-size: 13px;
  color: #ffd700;
  font-weight: 700;
  margin-top: 2px;
}

.shop-buy-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd700, #ff8f00);
  color: #3e2723;
  white-space: nowrap;
}

.shop-buy-btn:disabled {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed;
}

.shop-buy-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.shop-money {
  font-size: 18px;
  font-weight: 700;
  color: #ffd700;
  margin: 8px 0;
}

/* Floating text */
.float-text {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  font-size: 20px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: floatUp 1.2s ease-out forwards;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(1.2);
  }
}

/* Level announcement */
.level-announce {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
  pointer-events: none;
  z-index: 50;
  animation: levelAnnounce 1.5s ease-out forwards;
}

@keyframes levelAnnounce {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(1);
  }
}
