/* =====================================================
   BUNNY BUILDER GAME - Main Stylesheet
   Arc Testnet 2D Platformer
   ===================================================== */

/* Pixel font fallback (loads from Google Fonts if available) */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Orbitron:wght@400;700;900&display=swap');

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

:root {
  --primary: #FFD700;
  --primary-dark: #FFA500;
  --secondary: #00FFAA;
  --bg-dark: #0a0a1a;
  --bg-medium: #12122a;
  --bg-card: #1a1a35;
  --text-primary: #ffffff;
  --text-secondary: #aabbdd;
  --accent-blue: #4488FF;
  --accent-pink: #FF44AA;
  --accent-green: #44FF88;
  --danger: #FF4444;
  --success: #44FF88;
  --border: rgba(255,255,255,0.1);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Press Start 2P', 'Courier New', monospace;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ===================== SCREENS ===================== */
.screen {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ===================== WALLET SCREEN ===================== */
#wallet-screen {
  background: radial-gradient(ellipse at center, #1a1a4a 0%, #0a0a1a 100%);
  overflow-y: auto;
  padding: 20px;
  gap: 24px;
}

#wallet-screen::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(68, 136, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 68, 170, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.game-title-container {
  text-align: center;
  z-index: 1;
}

.pixel-logo {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
  animation: bounce 1s ease-in-out infinite alternate;
  display: inline-block;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.game-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.3;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark), #FF6B00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: 4px;
  margin-bottom: 8px;
}

.game-subtitle {
  font-size: 10px;
  color: var(--accent-blue);
  letter-spacing: 6px;
  margin-top: 4px;
}

.title-decoration {
  display: flex;
  gap: 16px;
  justify-content: center;
  font-size: 24px;
  margin-top: 12px;
  animation: spin-items 3s linear infinite;
}

@keyframes spin-items {
  0%, 100% { letter-spacing: 4px; }
  50% { letter-spacing: 12px; }
}

/* ===================== WALLET CONNECT BOX ===================== */
.wallet-connect-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  width: 100%;
  max-width: 480px;
  z-index: 1;
  position: relative;
  box-shadow: 0 0 40px rgba(68, 136, 255, 0.15);
}

.wallet-connect-box h2 {
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 8px;
  letter-spacing: 3px;
}

.wallet-hint {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.input-group {
  position: relative;
  margin-bottom: 12px;
}

.wallet-input {
  width: 100%;
  padding: 14px 44px 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  outline: none;
  transition: all 0.3s;
  letter-spacing: 1px;
}

.wallet-input:focus {
  border-color: var(--accent-blue);
  background: rgba(68, 136, 255, 0.08);
  box-shadow: 0 0 20px rgba(68, 136, 255, 0.2);
}

.wallet-input.valid {
  border-color: var(--success);
  background: rgba(68, 255, 136, 0.05);
}

.wallet-input.invalid {
  border-color: var(--danger);
  background: rgba(255, 68, 68, 0.05);
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}

.error-msg {
  color: var(--danger);
  font-size: 10px;
  margin-bottom: 12px;
  font-family: 'Orbitron', sans-serif;
}

.hidden { display: none !important; }

/* ===================== BUTTONS ===================== */
.btn-primary {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 8px;
  color: #000;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  letter-spacing: 2px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 215, 0, 0.4);
}

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

.btn-primary::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(45deg);
  transition: 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-secondary {
  padding: 12px 24px;
  background: transparent;
  border: 2px solid var(--accent-blue);
  border-radius: 8px;
  color: var(--accent-blue);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 2px;
}

.btn-secondary:hover {
  background: var(--accent-blue);
  color: #000;
  box-shadow: 0 0 20px rgba(68, 136, 255, 0.4);
}

.btn-reward {
  padding: 18px 36px;
  background: linear-gradient(135deg, #00FFAA, #00CC88);
  border: none;
  border-radius: 12px;
  color: #000;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  animation: pulse-glow 2s ease-in-out infinite;
  letter-spacing: 2px;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 170, 0.4); }
  50% { box-shadow: 0 0 40px rgba(0, 255, 170, 0.8); }
}

.btn-icon {
  font-size: 16px;
}

/* ===================== PRIZE POOL ===================== */
.prize-pool-info {
  margin-top: 20px;
  padding: 14px;
  background: rgba(255, 215, 0, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
  text-align: center;
}

.prize-label {
  font-size: 9px;
  color: var(--primary);
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.prize-amounts {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.prize-amounts .separator {
  color: var(--text-secondary);
  margin: 0 8px;
}

.prize-token {
  font-size: 8px;
  color: var(--text-secondary);
  font-family: 'Orbitron', sans-serif;
}

/* ===================== INFO CARDS ===================== */
.game-info-cards {
  display: flex;
  gap: 12px;
  z-index: 1;
}

.info-card {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.info-icon { font-size: 16px; }

/* ===================== LEADERBOARD PREVIEW ===================== */
.leaderboard-preview {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  z-index: 1;
}

.leaderboard-preview h3 {
  font-size: 10px;
  color: var(--primary);
  margin-bottom: 12px;
  letter-spacing: 3px;
}

.lb-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
}

.lb-entry:last-child { border-bottom: none; }

.lb-rank {
  width: 20px;
  color: var(--primary);
  font-weight: 700;
}

.lb-wallet {
  flex: 1;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  color: var(--secondary);
  font-weight: 700;
}

/* ===================== HUD ===================== */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 100%);
  z-index: 100;
  gap: 12px;
}

.hud-left, .hud-right, .hud-center {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hud-right { justify-content: flex-end; }
.hud-center { flex: 1; justify-content: center; }

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 7px;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

.hud-value {
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
}

.wallet-hud { max-width: 120px; }
.wallet-addr {
  font-size: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
  color: var(--accent-blue);
  font-family: 'Orbitron', monospace;
}

/* ===================== GAME SCREEN ===================== */
#game-screen {
  background: #0a0a1a;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

#game-screen.active {
  display: block !important;
}

#game-canvas {
  display: block;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a1a;
}

/* ===================== LEVEL BANNER ===================== */
#level-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  text-align: center;
  pointer-events: none;
  animation: banner-appear 0.5s ease-out;
}

@keyframes banner-appear {
  from { opacity: 0; transform: translate(-50%, -60%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.level-banner-inner {
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 20px 40px;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
}

#level-banner-num {
  display: block;
  font-size: 24px;
  color: var(--primary);
  letter-spacing: 4px;
  margin-bottom: 8px;
}

#level-banner-name {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

/* ===================== PAUSE MENU ===================== */
#pause-menu {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

#pause-menu.hidden { display: none; }

.pause-content {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pause-content h2 {
  color: var(--primary);
  font-size: 20px;
  margin-bottom: 8px;
}

/* ===================== MOBILE CONTROLS ===================== */
#mobile-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

@media (max-width: 768px) {
  #mobile-controls { display: flex; }
}

.mobile-row {
  display: flex;
  gap: 4px;
}

.mobile-jump {
  position: absolute;
  right: -80px;
  bottom: 0;
}

.mobile-btn {
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.jump-btn {
  width: 72px;
  height: 72px;
  background: rgba(255, 215, 0, 0.25);
  border-color: rgba(255, 215, 0, 0.5);
  font-size: 10px;
  font-family: 'Press Start 2P', monospace;
}

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

/* ===================== LEVEL COMPLETE SCREEN ===================== */
#level-complete-screen {
  background: radial-gradient(ellipse at center, #1a2a1a 0%, #0a0a1a 100%);
  overflow: hidden;
}

.level-complete-content {
  text-align: center;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.complete-icon {
  font-size: 64px;
  animation: star-pop 0.5s ease-out;
}

@keyframes star-pop {
  from { transform: scale(0) rotate(-180deg); }
  to { transform: scale(1) rotate(0deg); }
}

.level-complete-content h2 {
  font-size: 24px;
  color: var(--primary);
  letter-spacing: 4px;
}

.stats-grid {
  display: flex;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 24px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stat-label {
  font-size: 8px;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

.stat-value {
  font-size: 16px;
  color: var(--primary);
  font-family: 'Orbitron', monospace;
  font-weight: 700;
}

#complete-stars {
  font-size: 32px;
  letter-spacing: 8px;
}

/* ===================== VICTORY SCREEN ===================== */
#victory-screen {
  background: radial-gradient(ellipse at center, #1a1500 0%, #0a0a1a 100%);
  overflow: hidden;
}

.victory-fireworks {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.firework {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  animation: firework-burst 1s ease-out forwards;
}

@keyframes firework-burst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

.victory-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 520px;
  padding: 20px;
}

.trophy-anim {
  font-size: 80px;
  animation: trophy-bounce 0.6s ease-out, trophy-glow 2s ease-in-out infinite 0.6s;
  display: inline-block;
}

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

@keyframes trophy-glow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)); }
  50% { filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1)); }
}

.victory-title {
  font-size: clamp(32px, 6vw, 56px);
  background: linear-gradient(135deg, var(--primary), #FF6B00, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: text-shimmer 2s linear infinite;
  background-size: 200% auto;
  letter-spacing: 6px;
}

@keyframes text-shimmer {
  from { background-position: 0% center; }
  to { background-position: 200% center; }
}

.victory-subtitle {
  font-size: 10px;
  color: var(--secondary);
  letter-spacing: 4px;
}

/* ===================== WINNER CARD ===================== */
.winner-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 16px;
  padding: 20px 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.1);
}

.winner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.winner-row:last-child { border-bottom: none; }

.winner-label {
  font-size: 9px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  white-space: nowrap;
}

.winner-wallet {
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  color: var(--accent-blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.winner-score, .winner-time {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  color: var(--primary);
  font-weight: 700;
}

.winner-reward {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  color: var(--secondary);
  font-weight: 900;
}

.reward-row { border-top: 2px solid rgba(255, 215, 0, 0.2) !important; }

/* ===================== TX INFO ===================== */
.tx-info {
  width: 100%;
  max-width: 480px;
  background: rgba(68, 136, 255, 0.08);
  border: 1px solid rgba(68, 136, 255, 0.3);
  border-radius: 10px;
  padding: 14px 18px;
}

.tx-label {
  font-size: 8px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.tx-hash {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  color: var(--accent-blue);
  word-break: break-all;
  margin-bottom: 8px;
}

.explorer-link {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  color: var(--accent-blue);
  text-decoration: none;
  letter-spacing: 2px;
}

.explorer-link:hover { text-decoration: underline; }

/* ===================== REWARD STATUS ===================== */
.reward-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--secondary);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.network-badge {
  font-size: 9px;
  color: var(--accent-blue);
  border: 1px solid rgba(68, 136, 255, 0.3);
  border-radius: 20px;
  padding: 6px 14px;
  letter-spacing: 2px;
}

/* ===================== GAME OVER SCREEN ===================== */
#gameover-screen {
  background: radial-gradient(ellipse at center, #1a0a0a 0%, #0a0a1a 100%);
}

.gameover-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.gameover-icon {
  font-size: 64px;
  animation: shake 0.5s ease-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px) rotate(-5deg); }
  75% { transform: translateX(10px) rotate(5deg); }
}

.gameover-content h2 {
  font-size: 28px;
  color: var(--danger);
  letter-spacing: 4px;
}

#gameover-msg {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  color: var(--text-secondary);
}

.go-stats {
  display: flex;
  gap: 24px;
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
}

.go-stats strong { color: var(--primary); }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--accent-blue); border-radius: 3px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 480px) {
  .wallet-connect-box { padding: 20px 16px; }
  .game-info-cards { flex-wrap: wrap; justify-content: center; }
  .stats-grid { gap: 12px; }
  .winner-card { padding: 14px 16px; }
  .victory-content { padding: 12px; gap: 12px; }
}

/* ===================== PIXEL EFFECT ===================== */
.pixel-border {
  image-rendering: pixelated;
  box-shadow: 
    0 0 0 2px var(--primary),
    0 0 0 4px var(--bg-dark),
    0 0 0 6px rgba(255, 215, 0, 0.3);
}

/* Loading states */
.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}
