/* CSS Custom Properties */
:root {
  --primary-color: #00ff41;
  --secondary-color: #ff6b35;
  --background-dark: #0a0a0a;
  --background-medium: #1a1a1a;
  --background-light: #2a2a2a;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --border-color: #333333;
  --shadow-glow: 0 0 1rem rgba(0, 255, 65, 0.3);
  --shadow-orange: 0 0 1rem rgba(255, 107, 53, 0.3);
  --font-family: 'Courier New', monospace;
}

/* Base Styles */
body {
  background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-medium) 100%);
  color: var(--text-primary);
  font-family: var(--font-family);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* Utility Classes */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
header {
  background: var(--background-medium);
  border-bottom: 0.125rem solid var(--primary-color);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-glow);
}

.logo {
  max-width: 3rem;
  height: auto;
  margin-bottom: 0.5rem;
  filter: drop-shadow(var(--shadow-glow));
}

h1 {
  font-size: 2.5rem;
  color: var(--primary-color);
  text-shadow: 0 0 0.5rem var(--primary-color);
  letter-spacing: 0.125rem;
  text-transform: uppercase;
}

/* Main Content */
main {
  flex: 1;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  max-width: 50rem;
  margin: 0 auto;
  width: 100%;
}

/* Section Headings */
h2 {
  color: var(--secondary-color);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
}

/* Game Info Section */
.game-info {
  background: var(--background-light);
  border: 0.125rem solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  width: 100%;
  max-width: 25rem;
}

.stats {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

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

.label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.value {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--primary-color);
  text-shadow: 0 0 0.25rem var(--primary-color);
}

/* Game Board */
.game-board-container {
  width: 100%;
  max-width: 25rem;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.125rem;
  background: var(--border-color);
  border: 0.25rem solid var(--primary-color);
  border-radius: 0.5rem;
  padding: 0.125rem;
  box-shadow: var(--shadow-glow);
}

.cell {
  aspect-ratio: 1;
  background: var(--background-light);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
  min-height: 4rem;
}

.cell:hover {
  background: var(--background-medium);
}

.cell.valid-move {
  background: rgba(0, 255, 65, 0.2);
  box-shadow: inset 0 0 0.5rem var(--primary-color);
}

.cell.drag-over {
  background: rgba(255, 107, 53, 0.3);
  box-shadow: inset 0 0 0.5rem var(--secondary-color);
}

/* Pawns */
.pawn {
  font-size: 2rem;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
  padding: 0.25rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
}

.pawn:hover {
  transform: scale(1.1);
}

.pawn:active,
.pawn.dragging {
  cursor: grabbing;
  transform: scale(0.9);
  opacity: 0.7;
}

.player-pawn {
  color: var(--primary-color);
  text-shadow: 0 0 0.5rem var(--primary-color);
}

.computer-pawn {
  color: var(--secondary-color);
  text-shadow: 0 0 0.5rem var(--secondary-color);
}

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

/* Game Controls */
.game-controls {
  width: 100%;
  max-width: 25rem;
}

.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  background: var(--background-medium);
  color: var(--text-primary);
  border: 0.125rem solid var(--border-color);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-family);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.0625rem;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  min-width: 8rem;
}

.btn:hover {
  transform: translateY(-0.125rem);
}

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

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

.btn-primary:hover {
  background: var(--primary-color);
  color: var(--background-dark);
  box-shadow: var(--shadow-glow);
}

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

.btn-secondary:hover {
  background: var(--secondary-color);
  color: var(--background-dark);
  box-shadow: var(--shadow-orange);
}

/* Game Rules */
.game-rules {
  background: var(--background-light);
  border: 0.125rem solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  width: 100%;
  max-width: 25rem;
}

.game-rules ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-rules li {
  color: var(--text-secondary);
  position: relative;
  padding-left: 1.5rem;
}

.game-rules li::before {
  content: "▶";
  color: var(--primary-color);
  position: absolute;
  left: 0;
  top: 0;
}

/* Footer */
footer {
  background: var(--background-medium);
  border-top: 0.125rem solid var(--primary-color);
  padding: 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 30rem) {
  h1 {
    font-size: 2rem;
  }
  
  main {
    padding: 1rem 0.5rem;
    gap: 1.5rem;
  }
  
  .stats {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .stat {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .controls {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 12rem;
  }
}

/* Animation for game state changes */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.game-over {
  animation: pulse 1s ease-in-out;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
.btn:focus-visible,
.pawn:focus-visible {
  outline: 0.125rem solid var(--primary-color);
  outline-offset: 0.125rem;
}
