/* ==========================================================================
   Plus petit que trois (<3) - Style CSS3 moderne, épuré & pastel
   ========================================================================== */

:root,
html[data-theme="light"] {
  /* Thème Jour : Palette claire épurée, contrastes élevés (RGAA / WCAG AAA) */
  --bg-primary: #faf8f5;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-light: #cbd5e1;
  --border-focus: #94a3b8;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  /* Couleurs des blocs de jeu en mode clair */
  /* Blocs < en métal doré 8-bit */
  --tile-lt-bg: #eab308;
  --tile-lt-text: #451a03;
  --tile-lt-border: #ca8a04;

  --tile-1-bg: #e2f4ea;
  --tile-1-text: #195232;
  --tile-1-border: #bee2cc;

  --tile-2-bg: #e1effb;
  --tile-2-text: #194a70;
  --tile-2-border: #bfe0f7;

  --tile-3-bg: #fde8dc;
  --tile-3-text: #7c3b16;
  --tile-3-border: #f6cdb6;

  --tile-4-bg: #fdf5e2;
  --tile-4-text: #6b4e10;
  --tile-4-border: #f2dfb8;

  --tile-5-bg: #f6eef7;
  --tile-5-text: #59355c;
  --tile-5-border: #e3cfe4;

  --tile-6-bg: #fdeeed;
  --tile-6-text: #782c2c;
  --tile-6-border: #f5cecb;

  --tile-7-bg: #e2f6f5;
  --tile-7-text: #175452;
  --tile-7-border: #bceae7;

  --tile-8-bg: #f4f1ea;
  --tile-8-text: #4e483a;
  --tile-8-border: #ded7c8;

  --tile-9-bg: #e8edf7;
  --tile-9-text: #2c3c5d;
  --tile-9-border: #cad7ee;

  /* Lettres A à F : blocs en métal argenté 8-bit */
  --tile-a-bg: #cbd5e1;
  --tile-a-text: #0f172a;
  --tile-a-border: #94a3b8;

  --tile-b-bg: #cbd5e1;
  --tile-b-text: #0f172a;
  --tile-b-border: #94a3b8;

  --tile-c-bg: #cbd5e1;
  --tile-c-text: #0f172a;
  --tile-c-border: #94a3b8;

  --tile-d-bg: #cbd5e1;
  --tile-d-text: #0f172a;
  --tile-d-border: #94a3b8;

  --tile-e-bg: #cbd5e1;
  --tile-e-text: #0f172a;
  --tile-e-border: #94a3b8;

  --tile-f-bg: #cbd5e1;
  --tile-f-text: #0f172a;
  --tile-f-border: #94a3b8;

  /* Cœur parfait */
  --heart-color: #be123c;
  --heart-bg: #ffe4e6;
  --heart-border: #fda4af;
  --heart-glow: rgba(190, 18, 60, 0.25);

  /* États interactifs */
  --select-border: #433368;
  --select-glow: rgba(67, 51, 104, 0.3);
  --adjacent-border: #195232;
  --adjacent-glow: rgba(25, 82, 50, 0.3);
  --reject-color: #b91c1c;

  /* Arrière-plan des slots */
  --slot-bg: #ede9e3;
  --slot-border: rgba(0, 0, 0, 0.05);

  /* Typographie Rétro-Futuriste : Silkscreen pour toute l'UI, Play pour les longs textes */
  --font-arcade: 'Silkscreen', 'Play', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-text: 'Play', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-sans: 'Silkscreen', 'Play', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Silkscreen', 'Play', 'JetBrains Mono', 'SF Mono', 'Fira Code', Menlo, Consolas, Monaco, monospace;

  /* Dimensions de la grille dynamiques */
  --cols: 7;
  --rows: 8;
  --gap: 6px;
  --tile-size: min(
    calc((100vw - 36px - ((var(--cols) - 1) * var(--gap))) / var(--cols)),
    calc((100dvh - 250px - ((var(--rows) - 1) * var(--gap))) / var(--rows)),
    56px
  );
  --board-width: calc(var(--cols) * var(--tile-size) + (var(--cols) - 1) * var(--gap));
  --board-height: calc(var(--rows) * var(--tile-size) + (var(--rows) - 1) * var(--gap));
  --tile-radius: 11px;
}

/* Thème Nuit (Dark Mode) - Esthétique Rétro-Futuriste & Synthé Analogique (RGAA) */
html[data-theme="dark"] {
  --bg-primary: #0a0d14;
  --bg-surface: #121722;
  --bg-subtle: #182030;
  --border-light: #263246;
  --border-focus: #4b5d78;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Blocs < en métal doré 8-bit (mode sombre) */
  --tile-lt-bg: #eab308;
  --tile-lt-text: #fffbeb;
  --tile-lt-border: #facc15;

  --tile-1-bg: #0d281a;
  --tile-1-text: #86efac;
  --tile-1-border: #1a6d45;

  --tile-2-bg: #0f2438;
  --tile-2-text: #7dd3fc;
  --tile-2-border: #1e6096;

  --tile-3-bg: #2e1812;
  --tile-3-text: #fdba74;
  --tile-3-border: #823f2f;

  --tile-4-bg: #2d220c;
  --tile-4-text: #fde047;
  --tile-4-border: #7c6225;

  --tile-5-bg: #2b152d;
  --tile-5-text: #f0abfc;
  --tile-5-border: #783680;

  --tile-6-bg: #301212;
  --tile-6-text: #fca5a5;
  --tile-6-border: #8c3232;

  --tile-7-bg: #0c2625;
  --tile-7-text: #5eead4;
  --tile-7-border: #1f6b69;

  --tile-8-bg: #231e15;
  --tile-8-text: #fcd34d;
  --tile-8-border: #6b5c42;

  --tile-9-bg: #121d33;
  --tile-9-text: #93c5fd;
  --tile-9-border: #324c80;

  /* Lettres A à F : blocs en métal argenté 8-bit (mode sombre) */
  --tile-a-bg: #475569;
  --tile-a-text: #ffffff;
  --tile-a-border: #cbd5e1;

  --tile-b-bg: #475569;
  --tile-b-text: #ffffff;
  --tile-b-border: #cbd5e1;

  --tile-c-bg: #475569;
  --tile-c-text: #ffffff;
  --tile-c-border: #cbd5e1;

  --tile-d-bg: #475569;
  --tile-d-text: #ffffff;
  --tile-d-border: #cbd5e1;

  --tile-e-bg: #475569;
  --tile-e-text: #ffffff;
  --tile-e-border: #cbd5e1;

  --tile-f-bg: #475569;
  --tile-f-text: #ffffff;
  --tile-f-border: #cbd5e1;

  /* Cœur parfait : voyant carmin laser rétro-éclairé */
  --heart-color: #fb7185;
  --heart-bg: #38101e;
  --heart-border: #9f1239;
  --heart-glow: rgba(251, 113, 133, 0.45);

  --select-border: #c4b5fd;
  --select-glow: rgba(167, 139, 250, 0.5);
  --adjacent-border: #86efac;
  --adjacent-glow: rgba(74, 222, 128, 0.45);
  --reject-color: #f87171;

  --slot-bg: #0e131d;
  --slot-border: #1a2230;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Focus Visible RGAA */
:focus-visible {
  outline: 2.5px solid #d1345b !important;
  outline-offset: 2px !important;
}

/* Lien d'évitement RGAA */
.skip-link {
  position: absolute;
  top: -70px;
  left: 12px;
  background: var(--heart-color);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.skip-link:focus-visible {
  top: 12px;
  outline: 3px solid #ffffff !important;
}

/* Classe d'accessibilité écran uniquement (RGAA) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Typographie de lecture : longs paragraphes en Google Font Play */
p,
.about-text,
.legal-text,
.legal-section p,
.legal-cookie-list,
.legal-cookie-item,
.legal-highlight-section div,
.summary-content p,
.rule-summary-card p,
.rule-block p,
.rule-desc,
.rules-body p,
.heritage-quote,
.modal-body p {
  font-family: var(--font-text);
}

/* Règle stricte : la fonte Silkscreen ne dépasse jamais la graisse 400 (normal) */
h1, h2, h3, h4, h5, h6,
button {
  font-weight: 400;
}

/* Dans les textes de lecture (Play), les mots-clés en strong restent nets en gras */
p strong,
.legal-text strong,
.about-text strong {
  font-family: var(--font-text);
  font-weight: 700;
}

html[data-theme="dark"] body {
  background-color: #0a0d14;
  background-image: radial-gradient(circle at 50% 0%, #141c2c 0%, #0a0d14 75%);
  background-attachment: fixed;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100dvh;
  padding: env(safe-area-inset-top, 10px) 12px env(safe-area-inset-bottom, 12px) 12px;
}

/* Conteneur principal centré */
.app-wrapper {
  width: 100%;
  max-width: max(480px, calc(var(--board-width) + 24px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Header & Titre */
.game-header {
  width: var(--board-width);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}

.top-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 2px 8px 2px;
}

.brand-logo {
  display: flex;
  align-items: center;
}

.logo-heart {
  font-family: var(--font-mono);
  font-size: 1.95rem;
  font-weight: 400;
  color: var(--heart-color);
  text-shadow: 0 0 14px var(--heart-glow), 0 2px 4px rgba(0, 0, 0, 0.45);
  line-height: 1;
  user-select: none;
  letter-spacing: -0.02em;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-heart:hover {
  transform: scale(1.08);
}

.header-scores {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: auto;
  margin-right: 14px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  line-height: 1.1;
  margin-bottom: 2px;
}

.stat-val-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transition: color 0.12s ease, text-shadow 0.12s ease;
}

.stat-value.score-ticking {
  color: #ca8a04;
  text-shadow: 0 0 6px rgba(202, 138, 4, 0.4);
}

html[data-theme="dark"] .stat-value.score-ticking {
  color: #facc15;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
}

/* Bouton Engrenage Menu ⚙️ */
.btn-menu-gear {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  flex-shrink: 0;
}

.btn-menu-gear:hover {
  background: var(--bg-subtle);
  border-color: var(--border-focus);
  transform: rotate(30deg);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-menu-gear:active {
  transform: rotate(60deg) scale(0.94);
}

/* --- Modal Menu Réglages (Zoning) --- */
.menu-dialog .modal-card.menu-card {
  max-width: 340px;
  width: 90vw;
  padding: 18px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.menu-dialog .menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.menu-title {
  font-family: var(--font-mono);
  font-size: 1.12rem;
  font-weight: 400;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-action-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-light);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 400;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-sizing: border-box;
}

.menu-action-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-focus);
  transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.menu-action-btn:focus-visible {
  outline: 2.5px solid var(--border-focus);
  outline-offset: 2px;
}

.menu-btn-icon {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.menu-btn-label {
  flex-grow: 1;
  text-align: left;
}

.menu-btn-badge {
  font-size: 0.72rem;
  font-weight: 400;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

.menu-btn-arrow {
  font-size: 0.95rem;
  color: var(--text-dim);
}

.menu-coffee-action {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.menu-coffee-action:hover {
  background: #ffedd5;
  border-color: #f97316;
}

/* --- Trio de réglages rapides (tiers de largeur) --- */
.menu-trio-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.menu-triplet-btn {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 4px 8px;
  gap: 4px;
  min-height: 84px;
  width: 100%;
  border-radius: 10px;
}

.menu-triplet-btn:hover {
  transform: translateY(-2px);
}

.menu-triplet-btn .menu-btn-icon {
  font-size: 1.35rem;
  line-height: 1;
  margin: 0;
}

.menu-triplet-btn .menu-btn-label {
  flex-grow: 0;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-main);
  max-width: 100%;
}

.menu-triplet-btn .menu-btn-badge {
  font-size: 0.65rem;
  font-weight: 400;
  padding: 2px 5px;
  border-radius: 5px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Grand bouton Back en bas du Menu --- */
.menu-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  margin-top: 4px;
  border-radius: 12px;
  background: #2b2725;
  color: #ffffff;
  border: none;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(43, 39, 37, 0.2);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.menu-back-btn:hover {
  background: #181514;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(43, 39, 37, 0.3);
}

.menu-back-btn:active {
  transform: translateY(0);
}

.menu-back-btn:focus-visible {
  outline: 2.5px solid var(--border-focus);
  outline-offset: 2px;
}

.menu-back-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.menu-back-label {
  letter-spacing: -0.01em;
}

html[data-theme="dark"] .menu-card {
  background: var(--bg-surface);
  border-color: var(--border-light);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .menu-action-btn {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  color: var(--text-main);
}

html[data-theme="dark"] .menu-action-btn:hover {
  background: #253347;
  border-color: var(--border-focus);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .menu-triplet-btn:hover {
  transform: translateY(-2px);
}

html[data-theme="dark"] .menu-triplet-btn .menu-btn-badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

html[data-theme="dark"] .menu-coffee-action {
  background: #271406;
  border-color: #7c2d12;
  color: #fdba74;
}

html[data-theme="dark"] .menu-coffee-action:hover {
  background: #391c0a;
  border-color: #ea580c;
}

html[data-theme="dark"] .menu-back-btn {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.4);
}

html[data-theme="dark"] .menu-back-btn:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.55);
}

/* --- Modal Sélection de Langue --- */
.lang-dialog .modal-card.lang-card {
  max-width: 360px;
  width: 92vw;
  padding: 18px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 2px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-light);
  color: var(--text-main);
  font-family: var(--font-mono);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-sizing: border-box;
}

.lang-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.lang-btn:focus-visible {
  outline: 2.5px solid var(--border-focus);
  outline-offset: 2px;
}

.lang-btn.active {
  border-color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
}

.lang-flag {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.lang-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.lang-name {
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-check {
  font-size: 0.95rem;
  font-weight: 400;
  color: #e11d48;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.lang-btn.active .lang-check {
  opacity: 1;
}

html[data-theme="dark"] .lang-card {
  background: var(--bg-surface);
  border-color: var(--border-light);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .lang-btn {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  color: var(--text-main);
}

html[data-theme="dark"] .lang-btn:hover {
  background: #253347;
  border-color: var(--border-focus);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .lang-btn.active {
  border-color: #f43f5e;
  background: rgba(244, 63, 94, 0.18);
}

html[data-theme="dark"] .lang-btn.active .lang-check {
  color: #f43f5e;
}

/* --- Modal À Propos de <3 --- */
.modal-dialog.about-dialog {
  max-width: 480px;
}

.about-dialog .modal-card.about-card {
  max-width: 480px;
  padding: 22px;
  border-radius: 18px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
}

.about-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.about-title-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.about-header h2 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-main);
  margin: 0;
}

.about-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  text-align: left;
}

.about-heart-hero {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 400;
  color: #e11d48;
  letter-spacing: -0.05em;
  text-shadow: 0 4px 16px rgba(225, 29, 72, 0.3);
  user-select: none;
  margin-bottom: 2px;
}

.about-text {
  font-family: var(--font-text);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

.about-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

.about-footer .btn-primary {
  min-width: 100px;
}

/* Thème sombre pour le modal À propos */
html[data-theme="dark"] .about-card {
  background: var(--bg-surface);
  border-color: var(--border-light);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .about-heart-hero {
  color: #f43f5e;
  text-shadow: 0 4px 20px rgba(244, 63, 94, 0.45);
}

html[data-theme="dark"] .about-text {
  color: #cbd5e1;
}

/* --- Modal Mentions Légales & Confidentialité (RGPD / ePrivacy) --- */
.modal-dialog.legal-dialog {
  max-width: 540px;
}

.legal-dialog .modal-card.legal-card {
  max-width: 540px;
  max-height: 85vh;
  padding: 20px;
  border-radius: 18px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
}

.legal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legal-title-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.legal-header h2 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-main);
  margin: 0;
}

.legal-body {
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.legal-body::-webkit-scrollbar {
  width: 6px;
}

.legal-body::-webkit-scrollbar-track {
  background: transparent;
}

.legal-body::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

.legal-section {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
}

.legal-section-title {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-main);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.legal-text {
  font-family: var(--font-text);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

.legal-text strong {
  color: var(--text-main);
}

.legal-text a {
  color: #e11d48;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.legal-text a:hover {
  color: #be123c;
}

.legal-highlight-section {
  border-left: 3.5px solid #e11d48;
  background: rgba(225, 29, 72, 0.04);
}

.legal-cookie-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legal-cookie-item {
  font-family: var(--font-text);
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-muted);
}

.legal-cookie-item strong {
  color: var(--text-main);
}

.legal-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}

/* Thème sombre pour le modal légal */
html[data-theme="dark"] .legal-card {
  background: var(--bg-surface);
  border-color: var(--border-light);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .legal-section {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-light);
}

html[data-theme="dark"] .legal-section-title {
  color: #f8fafc;
}

html[data-theme="dark"] .legal-text {
  color: var(--text-muted);
}

html[data-theme="dark"] .legal-text strong {
  color: #f1f5f9;
}

html[data-theme="dark"] .legal-text a {
  color: #fb7185;
}

html[data-theme="dark"] .legal-text a:hover {
  color: #f43f5e;
}

html[data-theme="dark"] .legal-highlight-section {
  background: rgba(244, 63, 94, 0.07);
  border-left-color: #f43f5e;
}

html[data-theme="dark"] .legal-cookie-item {
  background: var(--bg-surface);
  border-color: var(--border-light);
  color: var(--text-muted);
}

html[data-theme="dark"] .legal-cookie-item strong {
  color: #f1f5f9;
}

/* HUD / Panneau de score & contrôles */
.game-main {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hud-panel {
  width: var(--board-width);
  max-width: 100%;
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.hud-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

/* Carte de Progression de Niveau & Score à battre */
.level-progress-card {
  width: var(--board-width);
  max-width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 7px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.level-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.level-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  padding: 2px 8px;
  border-radius: 6px;
}

.level-badge-label {
  font-size: 0.65rem;
  font-weight: 400;
  color: #3b82f6;
  letter-spacing: 0.06em;
}

.level-badge-num {
  font-size: 0.88rem;
  font-weight: 400;
  color: #1d4ed8;
  line-height: 1;
}

.level-progress-text {
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.level-progress-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.level-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8 0%, #6366f1 50%, #ec4899 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.45);
}

/* --- Case Unique d'Inventaire des Special powers --- */
.powers-inventory-card {
  width: var(--board-width);
  max-width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inventory-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inventory-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.inventory-title {
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.inventory-counter-badge {
  font-size: 0.72rem;
  font-weight: 400;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 1px 8px;
  line-height: 1.2;
}

.inventory-items {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  flex-wrap: wrap;
}

.inventory-empty-hint {
  font-size: 0.73rem;
  font-family: var(--font-mono);
  color: #94a3b8;
  font-style: italic;
  padding: 4px 0;
  user-select: none;
}

/* Pastilles des pouvoirs collectés côte à côte */
.inventory-power-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  user-select: none;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  outline: none;
}

.inventory-power-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.inventory-power-pill .pill-icon {
  font-size: 1.1rem;
  line-height: 1;
  animation: pillWiggle 2.6s infinite ease-in-out;
}

@keyframes pillWiggle {
  0%, 80%, 100% { transform: scale(1) rotate(0deg); }
  85% { transform: scale(1.15) rotate(-8deg); }
  90% { transform: scale(1.15) rotate(8deg); }
  95% { transform: scale(1.08) rotate(-4deg); }
}

.inventory-power-pill .pill-letter,
.inventory-power-pill .pill-name {
  font-size: 0.74rem;
  font-weight: 400;
  color: #334155;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 1px 6px;
  line-height: 1.25;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

html[data-theme="dark"] .inventory-power-pill .pill-letter,
html[data-theme="dark"] .inventory-power-pill .pill-name {
  color: #f1f5f9;
  background: #1e293b;
}

.inventory-power-pill .pill-count {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-main);
  background: var(--bg-subtle);
  border-radius: 999px;
  padding: 0 6px;
  border: 1px solid var(--border-light);
  line-height: 1.25;
}

/* Thèmes par élément */
.inventory-power-pill[data-power="A"] { border-color: #f59e0b; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.18); }
.inventory-power-pill[data-power="B"] { border-color: #ef4444; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.18); }
.inventory-power-pill[data-power="C"] { border-color: #06b6d4; box-shadow: 0 2px 8px rgba(6, 182, 212, 0.18); }
.inventory-power-pill[data-power="D"] { border-color: #3b82f6; box-shadow: 0 2px 8px rgba(59, 130, 246, 0.18); }
.inventory-power-pill[data-power="E"] { border-color: #eab308; box-shadow: 0 2px 8px rgba(234, 179, 8, 0.18); }
.inventory-power-pill[data-power="F"] { border-color: #f97316; box-shadow: 0 2px 8px rgba(249, 115, 22, 0.18); }

/* État armé (en attente de clic sur le plateau - style shoot'em up rétro) */
.inventory-power-pill {
  position: relative;
  overflow: visible;
}

.inventory-power-pill.armed {
  animation: pillArmedPulse 0.85s infinite alternate ease-in-out, shmupArmedFireGlow 0.38s infinite alternate steps(3) !important;
  transform: scale(1.06);
  z-index: 10;
}

.shmup-flame-aura {
  position: absolute;
  top: -16px;
  right: -6px;
  pointer-events: none;
  z-index: 15;
  filter: drop-shadow(0 0 5px rgba(249, 115, 22, 0.85)) drop-shadow(0 -2px 0 rgba(220, 38, 38, 0.8));
  animation: shmupAuraFlicker 0.28s infinite alternate steps(2);
}

@keyframes shmupAuraFlicker {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-3px) scale(1.15); }
}

@keyframes shmupArmedFireGlow {
  0% {
    box-shadow: 0 0 0 2px #facc15, 0 0 12px rgba(250, 204, 21, 0.7), inset 0 2px 0 #fef08a;
  }
  50% {
    box-shadow: 0 0 0 2.5px #f97316, 0 0 18px rgba(249, 115, 22, 0.85), inset 0 2px 0 #ffffff;
  }
  100% {
    box-shadow: 0 0 0 2px #dc2626, 0 0 14px rgba(220, 38, 38, 0.75), inset 0 2px 0 #fde047;
  }
}

.inventory-power-pill.armed[data-power="A"] { background: #fffbeb !important; border-color: #f59e0b !important; }
.inventory-power-pill.armed[data-power="B"] { background: #fef2f2 !important; border-color: #ef4444 !important; }
.inventory-power-pill.armed[data-power="C"] { background: #ecfeff !important; border-color: #06b6d4 !important; }
.inventory-power-pill.armed[data-power="D"] { background: #eff6ff !important; border-color: #3b82f6 !important; }
.inventory-power-pill.armed[data-power="E"] { background: #fefce8 !important; border-color: #eab308 !important; }
.inventory-power-pill.armed[data-power="F"] { background: #fff7ed !important; border-color: #f97316 !important; }

html[data-theme="dark"] .level-progress-card,
html[data-theme="dark"] .powers-inventory-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 3px 10px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .level-badge {
  background: #111d30;
  border-color: #1e365b;
}

html[data-theme="dark"] .level-badge-label {
  color: #60a5fa;
}

html[data-theme="dark"] .level-badge-num {
  color: #93c5fd;
}

html[data-theme="dark"] .level-progress-track {
  background: #0c1018;
  border: 1px solid #1c2638;
}

html[data-theme="dark"] .inventory-counter-badge {
  background: #111d30;
  border-color: #1e365b;
  color: #60a5fa;
}

html[data-theme="dark"] .inventory-power-pill {
  background: #151d2c;
  border-color: #2e3d55;
  color: #f1f5f9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 5px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .inventory-power-pill:hover {
  background: #1c273a;
  border-color: #475d80;
}

html[data-theme="dark"] .inventory-power-pill.armed[data-power="A"] { background: #271808 !important; border-color: #f59e0b !important; box-shadow: 0 0 0 2px #f59e0b, 0 4px 14px rgba(245, 158, 11, 0.5) !important; }
html[data-theme="dark"] .inventory-power-pill.armed[data-power="B"] { background: #270e0e !important; border-color: #ef4444 !important; box-shadow: 0 0 0 2px #ef4444, 0 4px 14px rgba(239, 68, 68, 0.5) !important; }
html[data-theme="dark"] .inventory-power-pill.armed[data-power="C"] { background: #072228 !important; border-color: #06b6d4 !important; box-shadow: 0 0 0 2px #06b6d4, 0 4px 14px rgba(6, 182, 212, 0.5) !important; }
html[data-theme="dark"] .inventory-power-pill.armed[data-power="D"] { background: #081d33 !important; border-color: #3b82f6 !important; box-shadow: 0 0 0 2px #3b82f6, 0 4px 14px rgba(59, 130, 246, 0.5) !important; }
html[data-theme="dark"] .inventory-power-pill.armed[data-power="E"] { background: #262008 !important; border-color: #eab308 !important; box-shadow: 0 0 0 2px #eab308, 0 4px 14px rgba(234, 179, 8, 0.5) !important; }
html[data-theme="dark"] .inventory-power-pill.armed[data-power="F"] { background: #291206 !important; border-color: #f97316 !important; box-shadow: 0 0 0 2px #f97316, 0 4px 14px rgba(249, 115, 22, 0.5) !important; }

@keyframes pillArmedPulse {
  0% { transform: scale(1.02); }
  100% { transform: scale(1.07); }
}

.bomb-card.armed .hud-sub {
  color: #dc2626;
  font-weight: 400;
}

@keyframes bombArmedPulse {
  0% { transform: scale(0.98); }
  100% { transform: scale(1.03); }
}

.hud-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 400;
  color: var(--text-muted);
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--text-main);
  line-height: 1.2;
}

.combo-badge {
  background: linear-gradient(135deg, #ff6b8b 0%, #ff8e53 100%);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  padding: 2px 7px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(255, 107, 139, 0.4);
  animation: comboBadgePulse 0.7s ease-in-out infinite alternate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

@keyframes comboBadgePulse {
  0% { transform: scale(0.92); filter: brightness(0.96); }
  100% { transform: scale(1.1); filter: brightness(1.1); box-shadow: 0 4px 12px rgba(255, 107, 139, 0.6); }
}

.hud-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.heart-card .heart-counter-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.heart-card .heart-icon {
  font-size: 1.15rem;
  animation: heartIdle 2s ease-in-out infinite;
}

.heart-card .hud-value {
  color: var(--heart-color);
}

@keyframes heartIdle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* Boutons de contrôle */
.hud-controls {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
  background: #fbf9f6;
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(1px);
}

.btn-icon svg {
  display: block;
}

.hidden {
  display: none !important;
}

/* Conteneur de la Grille */
.board-container {
  position: relative;
  width: var(--board-width);
  height: var(--board-height);
  padding: 0;
  touch-action: manipulation;
  overflow: visible;
}

/* Arrière-plan de slots */
.board-slots {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--tile-size));
  grid-template-rows: repeat(var(--rows), var(--tile-size));
  gap: var(--gap);
  pointer-events: none;
}

.slot {
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: var(--tile-radius);
  background-color: var(--bg-subtle);
  opacity: 0.5;
}

/* Conteneur des tuiles actives */
.board-tiles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Bloc individuel */
.tile {
  position: absolute;
  top: calc(var(--row) * (var(--tile-size) + var(--gap)));
  left: calc(var(--col) * (var(--tile-size) + var(--gap)));
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: var(--tile-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: calc(var(--tile-size) * 0.44);
  font-weight: 400;
  cursor: pointer;
  will-change: transform, top, left, opacity;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: top 0.28s cubic-bezier(0.25, 1, 0.5, 1),
              left 0.22s cubic-bezier(0.25, 1, 0.5, 1),
              transform 0.15s ease,
              box-shadow 0.18s ease,
              border-color 0.18s ease,
              opacity 0.2s ease;
  user-select: none;
  z-index: 1;
}

/* Variantes de couleurs par symbole */
/* Blocs < en métal doré 8-bit */
.tile[data-sym="<"] {
  background: linear-gradient(180deg, #fef9c3 0%, #fef08a 18%, #facc15 22%, #eab308 52%, #ca8a04 78%, #854d0e 100%);
  color: #451a03;
  border: 2px solid #ca8a04;
  box-shadow: inset 2px 2px 0 #fef9c3, inset -2px -2px 0 #78350f, 0 2px 5px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 #fef08a, 1px 1px 0 #78350f;
  font-weight: 400;
}

html[data-theme="dark"] .tile[data-sym="<"] {
  background: linear-gradient(180deg, #fef08a 0%, #eab308 24%, #ca8a04 55%, #92400e 80%, #451a03 100%);
  color: #fffbeb;
  border: 2px solid #facc15;
  box-shadow: inset 2px 2px 0 #fef08a, inset -2px -2px 0 #451a03, 0 0 14px rgba(234, 179, 8, 0.28), 0 2px 6px rgba(0, 0, 0, 0.5);
  text-shadow: 1px 1px 0 #451a03, 0 -1px 0 #fef08a, 0 0 10px rgba(250, 204, 21, 0.65);
}

.tile[data-sym="<"].selected {
  box-shadow: 0 0 0 2.5px #facc15, 0 0 18px rgba(250, 204, 21, 0.65), inset 2px 2px 0 #fef9c3, inset -2px -2px 0 #78350f;
}

.tile[data-sym="1"] {
  background-color: var(--tile-1-bg);
  color: var(--tile-1-text);
  border: 1.5px solid var(--tile-1-border);
}

.tile[data-sym="2"] {
  background-color: var(--tile-2-bg);
  color: var(--tile-2-text);
  border: 1.5px solid var(--tile-2-border);
}

.tile[data-sym="3"] {
  background-color: var(--tile-3-bg);
  color: var(--tile-3-text);
  border: 1.5px solid var(--tile-3-border);
}

.tile[data-sym="4"] {
  background-color: var(--tile-4-bg);
  color: var(--tile-4-text);
  border: 1.5px solid var(--tile-4-border);
}

.tile[data-sym="5"] {
  background-color: var(--tile-5-bg);
  color: var(--tile-5-text);
  border: 1.5px solid var(--tile-5-border);
}

.tile[data-sym="6"] {
  background-color: var(--tile-6-bg);
  color: var(--tile-6-text);
  border: 1.5px solid var(--tile-6-border);
}

.tile[data-sym="7"] {
  background-color: var(--tile-7-bg);
  color: var(--tile-7-text);
  border: 1.5px solid var(--tile-7-border);
}

.tile[data-sym="8"] {
  background-color: var(--tile-8-bg);
  color: var(--tile-8-text);
  border: 1.5px solid var(--tile-8-border);
}

.tile[data-sym="9"] {
  background-color: var(--tile-9-bg);
  color: var(--tile-9-text);
  border: 1.5px solid var(--tile-9-border);
}

/* Blocs lettres A à F : métal argenté 8-bit */
.tile[data-sym="A"],
.tile[data-sym="B"],
.tile[data-sym="C"],
.tile[data-sym="D"],
.tile[data-sym="E"],
.tile[data-sym="F"] {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 20%, #cbd5e1 50%, #94a3b8 78%, #64748b 100%);
  color: #0f172a;
  border: 2px solid #94a3b8;
  box-shadow: inset 2px 2px 0 #ffffff, inset -2px -2px 0 #334155, 0 2px 5px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 #ffffff, 1px 1px 0 #475569;
  font-weight: 400;
}

html[data-theme="dark"] .tile[data-sym="A"],
html[data-theme="dark"] .tile[data-sym="B"],
html[data-theme="dark"] .tile[data-sym="C"],
html[data-theme="dark"] .tile[data-sym="D"],
html[data-theme="dark"] .tile[data-sym="E"],
html[data-theme="dark"] .tile[data-sym="F"] {
  background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 22%, #64748b 55%, #334155 82%, #1e293b 100%);
  color: #ffffff;
  border: 2px solid #cbd5e1;
  box-shadow: inset 2px 2px 0 #ffffff, inset -2px -2px 0 #0f172a, 0 0 12px rgba(255, 255, 255, 0.15), 0 2px 6px rgba(0, 0, 0, 0.5);
  text-shadow: 1px 1px 0 #0f172a, 0 -1px 0 #cbd5e1, 0 0 8px rgba(255, 255, 255, 0.45);
}

.tile[data-sym="A"].selected,
.tile[data-sym="B"].selected,
.tile[data-sym="C"].selected,
.tile[data-sym="D"].selected,
.tile[data-sym="E"].selected,
.tile[data-sym="F"].selected {
  box-shadow: 0 0 0 2.5px #cbd5e1, 0 0 18px rgba(203, 213, 225, 0.65), inset 2px 2px 0 #ffffff, inset -2px -2px 0 #334155;
}

/* Tuile Cœur Pixel 8-bit */
.tile.tile-heart {
  background: linear-gradient(180deg, #ffe4e6 0%, #fecdd3 30%, #fda4af 60%, #fb7185 100%);
  border: 2px solid #f43f5e;
  box-shadow: inset 2px 2px 0 #fff1f2, inset -2px -2px 0 #9f1239, 0 0 18px rgba(244, 63, 94, 0.45);
  font-size: calc(var(--tile-size) * 0.52);
  z-index: 10;
}

html[data-theme="dark"] .tile.tile-heart {
  background: linear-gradient(180deg, #4c0519 0%, #881337 35%, #9f1239 70%, #be123c 100%);
  border: 2px solid #fb7185;
  box-shadow: inset 2px 2px 0 #fda4af, inset -2px -2px 0 #2a030c, 0 0 20px rgba(251, 113, 133, 0.55);
}

/* Sprite Cœur Pixel Art 8-bit */
.pixel-heart-8bit {
  display: inline-block;
  vertical-align: middle;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)) drop-shadow(0 0 6px rgba(244, 63, 94, 0.65));
  animation: pixelHeartBeat 0.45s ease-in-out infinite alternate;
}

@keyframes pixelHeartBeat {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.08);
  }
}

.pixel-heart-floater {
  display: inline-block;
  vertical-align: -2px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.legend-pixel-heart {
  display: inline-block;
  vertical-align: -1px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* État : Survol desktop */
@media (hover: hover) {
  .tile:hover:not(.selected):not(.adjacent-target) {
    transform: scale(1.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 10px rgba(0, 0, 0, 0.35);
    z-index: 2;
  }
}

/* Clic 1 : Tuile sélectionnée */
.tile.selected {
  transform: scale(1.07);
  box-shadow: 0 0 0 2.5px var(--select-border), 0 0 16px var(--select-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 5;
  filter: brightness(1.08);
}

/* Cases adjacentes valides */
.tile.adjacent-target {
  border: 2px dashed var(--adjacent-border) !important;
  box-shadow: 0 0 0 2px var(--adjacent-glow);
  animation: adjacentPulse 1.2s infinite ease-in-out alternate;
  z-index: 4;
}

@keyframes adjacentPulse {
  0% { transform: scale(1.02); }
  100% { transform: scale(1.05); }
}

/* Clic 2 : Rejet / secousse pour paire invalide */
.tile.invalid-shake {
  border-color: var(--reject-color) !important;
  box-shadow: 0 0 0 3px rgba(201, 68, 68, 0.3) !important;
  animation: shake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  z-index: 6;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Résolution : Éclatement pop standard */
.tile.pop-out {
  pointer-events: none;
  animation: popOutAnim 0.26s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  z-index: 8;
}

@keyframes popOutAnim {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.8; }
  100% { transform: scale(0.1); opacity: 0; }
}

/* Résolution : Cœur parfait (<3) */
.tile.heart-pulse-burst {
  pointer-events: none;
  animation: heartPulseBurstAnim 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  z-index: 15;
}

@keyframes heartPulseBurstAnim {
  0% { transform: scale(0.85); box-shadow: 0 0 0 var(--heart-glow); }
  45% { transform: scale(1.38); box-shadow: 0 0 26px var(--heart-glow); }
  75% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.2); opacity: 0; }
}

/* Chute / Spawn de nouvelle tuile */
.tile.tile-spawn {
  animation: tileSpawnAnim 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
}

@keyframes tileSpawnAnim {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Animation de remélange complet du plateau */
.tile.shuffle-spin {
  animation: shuffleSpinAnim 0.55s ease-in-out forwards;
}

@keyframes shuffleSpinAnim {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(0.2) rotate(180deg); opacity: 0.3; }
  100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

/* Bannière de remélange (deadlock) */
.shuffle-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-focus);
  padding: 12px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-main);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 20;
}

.shuffle-banner.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.shuffle-banner .shuffle-icon {
  animation: spinSlow 1s linear infinite;
  display: inline-block;
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Bannière de Combo (chutes en cascade) */
.combo-banner {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: var(--bg-surface);
  border: 2px solid #ff6b8b;
  padding: 8px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 400;
  color: #d1345b;
  box-shadow: 0 10px 30px rgba(209, 52, 91, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3), opacity 0.2s ease;
  z-index: 25;
}

.combo-banner.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1.08);
  animation: comboBannerBounce 0.5s ease-out;
}

@keyframes comboBannerBounce {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.08); }
}

.combo-fire {
  font-size: 1.3rem;
  animation: flameFlicker 0.6s ease-in-out infinite alternate;
}

@keyframes flameFlicker {
  0% { transform: scale(0.9) rotate(-6deg); }
  100% { transform: scale(1.18) rotate(6deg); }
}

/* Bannière festive de Montée de Niveau (Level Up !) */
.level-up-banner {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background: #0f172a;
  border: 2px solid #f59e0b;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(245, 158, 11, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: 14px;
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
  font-family: var(--font-mono);
}

.level-up-banner.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.level-up-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.level-up-icon {
  font-size: 2.2rem;
  line-height: 1;
  animation: trophyBounce 1s infinite alternate ease-in-out;
}

@keyframes trophyBounce {
  0% { transform: scale(0.95) rotate(-6deg); }
  100% { transform: scale(1.15) rotate(6deg); }
}

.level-up-text {
  display: flex;
  flex-direction: column;
}

.level-up-title {
  font-size: 1.12rem;
  font-weight: 400;
  color: #fef08a;
  letter-spacing: 0.02em;
}

.level-up-sub {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-top: 2px;
}

/* Floating score text popup */
.score-floater {
  position: absolute;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 25;
  animation: floatScore 0.8s ease-out forwards;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
}

.score-floater.standard {
  color: var(--tile-1-text);
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.9);
}

.score-floater.heart {
  color: var(--heart-color);
  font-size: 1.25rem;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.95);
}

.score-floater.combo {
  color: #e63946;
  font-size: 1.3rem;
  font-weight: 400;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.95), 0 0 14px rgba(230, 57, 70, 0.35);
}

@keyframes floatScore {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -10px) scale(1.15); }
  80% { opacity: 1; transform: translate(-50%, -30px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -45px) scale(0.9); }
}

/* Canvas de particules superposé */
.particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 30;
}

/* Mode Ciblage Pouvoir sur le Plateau */
.board-container.targeting-power,
.board-container.targeting-bomb {
  cursor: crosshair;
}

.board-container.targeting-power .tile,
.board-container.targeting-bomb .tile {
  cursor: crosshair;
}

/* --- Prévisualisations au survol des 6 Pouvoirs --- */
.tile.armageddon-preview {
  background-color: #fef3c7 !important;
  border: 2px dashed #f59e0b !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5) !important;
  transform: scale(0.96) !important;
  z-index: 6;
}

.tile.blast-preview {
  background-color: #fee2e2 !important;
  border: 2px dashed #ef4444 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45) !important;
  transform: scale(0.96) !important;
  z-index: 6;
}

.tile.chaos-preview {
  background-color: #cffafe !important;
  border: 2px dashed #06b6d4 !important;
  box-shadow: 0 0 11px rgba(6, 182, 212, 0.45) !important;
  transform: scale(0.96) !important;
  z-index: 6;
}

.tile.deluge-preview {
  background-color: #dbeafe !important;
  border: 2px dashed #3b82f6 !important;
  box-shadow: 0 0 11px rgba(59, 130, 246, 0.45) !important;
  transform: scale(0.96) !important;
  z-index: 6;
}

.tile.electric-preview {
  background-color: #fef9c3 !important;
  border: 2px dashed #eab308 !important;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.55) !important;
  transform: scale(0.96) !important;
  z-index: 6;
}

.tile.fire-preview {
  background-color: #ffedd5 !important;
  border: 2px dashed #f97316 !important;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.55) !important;
  transform: scale(0.96) !important;
  z-index: 6;
}

/* --- Sprites et Effets Animés de Feu 8-Bit Rétro Shoot'em Up --- */
.pixel-fire-8bit {
  display: inline-block;
  vertical-align: middle;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  shape-rendering: crispEdges;
  overflow: visible;
  filter: drop-shadow(0 2px 0 #450a0a) drop-shadow(0 0 8px rgba(249, 115, 22, 0.8));
}

.pixel-fire-8bit .shmup-flame-f1 {
  animation: shmupFrame1 0.14s steps(1) infinite;
}

.pixel-fire-8bit .shmup-flame-f2 {
  animation: shmupFrame2 0.14s steps(1) infinite;
}

@keyframes shmupFrame1 {
  0%, 49.9% { opacity: 1; display: inline; }
  50%, 100% { opacity: 0; display: none; }
}

@keyframes shmupFrame2 {
  0%, 49.9% { opacity: 0; display: none; }
  50%, 100% { opacity: 1; display: inline; }
}

/* Explosion de feu 8-bit (Shoot'em Up Arcade) */
.shmup-fire-burst {
  position: absolute;
  pointer-events: none;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  height: 0;
}

.shmup-fire-sprite {
  position: absolute;
  transform: translate(-50%, -50%);
  animation: shmupFireBurstPop 0.34s steps(4) forwards;
}

@keyframes shmupFireBurstPop {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    filter: brightness(3) contrast(1.5);
    opacity: 1;
  }
  35% {
    transform: translate(-50%, -50%) scale(1.35);
    filter: brightness(2.2);
  }
  70% {
    transform: translate(-50%, -50%) scale(1.1) translateY(-6px);
    filter: brightness(1.2);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.2) translateY(-16px);
    opacity: 0;
  }
}

/* Braises de feu 8-bit projetées radialement */
.shmup-fire-ember {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fef08a;
  box-shadow: 0 0 0 1px #dc2626, inset 1px 1px 0 #ffffff;
  pointer-events: none;
  animation: shmupEmberBurst 0.32s steps(4) forwards;
}

@keyframes shmupEmberBurst {
  0% {
    transform: translate(0, 0) scale(1);
    background: #ffffff;
    opacity: 1;
  }
  40% {
    background: #f97316;
    opacity: 1;
  }
  80% {
    background: #dc2626;
    opacity: 0.8;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.2);
    background: #450a0a;
    opacity: 0;
  }
}

/* Onde de choc de feu 8-bit (Bomb & Armageddon) */
.shmup-fire-ring-8bit {
  position: absolute;
  border-radius: 50%;
  border: 4px dashed #f97316;
  box-shadow: 0 0 0 3px #facc15, 0 0 0 6px #dc2626, inset 0 0 16px rgba(249, 115, 22, 0.6);
  transform: translate(-50%, -50%) scale(0.1);
  pointer-events: none;
  z-index: 28;
  animation: shmupRingExpand8Bit 0.35s steps(5) forwards;
}

@keyframes shmupRingExpand8Bit {
  0% {
    width: 24px;
    height: 24px;
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.2);
    border-color: #ffffff;
  }
  50% {
    border-color: #facc15;
    opacity: 0.9;
  }
  100% {
    width: calc(var(--tile-size) * 8.5);
    height: calc(var(--tile-size) * 8.5);
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
    border-color: #dc2626;
  }
}

/* Incinération des tuiles par le feu 8-bit */
.tile-flame-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 15;
  animation: tileFlameRise 0.32s steps(4) forwards;
}

@keyframes tileFlameRise {
  0% {
    transform: translateY(4px) scale(0.8);
    filter: brightness(2);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-8px) scale(1.25);
    filter: brightness(2.5);
    opacity: 1;
  }
  100% {
    transform: translateY(-22px) scale(0.3);
    opacity: 0;
  }
}

.tile.shmup-fire-burn {
  animation: shmupTileIncinerate 0.32s steps(4) forwards !important;
  z-index: 12 !important;
}

@keyframes shmupTileIncinerate {
  0% {
    transform: scale(1);
    background: #ffffff !important;
    border-color: #facc15 !important;
    box-shadow: 0 0 16px rgba(250, 204, 21, 0.9) !important;
  }
  30% {
    transform: scale(1.1) translateY(-4px);
    background: #f97316 !important;
    border-color: #dc2626 !important;
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.8) !important;
  }
  70% {
    transform: scale(0.7) translateY(-12px);
    background: #450a0a !important;
    border-color: #450a0a !important;
    box-shadow: 0 0 8px rgba(69, 10, 10, 0.6) !important;
  }
  100% {
    transform: scale(0) translateY(-20px);
    opacity: 0;
  }
}

/* --- Pouvoir Déluge : Flot d'Eau 8-Bit Ascendant --- */
.deluge-flood-8bit {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  pointer-events: none;
  z-index: 25;
  overflow: visible;
  animation: delugeRise8Bit 0.22s steps(6) forwards;
}

@keyframes delugeRise8Bit {
  0% {
    transform: translateY(100%);
    opacity: 0.6;
  }
  60% {
    opacity: 0.95;
  }
  100% {
    transform: translateY(0%);
    opacity: 0.92;
  }
}

.deluge-wave-crest {
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 14px;
  background: repeating-linear-gradient(
    90deg,
    #ffffff 0px,
    #ffffff 8px,
    #38bdf8 8px,
    #38bdf8 16px,
    #0284c7 16px,
    #0284c7 24px
  );
  box-shadow: 0 -3px 0 #ffffff, 0 3px 0 #0284c7, 0 0 10px rgba(56, 189, 248, 0.8);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.deluge-water-body {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 18%, #0369a1 50%, #0c4a6e 100%);
  box-shadow: inset 0 2px 0 #ffffff, inset 0 6px 0 #7dd3fc, 0 0 18px rgba(2, 132, 199, 0.65);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.deluge-water-droplet-8bit {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ffffff;
  box-shadow: 0 0 0 1px #0284c7;
  pointer-events: none;
  animation: delugeDropletSplash 0.3s steps(4) forwards;
}

@keyframes delugeDropletSplash {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
    background: #ffffff;
  }
  50% {
    transform: translate(var(--dx), var(--dy)) scale(1.2);
    background: #7dd3fc;
    opacity: 0.9;
  }
  100% {
    transform: translate(calc(var(--dx) * 1.5), calc(var(--dy) + 16px)) scale(0.2);
    background: #0284c7;
    opacity: 0;
  }
}

.pixel-water-8bit {
  display: inline-block;
  vertical-align: middle;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  shape-rendering: crispEdges;
}

.pixel-water-8bit .water-f1 {
  animation: waterFrame1 0.14s steps(1) infinite;
}

.pixel-water-8bit .water-f2 {
  animation: waterFrame2 0.14s steps(1) infinite;
}

@keyframes waterFrame1 {
  0%, 49.9% { opacity: 1; display: inline; }
  50%, 100% { opacity: 0; display: none; }
}

@keyframes waterFrame2 {
  0%, 49.9% { opacity: 0; display: none; }
  50%, 100% { opacity: 1; display: inline; }
}

.tile-deluge-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 15;
  animation: tileDelugeSwirl 0.34s steps(4) forwards;
  will-change: transform, opacity;
}

@keyframes tileDelugeSwirl {
  0% {
    transform: translateY(14px) scale(0.6);
    opacity: 0.6;
  }
  40% {
    transform: translateY(0) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateY(30px) scale(0.2);
    opacity: 0;
  }
}

/* --- Pouvoir Électricité : Éclairs Électriques 8-Bit --- */
.pixel-lightning-8bit {
  display: inline-block;
  vertical-align: middle;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  shape-rendering: crispEdges;
  overflow: visible;
}

.pixel-lightning-8bit .lightning-f1 {
  animation: lightningFrame1 0.08s steps(1) infinite;
}

.pixel-lightning-8bit .lightning-f2 {
  animation: lightningFrame2 0.08s steps(1) infinite;
}

@keyframes lightningFrame1 {
  0%, 49.9% { opacity: 1; display: inline; }
  50%, 100% { opacity: 0; display: none; }
}

@keyframes lightningFrame2 {
  0%, 49.9% { opacity: 0; display: none; }
  50%, 100% { opacity: 1; display: inline; }
}

/* Éclair s'abattant sur une tuile */
.electric-bolt-strike {
  position: absolute;
  pointer-events: none;
  z-index: 36;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  height: 0;
  will-change: transform, opacity;
}

.electric-bolt-sprite {
  position: absolute;
  transform: translate(-50%, -50%);
  animation: electricStrikePop 0.3s steps(4) forwards;
  will-change: transform, opacity;
}

@keyframes electricStrikePop {
  0% {
    transform: translate(-50%, -60%) scale(0.6);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -45%) scale(1);
    opacity: 0.85;
  }
  100% {
    transform: translate(-50%, -40%) scale(0.2);
    opacity: 0;
  }
}

/* Étincelles électriques 8-bit éjectées lors de l'impact */
.electric-spark-8bit {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #ffffff;
  box-shadow: 0 0 0 1px #38bdf8, 0 0 4px #facc15;
  pointer-events: none;
  animation: electricSparkBurst 0.28s steps(4) forwards;
  will-change: transform, opacity;
}

@keyframes electricSparkBurst {
  0% {
    transform: translate(0, 0) scale(1);
    background: #ffffff;
    opacity: 1;
  }
  40% {
    background: #facc15;
    opacity: 1;
  }
  75% {
    background: #38bdf8;
    opacity: 0.85;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.2);
    background: #1e3a8a;
    opacity: 0;
  }
}

.tile-lightning-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 15;
  animation: tileLightningFlash 0.3s steps(4) forwards;
  will-change: transform, opacity;
}

@keyframes tileLightningFlash {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(0.2);
    opacity: 0;
  }
}

/* Décharge d'origine au point de clic (Électricité) */
.electric-click-origin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 25%, #facc15 55%, #38bdf8 85%, transparent 100%);
  box-shadow: 0 0 10px #38bdf8, 0 0 16px #facc15;
  pointer-events: none;
  z-index: 38;
  animation: electricOriginPop 0.3s steps(4) forwards;
  will-change: transform, opacity;
}

@keyframes electricOriginPop {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  40% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
}

/* Faisceau / arc d'éclair 8-bit reliant le clic à chaque bloc ciblé */
.electric-arc-beam-8bit {
  position: absolute;
  top: 0;
  left: 0;
  height: 28px;
  margin-top: -14px;
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 37;
  overflow: visible;
  will-change: transform, opacity;
}

.electric-arc-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  animation: electricArcFlicker 0.08s steps(1) infinite;
  will-change: opacity;
}

.electric-arc-svg .arc-f1 {
  animation: arcFrame1 0.08s steps(1) infinite;
}

.electric-arc-svg .arc-f2 {
  animation: arcFrame2 0.08s steps(1) infinite;
}

@keyframes electricArcFlicker {
  0%, 49.9% { opacity: 0.92; }
  50%, 100% { opacity: 1; }
}

@keyframes arcFrame1 {
  0%, 49.9% { opacity: 1; display: inline; }
  50%, 100% { opacity: 0; display: none; }
}

@keyframes arcFrame2 {
  0%, 49.9% { opacity: 0; display: none; }
  50%, 100% { opacity: 1; display: inline; }
}

/* Onde de choc circulaire expansive */
.power-blast-ring,
.bomb-blast-ring {
  position: absolute;
  border-radius: 50%;
  border: 3.5px solid #ef4444;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.45) 0%, rgba(239, 68, 68, 0.1) 55%, transparent 72%);
  transform: translate(-50%, -50%) scale(0.1);
  pointer-events: none;
  z-index: 28;
  animation: blastRingExpand 0.45s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes blastRingExpand {
  0% {
    width: 20px;
    height: 20px;
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.2);
  }
  100% {
    width: calc(var(--tile-size) * 8.5);
    height: calc(var(--tile-size) * 8.5);
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* --- Animations d'Exécution des 6 Pouvoirs --- */

/* Barre de feu 8-bit montante d'Armageddon */
.armageddon-fire-bar-8bit {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  bottom: -40px;
  pointer-events: none;
  z-index: 35;
  animation: armageddonFireBarSweep 0.36s linear forwards;
  will-change: bottom;
}

@keyframes armageddonFireBarSweep {
  0% {
    bottom: -40px;
    opacity: 1;
  }
  85% {
    bottom: 95%;
    opacity: 1;
  }
  100% {
    bottom: 110%;
    opacity: 0;
  }
}

.armageddon-fire-beam {
  position: relative;
  width: 100%;
  height: 24px;
  background: linear-gradient(to bottom, #ffffff 0%, #fef08a 25%, #facc15 50%, #f97316 75%, #dc2626 100%);
  border-top: 3px solid #ffffff;
  border-bottom: 3px solid #7f1d1d;
  box-shadow: 0 0 10px #f97316, 0 -2px 0 #ffffff;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.armageddon-fire-crest-8bit {
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    #ffffff 0px, #ffffff 4px,
    #facc15 4px, #facc15 8px,
    transparent 8px, transparent 12px,
    #f97316 12px, #f97316 16px
  );
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.armageddon-fire-tail {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, rgba(249, 115, 22, 0.85) 0%, rgba(220, 38, 38, 0.5) 45%, rgba(69, 10, 10, 0.2) 80%, transparent 100%);
  border-left: 2px solid #f97316;
  border-right: 2px solid #f97316;
}

/* Double A : Armageddon */
.tile.armageddon-wipe {
  animation: armageddonTile 0.38s forwards cubic-bezier(0.1, 0.9, 0.2, 1);
  z-index: 10;
}
@keyframes armageddonTile {
  0% { transform: scale(1); filter: brightness(2.5) contrast(1.5); background-color: #fef08a; }
  35% { transform: scale(1.18); filter: brightness(3); }
  100% { transform: scale(0) rotate(15deg); opacity: 0; }
}

/* Double B : Bomb */
.tile.bomb-destroyed {
  animation: bombTileDestroy 0.32s forwards cubic-bezier(0.1, 0.9, 0.2, 1);
  z-index: 10;
}
@keyframes bombTileDestroy {
  0% { transform: scale(1); filter: brightness(1.8); }
  40% { transform: scale(1.15); filter: brightness(2.2); background-color: #fee2e2; }
  100% { transform: scale(0); opacity: 0; }
}

/* Double C : Chaos (Spirale violette cosmique 8-bit & translation pure des cases) */
.chaos-spiral-8bit {
  position: absolute;
  pointer-events: none;
  z-index: 38;
  transform-origin: 50% 50%;
  animation: chaosSpiralExpand8Bit 0.38s steps(6) forwards;
  will-change: transform, opacity;
  overflow: visible;
}

@keyframes chaosSpiralExpand8Bit {
  0% {
    transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
    opacity: 0.9;
  }
  40% {
    transform: translate(-50%, -50%) scale(0.95) rotate(180deg);
    opacity: 1;
  }
  75% {
    transform: translate(-50%, -50%) scale(1.22) rotate(300deg);
    opacity: 0.85;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.35) rotate(360deg);
    opacity: 0;
  }
}

.chaos-spiral-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.chaos-spiral-svg .spiral-f1 {
  animation: spiralFlicker1 0.08s steps(1) infinite;
}

.chaos-spiral-svg .spiral-f2 {
  animation: spiralFlicker2 0.08s steps(1) infinite;
}

@keyframes spiralFlicker1 {
  0%, 49.9% { opacity: 1; display: inline; }
  50%, 100% { opacity: 0; display: none; }
}

@keyframes spiralFlicker2 {
  0%, 49.9% { opacity: 0; display: none; }
  50%, 100% { opacity: 1; display: inline; }
}

.tile.chaos-swirl {
  animation: chaosTileTranslate8Bit 0.36s steps(4) forwards;
  will-change: transform;
  z-index: 8;
}
@keyframes chaosTileTranslate8Bit {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 3px); }
  50% { transform: translate(4px, -3px); }
  75% { transform: translate(-3px, -2px); }
  100% { transform: translate(0, 0); }
}

/* Double D : Deluge (Évacuation vers le bas) */
.tile.deluge-wash {
  animation: delugeTileWash 0.36s forwards cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}
@keyframes delugeTileWash {
  0% { transform: translateY(0); filter: brightness(1.4); background-color: #bfdbfe; }
  50% { transform: translateY(20px) scale(0.9); opacity: 0.8; }
  100% { transform: translateY(60px) scale(0.2); opacity: 0; }
}

/* Double E : Electricity (Foudre) */
.tile.electric-zap {
  animation: electricTileZap 0.32s forwards ease-in-out;
  z-index: 12;
}
@keyframes electricTileZap {
  0% { transform: scale(1); filter: brightness(3.5); background-color: #fef08a; }
  25% { transform: scale(1.15) rotate(5deg); }
  50% { transform: scale(1.05) rotate(-5deg); filter: brightness(2.8); }
  100% { transform: scale(0); opacity: 0; }
}

/* Double F : Fire (Cône de flammes ascendant 8-bit) */
.shmup-fire-cone-8bit {
  position: absolute;
  pointer-events: none;
  z-index: 36;
  transform-origin: 50% 100%;
  animation: fireConeErupt8Bit 0.32s steps(4) forwards;
  will-change: transform, opacity;
  overflow: visible;
}

@keyframes fireConeErupt8Bit {
  0% {
    transform: translate(-50%, -100%) scaleY(0.08) scaleX(0.25);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -100%) scaleY(1.04) scaleX(1.02);
    opacity: 1;
  }
  65% {
    transform: translate(-50%, -100%) scaleY(1.0) scaleX(1.0);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -100%) scaleY(1.06) scaleX(1.04);
    opacity: 0;
  }
}

.shmup-fire-cone-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.shmup-fire-cone-svg .cone-f1 {
  animation: coneFlicker1 0.08s steps(1) infinite;
}

.shmup-fire-cone-svg .cone-f2 {
  animation: coneFlicker2 0.08s steps(1) infinite;
}

@keyframes coneFlicker1 {
  0%, 49.9% { opacity: 1; display: inline; }
  50%, 100% { opacity: 0; display: none; }
}

@keyframes coneFlicker2 {
  0%, 49.9% { opacity: 0; display: none; }
  50%, 100% { opacity: 1; display: inline; }
}

.tile.fire-burn {
  animation: fireTileBurn 0.34s forwards cubic-bezier(0.1, 0.9, 0.2, 1);
  z-index: 10;
}
@keyframes fireTileBurn {
  0% { transform: scale(1); filter: brightness(2.2); background-color: #ffedd5; }
  40% { transform: translateY(-12px) scale(1.08); filter: brightness(2.6); }
  100% { transform: translateY(-32px) scale(0); opacity: 0; }
}

/* Secousse du plateau lors d'une explosion de pouvoir */
.board-container.power-blast-shake,
.board-container.bomb-blast-shake {
  animation: bombScreenShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes bombScreenShake {
  10%, 90% { transform: translate3d(-4px, 0, 0); }
  20%, 80% { transform: translate3d(5px, -3px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 4px, 0); }
  40%, 60% { transform: translate3d(6px, -4px, 0); }
}

/* Modal éphémère / Toast des Pouvoirs */
.power-toast,
.bomb-toast {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.75);
  background: #0f172a;
  border: 1.5px solid #38bdf8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bomb-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.bomb-toast-icon {
  font-size: 2rem;
  animation: toastBombSpin 0.5s ease-out;
}

@keyframes toastBombSpin {
  0% { transform: rotate(-30deg) scale(0.6); }
  60% { transform: rotate(15deg) scale(1.15); }
  100% { transform: rotate(0deg) scale(1); }
}

.bomb-toast-content {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.bomb-toast-title {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 400;
  color: #fca5a5;
  letter-spacing: 0.02em;
}

.bomb-toast-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #cbd5e1;
}

/* Légende rapide sous le plateau */
.quick-legend {
  width: var(--board-width);
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 0.73rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 6px 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sym {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 400;
  font-size: 0.75rem;
}

.sym-lt {
  background: linear-gradient(180deg, #fef9c3 0%, #facc15 40%, #ca8a04 100%);
  color: #451a03;
  border: 1px solid #ca8a04;
  box-shadow: inset 1px 1px 0 #fef9c3, inset -1px -1px 0 #78350f;
  text-shadow: 0 1px 0 #fef08a;
}

html[data-theme="dark"] .sym-lt {
  background: linear-gradient(180deg, #fef08a 0%, #eab308 45%, #78350f 100%);
  color: #fffbeb;
  border: 1px solid #facc15;
  box-shadow: inset 1px 1px 0 #fef08a, inset -1px -1px 0 #451a03;
  text-shadow: 1px 1px 0 #451a03;
}
.sym-num { background: var(--tile-1-bg); color: var(--tile-1-text); }
.sym-num3 { background: var(--tile-3-bg); color: var(--tile-3-text); }
.sym-num4 { background: var(--tile-4-bg); color: var(--tile-4-text); }
.sym-num5 { background: var(--tile-5-bg); color: var(--tile-5-text); }
.sym-obs { background: var(--tile-6-bg); color: var(--tile-6-text); }
.legend-arrow { color: var(--text-dim); }
.legend-res { font-weight: 400; color: var(--text-main); }
.legend-heart { font-weight: 400; color: var(--heart-color); }
.legend-sep { color: var(--border-focus); }

/* Pied de page */
.site-footer {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 8px;
}

/* Fenêtre modale des règles */
.modal-dialog {
  border: none;
  background: transparent;
  padding: 16px;
  max-width: 440px;
  width: 90%;
  margin: auto;
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 68vh;
  overflow-y: auto;
}

/* --- Simulation Graphique Interactive (Modal Règles) --- */
.rules-sim-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] .rules-sim-card {
  background: #111827;
  border-color: #1e293b;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.rules-sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.sim-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  background: rgba(242, 113, 207, 0.15);
  color: #f271cf;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(242, 113, 207, 0.3);
}

.sim-score-counter {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-muted);
}

.sim-score-counter strong {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.rules-sim-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0;
  overflow: visible;
}

.rules-sim-grid {
  display: grid;
  grid-template-columns: repeat(3, 50px);
  grid-template-rows: repeat(3, 50px);
  gap: 8px;
  position: relative;
}

.sim-tile {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 400;
  box-sizing: border-box;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease,
              background-color 0.25s ease,
              filter 0.2s ease;
}

/* Bloc < en métal doré 8-bit dans la simulation */
.sim-tile[data-sym="<"] {
  background: linear-gradient(180deg, #fef9c3 0%, #fef08a 18%, #facc15 22%, #eab308 52%, #ca8a04 78%, #854d0e 100%);
  color: #451a03;
  border: 2px solid #ca8a04;
  box-shadow: inset 2px 2px 0 #fef9c3, inset -2px -2px 0 #78350f, 0 2px 5px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 #fef08a, 1px 1px 0 #78350f;
  font-weight: 400;
}

html[data-theme="dark"] .sim-tile[data-sym="<"] {
  background: linear-gradient(180deg, #fef08a 0%, #eab308 24%, #ca8a04 55%, #92400e 80%, #451a03 100%);
  color: #fffbeb;
  border: 2px solid #facc15;
  box-shadow: inset 2px 2px 0 #fef08a, inset -2px -2px 0 #451a03, 0 0 14px rgba(234, 179, 8, 0.28), 0 2px 6px rgba(0, 0, 0, 0.5);
  text-shadow: 1px 1px 0 #451a03, 0 -1px 0 #fef08a, 0 0 10px rgba(250, 204, 21, 0.65);
}

.sim-tile[data-sym="1"] {
  background-color: var(--tile-1-bg);
  color: var(--tile-1-text);
  border: 1.5px solid var(--tile-1-border);
}

.sim-tile[data-sym="2"] {
  background-color: var(--tile-2-bg);
  color: var(--tile-2-text);
  border: 1.5px solid var(--tile-2-border);
}

.sim-tile[data-sym="3"] {
  background-color: var(--tile-3-bg);
  color: var(--tile-3-text);
  border: 1.5px solid var(--tile-3-border);
}

.sim-tile[data-sym="4"] {
  background-color: var(--tile-4-bg);
  color: var(--tile-4-text);
  border: 1.5px solid var(--tile-4-border);
}

.sim-tile[data-sym="5"] {
  background-color: var(--tile-5-bg);
  color: var(--tile-5-text);
  border: 1.5px solid var(--tile-5-border);
}

.sim-tile[data-sym="6"] {
  background-color: var(--tile-6-bg);
  color: var(--tile-6-text);
  border: 1.5px solid var(--tile-6-border);
}

.sim-tile[data-sym="7"] {
  background-color: var(--tile-7-bg);
  color: var(--tile-7-text);
  border: 1.5px solid var(--tile-7-border);
}

.sim-tile[data-sym="8"] {
  background-color: var(--tile-8-bg);
  color: var(--tile-8-text);
  border: 1.5px solid var(--tile-8-border);
}

/* État sélectionné (Clic sur <) */
.sim-tile.selected {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px var(--select-border), 0 6px 14px var(--select-glow);
  filter: brightness(1.05);
  z-index: 2;
}

/* Surbrillance des 4 cases voisines orthogonales */
.sim-tile.adjacent-target {
  border: 2px dashed var(--adjacent-border) !important;
  box-shadow: 0 0 0 2px var(--adjacent-glow);
  animation: adjacentPulse 1.2s infinite ease-in-out alternate;
  z-index: 2;
}

/* Transformation en cœur pixel 8-bit */
.sim-tile.tile-heart {
  background: linear-gradient(180deg, #ffe4e6 0%, #fecdd3 30%, #fda4af 60%, #fb7185 100%) !important;
  border: 2px solid #f43f5e !important;
  box-shadow: inset 2px 2px 0 #fff1f2, inset -2px -2px 0 #9f1239, 0 0 18px rgba(244, 63, 94, 0.45) !important;
  transform: scale(1.12);
  animation: heartPop 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 3;
}

html[data-theme="dark"] .sim-tile.tile-heart {
  background: linear-gradient(180deg, #4c0519 0%, #881337 35%, #9f1239 70%, #be123c 100%) !important;
  border: 2px solid #fb7185 !important;
  box-shadow: inset 2px 2px 0 #fda4af, inset -2px -2px 0 #2a030c, 0 0 20px rgba(251, 113, 133, 0.55) !important;
}

/* Curseur virtuel animé */
.rules-sim-cursor {
  position: absolute;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 10;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
  top: 0;
  left: 0;
  transform: translate3d(210px, 140px, 0); /* Position de repos hors centre */
}

.cursor-ripple {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid #38bdf8;
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
}

.cursor-ripple.active {
  animation: cursorRippleAnim 0.38s ease-out forwards;
}

@keyframes cursorRippleAnim {
  0% {
    opacity: 1;
    transform: scale(0.3);
  }
  100% {
    opacity: 0;
    transform: scale(2);
  }
}

/* Badge de score flottant animé */
.sim-float-score {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 1.12rem;
  font-weight: 400;
  color: #ef4444;
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid #fecaca;
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0) scale(0.5);
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="dark"] .sim-float-score {
  background: #1e111d;
  border-color: #7f1d1d;
  color: #f87171;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);
}

.sim-float-score.float-active {
  opacity: 1;
  transform: translate3d(-70%, -100%, 0) scale(1.15);
}

/* Légende dynamique de l'étape de démonstration */
.rules-sim-caption {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-main);
  margin-top: 10px;
  padding: 7px 10px;
  background: var(--bg-subtle);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  line-height: 1.35;
  transition: background 0.2s ease, border-color 0.2s ease;
}

/* --- Fiches Synthétiques Simplifiées des Règles --- */
.rules-quick-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.rule-summary-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.rule-summary-card.highlight {
  background: var(--heart-bg);
  border: 1.5px solid var(--heart-border);
}

.summary-icon {
  font-size: 1.3rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.summary-content strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-weight: 400;
  color: var(--text-main);
  margin-bottom: 2px;
}

.summary-content p {
  font-family: var(--font-text);
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

/* Rétro-compatibilité */
.rule-block {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-primary);
}

.rule-block.highlight {
  background: var(--heart-bg);
  border: 1px solid var(--heart-border);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  font-family: var(--font-mono);
  background: #2b2725;
  color: #ffffff;
  border: none;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 400;
  cursor: pointer;
  width: 100%;
  transition: all 0.18s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn-primary:hover {
  background: #403b38;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Mode Nuit : bouton primaire rouge éclatant à fort contraste (évite le blanc sur blanc) */
html[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4);
}

html[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.55);
  transform: translateY(-1px);
}

/* ==========================================================================
   Animation d'Ouverture Cinématique (< + 3 -> Flash -> Cœur Rouge Pivotant)
   ========================================================================== */

/* ==========================================================================
   Animation d'introduction 8-bit Rétro Arcade
   ========================================================================== */

.intro-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.28) 0px,
    rgba(0, 0, 0, 0.28) 2px,
    transparent 2px,
    transparent 4px
  ), #090710;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s steps(3), visibility 0.3s steps(3);
  animation: introOverlayFade 2.8s steps(4) forwards;
}

html[data-theme="light"] .intro-overlay {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.28) 0px,
    rgba(0, 0, 0, 0.28) 2px,
    transparent 2px,
    transparent 4px
  ), #130d1d;
}

html[data-theme="dark"] .intro-overlay {
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.35) 0px,
    rgba(0, 0, 0, 0.35) 2px,
    transparent 2px,
    transparent 4px
  ), #07050d;
}

.intro-overlay.intro-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: none;
}

.intro-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 1. Flash 8-bit stroboscopique arcade plein écran au point d'impact */
.intro-flash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  animation: introFlashExplosion 2.8s steps(1) forwards;
  will-change: opacity, background-color;
  z-index: 0;
}

/* 1b. Flash en étoile rétro 8-bit en arrière-plan à la rencontre des blocs */
.intro-starburst {
  position: absolute;
  width: clamp(280px, 55vw, 480px);
  height: clamp(280px, 55vw, 480px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transform: scale(0.2);
  transform-origin: center center;
  mix-blend-mode: screen;
  animation: introStarburstFlash 2.8s ease-out forwards;
  will-change: transform, opacity;
}

.intro-starburst-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 10px #ffffff) drop-shadow(0 0 24px #fef08a) drop-shadow(0 0 45px rgba(250, 204, 21, 0.85));
}

/* 2. Blocs < et 3 géants (aspect tuiles du jeu à grande échelle) */
.intro-symbols {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 16px);
  will-change: transform, opacity;
  animation: introSymbolsDisappear 2.8s steps(1) forwards;
  pointer-events: none;
  z-index: 3;
}

.intro-sym {
  width: clamp(110px, 22vw, 170px);
  height: clamp(110px, 22vw, 170px);
  border-radius: clamp(18px, 3.8vw, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-arcade);
  font-size: clamp(3.6rem, 11vw, 5.8rem);
  font-weight: 400;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, opacity;
  image-rendering: pixelated;
}

/* Bloc < : Métal Or 8-bit identique au jeu, à grande échelle */
.intro-sym-lt {
  background: linear-gradient(180deg, #fef9c3 0%, #fef08a 18%, #facc15 22%, #eab308 52%, #ca8a04 78%, #854d0e 100%);
  color: #451a03;
  border: clamp(3px, 0.7vw, 5px) solid #ca8a04;
  box-shadow:
    inset 4px 4px 0 #fef9c3,
    inset -4px -4px 0 #78350f,
    0 10px 30px rgba(0, 0, 0, 0.65);
  text-shadow: 0 2px 0 #fef08a, 2px 2px 0 #78350f;
  transform: translate3d(-100vw, 0, 0);
  animation: introFlyInLeft 2.8s cubic-bezier(0.12, 0.85, 0.25, 1) forwards;
}

html[data-theme="dark"] .intro-sym-lt {
  background: linear-gradient(180deg, #fef08a 0%, #eab308 24%, #ca8a04 55%, #92400e 80%, #451a03 100%);
  color: #fffbeb;
  border-color: #facc15;
  box-shadow:
    inset 4px 4px 0 #fef08a,
    inset -4px -4px 0 #451a03,
    0 0 24px rgba(234, 179, 8, 0.4),
    0 10px 30px rgba(0, 0, 0, 0.75);
  text-shadow: 2px 2px 0 #451a03, 0 -1px 0 #fef08a, 0 0 14px rgba(250, 204, 21, 0.75);
}

/* Bloc 3 : Tuile terracotta / orange chaud identique au jeu, à grande échelle */
.intro-sym-num {
  background-color: var(--tile-3-bg);
  color: var(--tile-3-text);
  border: clamp(3px, 0.7vw, 5px) solid var(--tile-3-border);
  box-shadow:
    inset 4px 4px 0 rgba(255, 255, 255, 0.12),
    inset -4px -4px 0 rgba(0, 0, 0, 0.35),
    0 10px 30px rgba(0, 0, 0, 0.65);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
  transform: translate3d(100vw, 0, 0);
  animation: introFlyInRight 2.8s cubic-bezier(0.12, 0.85, 0.25, 1) forwards;
}

html[data-theme="dark"] .intro-sym-num {
  background-color: #2e1812;
  color: #fdba74;
  border-color: #823f2f;
  box-shadow:
    inset 4px 4px 0 rgba(253, 186, 116, 0.2),
    inset -4px -4px 0 #150906,
    0 0 20px rgba(253, 186, 116, 0.25),
    0 10px 30px rgba(0, 0, 0, 0.75);
  text-shadow: 2px 2px 0 #150906, 0 0 10px rgba(253, 186, 116, 0.45);
}

/* 3. Cœur pixel art 8-bit pivotant de 90° (-90deg vers 0deg) puis zoomant jusqu'à remplir l'écran */
.intro-heart-wrap {
  position: absolute;
  width: clamp(130px, 25vw, 195px);
  height: clamp(130px, 25vw, 195px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.2) rotate(-90deg);
  transform-origin: center center;
  animation: introHeartSequence 2.8s ease-in forwards;
  will-change: transform, opacity;
  z-index: 2;
}

.intro-heart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 #30030c) drop-shadow(8px 8px 0 rgba(0, 0, 0, 0.75));
}

/* 4. Bouton Passer au style console rétro 8-bit */
.intro-skip-btn {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  border: 2px solid #64748b;
  color: #f8fafc;
  font-family: var(--font-arcade);
  font-size: 0.78rem;
  font-weight: 400;
  padding: 8px 14px;
  border-radius: 0;
  box-shadow: 3px 3px 0 #000000;
  cursor: pointer;
  z-index: 502;
  transition: transform 0.1s steps(2), box-shadow 0.1s steps(2);
  opacity: 0.9;
  letter-spacing: 0.05em;
}

.intro-skip-btn:hover {
  background: #1e293b;
  border-color: #94a3b8;
  color: #ffffff;
  opacity: 1;
}

.intro-skip-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000000;
}

/* ==========================================================================
   Keyframes de la Chorégraphie 8-bit Rétro (2,2s au total)
   ========================================================================== */

/* Arrivée purement décélérée du bloc < depuis la gauche (mouvement fluide continu sans étapes parasites) */
@keyframes introFlyInLeft {
  0% {
    opacity: 1;
    transform: translate3d(-100vw, 0, 0);
  }
  40% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  41% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1.06);
  }
  42%, 100% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(1.06);
  }
}

/* Arrivée purement décélérée du bloc 3 depuis la droite */
@keyframes introFlyInRight {
  0% {
    opacity: 1;
    transform: translate3d(100vw, 0, 0);
  }
  40% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
  41% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1.06);
  }
  42%, 100% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(1.06);
  }
}

/* Disparition des deux blocs au moment de la collision et du flash */
@keyframes introSymbolsDisappear {
  0%, 40% {
    opacity: 1;
  }
  41% {
    opacity: 0.8;
  }
  42%, 100% {
    opacity: 0;
    visibility: hidden;
  }
}

/* Flash stroboscopique 8-bit arcade à l'impact (vers ~1,1s) */
@keyframes introFlashExplosion {
  0%, 37% {
    opacity: 0;
  }
  39% {
    opacity: 0.95;
    background: #ffffff;
  }
  41% {
    opacity: 0.85;
    background: #fde047;
  }
  43% {
    opacity: 0.65;
    background: #f43f5e;
  }
  46% {
    opacity: 0.3;
    background: #881337;
  }
  48%, 100% {
    opacity: 0;
  }
}

/* Flash en étoile 8-bit arcade en arrière-plan à l'impact (bref éclat lumineux en expansion d'échelle sans rotation) */
@keyframes introStarburstFlash {
  0%, 39% {
    opacity: 0;
    transform: scale(0.2);
  }
  40% {
    opacity: 1;
    transform: scale(0.45);
  }
  42% {
    opacity: 1;
    transform: scale(1.05);
  }
  44.5% {
    opacity: 1;
    transform: scale(1.6);
  }
  47.5% {
    opacity: 0.9;
    transform: scale(2.1);
  }
  51% {
    opacity: 0.55;
    transform: scale(2.55);
  }
  54% {
    opacity: 0.2;
    transform: scale(2.9);
  }
  56%, 100% {
    opacity: 0;
    transform: scale(3.2);
    visibility: hidden;
  }
}

/* Séquence du Cœur Rouge 8-bit :
   - Apparaît au flash (couché à -90deg, matching l'émoticône <3)
   - Rotation angulaire saccadée par crans de 30° : -90deg -> -60deg -> -30deg -> 0deg
   - Pulsation 8-bit (battement de cœur par paliers)
   - Zoom massif jusqu'à remplir l'écran pour la transition vers le modal
*/
@keyframes introHeartSequence {
  0%, 38% {
    opacity: 0;
    transform: scale(0.35) rotate(-90deg);
  }
  39% {
    opacity: 1;
    transform: scale(1) rotate(-90deg);
  }
  46% {
    opacity: 1;
    transform: scale(1) rotate(-90deg);
  }
  /* Rotation de 90° par crans (-90deg vers 0deg) */
  52% {
    transform: scale(1.05) rotate(-60deg);
  }
  58% {
    transform: scale(1.1) rotate(-30deg);
  }
  64% {
    transform: scale(1) rotate(0deg);
  }
  /* Battement de cœur */
  68% {
    transform: scale(1.18) rotate(0deg);
  }
  72% {
    transform: scale(1) rotate(0deg);
  }
  76% {
    transform: scale(1.15) rotate(0deg);
    opacity: 1;
  }
  /* Zoom massif jusqu'à remplir tout l'écran */
  80% {
    transform: scale(1.4) rotate(0deg);
    opacity: 1;
  }
  84% {
    transform: scale(2.5) rotate(0deg);
    opacity: 1;
  }
  88% {
    transform: scale(5.5) rotate(0deg);
    opacity: 1;
  }
  92% {
    transform: scale(13) rotate(0deg);
    opacity: 1;
  }
  96% {
    transform: scale(28) rotate(0deg);
    opacity: 0.85;
  }
  100% {
    transform: scale(40) rotate(0deg);
    opacity: 0;
    visibility: hidden;
  }
}

/* Fondu de sortie rétro par paliers synchronisé sur le zoom du cœur */
@keyframes introOverlayFade {
  0%, 88% {
    opacity: 1;
    visibility: visible;
  }
  92% {
    opacity: 0.75;
    visibility: visible;
  }
  96% {
    opacity: 0.4;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* Révélation dynamique du bandeau de titre du modal de démarrage */
.start-card.revealed-from-intro .start-heritage-header {
  animation: headerRevealFromIntro 0.5s steps(4) forwards;
}

@keyframes headerRevealFromIntro {
  0% {
    opacity: 0;
    transform: scale(0.94);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Accessibilité : désactivation si réduction d'animation demandée */
@media (prefers-reduced-motion: reduce) {
  .intro-overlay {
    animation: none;
    display: none !important;
  }
}

/* ==========================================================================
   Écran de Démarrage / Choix de la Grille
   ========================================================================== */

.start-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.start-screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.start-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 22px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: scale(1);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
  padding: 0 0 18px 0;
}

/* ==========================================================================
   En-tête historique 8-bit Arcade du Modal de Démarrage
   ========================================================================== */
.start-heritage-header {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.22) 0px,
      rgba(0, 0, 0, 0.22) 2px,
      transparent 2px,
      transparent 4px
    ),
    linear-gradient(180deg, #f43f5e 0%, #e11d48 35%, #be123c 70%, #9f1239 100%);
  padding: 24px 16px 20px;
  text-align: center;
  position: relative;
  border-top: 3px solid #fda4af;
  border-bottom: 4px solid #30030c;
  box-shadow: inset 0 -3px 0 #881337, inset 0 3px 0 #fecdd3, 0 4px 0 rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

html[data-theme="dark"] .start-heritage-header {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.3) 0px,
      rgba(0, 0, 0, 0.3) 2px,
      transparent 2px,
      transparent 4px
    ),
    linear-gradient(180deg, #e11d48 0%, #be123c 40%, #9f1239 75%, #881337 100%);
  border-top-color: #fb7185;
  border-bottom-color: #1a0106;
}

/* Liseré 8-bit dithered à damier de pixels au bas de la bannière */
.start-heritage-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #f43f5e 0px,
    #f43f5e 4px,
    #be123c 4px,
    #be123c 8px,
    #881337 8px,
    #881337 12px,
    #30030c 12px,
    #30030c 16px
  );
  image-rendering: pixelated;
}

.heritage-heart-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: var(--font-arcade);
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 4.2rem);
  line-height: 1;
  color: #ffffff;
  text-shadow:
    3px 0 0 #30030c,
    0 3px 0 #30030c,
    3px 3px 0 #881337,
    6px 6px 0 #4c0519,
    9px 9px 0 #000000;
  margin-bottom: 8px;
  user-select: none;
  animation: heritageHeartBeat 2.4s steps(1) infinite;
  image-rendering: pixelated;
}

/* Cœurs en pixel art 8-bit encadrant le logo <3 */
.heritage-pixel-heart-decor {
  width: clamp(26px, 6vw, 36px);
  height: clamp(22px, 5vw, 30px);
  overflow: visible;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 #30030c) drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.6));
  animation: heritageHeartBeat 2.4s steps(1) infinite;
}

.heritage-logo-text {
  display: inline-block;
  letter-spacing: -0.03em;
}

@keyframes heritageHeartBeat {
  0%, 100% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.09);
  }
  24% {
    transform: scale(1);
  }
  36% {
    transform: scale(1.05);
  }
  46% {
    transform: scale(1);
  }
}

.heritage-quote {
  font-family: var(--font-text);
  font-size: clamp(0.88rem, 2.6vw, 1.05rem);
  line-height: 1.4em;
  color: #ffffff;
  text-shadow: 2px 2px 0 #30030c, 3px 3px 0 rgba(0, 0, 0, 0.7);
  margin: 0;
  letter-spacing: 0.01em;
}

.grid-picker-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px;
}

.section-label {
  font-size: 0.74rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.grid-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.grid-opt-card {
  position: relative;
  background: var(--bg-subtle);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font-sans);
}

.grid-opt-card:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  transform: translateY(-2px);
}

.grid-opt-card.active {
  border-color: #be123c;
  background: var(--heart-bg);
  box-shadow: 0 4px 12px var(--heart-glow);
}

.grid-opt-card.full-card {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: flex-start;
  padding: 11px 14px;
  gap: 12px;
  text-align: left;
}

.full-card .opt-title {
  font-size: 0.88rem;
}

.full-card .opt-dim {
  margin-left: auto;
  font-size: 0.78rem;
}

.full-card .opt-sub {
  margin-left: 0;
}

.opt-badge {
  position: absolute;
  top: -8px;
  right: 6px;
  background: #be123c;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 400;
  padding: 1px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.opt-icon {
  font-size: 1.2rem;
}

.opt-title {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-main);
}

.opt-dim {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
}

.opt-sub {
  font-size: 0.64rem;
  color: var(--text-dim);
}

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px;
}

.start-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-start {
  font-size: 0.95rem;
  padding: 12px;
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  border: none;
  color: #ffffff;
  font-weight: 400;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(190, 18, 60, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(190, 18, 60, 0.45);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 10px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
  background: var(--bg-subtle);
}

/* Lien Café dans le modal de démarrage */
.start-footer-coffee {
  padding: 2px 20px 0;
  text-align: center;
}

.coffee-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 20px;
  transition: all 0.18s ease;
}

.coffee-link:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.start-footer-legal {
  padding: 0 20px 6px;
  text-align: center;
}

.start-legal-link {
  background: none;
  border: none;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2.5px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.18s ease;
  opacity: 0.85;
}

.start-legal-link:hover {
  color: var(--text-main);
  opacity: 1;
}

.start-legal-link:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.footer-coffee-link {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.18s ease;
}

.footer-coffee-link:hover {
  color: #ea580c;
}

/* Micro-ajustements petits écrans */
@media (max-width: 380px) {
  :root {
    --gap: 4px;
    --tile-radius: 9px;
  }

  .game-title {
    font-size: 1.05rem;
  }

  .quick-legend {
    font-size: 0.65rem;
    gap: 4px;
    padding: 5px 6px;
  }

  .start-card {
    border-radius: 18px;
  }

  .grid-opt-card {
    padding: 8px 2px;
  }

  .heritage-heart-logo {
    font-size: 2.8rem;
    gap: 8px;
  }
}

/* Respect du réglage d'accessibilité de réduction des animations (RGAA) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
