/* =========================================================
   SMART GAMES — shared/css/base.css
   Reset + variables couleur/typo SMART + composants communs
   Palette : Caraïbe / tropicale (verts, bleus turquoise,
   jaune soleil, corail)
   ========================================================= */

:root {
  /* Palette */
  --smart-green-deep: #0b6e4f;
  --smart-green: #1aa06d;
  --smart-green-light: #7fd8a4;
  --smart-turquoise: #17b6c4;
  --smart-turquoise-light: #a3ecec;
  --smart-blue: #1d6fa5;
  --smart-blue-deep: #124b73;
  --smart-yellow: #ffcc33;
  --smart-yellow-deep: #f5a623;
  --smart-coral: #ff6f59;
  --smart-coral-deep: #e04f39;
  --smart-sand: #fff8e7;
  --smart-white: #ffffff;
  --smart-ink: #0f2e2a;
  --smart-ink-soft: #33544d;
  --smart-grey: #7c8f8b;
  --smart-error: #d6473c;
  --smart-success: #1aa06d;

  /* Layout tokens */
  --radius-s: 8px;
  --radius-m: 16px;
  --radius-l: 24px;
  --shadow-card: 0 6px 18px rgba(11, 66, 49, 0.14);
  --shadow-button: 0 4px 0 rgba(0, 0, 0, 0.15);
  --gap-s: 8px;
  --gap-m: 16px;
  --gap-l: 24px;
  --gap-xl: 40px;

  /* Typography */
  --font-main: "Baloo 2", "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  --font-fallback: system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg-body: linear-gradient(180deg, #eafcf3 0%, #e3f7fb 55%, #fef9e7 100%);
  --bg-header: var(--smart-green-deep);
  --text-color: var(--smart-ink);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-body: linear-gradient(180deg, #06231c 0%, #052a33 55%, #241d08 100%);
    --text-color: #eafcf3;
    --smart-sand: #123028;
    --smart-white: #0e2b25;
    --smart-ink: #eafcf3;
    --smart-ink-soft: #b9d8cf;
  }
}
:root[data-theme="dark"] {
  --bg-body: linear-gradient(180deg, #06231c 0%, #052a33 55%, #241d08 100%);
  --text-color: #eafcf3;
  --smart-sand: #123028;
  --smart-white: #0e2b25;
  --smart-ink: #eafcf3;
  --smart-ink-soft: #b9d8cf;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-main), var(--font-fallback);
  background: var(--bg-body);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}
img, svg { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0 0 var(--gap-s) 0; }

/* ---------- Layout helpers ---------- */
.smart-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--gap-m);
}
.smart-header {
  display: flex;
  align-items: center;
  gap: var(--gap-m);
  padding: var(--gap-m);
  color: var(--smart-white);
  background: linear-gradient(120deg, var(--smart-green-deep), var(--smart-turquoise));
  border-radius: var(--radius-m);
  margin-bottom: var(--gap-l);
  box-shadow: var(--shadow-card);
}
.smart-header h1 {
  font-size: 1.4rem;
  margin: 0;
}
.smart-header .smart-logo { width: 48px; height: 48px; flex-shrink: 0; }
.smart-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--smart-white);
  text-decoration: none;
  font-weight: 700;
  opacity: 0.9;
}
.smart-back:hover { opacity: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 24px;
  border-radius: var(--radius-l);
  border: none;
  cursor: pointer;
  color: var(--smart-white);
  background: var(--smart-green);
  box-shadow: var(--shadow-button);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  min-height: 48px;
  touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--smart-green); }
.btn-secondary { background: var(--smart-blue); }
.btn-accent { background: var(--smart-coral); }
.btn-yellow { background: var(--smart-yellow-deep); color: var(--smart-ink); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--smart-green);
  color: var(--smart-green-deep);
  box-shadow: none;
}
.btn-block { width: 100%; }
.btn-lg { font-size: 1.25rem; padding: 18px 28px; }

/* ---------- Cards ---------- */
.card {
  background: var(--smart-white);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-card);
  padding: var(--gap-l);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap-l);
}
.game-card {
  display: flex;
  flex-direction: column;
  gap: var(--gap-s);
  text-align: center;
  border: 2px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.game-card:hover { border-color: var(--smart-turquoise); transform: translateY(-2px); }
.game-card .thumb { width: 100%; height: 140px; margin: 0 auto var(--gap-s); }
.game-card h3 { color: var(--smart-green-deep); font-size: 1.15rem; }
.game-card p { color: var(--smart-ink-soft); font-size: 0.92rem; flex-grow: 1; }
.game-card .progress-pill {
  align-self: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--smart-sand);
  color: var(--smart-ink-soft);
}

/* ---------- Category sections (charte v4) ---------- */
.category-section { margin-bottom: var(--gap-l); }
.category-section:last-child { margin-bottom: 0; }
.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: var(--gap-m);
}
.category-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Progress bar ---------- */
.progress-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--smart-turquoise), var(--smart-green));
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--smart-yellow);
  color: var(--smart-ink);
}
.badge.locked { background: rgba(0,0,0,0.08); color: var(--smart-grey); }

/* ---------- Points (Comeanddollars v1 locaux) ---------- */
.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.05rem;
  background: linear-gradient(120deg, var(--smart-yellow), var(--smart-yellow-deep));
  color: var(--smart-ink);
  box-shadow: var(--shadow-card);
}
.points-total-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--smart-yellow);
  color: var(--smart-ink);
}

/* ---------- Quiz-engine components ---------- */
.quiz-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-m);
}
.quiz-image {
  width: 180px;
  height: 180px;
  background: var(--smart-sand);
  border-radius: var(--radius-l);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-m);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.quiz-image-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-m);
}
.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-m);
  width: 100%;
}
@media (max-width: 520px) {
  .quiz-options { grid-template-columns: 1fr; }
}
.quiz-option {
  background: var(--smart-white);
  border: 3px solid var(--smart-turquoise-light);
  border-radius: var(--radius-m);
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--smart-ink);
  transition: all 0.12s ease;
  min-height: 56px;
}
.quiz-option:hover { border-color: var(--smart-turquoise); }
.quiz-option.correct {
  background: var(--smart-green-light);
  border-color: var(--smart-green);
  color: var(--smart-green-deep);
}
.quiz-option.wrong {
  background: #ffd7d0;
  border-color: var(--smart-coral);
  color: var(--smart-coral-deep);
}
.quiz-option:disabled { cursor: default; opacity: 0.85; }

.feedback-banner {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-m);
  font-weight: 700;
  text-align: center;
}
.feedback-banner.good { background: var(--smart-green-light); color: var(--smart-green-deep); }
.feedback-banner.bad { background: #ffd7d0; color: var(--smart-coral-deep); }

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-m);
  width: 100%;
  font-weight: 700;
  color: var(--smart-ink-soft);
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-m { margin-top: var(--gap-m); }
.mt-l { margin-top: var(--gap-l); }
.mb-m { margin-bottom: var(--gap-m); }
.flex-row { display: flex; gap: var(--gap-m); flex-wrap: wrap; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }
.small { font-size: 0.85rem; color: var(--smart-ink-soft); }
.offline-banner {
  background: var(--smart-yellow);
  color: var(--smart-ink);
  text-align: center;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-s);
  margin-bottom: var(--gap-m);
}
