/* Estilos canónicos para Duelo de Artillería: Terreno Destructible */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-dark: #090d16;
  --bg-panel: #111827;
  --bg-card: #1f2937;
  --border-panel: #374151;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;

  --color-p1: #38bdf8;
  --color-p2: #ef4444;
  --color-wind: #eab308;
}

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 de la arena de combate */
.battle-arena-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;
}

/* Marcador superior: Vidas de los tanques, viento y temporizador */
.battle-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tank-hp-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-panel);
  border-radius: 0.5rem;
  padding: 0.6rem 0.8rem;
}

.tank-info-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.hp-bar-track {
  background-color: rgba(255, 255, 255, 0.1);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.3s ease;
}

.hp-bar-fill.p1 { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.hp-bar-fill.p2 { background: linear-gradient(90deg, #b91c1c, #ef4444); }

.match-center-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.turn-pill {
  background-color: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.wind-gauge {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.wind-arrow {
  display: inline-block;
  font-weight: 900;
  transition: transform 0.3s ease;
}

/* Canvas del juego */
.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-panel);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.7);
  margin-bottom: 1.25rem;
}

#artillery-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* Consola de mandos de disparo */
.firing-controls-panel {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-panel);
  border-radius: 0.75rem;
  padding: 1rem;
}

.sliders-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.control-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #374151;
  outline: none;
  cursor: pointer;
  accent-color: #38bdf8;
}

.weapons-selector {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-weapon-item {
  background: #1f2937;
  border: 1px solid #374151;
  color: #e5e7eb;
  border-radius: 0.4rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.btn-weapon-item:hover {
  background: #374151;
}

.btn-weapon-item.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  font-weight: 700;
}

.btn-fire-action {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  transition: transform 0.1s ease, background 0.15s ease;
  min-height: 48px;
}

.btn-fire-action:not(:disabled):hover {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  transform: translateY(-2px);
}

.btn-fire-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Opciones de partida (Modo / Dificultad / Reiniciar) */
.match-settings-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-panel);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.settings-left {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.select-setting {
  background-color: #1f2937;
  color: #f3f4f6;
  border: 1px solid var(--border-panel);
  border-radius: 0.4rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 100%;
  flex: 1 1 140px;
}

.btn-restart {
  background-color: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  border: 1px solid var(--border-panel);
  border-radius: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-restart:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Modal de fin de partida */
.artillery-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;
}

.artillery-modal-dialog {
  background-color: #111827;
  border: 2px solid var(--border-panel);
  border-radius: 1rem;
  width: 100%;
  max-width: 440px;
  padding: 1.75rem;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.artillery-modal-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.btn-modal-action {
  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-modal-action:hover {
  background: #1d4ed8;
}

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

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

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

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

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

/* Responsividad */
@media (max-width: 768px) {
  .firing-controls-panel {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .battle-scoreboard {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}
