/* ===== style.css ===== */

:root {
  --bg: #0b1220;
  --panel: #0f1724;
  --accent: #4ee1a0;
  --danger: #ff6b6b;
  --muted: #9aa4b2;
}

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

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
  font-family: 'Inter', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #071022 0%, #081328 60%);
  color: #e6eef6;
}

#gameWrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  position: relative;
}

canvas {
  background: radial-gradient(circle at 20% 10%, rgba(255,255,255,0.02), transparent 100%), 
              rgba(0,0,0,0.25);
  border-radius: 12px;
  box-shadow: 
    0 10px 40px rgba(2, 6, 23, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  display: block;
  max-width: 95vw;
  max-height: 95vh;
  image-rendering: crisp-edges;
}

/* Estilo para cuando el canvas debe mantener aspecto ratio */
@media (max-width: 950px) {
  canvas {
    width: 100vw !important;
    height: auto !important;
  }
}

@media (max-height: 650px) {
  canvas {
    width: auto !important;
    height: 100vh !important;
  }
}

/* UI Elements */
#ui {
  width: 320px;
  min-height: 480px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border-radius: 12px;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

h1 {
  font-size: 18px;
  margin: 0 0 8px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: #042226;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: #5ef5af;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 225, 160, 0.4);
}

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

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* Overlay para mensajes */
#overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(10px);
  padding: 26px;
  border-radius: 14px;
  display: none;
  min-width: 320px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#overlay h2 {
  margin: 0 0 12px;
  font-size: 24px;
  color: var(--accent);
}

.small {
  font-size: 13px;
  color: var(--muted);
}

/* Footer */
footer {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

/* Animación de aparición */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

#overlay.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Scrollbar personalizado (opcional) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Cursor personalizado para el canvas */
canvas {
  cursor: crosshair;
}

/* Efectos de resplandor para elementos interactivos */
.glow {
  box-shadow: 0 0 20px rgba(78, 225, 160, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(78, 225, 160, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(78, 225, 160, 0.8);
  }
}

/* Loading screen (opcional) */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, #071022 0%, #081328 60%);
  z-index: 9999;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(78, 225, 160, 0.2);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  footer {
    font-size: 11px;
    bottom: 10px;
  }
  
  #gameWrap {
    padding: 0;
  }
  
  canvas {
    border-radius: 0;
  }
}

/* Pantallas muy pequeñas */
@media (max-width: 480px) {
  footer {
    display: none;
  }
}

/* Modo paisaje en móviles */
@media (max-height: 500px) and (orientation: landscape) {
  footer {
    display: none;
  }
  
  canvas {
    border-radius: 0;
  }
}