/* Sneks At War - Worms 2 Clone Stylesheet */
:root {
  --bg-dark: #090d16;
  --panel-bg: rgba(15, 23, 42, 0.85);
  --panel-border: rgba(56, 189, 248, 0.25);
  --primary-neon: #39ff14;
  --accent-pink: #ff0055;
  --accent-cyan: #00f0ff;
  --accent-amber: #ffaa00;
  --accent-purple: #a855f7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-mono: 'JetBrains Mono', monospace;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header & Nav */
.game-header {
  height: 52px;
  background: rgba(10, 15, 26, 0.95);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent-pink), #ff00aa);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #ff0055, #cc0044);
  border-color: #ff3377;
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff1a66, #e6004c);
  box-shadow: 0 0 18px rgba(255, 0, 85, 0.6);
}

.btn-neon {
  background: linear-gradient(135deg, #22c55e, #15803d);
  border-color: var(--primary-neon);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.3);
}

.btn-neon:hover {
  background: linear-gradient(135deg, #39ff14, #16a34a);
  color: #000;
}

/* Main Viewport Container */
.game-viewport-wrap {
  position: relative;
  width: 100vw;
  height: calc(100vh - 52px);
  background: #050811;
  overflow: hidden;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* HUD Layer */
.hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  z-index: 10;
}

.hud-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

/* Team Health Cards */
.teams-health-container {
  display: flex;
  gap: 0.75rem;
  pointer-events: auto;
}

.team-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 140px;
  backdrop-filter: blur(8px);
  transition: all 0.25s ease;
}

.team-card.active-turn {
  border-color: var(--primary-neon);
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
  transform: scale(1.05);
}

.team-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
}

.team-name {
  display: flex;
  align-items: center;
  gap: 4px;
}

.team-color-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.team-total-hp {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
}

.team-hp-bar-outer {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.team-hp-bar-inner {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Turn Timer & Active Snek Badge Center Top */
.turn-status-badge {
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.turn-timer-clock {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-neon);
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
  line-height: 1;
}

.turn-timer-clock.timer-warning {
  color: var(--accent-pink);
  text-shadow: 0 0 12px rgba(255, 0, 85, 0.8);
  animation: pulseWarning 0.5s infinite alternate;
}

@keyframes pulseWarning {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

.turn-info-text {
  display: flex;
  flex-direction: column;
}

.turn-active-snek-name, .turn-active-snake-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.turn-active-team-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Selected Weapon Action Pill Right Top */
.active-weapon-pill {
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.active-weapon-pill:hover {
  border-color: var(--accent-cyan);
  background: rgba(30, 41, 59, 0.95);
}

.weapon-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

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

.weapon-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
}

.weapon-ammo-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-amber);
}

/* Bottom HUD Controls Bar */
.hud-bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
}

/* Wind Gauge Left Bottom */
.wind-gauge-box {
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 200px;
  backdrop-filter: blur(8px);
}

.wind-label-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wind-bar-outer {
  position: relative;
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.wind-bar-center-line {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.wind-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--primary-neon));
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Center Bottom Charge Power Meter */
.power-meter-container {
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 320px;
  backdrop-filter: blur(10px);
}

.power-meter-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.power-bar-outer {
  width: 100%;
  height: 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.power-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  border-radius: 6px;
  transition: width 0.05s linear;
}

.controls-hint-row {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Right Bottom Arsenal Toggle Button */
.arsenal-toggle-btn {
  pointer-events: auto;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border: 1px solid #60a5fa;
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.arsenal-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(59, 130, 246, 0.7);
}

/* Modals & Overlays */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 17, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 24px;
  max-width: 680px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 12px;
}

.modal-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--primary-neon);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #fff;
}

/* Weapon Inventory Grid Overlay */
.weapon-grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.weapon-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
}

.weapon-card:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.weapon-card.selected {
  border-color: var(--primary-neon);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.4);
  background: rgba(57, 255, 20, 0.1);
}

.weapon-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.weapon-card-icon {
  font-size: 1.8rem;
}

.weapon-card-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
}

.weapon-card-ammo {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-amber);
}

.weapon-card-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Setup Screen Formatting */
.setup-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-control {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: #fff;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Match Stats Victory Screen */
.victory-winner-banner {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, rgba(57, 255, 20, 0.15), rgba(0, 240, 255, 0.15));
  border: 1px solid var(--primary-neon);
  border-radius: 12px;
}

.victory-title {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 2rem;
  color: var(--primary-neon);
  margin-bottom: 6px;
}

.victory-mvp {
  font-size: 1rem;
  color: var(--accent-amber);
  font-family: var(--font-mono);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th, .stats-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

.stats-table th {
  font-family: var(--font-heading);
  color: var(--text-muted);
}
