/* ═══════════════════════════════════════════
   ConcentraKids — style.css
   Base : ConcentraKids original (vert glassmorphism)
   + styles TOTO intégrés + Level-Flash
═══════════════════════════════════════════ */
:root {
  --green-1: #0bbf6a;
  --green-2: #11d47a;
  --green-3: #83f08d;
  --yellow: #ffe66d;
  --pink: #ff80bf;
  --blue: #7ad7ff;
  --purple: #c0a6ff;
  --ink: #173125;
  --card: rgba(255,255,255,0.18);
  --line: rgba(255,255,255,0.28);
  --shadow: 0 20px 45px rgba(18, 70, 37, 0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "Trebuchet MS", "Segoe UI", sans-serif; color: #fff; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.24), transparent 26%),
    radial-gradient(circle at bottom right, rgba(255,255,255,0.18), transparent 22%),
    linear-gradient(135deg, #1fbf75 0%, #0f935b 34%, #4ad285 68%, #0ca46a 100%);
  position: relative;
  overflow-x: hidden;
}

/* ── Orbes background ─────────────────── */
.bg-orb {
  position: fixed; border-radius: 50%; filter: blur(12px); opacity: 0.42; z-index: 0;
}
.orb-1 { width: 220px; height: 220px; background: var(--yellow); top: 60px; right: -70px; }
.orb-2 { width: 180px; height: 180px; background: var(--pink); bottom: 60px; left: -50px; }
.orb-3 { width: 260px; height: 260px; background: var(--blue); bottom: 30%; right: -90px; }

/* ── Hero ─────────────────────────────── */
.hero, .layout { position: relative; z-index: 1; }
.hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 28px 24px 12px;
}
.hero h1 { margin: 6px 0; font-size: clamp(2rem, 4vw, 3.6rem); }
.subtitle { max-width: 720px; margin: 0; font-size: 1.05rem; opacity: 0.95; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; opacity: 0.9; margin: 0; }
.hero-badge {
  background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.12));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 26px; padding: 18px 20px;
  font-weight: 700; line-height: 1.7; min-width: 180px; text-align: center;
}

/* ── Layout ───────────────────────────── */
.layout {
  display: grid; grid-template-columns: 370px minmax(0, 1fr);
  gap: 20px; padding: 10px 24px 28px;
}
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.20), rgba(255,255,255,0.10));
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 30px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.sidebar {
  padding: 18px; display: flex; flex-direction: column; gap: 16px;
}
.sidebar section {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  border-radius: 22px; padding: 16px;
}
.sidebar h2, .content h2 { margin: 0 0 12px; }
.content { display: grid; gap: 20px; }
.games-panel, .play-panel { padding: 18px; }
.panel-title-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px;
}
.status-pill, .score-badge {
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.26);
  padding: 10px 14px; border-radius: 999px; font-weight: 800;
}

/* ── Buttons ──────────────────────────── */
.btn {
  border: 0; border-radius: 16px; padding: 12px 16px;
  font-weight: 800; cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, #ffe76e, #ffb627); color: #28440a; }
.btn.secondary { background: linear-gradient(135deg, #86d9ff, #9f86ff); color: #13344a; }
.btn.ghost { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.20); }
.btn.btn-toto { background: linear-gradient(135deg, #ef4444, #fb923c); color: #fff; }
.btn.btn-toto:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(239,68,68,0.4); }
.big-btn { width: 100%; padding: 16px; font-size: 1rem; }

/* ── Profile card ─────────────────────── */
.profile-card {
  min-height: 120px; border-radius: 18px; border: 1px dashed rgba(255,255,255,0.32);
  display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 16px;
}
.profile-card.empty { align-items: flex-start; }
.profile-card .player-name { font-size: 1.4rem; font-weight: 900; }
.profile-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.meta-pill {
  padding: 10px; border-radius: 16px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.2);
}

/* ── Age / games grid ─────────────────── */
.age-grid, .games-grid { display: grid; gap: 12px; }
.age-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.age-btn {
  border-radius: 18px; border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.12); color: white;
  font-weight: 800; padding: 14px 10px; cursor: pointer;
}
.age-btn.active, .game-card.active {
  outline: 3px solid rgba(255,230,109,0.85); transform: translateY(-1px);
}
.games-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.game-card {
  padding: 18px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.10));
  border: 1px solid rgba(255,255,255,0.2);
  display: flex; flex-direction: column; gap: 10px; min-height: 210px;
  cursor: pointer; transition: transform 0.15s;
}
.game-card:hover { transform: translateY(-2px); }
.game-card h3 { margin: 0; }
.game-card p { margin: 0 0 auto; }
.game-icon {
  width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center; font-size: 1.7rem;
  background: rgba(255,255,255,0.18);
}
.game-card-toto {
  border: 1px solid rgba(239,68,68,0.4);
  background: linear-gradient(180deg, rgba(239,68,68,0.12), rgba(251,146,60,0.08));
}
.game-card-toto.active { outline: 3px solid rgba(239,68,68,0.7); }
.toto-icon { background: linear-gradient(135deg, rgba(239,68,68,0.3), rgba(251,146,60,0.3)); }

/* ── Progress ─────────────────────────── */
.progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-bar-wrap {
  height: 14px; border-radius: 999px;
  background: rgba(255,255,255,0.13); overflow: hidden; margin-bottom: 12px;
}
.progress-bar {
  height: 100%; width: 2.5%; border-radius: 999px;
  background: linear-gradient(90deg, var(--yellow), #ffb331, var(--pink));
  transition: width 0.5s ease;
}
.levels-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.level-chip {
  display: grid; place-items: center; padding: 8px 0;
  border-radius: 12px; background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18); font-size: 0.82rem; font-weight: 800;
}
.level-chip.done { background: rgba(255,230,109,0.26); }
.level-chip.current { background: rgba(122,215,255,0.28); }
.level-chip.locked { opacity: 0.5; }

/* ── Leaderboard ──────────────────────── */
.leaderboard { display: grid; gap: 10px; }
.leader-row {
  display: grid; grid-template-columns: 50px 1fr auto;
  gap: 10px; align-items: center;
  padding: 12px; border-radius: 18px; background: rgba(255,255,255,0.10);
}
.rank-badge {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 900;
  background: rgba(255,255,255,0.16);
}
.leader-name { font-weight: 900; }
.leader-meta { opacity: 0.9; font-size: 0.9rem; }

/* ── Play area ────────────────────────── */
.play-area {
  min-height: 520px; border-radius: 26px;
  background: rgba(5, 63, 33, 0.18);
  border: 1px solid rgba(255,255,255,0.18); padding: 18px;
}
.intro-state { display: grid; place-items: center; }
.intro-box { text-align: center; max-width: 520px; }
.mascot { font-size: 4rem; margin-bottom: 10px; }
.game-shell { display: grid; gap: 16px; }
.game-topbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: space-between; align-items: center;
}
.topbar-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.small-pill {
  padding: 8px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.16);
  font-weight: 700;
}

/* ── Memory game ──────────────────────── */
.memory-grid { display: grid; gap: 10px; justify-content: center; }
.memory-card {
  width: 72px; height: 72px; border-radius: 18px; border: 0;
  font-size: 1.9rem; cursor: pointer;
  background: linear-gradient(135deg, #ffffff, #defbe8); color: #173125; font-weight: 900;
  transition: transform 0.15s;
}
.memory-card:not(.hidden-face):not(.matched):hover { transform: scale(0.95); }
.memory-card.hidden-face { background: linear-gradient(135deg, #3dd085, #138955); color: transparent; }
.memory-card.matched { opacity: 0.7; }

/* ── Battle game ──────────────────────── */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.choice-card {
  border: 0; border-radius: 20px; padding: 18px; cursor: pointer;
  font-weight: 900; color: #123120;
  background: linear-gradient(135deg, #fff8dc, #f5ffd1);
  transition: transform 0.12s;
}
.choice-card:hover { transform: translateY(-1px); }
.battle-board { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.team-column {
  border-radius: 24px; padding: 16px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
}
.team-column h3 { margin-top: 0; }
.card-line { display: flex; flex-wrap: wrap; gap: 10px; }
.mini-card {
  min-width: 56px; min-height: 76px; border-radius: 16px;
  background: linear-gradient(135deg, #fff, #e8ffe1); color: #173125;
  display: grid; place-items: center; font-size: 1.2rem; font-weight: 900;
}
.card-back { background: linear-gradient(135deg, #1f9e65, #52db94); color: transparent; }

/* ── Uno game ─────────────────────────── */
.uno-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; }
.uno-card {
  border: 0; border-radius: 20px; padding: 18px; cursor: pointer; font-weight: 900;
  min-height: 110px; color: #fff; font-size: 1.3rem;
  display: grid; place-items: center; transition: transform 0.12s;
}
.uno-card:hover { transform: translateY(-1px); }
.uno-red    { background: linear-gradient(135deg, #ff6b6b, #d93636); }
.uno-blue   { background: linear-gradient(135deg, #53b7ff, #0b77d5); }
.uno-green  { background: linear-gradient(135deg, #43d17a, #0b9a49); }
.uno-yellow { background: linear-gradient(135deg, #ffd34d, #f59d00); color: #4b3000; }
.uno-card.selected-good { outline: 4px solid rgba(255,255,255,0.9); }
.uno-card.selected-bad  { filter: grayscale(0.4); opacity: 0.65; }

/* ── Ludo game ────────────────────────── */
.path-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; max-width: 520px; margin-inline: auto;
}
.path-node {
  border: 0; border-radius: 20px; padding: 18px; cursor: pointer; font-weight: 900;
  color: #123120; background: linear-gradient(135deg, #fff8dc, #f5ffd1);
  min-height: 72px; display: grid; place-items: center; transition: transform 0.12s;
}
.path-node:hover { transform: translateY(-1px); }
.path-node.active-show { background: linear-gradient(135deg, #ffe96f, #ff9d00); }
.path-node.user-good   { background: linear-gradient(135deg, #82ffbc, #36b868); }
.path-node.user-wrong  { background: linear-gradient(135deg, #ff98ab, #e94b67); color: white; }
.path-node.disabled    { pointer-events: none; opacity: 0.7; }

/* ── Message box / result ─────────────── */
.message-box {
  border-radius: 22px; padding: 16px;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18);
}
.form-message { min-height: 24px; }
.message-success { color: #d6ffd8; }
.message-error   { color: #ffd8de; }
.message-info    { color: #eefbff; }

/* ── Modals ───────────────────────────── */
.modal {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(3, 27, 14, 0.35); z-index: 20; padding: 16px;
}
.hidden { display: none !important; }
.modal-card { width: min(92vw, 460px); padding: 22px; }
.modal-card input {
  width: 100%; margin-top: 8px; margin-bottom: 14px;
  border-radius: 16px; border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.12); color: #fff;
  padding: 13px 14px; font-size: 1rem;
}
.modal-card input::placeholder { color: rgba(255,255,255,0.72); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ── Toast ────────────────────────────── */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  padding: 14px 18px; border-radius: 18px;
  background: rgba(18, 49, 32, 0.9); color: #fff;
  box-shadow: var(--shadow); max-width: 320px;
}

/* ── Level-Up Flash ───────────────────── */
.level-flash {
  position: fixed; inset: 0; z-index: 99;
  display: grid; place-items: center;
  background: rgba(5, 50, 25, 0.70); backdrop-filter: blur(4px);
  animation: lfFadeIn 0.2s ease;
  cursor: pointer;
}
@keyframes lfFadeIn { from { opacity: 0; } to { opacity: 1; } }
.level-flash-inner {
  text-align: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.24), rgba(255,255,255,0.10));
  border: 2px solid rgba(255,230,109,0.65);
  border-radius: 36px; padding: 44px 72px;
  box-shadow: 0 0 80px rgba(255,230,109,0.3), 0 24px 60px rgba(0,0,0,0.3);
  animation: lfPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes lfPop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.lf-emoji { font-size: 3.8rem; animation: lfSpin 0.55s ease; }
@keyframes lfSpin {
  from { transform: rotate(-20deg) scale(0); }
  to   { transform: rotate(0) scale(1); }
}
.lf-label { font-size: 0.9rem; letter-spacing: 0.22em; opacity: 0.9; margin-top: 8px; }
.lf-num {
  font-size: 5.5rem; font-weight: 900; line-height: 1;
  color: var(--yellow); text-shadow: 0 0 28px rgba(255,230,109,0.7);
}
.lf-sub { font-size: 1.5rem; font-weight: 700; margin-top: 4px; }

/* ══ TOTO — Zone de jeu intégrée ═══════ */
.toto-shell {
  display: flex; flex-direction: column; gap: 14px;
}

/* Setup panel (choix arme/camp) */
.toto-setup {
  display: grid; gap: 14px;
}
.toto-setup-row {
  display: grid; gap: 10px;
}
.toto-role-grid { grid-template-columns: repeat(2, 1fr); }
.toto-weapon-grid { grid-template-columns: repeat(2, 1fr); }

.toto-choice-btn {
  border: 0; border-radius: 20px; padding: 14px;
  background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.22);
  color: #fff; cursor: pointer; text-align: left;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.toto-choice-btn:hover { transform: translateY(-2px); }
.toto-choice-btn.active {
  border-color: rgba(255,230,109,0.8);
  background: rgba(255,230,109,0.12);
}
.toto-choice-btn .tc-emoji { font-size: 2rem; display: block; margin-bottom: 6px; }
.toto-choice-btn .tc-title { display: block; font-weight: 900; font-size: 0.95rem; }
.toto-choice-btn .tc-desc  { display: block; font-size: 0.8rem; opacity: 0.8; margin-top: 4px; line-height: 1.4; }

.toto-weapon-btn {
  border: 0; border-radius: 18px; padding: 12px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; cursor: pointer; text-align: left;
  font-family: inherit; transition: transform 0.15s, border-color 0.15s;
}
.toto-weapon-btn:hover { transform: translateY(-2px); }
.toto-weapon-btn.active { border-color: rgba(255,230,109,0.8); background: rgba(255,230,109,0.10); }
.tw-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tw-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.3rem;
}
.tw-range {
  font-size: 0.7rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em;
  background: rgba(255,255,255,0.18); padding: 4px 8px; border-radius: 999px; opacity: 0.9;
}
.tw-name { display: block; font-weight: 900; font-size: 0.9rem; }
.tw-desc { display: block; font-size: 0.75rem; opacity: 0.8; margin-top: 2px; line-height: 1.35; }

/* Canvas arena */
.toto-arena-wrap {
  position: relative; border-radius: 22px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
#totoCanvas {
  display: block; width: 100%; height: auto; background: transparent;
}
.toto-bars {
  position: absolute; inset: 10px 10px auto 10px; z-index: 3;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.toto-bar-box {
  background: rgba(255,255,255,0.85); border-radius: 16px; padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.toto-bar-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; font-size: 10px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.1em; color: #334155;
}
.toto-bar-track {
  background: #e2e8f0; border-radius: 999px; height: 10px; overflow: hidden;
}
.toto-bar-fill {
  height: 100%; border-radius: 999px; width: 100%;
  transition: width 0.3s ease;
}
.toto-bar-fill.red   { background: linear-gradient(90deg, #ef4444, #fb923c); }
.toto-bar-fill.green { background: linear-gradient(90deg, #10b981, #84cc16); }

.toto-attack-btn {
  position: absolute; right: 12px; bottom: 12px; z-index: 3;
  padding: 12px 20px; border: 0; border-radius: 16px;
  background: linear-gradient(90deg, #059669, #22c55e, #84cc16);
  color: white; font-weight: 900; font-size: 0.95rem; cursor: pointer;
  box-shadow: 0 4px 20px rgba(5,150,105,0.4);
  font-family: inherit; min-width: 140px;
  transition: transform 0.12s;
}
.toto-attack-btn:hover { transform: translateY(-2px); }
.toto-attack-btn.pulse { animation: totoPulse 1s infinite; }
@keyframes totoPulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.05); box-shadow: 0 6px 28px rgba(5,150,105,0.6); }
}

.toto-overlay {
  position: absolute; inset: 0; z-index: 5; display: none;
  align-items: center; justify-content: center;
  background: rgba(15,23,42,0.18); backdrop-filter: blur(2px);
}
.toto-overlay.show { display: flex; }
.toto-overlay-card {
  max-width: 480px; width: 90%; padding: 28px; border-radius: 28px;
  background: rgba(255,255,255,0.92); text-align: center;
  box-shadow: 0 24px 50px rgba(0,0,0,0.18); color: #1f2937;
}
.toto-overlay-card h3 { margin: 8px 0; font-size: 1.8rem; }
.toto-overlay-card p { color: #546171; font-weight: 700; line-height: 1.5; margin: 8px 0 0; }
.toto-overlay-card button { margin-top: 16px; }

/* TOTO tutorial modal */
.toto-tutorial-card {
  width: min(92vw, 760px) !important;
  position: relative; color: #fff;
}
.tuto-close-btn {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border-radius: 999px;
  background: rgba(239,68,68,0.8); border: 0;
  color: #fff; font-size: 1.1rem; font-weight: 900; cursor: pointer;
  display: grid; place-items: center;
}
.tuto-intro { opacity: 0.9; margin: 0 0 18px; font-size: 1rem; line-height: 1.6; }
.tuto-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.tuto-box {
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 18px; padding: 14px;
}
.tuto-box h3 { font-size: 0.9rem; margin: 0 0 8px; }
.tuto-box p  { font-size: 0.85rem; margin: 0; opacity: 0.85; line-height: 1.5; }
.tuto-actions { display: flex; gap: 12px; }

/* ── Responsive ───────────────────────── */
@media (max-width: 1120px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}
@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .age-grid { grid-template-columns: 1fr; }
  .levels-grid { grid-template-columns: repeat(5, 1fr); }
  .memory-card { width: 58px; height: 58px; font-size: 1.45rem; }
  .play-area { min-height: 460px; padding: 12px; }
  .battle-board { grid-template-columns: 1fr; }
  .toto-role-grid, .toto-weapon-grid { grid-template-columns: 1fr; }
  .tuto-grid { grid-template-columns: 1fr; }
  .toto-bars { grid-template-columns: 1fr; }
}

/* ── TOTO Setup panel scroll (beaucoup d'armes) ── */
.toto-weapon-grid {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.toto-weapon-grid::-webkit-scrollbar { width: 4px; }
.toto-weapon-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 4px; }

/* ── Bouton quitter overlay sur canvas ── */
.toto-arena-wrap { position: relative; }

/* ── Overlay amélioré ── */
.toto-overlay-card button + button { margin-top: 0; }

/* ── Setup visible correction ── */
#totoSetupPanel { display: flex; flex-direction: column; gap: 6px; }

/* ══════════════════════════════════════════════════════════
   TOTO — Zone de jeu élargie + setup layout v4
══════════════════════════════════════════════════════════ */

/* Play area TOTO : plus haute */
.toto-fullplay {
  min-height: 680px !important;
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Setup panel principal */
.toto-setup-panel {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow-y: auto;
}

/* Header setup */
.toto-setup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.toto-setup-title {
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toto-setup-lv {
  background: linear-gradient(135deg, rgba(255,230,109,.25), rgba(255,180,0,.2));
  border: 1px solid rgba(255,230,109,.5);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .9rem;
}

/* Colonnes setup */
.toto-setup-cols {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  flex: 1;
}
.toto-setup-left  { display: flex; flex-direction: column; gap: 10px; }
.toto-setup-right { display: flex; flex-direction: column; gap: 10px; }

.toto-section-label {
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .85;
  padding: 6px 0 2px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}

/* Rôle grid */
.toto-role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Armes grid — scrollable */
.toto-weapon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
.toto-weapon-grid::-webkit-scrollbar { width: 4px; }
.toto-weapon-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 4px; }

/* Preview canvas wrapper */
.toto-preview-wrap {
  flex: 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  min-height: 160px;
  background: #1a3a2a;
}
.toto-preview-wrap canvas {
  width: 100% !important;
  height: auto !important;
  display: block;
}

/* Stats box */
.toto-stats-box {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toto-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
}
.toto-stat-row span { opacity: .8; }
.toto-stat-row strong { font-weight: 900; }

/* Boutons action */
.toto-action-btns {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.toto-ghost-btn {
  padding: 12px 16px;
  white-space: nowrap;
  font-size: .88rem;
}

/* Arena wrap — occupe tout l'espace */
#totoArenaWrap.toto-arena-wrap {
  flex: 1;
  position: relative;
  min-height: 500px;
}
#totoArenaWrap canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 640px;
  object-fit: contain;
}

/* Barres HP repositionnées */
.toto-arena-wrap .toto-bars {
  position: absolute;
  inset: 8px 8px auto 8px;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Overlay résultat amélioré */
.toto-overlay-card {
  max-width: 500px;
  width: 90%;
  padding: 32px 28px;
  border-radius: 30px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  text-align: center;
  color: #1a2e1a;
}
.toto-overlay-card h3 { color: #1a3a1a; }

/* Responsive */
@media (max-width: 900px) {
  .toto-setup-cols { grid-template-columns: 1fr; }
  .toto-setup-right { order: -1; }
  .toto-preview-wrap { min-height: 120px; }
  .toto-weapon-grid { grid-template-columns: repeat(3, 1fr); max-height: 180px; }
}
@media (max-width: 600px) {
  .toto-role-grid { grid-template-columns: 1fr; }
  .toto-weapon-grid { grid-template-columns: 1fr 1fr; }
  .toto-fullplay { min-height: 560px !important; }
}

/* ── Space Blaster game card ─────────────────────────────── */
.game-card-space {
  border: 1px solid rgba(0,150,255,.4);
  background: linear-gradient(180deg, rgba(0,50,180,.15), rgba(0,100,255,.08));
}
.game-card-space.active { outline: 3px solid rgba(0,200,255,.8); }
.space-icon { background: linear-gradient(135deg, rgba(0,50,200,.4), rgba(0,150,255,.3)); }
.btn-space { background: linear-gradient(135deg, #0066cc, #00aaff); color: #fff; }
.btn-space:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,150,255,.5); }

/* ── Space game play area ────────────────────────────────── */
.space-fullplay {
  min-height: 680px !important;
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.space-arena-wrap {
  flex: 1;
  position: relative;
  background: #050514;
  border-radius: 0 0 26px 26px;
}
.space-arena-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 660px;
}
.space-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0,10,40,.8);
  border-bottom: 1px solid rgba(0,100,255,.3);
  flex-wrap: wrap;
  gap: 8px;
}
.space-ctrl-pill {
  background: rgba(0,50,150,.5);
  border: 1px solid rgba(0,100,255,.4);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .8rem;
  color: #88ccff;
  font-weight: 700;
}

/* ── TOTO canvas wrap — setup TOUJOURS au-dessus du canvas ── */
.toto-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 500px;
}
.toto-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 580px;
}
.toto-setup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5,30,12,.88);
  backdrop-filter: blur(4px);
  border-radius: 22px;
  padding: 16px 18px;
  z-index: 10;
  overflow-y: auto;
}
.toto-setup-title {
  font-size: 1.35rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.toto-setup-lv {
  background: rgba(255,230,109,.22);
  border: 1px solid rgba(255,230,109,.4);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 900;
}

/* ── Donkey Kong card ─── */
.game-card-dk  { border:1px solid rgba(200,100,0,.4); background:linear-gradient(180deg,rgba(180,80,0,.15),rgba(100,40,0,.08)); }
.game-card-dk.active { outline:3px solid rgba(255,150,0,.8); }
.dk-icon  { background:linear-gradient(135deg,rgba(180,80,0,.4),rgba(255,140,0,.3)); }
.btn-dk   { background:linear-gradient(135deg,#8B4513,#cc6600); color:#fff; }
.btn-dk:hover { transform:translateY(-2px); box-shadow:0 4px 20px rgba(200,100,0,.5); }

/* ── Pac-Man card ─── */
.game-card-pac  { border:1px solid rgba(255,220,0,.4); background:linear-gradient(180deg,rgba(50,50,0,.15),rgba(20,20,0,.08)); }
.game-card-pac.active { outline:3px solid rgba(255,220,0,.8); }
.pac-icon  { background:linear-gradient(135deg,rgba(80,80,0,.4),rgba(200,180,0,.3)); }
.btn-pac   { background:linear-gradient(135deg,#886600,#ccaa00); color:#fff; }
.btn-pac:hover { transform:translateY(-2px); box-shadow:0 4px 20px rgba(200,180,0,.5); }

/* ── Space fullscreen canvas ─── */
.space-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050514;
  overflow: hidden;
}
.space-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
}
.space-ctrl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: rgba(0,8,35,.9);
  border-bottom: 1px solid rgba(0,100,255,.3);
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.space-ctrl-pills { display:flex; gap:6px; flex-wrap:wrap; }
.space-ctrl-pill  { background:rgba(0,50,150,.5); border:1px solid rgba(0,100,255,.4); padding:4px 10px; border-radius:999px; font-size:.78rem; color:#88ccff; font-weight:700; }
.btn-space-sm     { background:rgba(0,50,150,.6); border:1px solid rgba(0,150,255,.5); padding:5px 12px; border-radius:8px; font-size:.8rem; color:#fff; font-weight:700; cursor:pointer; }
.btn-space-sm:hover { background:rgba(0,80,200,.7); }

/* Arcade fullplay pour DK et Pac-Man */
.arcade-fullplay {
  min-height: 680px !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* ── Ludo King ── */
.game-card-ludo{border:1px solid rgba(255,215,0,.4);background:linear-gradient(180deg,rgba(50,40,0,.15),rgba(20,16,0,.08))}
.game-card-ludo.active{outline:3px solid rgba(255,215,0,.8)}
.ludo-icon{background:linear-gradient(135deg,rgba(80,65,0,.4),rgba(200,170,0,.3))}
.btn-ludo{background:linear-gradient(135deg,#8B7000,#d4aa00);color:#fff}
/* ── Snake ── */
.game-card-snake{border:1px solid rgba(0,200,80,.4);background:linear-gradient(180deg,rgba(0,50,15,.15),rgba(0,20,5,.08))}
.game-card-snake.active{outline:3px solid rgba(0,200,80,.8)}
.snake-icon{background:linear-gradient(135deg,rgba(0,80,20,.4),rgba(0,180,60,.3))}
.btn-snake{background:linear-gradient(135deg,#006614,#00aa22);color:#fff}
/* ── Breakout ── */
.game-card-brkout{border:1px solid rgba(0,150,255,.4);background:linear-gradient(180deg,rgba(0,30,80,.15),rgba(0,10,30,.08))}
.game-card-brkout.active{outline:3px solid rgba(0,150,255,.8)}
.brkout-icon{background:linear-gradient(135deg,rgba(0,40,120,.4),rgba(0,120,220,.3))}
.btn-brkout{background:linear-gradient(135deg,#003388,#0055cc);color:#fff}

/* ═══════════════════════════════════════════════════════════
   AMÉLIORATIONS VISUELLES v8 — Moteur chargement + Fullscreen
═══════════════════════════════════════════════════════════ */

/* ── Fullscreen : canvas s'étire pour remplir l'écran ── */
:fullscreen #playArea,
:-webkit-full-screen #playArea,
:-moz-full-screen #playArea {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  border-radius: 0 !important;
  overflow: hidden;
}
:fullscreen canvas,
:-webkit-full-screen canvas,
:-moz-full-screen canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 100vh !important;
  object-fit: contain;
}
:fullscreen .space-canvas-wrap,
:-webkit-full-screen .space-canvas-wrap,
:-moz-full-screen .space-canvas-wrap {
  height: 100vh !important;
}
:fullscreen .toto-fullplay,
:-webkit-full-screen .toto-fullplay,
:-moz-full-screen .toto-fullplay {
  height: 100vh !important;
}

/* ── Bouton fullscreen visible sur tous supports ── */
#ck-fs-btn {
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Cartes de jeux améliorées ── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.game-card {
  border-radius: 20px;
  padding: 18px 16px 14px;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease;
  position: relative;
  overflow: hidden;
}
.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.06) 0%, transparent 60%);
  pointer-events: none;
}
.game-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.game-card.active {
  transform: translateY(-3px);
}
.game-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.1);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.game-card h3 {
  font-size: .95rem;
  font-weight: 800;
  margin: 0 0 5px;
  letter-spacing: -.01em;
}
.game-card p {
  font-size: .78rem;
  opacity: .7;
  margin: 0 0 12px;
  line-height: 1.4;
}

/* ── TOTO : structure correcte (setup SOUS le canvas) ── */
.toto-fullplay {
  min-height: 480px !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Setup bar remplace l'overlay opaque */
#totoSetupBar {
  background: rgba(5,28,10,.94) !important;
  border-top: 1px solid rgba(74,200,120,.2) !important;
}
#totoSetupBar .toto-section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .6;
  margin-bottom: 4px;
}
#totoSetupBar .toto-choice-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  transition: all .15s;
  font-weight: 700;
}
#totoSetupBar .toto-choice-btn.active {
  background: rgba(74,200,120,.22);
  border-color: #4ade80;
  color: #4ade80;
}
#totoSetupBar .toto-weapon-btn {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 9px;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  transition: all .15s;
  font-weight: 600;
  text-align: left;
  line-height: 1.3;
}
#totoSetupBar .toto-weapon-btn.active {
  background: rgba(74,200,120,.2);
  border-color: #4ade80;
  color: #4ade80;
}
#totoSetupBar .toto-setup-lv {
  background: rgba(255,230,109,.18);
  border: 1px solid rgba(255,230,109,.35);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  color: rgba(255,230,109,.9);
}

/* ── Space canvas plein écran ── */
.space-canvas-wrap canvas,
.arcade-fullplay canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 100px);
  width: auto;
  height: auto;
  margin: auto;
}

/* ── Responsive mobile ── */
@media (max-width: 600px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .game-card { padding: 14px 12px 11px; border-radius: 16px; }
  .game-icon { font-size: 2rem; width: 48px; height: 48px; }
  #totoSetupBar { max-height: 220px; padding: 10px 12px; }
  #ck-fs-btn { font-size: 1.3rem; padding: 10px 14px; }
}

/* ── Toto HP bars plus visibles ── */
.toto-bars {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 5;
  pointer-events: none;
  width: min(700px, 92%);
}
.toto-bar-box {
  flex: 1;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 5px 10px;
}
.toto-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: .7rem;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  margin-bottom: 4px;
}
.toto-bar-track {
  height: 7px;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  overflow: hidden;
}
.toto-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .3s ease;
}
.toto-bar-fill.red   { background: linear-gradient(90deg, #ef4444, #f97316); }
.toto-bar-fill.green { background: linear-gradient(90deg, #22c55e, #4ade80); }

/* ── Bouton attaque ── */
.toto-attack-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 5;
  background: linear-gradient(135deg, #166534, #15803d);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  padding: 11px 22px;
  font-size: .95rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,180,80,.4);
  transition: transform .12s, box-shadow .12s;
}
.toto-attack-btn:hover, .toto-attack-btn.pulse {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(0,220,100,.55);
}

/* ── Overlay victoire/défaite TOTO ── */
.toto-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(6px);
}
.toto-overlay.show { display: flex; }
.toto-overlay-card {
  background: #fff;
  border-radius: 22px;
  padding: 30px 36px;
  text-align: center;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  animation: ck-fadein .3s ease;
}

/* ── Turbo Race card ─────────────────────────────────────── */
.game-card-race{border:1px solid rgba(255,107,53,.5);background:linear-gradient(180deg,rgba(80,20,0,.18),rgba(30,5,0,.08))}
.game-card-race.active{outline:3px solid rgba(255,107,53,.9)}
.race-icon{background:linear-gradient(135deg,rgba(120,40,0,.5),rgba(255,100,30,.3))}
.btn-race{background:linear-gradient(135deg,#c2410c,#ff6b35);color:#fff}
.btn-race:hover{background:linear-gradient(135deg,#ea580c,#ff8c00)}
