/* ─── v2-flash.css — Flash Kwiiz DANS la démo du hero ────────────────────────
   Additif à v2.css, tout scopé sous .kv2 (même règle : chargé APRÈS, ne
   redéfinit rien de l'existant). Deux blocs :
     1. le SÉLECTEUR DE MODE posé au-dessus de la tablette (miroir de
        `components/flash/ModeSwitch.jsx` : deux segments, une pastille qui
        GLISSE) — version claire, puisqu'il vit sur le fond du hero et non sur
        le ciel nuit du lobby ;
     2. l'ÉCRAN FLASH, un second `.kv2-screen` superposé au classique dans le
        MÊME cadre de tablette. La peau est celle du vrai mode (flashSkin.jsx) :
        barre ambrée, ciel nuit qui s'embrase d'ambre en haut, carte blanche à
        bande de tête (violet « ? » au recto, vert « ✓ » au verso), « À revoir »
        AMBRE — jamais rouge — et « Je sais » vert.
   ⚠️ Codes couleur = ceux de flashSkin.jsx / theme.js (la landing n'a pas de
   build : recopiés, à faire évoluer ensemble). */

.kv2 {
  --kv2-flash-amber: #F59E0B;
  --kv2-flash-gold: #FFD166;
  --kv2-flash-ink: #B57E10;
  --kv2-flash-bar: linear-gradient(180deg, hsl(31 78% 41%) 0%, hsl(29 80% 33%) 100%);
  /* Le ciel NUIT du jeu (StarrySky.NIGHT_SKY_GRADIENT), sans embrasement :
     comme in-game, l'ambre vit dans la barre, le fond n'est que le ciel
     étoilé (retour Quentin 29.08). */
  --kv2-flash-sky: linear-gradient(170deg, hsl(222 47% 11%) 0%, hsl(230 40% 16%) 50%, hsl(222 47% 11%) 100%);
  --kv2-flash-band-q: linear-gradient(90deg, #5B6CF9, #7C3AED);
  --kv2-flash-band-a: linear-gradient(90deg, #22B573, #34D399);
}

/* ═══ 1. Sélecteur de mode ══════════════════════════════════════════════════ */
/* Rail gris compact + pastille blanche qui glisse : la « boîte iOS » de niveau 1
   du tableau de bord (on CHANGE de sous-vue, on ne filtre pas). Centré au-dessus
   de la tablette, dans la colonne de la démo (328px) : même position sur
   téléphone et sur ordinateur. */
.kv2-modeswitch {
  position: relative; display: flex; gap: 3px; padding: 3px; margin: 0 auto 14px;
  width: max-content; max-width: 100%;
  border-radius: 999px; background: rgba(45, 45, 58, 0.06);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(45, 45, 58, 0.05);
}
.kv2-ms-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0; z-index: 0;
  border-radius: 999px; background: #fff;
  box-shadow: 0 2px 8px rgba(45, 45, 58, 0.16), 0 0 0 1px rgba(45, 45, 58, 0.04);
  transition: transform .28s cubic-bezier(0.22, 1, 0.36, 1), width .28s cubic-bezier(0.22, 1, 0.36, 1);
}
.kv2-ms-btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border: 0; border-radius: 999px; background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13.5px; font-weight: 700;
  color: var(--text-secondary); white-space: nowrap; cursor: pointer;
  transition: color .28s ease;
}
.kv2-ms-btn[aria-pressed="true"] { color: var(--text); cursor: default; }
.kv2-ms-btn svg { width: 15px; height: 15px; flex: none; transition: color .2s ease; }
.kv2-ms-btn[data-ms="classic"] svg { color: #AEB9FB; }
.kv2-ms-btn[data-ms="classic"][aria-pressed="true"] svg { color: var(--accent); }
.kv2-ms-btn[data-ms="flash"] svg { color: #F5C451; }
.kv2-ms-btn[data-ms="flash"][aria-pressed="true"] svg { color: #D97706; }
.kv2-ms-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .kv2-ms-btn[aria-pressed="false"]:hover { color: var(--text); }
}
/* « Nouveau » en biais sur le coin du segment Flash — la place de la couronne
   Pro dans l'app : c'est là que le mode se découvre. */
.kv2-ms-new {
  position: absolute; top: -9px; right: -10px; transform: rotate(10deg);
  padding: 2px 7px; border-radius: 999px; background: var(--kv2-flash-gold); color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 9.5px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(45, 45, 58, 0.25);
}

/* ═══ 2. Bascule classique ⇄ Flash ═════════════════════════════════════════ */
/* Le second écran est SUPERPOSÉ au premier dans le cadre (même inset que le
   padding de la tablette). Le classique reste monté et garde son état : on
   revient dessus exactement où on l'avait laissé — bascule EN PLACE, comme le
   lobby de l'app (règle QuizTestPreview). */
.kv2-pad { isolation: isolate; }
.kv2-fscreen {
  position: absolute; inset: 12px; z-index: 1;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 26px;
  background: var(--kv2-night);
  opacity: 0; pointer-events: none;
  transition: opacity .35s ease;
}
.kv2-hero-visual[data-mode="flash"] .kv2-fscreen { opacity: 1; pointer-events: auto; }
.kv2-hero-visual[data-mode="flash"] #kv2Screen { opacity: 0; transition: opacity .35s ease; }
#kv2Screen { transition: opacity .35s ease; }

/* Le coach : deux paires (image + bulle), une par mode. Le moteur classique
   continue d'écrire dans la sienne (minuteur d'inactivité compris) sans qu'on
   le voie ; Flash Kwiiz tient la sienne. Un seul Kwiix visible à la fois. */
.kv2-hero-visual[data-mode="flash"] .kv2-bubble:not(.kv2-fbubble),
.kv2-hero-visual[data-mode="flash"] .kv2-coach-img:not(.kv2-fcoach),
.kv2-hero-visual:not([data-mode="flash"]) .kv2-fbubble,
.kv2-hero-visual:not([data-mode="flash"]) .kv2-fcoach { display: none; }

/* Éclair d'entrée : un voile doré qui claque puis s'éteint à la bascule vers
   Flash Kwiiz. ORNEMENT (coupé sous prefers-reduced-motion). */
.kv2-fflash {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 209, 102, 0.85), rgba(245, 158, 11, 0.25) 55%, transparent 80%);
}
@media (prefers-reduced-motion: no-preference) {
  .kv2-fflash.go { animation: kv2-fflash .7s ease-out; }
}
@keyframes kv2-fflash { 0% { opacity: 0; } 12% { opacity: 1; } 30% { opacity: .35; } 45% { opacity: .8; } 100% { opacity: 0; } }

/* ═══ 3. L'écran Flash ══════════════════════════════════════════════════════ */
/* Barre du haut AMBRÉE (la barre dit le mode, pas une pastille — flashSkin) */
.kv2-ftop { position: relative; color: #fff; background: var(--kv2-flash-bar); }
.kv2-fbolt { display: grid; place-items: center; flex: none; width: 22px; height: 22px; color: rgba(60, 30, 0, 0.42); }
.kv2-fbolt svg { width: 18px; height: 18px; filter: drop-shadow(0 1px 0 rgba(255, 225, 160, 0.35)); }
.kv2-fprog i[data-s="again"] { background: var(--kv2-flash-gold); }
.kv2-fprog i[data-s="known"] { background: #34d399; }
.kv2-fmeta { background: hsl(222 47% 11%); color: var(--kv2-flash-gold); }

/* Corps : le ciel nuit étoilé, rien d'autre */
.kv2-fbody {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: var(--kv2-flash-sky); padding: 8px 10px 10px;
}
.kv2-fbody > * { position: relative; }
/* Le CIEL ÉTOILÉ du jeu (StarrySky) derrière les cartes : étoiles générées
   en JS (positions, taille, rythme), scintillement en CSS. Sous
   prefers-reduced-motion : étoiles statiques, discrètes. */
.kv2-fsky { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.kv2-fsky i {
  position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s);
  border-radius: 50%; background: #fff; opacity: var(--lo);
}
@media (prefers-reduced-motion: no-preference) {
  .kv2-fsky i { animation: kv2-twinkle var(--t) ease-in-out var(--d) infinite alternate; }
}
@keyframes kv2-twinkle { from { opacity: var(--lo); } to { opacity: var(--hi); } }

/* Piles à revoir (gauche, ambre) · acquises (droite, vert) */
.kv2-fpiles { display: flex; justify-content: space-between; flex: none; }
.kv2-fpile {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1.5px solid;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12px; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums;
}
.kv2-fpile svg { width: 12px; height: 12px; }
.kv2-fpile.again { border-color: rgba(245, 158, 11, 0.4); }
.kv2-fpile.again svg { color: var(--kv2-flash-amber); }
.kv2-fpile.know { border-color: rgba(34, 181, 115, 0.4); }
.kv2-fpile.know svg { color: #34d399; }
@media (prefers-reduced-motion: no-preference) {
  .kv2-fpile b.pop { display: inline-block; animation: kv2-fpop .32s cubic-bezier(0.34, 1.56, 0.64, 1); }
}
@keyframes kv2-fpop { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* Scène : la carte, centrée, qui tient dans la main */
.kv2-fstage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 6px; }
.kv2-fcard-wrap {
  /* 214px (et non toute la largeur de l'écran) : une carte plus étroite que
     la scène laisse de l'air de chaque côté, le glissement se lit mieux et
     la carte « tient dans la main » (retour Quentin 29.08). */
  position: relative; width: 100%; max-width: 214px; height: 100%; max-height: 236px;
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y;
  animation: kv2-fcard-in .3s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
.kv2-fcard-wrap:focus-visible { outline: none; }
.kv2-fcard-wrap[data-drag="1"] { cursor: grabbing; transition: none; }
.kv2-fcard-wrap.fly { transition: transform .32s cubic-bezier(0.4, 0, 0.8, 0.4), opacity .3s ease; opacity: 0; }
/* Mouvement de CONTENU : la carte entre, se retourne et part sur toutes les machines. */
@keyframes kv2-fcard-in { from { transform: scale(.94) translateY(12px); opacity: .6; } to { transform: none; opacity: 1; } }
.kv2-fcard-ghost {
  position: absolute; inset: 0; border-radius: 22px;
  background: rgba(255, 255, 255, 0.55); transform: scale(.94) translateY(11px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}
.kv2-fcard { position: absolute; inset: 0; perspective: 1200px; }
.kv2-fcard > div {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(0.25, 0.9, 0.3, 1.05);
}
.kv2-fcard[data-flipped="1"] > div { transform: rotateY(180deg); }
.kv2-fface {
  position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; background: #fff; border: 1px solid rgba(45, 45, 58, 0.05);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.kv2-fface.back { transform: rotateY(180deg); }
/* La face cachée ne capte rien (règle FlashCard.jsx). */
.kv2-fcard[data-flipped="0"] .kv2-fface.back,
.kv2-fcard[data-flipped="1"] .kv2-fface.front { pointer-events: none; }
.kv2-fband { flex: none; height: 26px; display: grid; place-items: center; color: #fff; }
.kv2-fband svg { width: 15px; height: 15px; }
.kv2-fband.q { background: var(--kv2-flash-band-q); }
.kv2-fband.a { background: var(--kv2-flash-band-a); }
.kv2-fface-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 14px 16px; text-align: center;
}
.kv2-feyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-secondary);
}
.kv2-fmain {
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 25px; font-weight: 800;
  line-height: 1.2; color: var(--text); overflow-wrap: break-word; max-width: 100%;
}
.kv2-fmain.ans { color: #22B573; font-size: 27px; }
.kv2-frecall { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.kv2-fnote { font-size: 11px; color: var(--text-secondary); }

/* Tampons de tranchage (opacité pilotée par le glissement) */
.kv2-fstamp {
  position: absolute; top: 38px; z-index: 2; opacity: 0; pointer-events: none;
  padding: 4px 10px; border-radius: 8px; border: 3px solid; background: rgba(255, 255, 255, 0.92);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13px; font-weight: 800; letter-spacing: 1px;
}
.kv2-fstamp.know { right: 12px; transform: rotate(8deg); color: #22B573; border-color: #22B573; }
.kv2-fstamp.again { left: 12px; transform: rotate(-8deg); color: var(--kv2-flash-amber); border-color: var(--kv2-flash-amber); }

/* Sous la carte : l'invitation, puis les deux gestes */
.kv2-fhint {
  flex: none; height: 18px; text-align: center; font-size: 11.5px; font-weight: 600;
  color: rgba(255, 255, 255, 0.55); transition: opacity .3s ease;
}
.kv2-fhint[data-off="1"] { opacity: 0; }
.kv2-fctas { flex: none; display: flex; gap: 8px; justify-content: center; padding-top: 6px; }
.kv2-fcta {
  flex: 1; max-width: 132px; height: 40px; border: 0; border-radius: 999px; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13.5px; font-weight: 800;
  transition: transform .12s ease, filter .12s ease, box-shadow .15s ease;
}
.kv2-fcta svg { width: 15px; height: 15px; }
.kv2-fcta.again { background: linear-gradient(135deg, #F59E0B, #D97706); box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35); }
.kv2-fcta.know  { background: linear-gradient(135deg, #22B573, #059669); box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35); }
@media (hover: hover) { .kv2-fcta:hover { filter: brightness(1.12); } }
.kv2-fcta:active { transform: scale(.96); filter: brightness(.96); }
.kv2-fcta:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.kv2-fscreen[data-phase="round"] .kv2-fpiles,
.kv2-fscreen[data-phase="round"] .kv2-fhint,
.kv2-fscreen[data-phase="round"] .kv2-fctas,
.kv2-fscreen[data-phase="end"] .kv2-fpiles,
.kv2-fscreen[data-phase="end"] .kv2-fhint,
.kv2-fscreen[data-phase="end"] .kv2-fctas { display: none; }

/* Fin de manche / « Tout est appris ! » : une carte blanche, comme les autres */
.kv2-fend {
  width: 100%; max-width: 262px; border-radius: 22px; background: #fff; padding: 14px 14px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: kv2-fcard-in .3s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
.kv2-fend-eyebrow {
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 10px; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--kv2-flash-ink);
}
.kv2-fend-title { font-family: 'Fredoka', sans-serif; font-size: 1.2rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.kv2-fend-kwiix { width: 56px; height: 56px; }
.kv2-fend-kwiix img { width: 100%; height: 100%; filter: drop-shadow(0 8px 5px rgba(0, 0, 0, 0.08)); }
.kv2-fend-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.kv2-fend-stats span {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11.5px; font-weight: 800; color: var(--text);
  background: #F6F7FB; border: 1px solid var(--border);
}
.kv2-fend-stats svg { width: 12px; height: 12px; }
.kv2-fend-stats .know svg { color: #22B573; }
.kv2-fend-stats .again svg { color: var(--kv2-flash-amber); }
.kv2-fend-xp {
  padding: 4px 11px; border-radius: 999px; background: var(--gold); color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12px; font-weight: 800;
}
.kv2-fend-note { font-size: 11px; line-height: 1.35; color: var(--text-secondary); max-width: 24ch; }
.kv2-fend-ctas { margin-top: 4px; display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
.kv2-fend-ctas > * {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; border-radius: 999px; border: 0; cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12.5px; font-weight: 800;
  transition: transform .15s ease, filter .15s ease;
}
.kv2-fend-ctas > *:hover { filter: brightness(1.06); }
.kv2-fend-ctas > *:active { transform: scale(.97); }
.kv2-fend-next { background: var(--accent2); color: #fff; box-shadow: 0 6px 16px rgba(0, 179, 125, 0.3); }
.kv2-fend-signup { background: var(--accent); color: #fff; text-decoration: none; box-shadow: 0 6px 16px rgba(91, 108, 249, 0.3); }
.kv2-fend-replay { background: #fff; color: var(--text-secondary); border: 1.5px solid var(--border); }
.kv2-fend-replay svg { width: 13px; height: 13px; }
.kv2-fend-replay:hover { color: var(--text); border-color: var(--text-secondary); }

/* ═══ 4. L'ORAGE de la bascule vers Flash Kwiiz ═══════════════════════════════ */
/* Un éclair d'orage qui part du HAUT du hero (sous la navbar) et descend
   entre le Kwiix et la tablette — miroir de l'éclair d'entrée de l'app
   (flashSkin FlashStrike + index.css « Éclair d'entrée Flash ») : le canal se
   DESSINE de haut en bas, les ramifications suivent, le tout scintille puis
   s'éteint ; boule de lumière à la racine, éclat d'impact à la pointe, voile
   doré qui claque. Ancrage horizontal et hauteur posés en JS (--x, --h).
   ORNEMENT : coupé sous prefers-reduced-motion, jamais un obstacle au clic. */
.kv2-storm { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.kv2-storm-flash {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse 34% 40% at var(--x) var(--top, 0px), rgba(255, 232, 170, 0.75) 0%, rgba(255, 209, 102, 0.42) 22%, rgba(245, 158, 11, 0.14) 50%, transparent 74%);
}
.kv2-bolt {
  position: absolute; top: var(--top, 0px); left: var(--x); height: var(--h); width: auto;
  overflow: visible; opacity: 0; transform: translateX(-50%);
}
.kv2-bolt-path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.kv2-bolt-core { stroke: #fff; stroke-width: 2.6; }
.kv2-bolt-halo { stroke: rgba(255, 209, 102, 0.9); stroke-width: 12; }
.kv2-bolt-branch { stroke: rgba(255, 250, 235, 0.95); stroke-width: 1.5; }
.kv2-bolt-branch-halo { stroke: rgba(255, 209, 102, 0.8); stroke-width: 7; }
.kv2-bolt-origin { fill: #FFF3CF; opacity: 0; }
.kv2-bolt-tip { fill: #FFE9A8; opacity: 0; }
.kv2-bolt-origin, .kv2-bolt-tip { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .kv2-storm-flash { animation: kv2-bolt-flash 1.6s ease-out both; }
  .kv2-bolt { animation: kv2-bolt-flicker 1.6s ease-out both; }
  .kv2-bolt-path { animation: kv2-bolt-draw .55s cubic-bezier(0.2, 0.6, 0.3, 1) both; }
  .kv2-bolt-branch { animation-delay: calc(.18s + var(--i) * .07s); animation-duration: .35s; }
  .kv2-bolt-origin { animation: kv2-bolt-origin 1.6s ease-out both; }
  .kv2-bolt-tip { animation: kv2-bolt-tip 1.1s ease-out .45s both; }
}
@keyframes kv2-bolt-flicker { 0% { opacity: 0; } 12% { opacity: 1; } 18% { opacity: .45; } 24% { opacity: 1; } 40% { opacity: .8; } 46% { opacity: 1; } 70% { opacity: .9; } 100% { opacity: 0; } }
@keyframes kv2-bolt-draw { to { stroke-dashoffset: 0; } }
@keyframes kv2-bolt-origin { 0% { opacity: 0; transform: scale(.6); } 8% { opacity: 1; transform: scale(1.25); } 16% { opacity: .55; transform: scale(1); } 24% { opacity: 1; transform: scale(1.15); } 60% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(.9); } }
@keyframes kv2-bolt-tip { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: .95; transform: scale(1.2); } 30% { opacity: .5; transform: scale(1); } 45% { opacity: .85; transform: scale(1.1); } 100% { opacity: 0; transform: scale(.8); } }
@keyframes kv2-bolt-flash { 0% { opacity: 0; } 12% { opacity: 1; } 20% { opacity: .5; } 28% { opacity: .95; } 100% { opacity: 0; } }
