/**
 * Base Styles - RevoFun Game Website
 * Contains: Reset, typography, layout, buttons, and common components
 */

/* ===== CSS VARIABLES ===== */
:root {
  /* Base Colors */
  --color-bg-primary: #0f172a;
  --color-bg-secondary: #020617;
  --color-text-primary: #e5e7eb;
  --color-text-muted: #94a3b8;
  --color-text-subtle: #64748b;
  --color-accent: #38bdf8;
  --color-accent-hover: #0ea5e9;
  
  /* Status Colors */
  --color-success: #22c55e;
  --color-error: #dc2626;
  --color-warning: #fbbf24;
  
  /* Theme Colors - Detective */
  --color-detective: #fbbf24;
  --color-detective-dark: #ca8a04;
  --color-detective-darker: #a16207;
  
  /* Theme Colors - Samurai */
  --color-samurai: #dc2626;
  --color-samurai-dark: #8b0000;
  --color-samurai-darker: #6b0000;
  --color-samurai-light: #a00000;
  --color-samurai-accent: #d4af37;
  
  /* Theme Colors - Arcade */
  --color-arcade: #38bdf8;
  --color-arcade-btn: #f43f5e;
  --color-arcade-btn-dark: #be123c;
  --color-arcade-btn-light: #fb7185;
  --color-arcade-btn-hover: #e11d48;
  --color-arcade-btn-border: #fda4af;
  
  /* Theme Colors - Go/Gomoku */
  --color-go: #d4af37;
  --color-go-dark: #b8860b;
  --color-go-wood: #8b4513;
  --color-go-wood-light: #a0522d;
  --color-go-wood-dark: #654321;
  
  /* Theme Colors - AI Badge */
  --color-ai-primary: #8b5cf6;
  --color-ai-secondary: #6366f1;
  
  /* Border Colors */
  --color-border: #334155;
  --color-border-light: #1e293b;
  
  /* Spacing */
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 20px;
  --spacing-lg: 30px;
  --spacing-xl: 40px;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  
  /* Font */
  --font-mono: 'Courier New', monospace;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== LAYOUT ===== */
header,
main,
footer {
  max-width: 900px;
  margin: auto;
  padding: var(--spacing-lg);
}

footer {
  text-align: center;
  margin-top: var(--spacing-xl);
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ===== GAMES LIST ===== */
.game-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 280px));
  grid-template-rows: auto auto;
  gap: var(--spacing-md);
  justify-content: center;
  justify-items: center;
}

/* Cross/Diamond layout for 4 cards */
.game-list .game-card:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
}

.game-list .game-card:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.game-list .game-card:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.game-list .game-card:nth-child(4) {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
}

.game-card {
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border-light);
}

/* ===== BUTTONS ===== */
button,
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--color-accent);
  color: var(--color-bg-secondary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: bold;
}

button:hover,
.btn:hover {
  background-color: var(--color-accent-hover);
}

button:disabled {
  background-color: var(--color-text-subtle);
  cursor: not-allowed;
}

/* ===== GAME PAGES COMMON ===== */
main h1 {
  margin-bottom: var(--spacing-sm);
}

main p {
  margin-bottom: var(--spacing-md);
}

/* ===== STATS PANEL (SHARED) ===== */
.stats-panel {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.stat-box {
  background-color: var(--color-bg-secondary);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  min-width: 80px;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-subtle);
  letter-spacing: 2px;
  margin-bottom: var(--spacing-xs);
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--color-accent);
  font-family: var(--font-mono);
}

/* ===== COMMON ANIMATIONS ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

@keyframes celebrate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

/* ===== CONFETTI (SHARED) ===== */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1000;
}

.confetti {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===== KEYBOARD HINTS ===== */
.keyboard-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  margin-top: var(--spacing-md);
  opacity: 0.7;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 600px) {
  header,
  main,
  footer {
    padding: var(--spacing-md);
  }
  
  .stats-panel {
    flex-wrap: wrap;
    gap: var(--spacing-sm);
  }
  
  .stat-box {
    min-width: 70px;
    padding: var(--spacing-sm) var(--spacing-sm);
  }
  
  .stat-value {
    font-size: 1.4rem;
  }
}
