/* Estilos canónicos para Constructor de Islas: Diorama 3D */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-dark: #0a0f1d;
  --bg-panel: #111c2e;
  --bg-card: #182840;
  --border-panel: #243c5a;
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;

  --color-gold: #f59e0b;
  --color-ocean: #0284c7;
  --color-green: #22c55e;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mono {
  font-family: var(--font-mono);
}

/* Contenedor principal del diorama */
.island-builder-container {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-panel);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  margin-bottom: 2rem;
}

/* Barra superior de puntuación e hitos */
.island-scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-island-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-panel);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.stat-island-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stat-island-val {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

.stat-island-val.score { color: #38bdf8; }
.stat-island-val.milestone { color: var(--color-gold); }
.stat-island-val.target { color: #4ade80; }

/* Barra de progreso de hito */
.milestone-progress-track {
  background-color: rgba(255, 255, 255, 0.1);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.milestone-progress-bar {
  background: linear-gradient(90deg, #0284c7, #22c55e);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

/* Visor 3D */
.diorama-viewport-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-panel);
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.6);
  margin-bottom: 1.25rem;
  background-color: #0c131f;
}

#diorama-canvas-container {
  width: 100%;
  height: 100%;
  cursor: grab;
}

#diorama-canvas-container:active {
  cursor: grabbing;
}

/* Indicador flotante de puntos de sinergia */
.score-badge {
  position: absolute;
  pointer-events: none;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 4px 8px;
  border-radius: 20px;
  z-index: 50;
  display: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  animation: badgePop 0.2s ease-out;
}

.score-badge.positive {
  background-color: #15803d;
  color: #dcfce7;
  border: 1px solid #4ade80;
}

.score-badge.negative {
  background-color: #991b1b;
  color: #fee2e2;
  border: 1px solid #f87171;
}

@keyframes badgePop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1.0); opacity: 1; }
}

/* Panel inferior: Edificio activo, cola de reserva y controles de cámara */
.builder-controls-panel {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 1rem;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-panel);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}

.active-building-card {
  background: linear-gradient(135deg, #1e3a5f, #0f233a);
  border: 2px solid #38bdf8;
  border-radius: 0.6rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.building-icon {
  font-size: 1.8rem;
}

.building-details {
  display: flex;
  flex-direction: column;
}

.building-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.building-base-points {
  font-size: 0.75rem;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.queue-preview-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
}

.queue-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.queue-list {
  display: flex;
  gap: 0.4rem;
}

.queue-mini-item {
  background: #182840;
  border: 1px solid var(--border-panel);
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.queue-mini-item.more {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.view-controls-group {
  display: flex;
  gap: 0.5rem;
}

.btn-island-ctrl {
  background: #182840;
  color: #e2e8f0;
  border: 1px solid var(--border-panel);
  border-radius: 0.4rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-island-ctrl:hover {
  background: #243c5a;
}

/* Modales */
.island-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.island-modal-dialog {
  background-color: #0f1d30;
  border: 2px solid var(--border-panel);
  border-radius: 1rem;
  width: 100%;
  max-width: 480px;
  padding: 1.75rem;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.modal-header-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.island-modal-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #fff;
}

.island-modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.reward-packs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.pack-card {
  background: #182840;
  border: 2px solid #38bdf8;
  border-radius: 0.6rem;
  padding: 0.75rem;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, background 0.15s ease;
}

.pack-card:hover {
  transform: translateY(-3px);
  background: #1e3a5f;
}

.pack-name {
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.pack-items {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
}

.btn-island-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
}

.btn-island-primary:hover {
  background: #1d4ed8;
}

/* Sección SEO */
.island-seo-section {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-panel);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-top: 2rem;
  color: #cbd5e1;
}

.island-seo-section h2 {
  font-family: var(--font-heading);
  color: #fff;
  margin-top: 0;
  margin-bottom: 1rem;
}

.island-seo-section h3 {
  font-family: var(--font-heading);
  color: #38bdf8;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.island-seo-section p {
  line-height: 1.6;
  margin-bottom: 1rem;
}

.island-seo-section ul {
  padding-left: 1.25rem;
  line-height: 1.6;
}

/* Responsividad */
@media (max-width: 860px) {
  .builder-controls-panel {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .reward-packs-grid {
    grid-template-columns: 1fr;
  }
}
