/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Apply animations to main sections */
.header {
  animation: fadeInUp 0.8s ease-out;
}

.stats-panel {
  animation: slideInLeft 0.8s ease-out 0.2s both;
}

.game-section {
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.neural-section {
  animation: slideInRight 0.8s ease-out 0.6s both;
}

.controls-section {
  animation: fadeInUp 0.8s ease-out 0.8s both;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

/* Main container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--background) 0%, var(--muted) 100%);
  position: relative;
}

.app-container::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Header section */
.header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.header::before {
  content: "";
  position: absolute;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--success),
    var(--warning)
  );
  border-radius: 2px;
}

.title {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--foreground);
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
  line-height: 1.1;
  background: linear-gradient(
    135deg,
    var(--foreground),
    var(--muted-foreground)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.25rem;
  color: var(--muted-foreground);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
}

/* Stats panel */
.stats-panel {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.stats-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.stat-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-card-icon {
  font-size: 1.125rem;
}

.stat-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.stat-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.stat-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.stat-value.warning {
  color: var(--warning);
}

.stat-value.danger {
  color: var(--error);
}

.stat-value.highlight {
  color: var(--success);
  font-weight: 700;
}

/* Status indicator */
.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse 2s infinite;
}

.status-indicator.running {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-indicator.paused {
  background: var(--warning);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
  animation: none;
}

.status-indicator.stopped {
  background: var(--error);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Keyboard shortcuts */
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
}

.shortcut-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.shortcut-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.shortcut-key {
  background: var(--muted);
  color: var(--foreground);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
  box-shadow: var(--shadow-sm);
}

/* Status indicator */
.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-indicator.running {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-indicator.paused {
  background: var(--warning);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.status-indicator.stopped {
  background: var(--error);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Keyboard shortcuts */
.keyboard-shortcuts {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.shortcut-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
}

.shortcut-key {
  background: var(--muted);
  color: var(--foreground);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
}

/* Game canvas section */
.game-section {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
}

.canvas-container {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.canvas-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--success),
    var(--warning),
    var(--error)
  );
  border-radius: 16px 16px 0 0;
}

.canvas-container:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

#gameCanvas {
  border-radius: 12px;
  background: linear-gradient(135deg, #87ceeb, #98d8e8);
  display: block;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

#gameCanvas:hover {
  box-shadow: var(--shadow-lg);
}

/* Neural network section */
.neural-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.neural-panel {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.neural-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--warning));
  border-radius: 16px 16px 0 0;
}

.neural-panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.neural-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 1rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.neural-title::before {
  content: "🧠";
  font-size: 1.25rem;
}

.neural-canvas {
  border-radius: 12px;
  background: linear-gradient(135deg, var(--muted), var(--accent));
  border: 1px solid var(--border);
  width: 100%;
  height: auto;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.neural-canvas:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-hover);
}

/* Control buttons */
.controls-section {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  padding: 1rem 0;
}
.control-button {
  padding: 12px 20px;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: "Inter", sans-serif;
  font-weight: bolder;
}

.control-button.primary {
  background: #1010be;
  color: white;
}

.control-button.secondary {
  background: #ecad0d;
  color: white;
}

.control-button.danger {
  background: red;
  color: white;
}

.control-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
/* Enhanced info panel with better visual hierarchy */
.info-panel {
  background: linear-gradient(135deg, var(--background), var(--muted));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideInLeft 0.8s ease-out 1s both;
}

.info-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--warning), var(--primary), var(--success));
  border-radius: 16px 16px 0 0;
}

.info-panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.info-text {
  font-size: 1rem;
  color: var(--foreground);
  line-height: 1.8;
  margin: 0;
  font-weight: 400;
  text-align: left;
  position: relative;
  z-index: 1;
}

.info-text strong {
  color: var(--foreground);
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
  margin-bottom: 0.25rem;
}

.info-text strong::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.info-text strong:hover::after {
  opacity: 1;
}

.info-text br {
  margin-bottom: 1rem;
  display: block;
  content: "";
}

/* Add some visual elements to make it more engaging */
.info-panel::after {
  content: "🧠";
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-size: 2rem;
  opacity: 0.1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.info-panel:hover::after {
  opacity: 0.2;
}

/* Stats section */
.stats-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stats-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--success),
    var(--warning)
  );
  border-radius: 16px 16px 0 0;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.stats-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 12px 12px 0 0;
}

.stat-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-xl);
  border-color: var(--border-hover);
}

.stat-card:hover .stat-card-icon {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

.stat-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card-icon {
  font-size: 1.25rem;
}

.stat-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}

.stat-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.stat-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
}

.stat-value.warning {
  color: var(--warning);
}

.stat-value.highlight {
  color: var(--success);
  font-weight: 700;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.shortcut-row:last-child {
  border-bottom: none;
}

.shortcut-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.shortcut-key {
  background: var(--muted);
  color: var(--foreground);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Footer */
.footer {
  text-align: center;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  background: linear-gradient(135deg, var(--background), var(--muted));
  border-radius: 16px 16px 0 0;
  position: relative;
  animation: fadeInUp 0.8s ease-out 1.2s both;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.footer p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.footer p::before {
  content: "⚡";
  font-size: 1rem;
  opacity: 0.7;
}

.footer a {
  color: var(--foreground);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.footer a:hover {
  color: var(--primary);
  text-decoration: none;
  background: var(--accent);
  transform: translateY(-1px);
}

.footer a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.3s ease;
  border-radius: 1px;
}

.footer a:hover::after {
  width: 100%;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .app-container {
    padding: 1rem;
  }

  .header {
    margin-bottom: 2rem;
  }

  .header::before {
    width: 60px;
    height: 3px;
  }

  .title {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .stats-panel {
    padding: 1.5rem;
  }

  .stats-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .stats-title {
    font-size: 1.25rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .game-section {
    margin-bottom: 2rem;
  }

  .canvas-container {
    padding: 1rem;
  }

  #gameCanvas {
    width: 100%;
    height: auto;
    max-width: 350px;
  }

  .neural-section {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .neural-panel {
    padding: 1rem;
  }

  .controls-section {
    gap: 1rem;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0;
  }

  .control-button {
    padding: 1rem 2rem;
    font-size: 0.875rem;
    min-width: 200px;
    max-width: 280px;
    width: 100%;
  }

  .control-button::after {
    width: 16px;
    height: 16px;
  }

  .info-panel {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }

  .info-text {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .info-panel::after {
    display: none; /* Hide the brain emoji on mobile for cleaner look */
  }

  .footer {
    padding: 1.5rem 0;
    margin-top: 2rem;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 0.75rem;
  }

  .title {
    font-size: 2rem;
  }

  .stats-panel {
    padding: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .control-button {
    width: 100%;
    max-width: 300px;
    min-width: auto;
    padding: 0.875rem 1.75rem;
    font-size: 0.8rem;
  }

  .controls-section {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .control-button::after {
    width: 14px;
    height: 14px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f172a;
    --foreground: #f8fafc;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --border: #334155;
    --border-hover: #475569;
    --primary: #f8fafc;
    --primary-hover: #e2e8f0;
    --accent: #1e293b;
    --accent-hover: #334155;
  }
}
