/* ============================================================
   BATAY — table de jeu moderne
   Feutre sombre, cartes très arrondies, thèmes & textures
   ============================================================ */

:root {
  /* Feutre de table (défaut : vert classique) */
  --felt-1: #0a3325;
  --felt-2: #0b3d2c;
  --felt-3: #072a1e;
  --felt-glow: rgba(255, 255, 255, 0.04);

  /* Accents */
  --gold: #f2c14e;
  --gold-soft: #ffdf8e;
  --red: #d63031;
  --ink: #1e2733;

  /* Cartes */
  --card-w: 76px;
  --card-h: 108px;
  --card-radius: 18px;
  --card-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);

  --chip-bg: rgba(255, 255, 255, 0.09);
  --chip-brd: rgba(255, 255, 255, 0.14);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Thèmes de couleur du tapis */
body[data-theme="classic"] { --felt-1: #0a3325; --felt-2: #0b3d2c; --felt-3: #072a1e; }
body[data-theme="emerald"] { --felt-1: #0d4630; --felt-2: #0e5a3d; --felt-3: #083a28; }
body[data-theme="ocean"]   { --felt-1: #0a2540; --felt-2: #0d2f52; --felt-3: #071a30; }
body[data-theme="wine"]    { --felt-1: #3a0f1e; --felt-2: #4a1426; --felt-3: #2a0a14; }
body[data-theme="slate"]   { --felt-1: #16232e; --felt-2: #1d2c3a; --felt-3: #101a24; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: #f4f7f5;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--felt-2) 0%, var(--felt-1) 55%, var(--felt-3) 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.6s ease;
}

/* Texture du tapis (motif en filigrane) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 1;
  transition: opacity 0.4s ease;
}

body[data-texture="felt"]::before {
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.010) 0 2px, transparent 2px 4px);
}
body[data-texture="nap"]::before {
  background-image:
    repeating-linear-gradient(65deg, rgba(255,255,255,0.02) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-65deg, rgba(255,255,255,0.014) 0 3px, transparent 3px 9px);
}
body[data-texture="wood"]::before {
  background-image:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.10) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.028) 0 1px, transparent 1px 52px);
}
body[data-texture="velvet"]::before {
  background-image: radial-gradient(90% 70% at 50% 28%, rgba(255,255,255,0.06), transparent 60%);
}

/* ------------------------------------------------------------------
   Stage : conteneur absolu où les cartes volent
   ------------------------------------------------------------------ */
#stage {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* ------------------------------------------------------------------
   Carte
   ------------------------------------------------------------------ */
.card {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  transform-style: preserve-3d;
  will-change: transform, opacity;
  left: 0;
  top: 0;
  transform: translate3d(0, 0, 0) scale(1);
}

/* Deux faces par carte : le retournement 3D (révélation en bataille) joue
   sur rotateY du conteneur ; backface-visibility masque la face arrière. */
.card .face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.card .face-front {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.card .corner {
  position: absolute;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.card .corner.tl { top: 6px; left: 7px; }
.card .corner.br { bottom: 6px; right: 7px; transform: rotate(180deg); }

.card .corner span { font-size: 12px; }

.card .pips {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 700;
}


/* Dos de carte — motif losanges (face arrière, exposée par rotation Y) */
.card .face-back {
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.14), transparent 55%),
    repeating-linear-gradient(45deg, #1d4ed8 0 8px, #1e40af 8px 16px);
  border: 1px solid rgba(0, 0, 0, 0.25);
  transform: rotateY(180deg);
}
.card .face-back::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,0.18) 6px 12px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255,255,255,0.18) 6px 12px);
}

/* ------------------------------------------------------------------
   Deck
   ------------------------------------------------------------------ */
.deck {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
}
.deck .deck-pile {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.16), transparent 55%),
    repeating-linear-gradient(45deg, #c2262c 0 8px, #a51c22 8px 16px);
  border: 1px solid rgba(0, 0, 0, 0.3);
  box-shadow: var(--card-shadow);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.deck .deck-pile::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,0.16) 6px 12px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255,255,255,0.16) 6px 12px);
}
.deck::before {
  content: "";
  position: absolute;
  inset: -3px -3px 0;
  border-radius: calc(var(--card-radius) + 3px);
  background: #fff;
  opacity: 0.14;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.18);
}

.deck.is-tappable { cursor: pointer; }
.deck.is-tappable .deck-pile {
  animation: deck-pulse 1.6s ease-in-out infinite;
}
.deck.is-tappable:active .deck-pile {
  transform: scale(0.92) translateY(3px);
}
.deck.is-tappable:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
  border-radius: var(--card-radius);
}
.deck.is-dimmed { opacity: 0.45; transition: opacity 0.3s ease; }

/* Halo doré sur le deck du vainqueur d'un ramassage */
.deck.winner-glow .deck-pile {
  animation: winner-glow 1.8s ease-out;
}
.deck.winner-glow {
  animation: deck-halo 1.8s ease-out;
}
@keyframes winner-glow {
  0%   { box-shadow: var(--card-shadow), 0 0 0 2px rgba(242, 193, 78, 0.95), 0 0 18px 6px rgba(242, 193, 78, 0.55); }
  35%  { box-shadow: var(--card-shadow), 0 0 0 7px rgba(242, 193, 78, 0.8), 0 0 42px 18px rgba(242, 193, 78, 0.7); }
  100% { box-shadow: var(--card-shadow), 0 0 0 3px rgba(242, 193, 78, 0.35), 0 0 20px 8px rgba(242, 193, 78, 0.25); }
}
@keyframes deck-halo {
  0%   { filter: drop-shadow(0 0 0 rgba(242, 193, 78, 0)); }
  30%  { filter: drop-shadow(0 0 16px rgba(242, 193, 78, 0.9)); }
  100% { filter: drop-shadow(0 0 8px rgba(242, 193, 78, 0.3)); }
}

.deck-hint {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold-soft);
  opacity: 0.9;
  animation: hint-breathe 1.6s ease-in-out infinite;
}

@keyframes deck-pulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.02); }
}
@keyframes hint-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ------------------------------------------------------------------
   Mise en page — portrait mobile
   ------------------------------------------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 14px 8px;
  z-index: 10;
}
.topbar-right { display: flex; align-items: center; gap: 7px; }

.round-chip, .count-chip {
  background: var(--chip-bg);
  border: 1px solid var(--chip-brd);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #eaf3ee;
}
.round-chip { padding: 5px 11px; white-space: nowrap; }
.count-chip {
  padding: 3px 12px;
  min-width: 44px;
  text-align: center;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  flex: none;
}
.icon-btn:active { transform: scale(0.9); }

.table {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 14px calc(14px + var(--safe-bottom));
  position: relative;
  z-index: 2;
}

/* Logo en filigrane au centre du tapis — sous les zones, au-dessus du feutre */
.table-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(170px, 52vw, 280px);
  height: auto;
  opacity: 0.16;
  pointer-events: none;
  z-index: -1;
  filter: drop-shadow(0 0 34px rgba(242, 193, 78, 0.12));
}

/* Zones */
.zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.5s cubic-bezier(0.3, 1, 0.4, 1);
}
/* En mode 2 joueurs, la zone du haut est retournée pour le joueur assis en face :
   le deck, les libellés et l'indication de tour lui sont alors lisibles à l'endroit. */
.zone-top.mirrored { transform: rotate(180deg); }

.zone-head {
  display: flex;
  align-items: center;
  gap: 9px;
}
.zone-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #dfeae4;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
}
.zone-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  min-height: var(--card-h);
}

.zone-top { margin-top: 2px; }
.zone-bottom { margin-top: auto; }
.zone-bottom .zone-body { padding-bottom: 30px; }

/* Emplacements où atterrissent les cartes */
.slot {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  background: var(--felt-glow);
}
.slot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.28);
}

/* Tapis central */
.center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 0;
}

/* Bannière BATAILLE — en fixed pour rester au-dessus des cartes */
.battle-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0) rotate(-4deg);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--gold-soft);
  background: linear-gradient(135deg, #7a1c1c, #b3341e 55%, #7a1c1c);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 8px 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 26px rgba(242, 193, 78, 0.35);
  z-index: 60;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
}
.battle-banner.show {
  animation: banner-in 1.15s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
@keyframes banner-in {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(-8deg); opacity: 0; }
  22%  { transform: translate(-50%, -50%) scale(1.18) rotate(3deg); opacity: 1; }
  32%  { transform: translate(-50%, -50%) scale(0.98) rotate(-2deg); opacity: 1; }
  40%  { transform: translate(-50%, -50%) scale(1.05) rotate(1deg); opacity: 1; }
  48%  { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
  82%  { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.6) rotate(0); opacity: 0; }
}

/* Secousse de la table pendant une bataille */
#table.shaking .zone, #table.shaking .center {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
#table.shaking .center { animation-duration: 0.65s; animation-delay: 0.08s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px) rotate(0.2deg); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px) rotate(-0.2deg); }
}

.pot-info {
  font-size: 12px;
  font-weight: 600;
  color: #cfe3d8;
  background: var(--chip-bg);
  border: 1px solid var(--chip-brd);
  padding: 3px 12px;
  border-radius: 999px;
}
.pot-info strong { color: var(--gold-soft); }
.hidden { display: none !important; }

/* ------------------------------------------------------------------
   Overlays (démarrage, fin, confirmations, panneaux)
   ------------------------------------------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 20, 14, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: overlay-in 0.35s ease both;
}
.overlay.hidden { display: none; }
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.start-card, .end-card, .mini-card, .panel {
  width: min(360px, 92vw);
  max-height: 88vh;
  overflow: auto;
  background: linear-gradient(160deg, #0e422f, #0a3325);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: card-in 0.45s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.start-card { padding: 24px 24px 20px; text-align: center; }
.end-card { padding: 26px 24px; text-align: center; }
.mini-card { padding: 26px 24px; text-align: center; width: min(320px, 88vw); }
.panel { padding: 20px; }
@keyframes card-in {
  from { transform: translateY(26px) scale(0.94); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.start-logo-img {
  width: 104px;
  height: 104px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}
.end-card h2, .mini-card h2, .panel h2 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #fff, #cfead9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tagline { color: #bcd6c8; font-size: 14px; margin-top: 4px; }

/* Sélecteur de mode */
.mode-select {
  display: flex;
  gap: 8px;
  margin: 16px 0 4px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-brd);
  border-radius: 999px;
  padding: 4px;
}
.mode-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #cfe3d8;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 6px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.15s ease;
}
.mode-btn.is-active {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #2a1c02;
  box-shadow: 0 4px 12px rgba(242, 193, 78, 0.35);
}
.mode-btn:active { transform: scale(0.96); }

.rules {
  list-style: none;
  margin: 16px 0 18px;
  text-align: left;
  display: grid;
  gap: 9px;
}
.rules li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: #e2eee8;
}
.rules li span {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #2a1c02;
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
  margin-top: 1px;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #2a1c02;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(242, 193, 78, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn-primary:active { transform: scale(0.96); }
.btn-primary:focus-visible, .btn-ghost:focus-visible, .btn-danger:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.btn-ghost {
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: #eaf3ee;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.btn-ghost:active { transform: scale(0.96); }

.btn-danger {
  border: 1px solid rgba(255, 120, 120, 0.35);
  background: linear-gradient(180deg, #b3341e, #8f2415);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  padding: 11px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.btn-danger:active { transform: scale(0.96); }

.menu-row { display: flex; gap: 10px; margin-top: 14px; }
.menu-row .btn-ghost { flex: 1; }

/* Fin de partie */
.end-emoji {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 8px;
  animation: end-pop 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
@keyframes end-pop {
  from { transform: scale(0) rotate(-20deg); }
  to   { transform: scale(1) rotate(0); }
}
.end-sub { color: #bcd6c8; font-size: 14px; margin: 8px 0 18px; }
.end-actions { display: grid; gap: 10px; }
.end-actions .btn-primary { width: 100%; }
.end-actions .btn-ghost { width: 100%; }
.end-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 22px;
}
.end-stats div {
  flex: 1;
  max-width: 120px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-brd);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.end-stats strong {
  font-size: 22px;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}
.end-stats span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #9fb8ab; }

/* Confirmation */
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row .btn-ghost, .btn-row .btn-danger { flex: 1; }

/* Panneaux (Scores, Tapis) */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 24px; }

.scores-empty { color: #bcd6c8; font-size: 13.5px; text-align: center; padding: 18px 6px; }
.scores-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 46vh;
  overflow: auto;
}
.scores-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-brd);
  border-radius: 14px;
  padding: 10px 12px;
}
.scores-list .s-winner { font-size: 14px; font-weight: 800; flex: 1; min-width: 0; }
.scores-list .s-winner small { display: block; font-weight: 600; font-size: 11px; color: #9fb8ab; margin-top: 2px; }
.scores-list .s-meta { text-align: right; font-size: 11px; color: #bcd6c8; line-height: 1.5; }
.scores-list .s-meta strong { color: var(--gold-soft); font-size: 12px; }
.scores-list .s-badge {
  flex: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(242, 193, 78, 0.16);
  border: 1px solid rgba(242, 193, 78, 0.35);
  color: var(--gold-soft);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Réglages tapis */
.settings-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9fb8ab;
  margin: 14px 0 10px;
}
.settings-label:first-of-type { margin-top: 0; }

.swatches { display: flex; gap: 12px; justify-content: center; }
.swatch {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  background: var(--sw, #0b3d2c);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.swatch.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(242, 193, 78, 0.25), 0 6px 16px rgba(0, 0, 0, 0.4);
  transform: scale(1.08);
}
.swatch:active { transform: scale(0.94); }

.texture-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tex-btn {
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: #dce9e1;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}
.tex-btn.is-active {
  border-color: var(--gold);
  background: rgba(242, 193, 78, 0.16);
  color: var(--gold-soft);
}
.tex-btn:active { transform: scale(0.94); }

.settings-note { color: #9fb8ab; font-size: 11.5px; text-align: center; margin-top: 16px; }

/* ------------------------------------------------------------------
   Micro-animations d'état
   ------------------------------------------------------------------ */
.count-chip.pop { animation: chip-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes chip-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Écrans courts : serrer la verticale */
@media (max-height: 720px) {
  :root { --card-w: 66px; --card-h: 94px; }
  .rules { gap: 6px; margin: 12px 0 14px; }
  .start-card { padding: 16px; }
  .center { min-height: 36px; }
  .battle-banner { font-size: 24px; }
}

/* Grands écrans : centrer et limiter la largeur */
@media (min-width: 640px) {
  body { align-items: center; }
  .topbar, .table { width: 480px; }
  :root { --card-w: 84px; --card-h: 120px; }
}

/* Écrans étroits : réduire le bandeau */
@media (max-width: 370px) {
  .round-chip { font-size: 11px; padding: 5px 8px; }
}

/* Respect du reduce-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
