/**************************************
 * NTools — Canette (standalone)
 **************************************/

/* Utilise les variables du thème global */
:root{
  /* Alias pour compatibilité */
  --bg-elev: var(--bg-elevated);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --brand-600: var(--brand-dark);
  --card: var(--bg-card);
  --stroke: var(--border);
  --radius: var(--radius-lg);
}

/* Container global (+ largeur un peu étendue sur cette page) */
.container{
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.container.canette-page{ max-width: 1240px; }

/* ===== HERO ===== */
.hero{
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: calc(var(--radius) + 2px);
  padding: 48px 28px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 20px;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(79,140,255,.18), transparent 50%),
    radial-gradient(1200px 400px at 110% 50%, rgba(43,107,255,.15), transparent 55%),
    linear-gradient(-45deg, var(--bg-elevated), var(--bg), var(--bg-card), var(--bg-elevated));
  background-size: auto auto, auto auto, 400% 400%;
  animation: heroBgMove 20s ease infinite;
}
@keyframes heroBgMove{
  0%   { background-position: left top, right center,   0% 50%; }
  50%  { background-position: left top, right center, 100% 50%; }
  100% { background-position: left top, right center,   0% 50%; }
}
.hero-content h1{
  font-size: clamp(26px, 3.4vw, 42px);
  margin: 0 0 10px;
  line-height: 1.15;
}
.hero-content .brand{ color: var(--brand) }
.hero-content p{ color: var(--muted); max-width: 54ch; margin: 0 0 18px }

/* Boutons */
.cta{ display:flex; gap:12px; flex-wrap:wrap }
.btn-primary{
  background: linear-gradient(135deg,var(--brand),var(--brand-600));
  color:#fff; padding:12px 18px; border-radius:12px; font-weight:700;
  box-shadow: 0 10px 24px rgba(79,140,255,.25);
}
.btn-ghost{
  background: transparent; color:#fff; padding:12px 16px; border-radius:12px;
  border:1px solid var(--stroke); font-weight:600;
}
.btn-primary:hover{ filter: brightness(1.04) }
.btn-ghost:hover{ border-color: var(--brand) }

/* Illustration */
.hero-illustration{ position:relative; min-height:220px; border-radius:14px }
.hero .grid{
  position:absolute; inset:0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 22px 22px;
  border-radius:12px; opacity:.35; mix-blend:screen;
}
.orb{ position:absolute; filter: blur(22px); opacity:.6; border-radius:999px }
.orb-a{ width:180px; height:180px; right:10%; top:10%; background:#4f8cff }
.orb-b{ width:220px; height:220px; left:5%; bottom:-10%; background:#2b6bff }

/* ===== BLOCS ===== */
.blocks{ margin-top:28px; display:grid; gap:20px }
.block{
  background: var(--bg-elev);
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 22px;
}
.block-head h2{ margin:0; font-size:18px }
.block-head p{ margin:6px 0 0; color: var(--muted); font-size:14px }

/* (Conserve .cards/.card si réutilisées ailleurs dans la page) */
.cards{
  margin-top:14px;
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:14px;
}
.card{
  grid-column: span 6;
  display:flex; gap:14px; align-items:center;
  background: var(--bg-card);
  border:1px solid var(--stroke);
  border-radius: 14px;
  padding: 14px;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
  will-change: transform;
}
.card:hover{
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 8px 20px rgba(79,140,255,.25);
  border-color: rgba(79,140,255,.4);
}
.card-icon{
  width:42px;height:42px; display:grid; place-items:center;
  border-radius:10px; background:#10151f; color: var(--brand);
  border:1px solid rgba(79,140,255,.25);
  flex:0 0 auto;
}
.card-icon svg{ width:22px; height:22px; transition: transform .4s ease; }
.card:hover .card-icon svg{ transform: scale(1.08); }
.card-body h3{ margin:0 0 4px; font-size:16px }
.card-body p{ margin:0; color: var(--muted); font-size:14px }

/* Responsive */
@media (max-width: 980px){
  .hero{ grid-template-columns: 1fr; padding:36px 18px }
  .hero-illustration{ min-height:180px }
  .card{ grid-column: span 12 }
}

/* =========================================================
   Canette — Grille de thématiques (icônes petites et fixes)
   ========================================================= */
.themes-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap:16px;
  margin-top:.75rem;
}
.theme-tile{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:.55rem;
  padding:12px 10px;
  min-height:120px;
  border-radius:16px;
  background: rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 6px 14px rgba(0,0,0,.14);
  text-decoration:none;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, filter .2s ease;
}
.theme-tile:hover{
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(0,0,0,.2);
  border-color: rgba(255,255,255,.24);
  background: rgba(255,255,255,.04);
  filter: saturate(1.08);
}

/* Icône ronde couleur — taille strictement contrôlée */
.canette-page .theme-tile .tile-icon{
  width:44px !important;
  height:44px !important;
  border-radius:50%;
  display:grid !important;
  place-items:center !important;
  color:#111827;
  flex:0 0 auto !important;
  overflow:hidden !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
/* Écrase tout style global type svg{width:100%} */
html body .canette-page .theme-tile .tile-icon > svg,
html body .canette-page .theme-tile svg,
html body .canette-page .theme-tile * svg{
  width:20px !important;
  height:20px !important;
  min-width:20px !important;
  min-height:20px !important;
  max-width:20px !important;
  max-height:20px !important;
  display:block !important;
  flex:none !important;
  box-sizing:content-box !important;
  transform:none !important;
}

/* Libellé */
.tile-text span{
  font-weight:700;
  font-size:.94rem;
  text-align:center;
  color: var(--text);
  line-height:1.15;
}

/* Couleurs du rond */
.tone-purple { background:linear-gradient(180deg,#c084fc,#a78bfa); }
.tone-blue   { background:linear-gradient(180deg,#60a5fa,#3b82f6); }
.tone-amber  { background:linear-gradient(180deg,#fbbf24,#f59e0b); }
.tone-yellow { background:linear-gradient(180deg,#fde047,#facc15); }
.tone-green  { background:linear-gradient(180deg,#86efac,#34d399); }
.tone-indigo { background:linear-gradient(180deg,#a5b4fc,#6366f1); }
.tone-cyan   { background:linear-gradient(180deg,#67e8f9,#22d3ee); }
.tone-orange { background:linear-gradient(180deg,#fdba74,#fb923c); }
.tone-red    { background:linear-gradient(180deg,#fca5a5,#ef4444); }
.tone-pink   { background:linear-gradient(180deg,#f9a8d4,#ec4899); }
.tone-slate  { background:linear-gradient(180deg,#cbd5e1,#94a3b8); }
.tone-teal   { background:linear-gradient(180deg,#5eead4,#14b8a6); }
.tone-violet { background:linear-gradient(180deg,#c4b5fd,#8b5cf6); }
.tone-dark   { background:linear-gradient(180deg,#d1d5db,#6b7280); }
.tone-lime   { background:linear-gradient(180deg,#bef264,#84cc16); }
.tone-emerald{ background:linear-gradient(180deg,#6ee7b7,#10b981); }
.tone-zinc   { background:linear-gradient(180deg,#d4d4d8,#71717a); }
.tone-fuchsia{ background:linear-gradient(180deg,#f0abfc,#d946ef); }

@media (min-width: 1400px){
  .container.canette-page{ max-width: 1320px; }
  .themes-grid{ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width:480px){
  .themes-grid{ gap:12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .theme-tile{ min-height:110px; }
  .canette-page .theme-tile .tile-icon{ width:40px !important; height:40px !important; }
  html body .canette-page .theme-tile .tile-icon > svg,
  html body .canette-page .theme-tile svg,
  html body .canette-page .theme-tile * svg{
    width:18px !important; height:18px !important;
  }
  .tile-text span{ font-size:.92rem; }
}

/* =========================================================
   UI Quiz (QCM + phase saisie libre)
   ========================================================= */
.quiz-card{
  background: var(--bg-card);
  border:1px solid var(--stroke);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}
.question{ font-size: 1.08rem; margin-bottom: .9rem; color: var(--text); }

/* QCM */
.answers{ display:grid; gap:.65rem; }
.answer-btn{
  width:100%; text-align:left;
  padding:.9rem 1rem;
  background:#14161b;
  border:1px solid var(--stroke);
  border-radius:12px;
  cursor:pointer;
  transition: transform .06s ease, background .2s ease, border-color .2s ease, filter .2s ease;
  color: var(--text);
}
.answer-btn:hover{ transform: translateY(-1px); filter: brightness(1.05); }
.answer-btn.correct{ background: var(--success-light); border-color: var(--success); }
.answer-btn.wrong  { background: var(--danger-light); border-color: var(--danger); }
.answer-btn.disabled{ opacity:.9; pointer-events:none; }

/* Saisie libre (phase recall) */
.answer-input-row{ display:flex; gap:.6rem; }
.answer-input{
  flex:1;
  background:var(--bg-elevated);
  border:1px solid var(--stroke);
  color:var(--text);
  padding:.85rem .9rem;
  border-radius:12px;
  outline:none;
}
.answer-input:focus{ border-color: var(--brand); }
.recall-feedback{ margin-top:.5rem; font-size:.95rem; color:var(--muted); }
.recall-feedback.ok{ color:var(--success); }
.recall-feedback.ko{ color:var(--danger); }

.controls{ display:flex; gap:.7rem; margin-top:1rem; }
.result{
  margin-top: 1rem;
  background: rgba(255,255,255,.02);
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 12px 14px;
}

/* =========================================================
   Contraste global pour la page Canette
   ========================================================= */
.canette-page { color: var(--text); }
.canette-page .hero .hero-content h1 { color: var(--text); }
.canette-page .hero .hero-content .subtitle { color: var(--muted); }
.canette-page .meta,
.canette-page .meta span,
.canette-page .meta b { color: var(--muted); }
.canette-page .btn.btn-ghost { color: var(--text); }

/* Badge mode */
.mode-badge{
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 12px;
}
.mode-badge.is-chrono{ border-color:var(--brand); color:var(--brand-hover); }

/* Timer */
.timer{
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #0f1217;
  border: 1px solid var(--stroke);
  overflow: hidden;
  margin-bottom: 12px;
}
.timer-bar{
  position:absolute; left:0; top:0; bottom:0;
  width: 100%;
  background: linear-gradient(90deg,#22c55e,#ef4444);
  transition: width .1s linear;
}
.timer-text{
  position:absolute; right:8px; top:-22px;
  font-size: 12px; color: var(--muted);
}

.lb{
  width:100%;
  border-collapse: collapse;
  font-size: 14px;
}
.lb thead th{
  text-align:left;
  padding:10px 12px;
  border-bottom:1px solid var(--stroke);
  color: var(--muted);
}
.lb tbody td{
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.lb tbody tr:hover{
  background: rgba(255,255,255,.02);
}

.answers .answer-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 10px;
  margin: 8px 0;
  border: 1px solid var(--border, #2a2a2a);
}
.answer-btn.disabled { opacity: .5; pointer-events: none; }
#nextBtn.is-disabled { opacity: .5; pointer-events: none; }
.question { word-wrap: break-word; overflow-wrap: anywhere; }

/* Bouton "Suivant" lisible quand disabled */
.btn[disabled],
#nextBtn[disabled] {
  opacity: .5;
  pointer-events: none;
  filter: saturate(0.3);
}

/* Accessibilité mobile/dark : on évite l'illusion d'activité */
.btn.btn-primary[disabled] {
  box-shadow: none;
}

/* États de réponse très visibles sur fond sombre */
.answer-btn.correct {
  background: var(--success-light);
  border-color: var(--success);
  color: white;
}
.answer-btn.wrong {
  background: var(--danger-light);
  border-color: var(--danger);
  color: white;
}

/* Quand on a révélé la solution, on garde les couleurs et on coupe les hovers */
.answer-btn.disabled { opacity: .85; pointer-events: none; }
.answer-btn.correct.disabled,
.answer-btn.wrong.disabled { opacity: 1; }

.answers.revealed .answer-btn:hover,
.answers.revealed .answer-btn:focus {
  background: inherit;
  color: inherit;
  border-color: inherit;
  box-shadow: none;
}

/* Champ "écriture" : feedback très lisible */
.recall-feedback.ok {
  color: var(--success);
  font-weight: 600;
  margin-top: 8px;
}
.recall-feedback.ko {
  color: var(--danger);
  font-weight: 600;
  margin-top: 8px;
}
.recall-feedback.ko b { color: white; }

/* Accessibilité : focus visible sur les réponses */
.answer-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Le texte de la question ne doit pas être "gris" */
.question { color: var(--text-primary); }

