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

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: #1a1a2e;
  color: #eee;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app { width: 100%; height: 100vh; position: relative; }

.screen { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
.screen.active { display: flex; flex-direction: column; }

.center-content { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 16px; padding: 20px; }

.menu-header { text-align: center; padding: 30px 20px 10px; }
.menu-header h1 { font-size: 28px; background: linear-gradient(135deg, #f39c12, #e74c3c); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 2px; }

.stats-row { display: flex; gap: 12px; justify-content: center; margin-top: 6px; }
.stat { font-size: 14px; background: #16213e; padding: 4px 10px; border-radius: 12px; }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; padding: 20px; max-width: 350px; margin: 0 auto; width: 100%; }

.btn {
  padding: 14px 20px; border: none; border-radius: 12px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: linear-gradient(135deg, #3498db, #2980b9); color: #fff; }
.btn-secondary { background: linear-gradient(135deg, #2ecc71, #27ae60); color: #fff; }
.btn-outline { background: transparent; border: 2px solid #3498db; color: #3498db; }
.btn-gold { background: linear-gradient(135deg, #f39c12, #e67e22); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

#ad-earnings-info { text-align: center; color: #f39c12; margin-top: 8px; }

.spinner {
  width: 50px; height: 50px; border: 4px solid #333; border-top: 4px solid #3498db;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#battle-canvas { width: 100%; flex: 1; display: block; }

#battle-hud { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

#hud-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; background: rgba(0,0,0,0.6); pointer-events: auto;
}
#hud-timer { font-size: 20px; font-weight: bold; color: #f39c12; }
#hud-enemy-name { font-size: 14px; color: #e74c3c; }

#hud-bottom {
  position: absolute; bottom: 0; left: 0; width: 100%;
  background: rgba(0,0,0,0.85); padding: 8px; pointer-events: auto;
}

#elixir-bar-container {
  width: 100%; height: 20px; background: #333; border-radius: 10px;
  position: relative; margin-bottom: 8px; overflow: hidden;
}
#elixir-bar {
  height: 100%; background: linear-gradient(90deg, #9b59b6, #8e44ad);
  border-radius: 10px; transition: width 0.2s; width: 50%;
}
#elixir-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 12px; font-weight: bold; color: #fff;
}

#card-hand { display: flex; gap: 6px; justify-content: center; overflow-x: auto; padding: 4px 0; }

.card-slot {
  width: 70px; min-width: 70px; background: #16213e; border: 2px solid #3498db;
  border-radius: 8px; padding: 4px; text-align: center; cursor: pointer;
  transition: all 0.2s; user-select: none;
}
.card-slot:active { transform: scale(0.92); border-color: #f39c12; }
.card-slot.disabled { opacity: 0.4; pointer-events: none; }
.card-slot .card-name { font-size: 9px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-slot .card-cost { font-size: 11px; color: #9b59b6; font-weight: bold; margin-top: 2px; }
.card-slot .card-icon { font-size: 24px; margin: 4px 0; }
.card-slot.selected { border-color: #f39c12; background: #1a3a5c; box-shadow: 0 0 10px rgba(243,156,18,0.5); }

#screen-result h2 { font-size: 32px; }
#result-rewards { font-size: 18px; text-align: center; line-height: 1.8; }

.deck-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; }
.deck-header h2 { font-size: 20px; }

#deck-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 20px 20px; overflow-y: auto; }

.deck-card {
  background: #16213e; border: 2px solid #444; border-radius: 10px; padding: 10px;
  text-align: center; cursor: pointer; transition: all 0.2s;
}
.deck-card.in-deck { border-color: #2ecc71; background: #1a3a2e; }
.deck-card .dc-icon { font-size: 30px; }
.deck-card .dc-name { font-size: 12px; font-weight: 600; margin-top: 4px; }
.deck-card .dc-stats { font-size: 10px; color: #888; margin-top: 2px; }
.deck-card .dc-rarity { font-size: 10px; margin-top: 2px; }
.dc-rarity.common { color: #95a5a6; }
.dc-rarity.rare { color: #3498db; }
.dc-rarity.epic { color: #9b59b6; }
.dc-rarity.legendary { color: #f39c12; }

#leaderboard-list { padding: 0 20px; overflow-y: auto; flex: 1; }
.lb-entry {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: #16213e; border-radius: 8px; margin-bottom: 6px;
}
.lb-rank { font-weight: bold; color: #f39c12; min-width: 30px; }
.lb-name { flex: 1; margin-left: 10px; }
.lb-trophies { color: #f39c12; }

.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 100; }
.overlay.hidden { display: none; }
.ad-container { background: #16213e; border-radius: 16px; padding: 24px; max-width: 320px; width: 90%; text-align: center; }
.ad-placeholder { background: #0f3460; border: 2px dashed #3498db; border-radius: 8px; padding: 40px 20px; margin: 16px 0; }
#ad-timer-display { color: #f39c12; margin-bottom: 12px; font-size: 14px; }
