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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

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

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
  color: white;
  font-size: 20px;
  font-weight: bold;
  z-index: 10;
  pointer-events: none;
}

#abilityHint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 200, 0, 0.9);
  color: #333;
  padding: 12px 28px;
  border-radius: 30px;
  font-size: 22px;
  font-weight: bold;
  z-index: 10;
  pointer-events: none;
  animation: pulse 0.6s ease-in-out infinite alternate;
}

@keyframes pulse {
  from { transform: translate(-50%, -50%) scale(1); opacity: 0.9; }
  to { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
}

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

.overlay-content {
  background: linear-gradient(135deg, #2d2d5e, #1a1a3e);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 36px 44px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  color: #eee;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.shop-content {
  max-width: 700px;
}

.title-content h1 {
  font-size: 48px;
  margin-bottom: 8px;
  background: linear-gradient(to right, #ff6b6b, #ffd93d, #6bcb77);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 18px;
  color: #aaa;
  margin-bottom: 24px;
}

.instructions {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 28px;
}

.instructions p {
  margin: 8px 0;
  font-size: 16px;
}

h2 {
  font-size: 32px;
  margin-bottom: 16px;
}

h3 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #ccc;
  text-align: left;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 32px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  color: white;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7c7ff7, #a78bfa);
}

.btn-small {
  padding: 8px 18px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ccc;
  margin-top: 8px;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.btn-large {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 22px;
  margin-top: 20px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* Shop */
.shop-coins {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 20px;
  color: #ffd93d;
}

.shop-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: left;
}

.animal-grid, .passive-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.animal-card, .passive-card {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  text-align: center;
  min-width: 90px;
}

.animal-card:hover, .passive-card:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
}

.animal-card .animal-emoji {
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
}

.animal-card .animal-name {
  font-weight: bold;
  display: block;
  margin-bottom: 2px;
}

.animal-card .animal-ability {
  font-size: 11px;
  color: #aaa;
  display: block;
  margin-bottom: 3px;
}

.animal-card .animal-cost {
  color: #ffd93d;
  font-size: 13px;
}

.animal-card.sell-card {
  border-color: rgba(255, 100, 100, 0.3);
}

.animal-card.sell-card:hover {
  border-color: rgba(255, 100, 100, 0.6);
  background: rgba(255, 50, 50, 0.15);
}

.passive-card {
  min-width: 140px;
  text-align: left;
}

.passive-card .passive-name {
  font-weight: bold;
  display: block;
  margin-bottom: 4px;
}

.passive-card .passive-desc {
  font-size: 12px;
  color: #aaa;
  display: block;
  margin-bottom: 4px;
}

.passive-card .passive-cost {
  color: #ffd93d;
  font-size: 13px;
}

.passive-card.owned {
  border-color: rgba(100, 255, 100, 0.3);
  cursor: default;
  opacity: 0.7;
}

/* Rewards */
.rewards-list {
  text-align: left;
  margin: 16px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.reward-line {
  padding: 6px 0;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
}

.reward-line.total {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 20px;
  font-weight: bold;
  color: #ffd93d;
}

/* Scrollbar styling */
.overlay-content::-webkit-scrollbar {
  width: 8px;
}

.overlay-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.overlay-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}
