/**
 * LEARNature-ly Game Framework CSS
 * Base styles shared across all games.
 * Games load their own CSS on top of this foundation.
 */

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  color: #1a1a2e;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Typography ────────────────────────────────────── */
h1 { font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 700; }
h2 { font-size: clamp(1.1rem, 3vw, 1.5rem); font-weight: 600; }
h3 { font-size: clamp(1rem, 2.5vw, 1.25rem); font-weight: 600; }

/* ── Container ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

/* ── Game Card ─────────────────────────────────────── */
.game-card, .card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* ── Buttons ───────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

button:active, .btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(102,126,234,0.5);
}

.btn-secondary {
  background: #f0f0f5;
  color: #333;
}

.btn-large {
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
}

/* ── Screens ───────────────────────────────────────── */
.screen { min-height: 100vh; display: flex; flex-direction: column; }
.screen.hidden { display: none !important; }

/* ── Header / Footer ──────────────────────────────── */
.game-header {
  text-align: center;
  padding: 1rem 0;
  color: #fff;
}

.game-footer {
  text-align: center;
  padding: 1rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ── Stats Bar ─────────────────────────────────────── */
.game-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #fff;
  font-weight: 500;
}

/* ── Grid Layouts ──────────────────────────────────── */
.game-grid {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 0;
}

/* ── Feedback ──────────────────────────────────────── */
.feedback-correct {
  animation: pulse-green 0.4s ease;
}

.feedback-incorrect {
  animation: shake 0.4s ease;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76,175,80,0.5); }
  50% { box-shadow: 0 0 0 12px rgba(76,175,80,0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

/* ── Progress Bar ──────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: 0.75rem; }
  .game-stats { gap: 0.75rem; font-size: 0.9rem; }
}
