/* Pixel Royale - Styles */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a2e;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#game {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Loading */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
}
.loader {
  width: 48px; height: 48px;
  border: 4px solid #333;
  border-top: 4px solid #e74c3c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); }}

/* Top Bar */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  min-height: 48px;
  flex-shrink: 0;
}
#team-badge { font-size: 22px; width: 36px; text-align: center; }
#game-title { font-size: 14px; font-weight: 700; letter-spacing: 2px; }
#stars-display { font-size: 14px; font-weight: 600; }

/* Canvas */
#canvas-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #111;
  min-height: 0;
}
#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Bottom Bar */
#bottom-bar {
  background: #16213e;
  border-top: 1px solid #0f3460;
  padding: 6px 8px;
  flex-shrink: 0;
}

#cooldown-display {
  text-align: center;
  font-size: 12px;
  padding: 2px 0;
  min-height: 18px;
  color: #f1c40f;
}

#palette {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 6px 0;
  flex-wrap: wrap;
}
.color-swatch {
  width: 28px; height: 28px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.5); }

#actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 4px 0;
  flex-wrap: wrap;
}
.action-btn {
  background: #0f3460;
  color: #eee;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:active { transform: scale(0.9); }
.action-btn.active { background: #e74c3c; }

/* Modals */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-content {
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  padding: 24px;
  max-width: 320px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-content h2 { text-align: center; margin-bottom: 16px; font-size: 18px; }
.close-btn {
  position: absolute;
  top: 8px; right: 12px;
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
}
.close-btn:hover { color: #fff; }

.team-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 2px solid #333;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.team-btn:active { transform: scale(0.95); }
.team-btn[data-team="fenix"]:hover { border-color: #e74c3c; }
.team-btn[data-team="triton"]:hover { border-color: #3498db; }
.team-btn[data-team="selva"]:hover { border-color: #2ecc71; }
.team-btn[data-team="sol"]:hover { border-color: #f1c40f; }

#leaderboard-list, #team-scores { margin: 8px 0; }
.lb-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid #222;
}
.ts-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 600;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  transition: opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}
#toast.show { opacity: 1; }

/* Tooltip */
#pixel-tooltip {
  position: absolute;
  background: rgba(0,0,0,0.9);
  border: 1px solid #333;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
}

/* Tutorial Overlay */
#tutorial-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.tutorial-content {
  background: #1a1a2e;
  border: 1px solid #e74c3c;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.tutorial-content h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #f1c40f;
}
.tutorial-steps {
  text-align: left;
  margin-bottom: 16px;
}
.tutorial-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0;
  font-size: 14px;
  line-height: 1.4;
}
.step-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.tutorial-bonus {
  background: #f1c40f20;
  border: 1px solid #f1c40f40;
  border-radius: 8px;
  padding: 10px;
  margin: 16px 0;
  font-size: 14px;
  color: #f1c40f;
}
.start-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.start-btn:active { transform: scale(0.95); }
