/* ========================================
   WOLVES VS ENTROPY - COLOR PALETTE
   Edit these variables to change the theme
   ======================================== */

/* Title & Phase Icon Styles */
.title-icon {
  height: 1.6em;
  width: auto;
  vertical-align: -0.25em;
}

.phase-icon {
  height: 1.2em;
  width: auto;
  vertical-align: -0.15em;
}

:root {
  /* Grid & Board */
  --color-grid-lines: #00d4ff;           /* Electric blue grid lines */
  --color-board-bg: #1a1a2e;             /* Dark board background */
  --color-tile-empty: #2d2d44;           /* Empty tile */
  --color-tile-empty-hover: #3d3d54;     /* Empty tile hover */
  --color-tile-valid-move: #4a5568;      /* Valid move indicator */
  
  /* Wolves */
  --color-wolf-bg: #4a6741;              /* Wolf tile background */
  --color-wolf-selected: #5a8a4a;        /* Selected wolf */
  --color-wolf-stabilizing: #8b6914;     /* Stabilizing wolf background */
  --color-wolf-stabilizing-glow: #fbbf24; /* Stabilizing glow effect */
  
  /* Entropy */
  --color-entropy: #1a0a1a;              /* Entropy tile - void purple-black */
  --color-entropy-border: #4a1942;       /* Entropy border accent */
  --color-entropy-inner: #2d1029;        /* Entropy inner gradient */
  
  /* UI Elements */
  --color-bg-primary: #0f0f1a;           /* Main background */
  --color-bg-secondary: #1a1a2e;         /* Secondary background */
  --color-bg-panel: #252540;             /* Panel background */
  --color-text-primary: #e2e8f0;         /* Primary text */
  --color-text-secondary: #94a3b8;       /* Secondary text */
  --color-text-muted: #64748b;           /* Muted text */
  
  /* Buttons */
  --color-btn-primary: #3b82f6;          /* Primary button */
  --color-btn-primary-hover: #2563eb;    /* Primary button hover */
  --color-btn-secondary: #475569;        /* Secondary button */
  --color-btn-secondary-hover: #64748b;  /* Secondary button hover */
  --color-btn-danger: #dc2626;           /* Danger/warning button */
  --color-btn-success: #22c55e;          /* Success button */
  
  /* Status Colors */
  --color-status-win: #22c55e;           /* Win state */
  --color-status-loss: #ef4444;          /* Loss state */
  --color-status-warning: #f59e0b;       /* Warning */
  --color-turn-counter: #00d4ff;         /* Turn counter accent */
  
  /* Difficulty */
  --color-difficulty-easy: #22c55e;
  --color-difficulty-medium: #f59e0b;
  --color-difficulty-hard: #ef4444;
}

/* ========================================
   BASE STYLES
   ======================================== */

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

#app {
  width: 100%;
  max-width: 900px;
}

/* ========================================
   GAME CONTAINER
   ======================================== */

.game-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

.game-header {
  text-align: center;
}

.game-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--color-text-primary), var(--color-grid-lines));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Preserve emoji colors in gradient text */
.emoji {
  -webkit-text-fill-color: initial;
  background: none;
}

.game-subtitle {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

/* ========================================
   STATUS BAR
   ======================================== */

.status-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  background: var(--color-bg-panel);
  border-radius: 12px;
  border: 1px solid var(--color-grid-lines);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.status-item {
  text-align: center;
}

.status-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.status-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-turn-counter);
}

.status-value.entropy-count {
  color: #b366b3;
  text-shadow: 0 0 6px rgba(179, 102, 179, 0.5), 0 0 2px rgba(255, 255, 255, 0.5);
}

.status-value.entropy-count.danger {
  color: #ff6b6b;
  text-shadow: 0 0 8px rgba(255, 107, 107, 0.7), 0 0 3px rgba(255, 255, 255, 0.5);
  animation: pulse-danger 1s infinite;
}

.status-value.spawns {
  color: var(--color-wolf-selected);
}

@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* ========================================
   GAME BOARD
   ======================================== */

.board-wrapper {
  position: relative;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  background: var(--color-grid-lines);
  padding: 3px;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.2);
  width: min(500px, 90vw);
  aspect-ratio: 1;
}

.tile {
  position: relative;
  background: var(--color-tile-empty);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 1;
}

.tile:hover:not(.entropy):not(.wolf):not(.disabled) {
  background: var(--color-tile-empty-hover);
}

.tile.valid-move {
  background: var(--color-tile-valid-move);
  box-shadow: inset 0 0 15px rgba(0, 212, 255, 0.3);
}

.tile.valid-move::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(0, 212, 255, 0.4);
  animation: pulse-valid 1.5s infinite;
}

@keyframes pulse-valid {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 0.3; }
}

/* ========================================
   WOLF TILES
   ======================================== */

.tile.wolf {
  background: var(--color-wolf-bg);
  cursor: grab;
}

.tile.wolf:active {
  cursor: grabbing;
}

.tile.wolf.selected {
  background: var(--color-wolf-selected);
  box-shadow: 0 0 15px rgba(90, 138, 74, 0.5);
}

.tile.wolf.stabilizing {
  background: var(--color-wolf-stabilizing);
  cursor: not-allowed;
  animation: stabilize-glow 2s ease-in-out infinite;
}

@keyframes stabilize-glow {
  0%, 100% { 
    box-shadow: 0 0 10px var(--color-wolf-stabilizing-glow);
  }
  50% { 
    box-shadow: 0 0 25px var(--color-wolf-stabilizing-glow), 
                0 0 40px rgba(251, 191, 36, 0.3);
  }
}

.wolf-icon {
  position: absolute;
  width: 70%;
  height: 70%;
  object-fit: contain;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.tile.wolf.stabilizing .wolf-icon {
  filter: sepia(1) saturate(5) hue-rotate(15deg);
  animation: stabilize-pulse 2s ease-in-out infinite;
}

@keyframes stabilize-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.9); }
}

/* Wolf that has already moved this turn */
.tile.wolf.moved {
  background: var(--color-wolf-bg);
  opacity: 0.6;
  cursor: not-allowed;
}

.tile.wolf.moved .wolf-icon {
  opacity: 0.5;
}

/* ========================================
   ENTROPY TILES
   ======================================== */

.tile.entropy {
  background: radial-gradient(circle at center, 
    var(--color-entropy-inner) 0%, 
    var(--color-entropy) 70%);
  border: 2px solid var(--color-entropy-border);
  cursor: not-allowed;
}

.tile.entropy::before {
  content: '';
  position: absolute;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, 
    transparent 30%, 
    var(--color-entropy-border) 70%);
  opacity: 0.3;
  border-radius: 50%;
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.actions-panel {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-btn-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-btn-primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--color-btn-secondary);
  color: var(--color-text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-btn-secondary-hover);
}

.btn-spawn {
  background: var(--color-wolf-bg);
  color: white;
}

.btn-spawn:hover:not(:disabled) {
  background: var(--color-wolf-selected);
}

.btn-pass {
  background: transparent;
  border: 2px solid var(--color-btn-secondary);
  color: var(--color-text-secondary);
}

.btn-pass:hover:not(:disabled) {
  border-color: var(--color-text-primary);
  color: var(--color-text-primary);
}

/* ========================================
   RULES PANEL
   ======================================== */

.rules-panel {
  background: var(--color-bg-panel);
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 500px;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.rules-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-grid-lines);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rules-list {
  list-style: none;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.rules-list li {
  padding: 0.25rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.rules-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--color-grid-lines);
}

/* ========================================
   DIFFICULTY SELECTOR
   ======================================== */

.difficulty-screen {
  text-align: center;
  padding: 2rem;
}

.difficulty-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--color-text-primary), var(--color-grid-lines));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.difficulty-title .emoji,
.game-title .emoji {
  -webkit-text-fill-color: initial;
}

.difficulty-subtitle {
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
}

.difficulty-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 300px;
  margin: 0 auto;
}

.difficulty-btn {
  padding: 1.25rem 2rem;
  border: 2px solid;
  border-radius: 12px;
  background: var(--color-bg-panel);
  cursor: pointer;
  transition: all 0.3s ease;
}

.difficulty-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.difficulty-btn.easy {
  border-color: var(--color-difficulty-easy);
}

.difficulty-btn.easy:hover {
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.2);
}

.difficulty-btn.medium {
  border-color: var(--color-difficulty-medium);
}

.difficulty-btn.medium:hover {
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.2);
}

.difficulty-btn.hard {
  border-color: var(--color-difficulty-hard);
}

.difficulty-btn.hard:hover {
  background: rgba(239, 68, 68, 0.1);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.2);
}

.difficulty-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 0.25rem;
}

.difficulty-btn.easy .difficulty-name { color: var(--color-difficulty-easy); }
.difficulty-btn.medium .difficulty-name { color: var(--color-difficulty-medium); }
.difficulty-btn.hard .difficulty-name { color: var(--color-difficulty-hard); }

.difficulty-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ========================================
   GAME OVER SCREEN
   ======================================== */

.game-over-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.5s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-over-content {
  text-align: center;
  padding: 3rem;
  background: var(--color-bg-panel);
  border-radius: 20px;
  border: 2px solid;
  max-width: 400px;
  animation: scale-in 0.3s ease;
}

@keyframes scale-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.game-over-content.win {
  border-color: var(--color-status-win);
  box-shadow: 0 0 50px rgba(34, 197, 94, 0.3);
}

.game-over-content.loss {
  border-color: var(--color-status-loss);
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.3);
}

.game-over-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.game-over-content.win .game-over-title {
  color: var(--color-status-win);
}

.game-over-content.loss .game-over-title {
  color: var(--color-status-loss);
}

.game-over-message {
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.game-over-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--color-bg-secondary);
  border-radius: 10px;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-grid-lines);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

/* ========================================
   PHASE INDICATOR
   ======================================== */

.phase-indicator {
  text-align: center;
  padding: 0.5rem 1rem;
  background: var(--color-bg-panel);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.phase-indicator.player-phase {
  color: var(--color-wolf-selected);
  border: 1px solid var(--color-wolf-selected);
}

.phase-indicator.entropy-phase {
  color: #9b4d96;
  border: 1px solid #9b4d96;
  animation: entropy-pulse 0.5s ease;
}

@keyframes entropy-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ========================================
   MESSAGE TOAST
   ======================================== */

.message-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-bg-panel);
  border: 1px solid var(--color-grid-lines);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--color-text-primary);
  z-index: 50;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { 
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 600px) {
  .game-title, .difficulty-title {
    font-size: 1.75rem;
  }
  
  .status-bar {
    gap: 1rem;
    padding: 0.75rem 1rem;
  }
  
  .status-value {
    font-size: 1.25rem;
  }
  
  .game-board {
    width: 95vw;
  }
  
  .actions-panel {
    gap: 0.5rem;
  }
  
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }
  
  .rules-panel {
    padding: 1rem;
  }
  
  .rules-list {
    font-size: 0.75rem;
  }
  
  .difficulty-options {
    max-width: 90%;
  }
  
  .game-over-content {
    margin: 1rem;
    padding: 2rem;
  }
  
  .game-over-title {
    font-size: 2rem;
  }
}

/* ========================================
   DRAG & DROP STYLES
   ======================================== */

.tile.dragging {
  opacity: 0.5;
}

.tile.drag-over.valid-move {
  background: var(--color-wolf-selected);
  box-shadow: 0 0 20px rgba(90, 138, 74, 0.5);
}

/* Touch-friendly larger tap targets on mobile */
@media (pointer: coarse) {
  .tile {
    min-height: 50px;
  }
}
