/* ═══════════════════════════════════════════
   Belote Tunisienne — design system
   Desktop + mobile (phone-first safe layout)
═══════════════════════════════════════════ */

:root {
  --felt-deep: #0c3b2e;
  --felt-mid: #145a43;
  --felt-light: #1a6b50;
  --gold: #d4a84b;
  --gold-soft: #e8c87a;
  --cream: #f7f0e1;
  --ink: #1a1410;
  --coral: #c23b2a;
  --coral-deep: #8f2a1e;
  --ink-soft: #2a2218;
  --panel: #0a1c16;
  --panel-elevated: #12261f;
  --panel-border: rgba(247, 240, 225, 0.08);
  --line: rgba(247, 240, 225, 0.1);
  --surface: #081611;
  --surface-group: rgba(4, 14, 11, 0.55);
  --surface-press: rgba(247, 240, 225, 0.08);
  --on-surface: #f7f0e1;
  --on-surface-muted: rgba(247, 240, 225, 0.62);
  --elev-1: 0 1px 0 rgba(255, 255, 255, 0.05);
  --elev-2: 0 8px 24px rgba(0, 0, 0, 0.28);
  --elev-sheet: 0 -12px 40px rgba(0, 0, 0, 0.45);
  --duration: 180ms;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-sheet: 20px 20px 0 0;
  --font-display: "Amiri", "Times New Roman", serif;
  --font-ui: "Outfit", system-ui, sans-serif;
  /* Hauteur jeu : JS --app-height (clavier-stable). Pas de 100lvh (trop grand si barre URL). */
  --app-height: 100dvh;
  --touch: 44px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  /* PNG 400×620 (~1.55). Chevauchement plus fort → cartes plus grandes lisibles. */
  --card-ratio: 1.55;
  --card-w: clamp(72px, min(20vmin, (100vw - 28px) / 4.85), 108px);
  --card-h: calc(var(--card-w) * var(--card-ratio));
  --card-radius: calc(var(--card-w) * 0.06);
  /* PNG avec alpha : pas de plaque blanche sous la carte */
  --card-face: transparent;
  --hand-overlap: calc(var(--card-w) * 0.52);
  --hand-area-h: calc(var(--card-h) + 28px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --topbar-h: 52px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Android navigateur : plancher haut léger si env()=0. Pas de plancher bas (bande verte). */
html.is-android {
  --safe-top: max(env(safe-area-inset-top, 0px), 8px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* App Capacitor : bas = 0 toujours (sur Android ça ne sert à rien et crée une bande verte) */
html.is-android.is-native {
  --safe-top: max(env(safe-area-inset-top, 0px), 0px);
  --safe-bottom: 0px !important;
  --safe-left: 0px;
  --safe-right: 0px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  height: 100%;
  background: #000;
  color: var(--cream);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
  overflow-x: clip;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Pendant l’intro : fond strictement feutre */
body.boot-pending,
body.boot-play {
  background: #0c3b2e !important;
}

#app {
  min-height: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  min-height: var(--app-height, 100dvh);
}

button, input {
  font-family: inherit;
  font-size: 16px; /* évite le zoom iOS sur focus */
}

.screen {
  display: none;
  min-height: 100svh;
  min-height: 100dvh;
  min-height: var(--app-height, 100dvh);
}

.screen.active {
  display: flex;
}

/* Voile feutre : cache le swap d’écrans (évite le cut layout) */
#page-veil {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 80% 70% at 50% 36%, #1a6b50 0%, #0c3b2e 52%, #050806 100%);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
#page-veil.is-on {
  opacity: 1;
  pointer-events: auto;
}

/*
 * Jeu plein écran figé (Android / Capacitor) :
 * le clavier panne souvent le scroll du body ; fixed + inset
 * empêche topbar / feutre / main de rester « montés ».
 *
 * IMPORTANT : ne PAS fixer height: var(--app-height) — si --app-height
 * est plus petit que l’écran, une bande verte (body) apparaît en bas.
 */
html.is-native #screen-game.active,
html.is-android #screen-game.active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  z-index: 5;
  overflow: hidden !important;
}

/* Pendant clavier ouvert : ne pas laisser le home scroller hors cadre */
html.keyboard-open,
html.keyboard-open body {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

html.keyboard-open #screen-home.active {
  /* garde le cadre visible même si le WebView panne un peu */
  position: relative;
}

/* ═══════════════════════════════════════════
   BOOT INTRO — donne + calligraphie
   Timeline (~3.9s) :
   0.00–0.55  feutre s’allume, carte se pose
   0.55–2.40  écriture droite → gauche
   2.30–3.20  reflet, enseignes, marque
   3.20–4.10  fondu vers le home
═══════════════════════════════════════════ */
.boot-intro {
  /* inset:0 = bords physiques ; pas de height en px (évite chin gap iOS) */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  opacity: 1;
  background: #0c3b2e;
  box-sizing: border-box;
  /* Fondu long pour laisser la 2ᵉ fenêtre apparaître progressivement dessous */
  transition:
    opacity 1.05s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 1.05s,
    transform 1.05s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.boot-intro.is-leaving,
.boot-intro.is-done {
  will-change: auto;
}

.boot-intro.is-leaving {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  pointer-events: none;
}

.boot-intro.is-done {
  display: none;
}

/* —— Fond cinématique —— */
.boot-intro-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 50% 38%, rgba(26, 107, 80, 0.55), transparent 70%),
    linear-gradient(180deg, #061612 0%, #0c3b2e 48%, #050806 82%, #000 100%);
  transform: scale(1.04);
  opacity: 0.55;
}

body.boot-play .boot-intro-bg {
  animation: boot-felt-bloom 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes boot-felt-bloom {
  from { opacity: 0.35; transform: scale(1.08); }
  to { opacity: 1; transform: none; }
}

.boot-intro-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M36 8 L40 28 L60 32 L40 36 L36 56 L32 36 L12 32 L32 28 Z' fill='%23d4a84b'/%3E%3C/svg%3E");
  background-size: 56px 56px;
}

body.boot-play .boot-intro-bg::before {
  opacity: 0.05;
}

.boot-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(22px);
  opacity: 0;
  pointer-events: none;
  transform: translateZ(0);
}

body.boot-play .boot-orb-a {
  animation: boot-orb-in 1.2s ease 0.05s both;
}
body.boot-play .boot-orb-b {
  animation: boot-orb-in-plain 1.2s ease 0.2s both;
}
body.boot-play .boot-orb-c {
  animation: boot-orb-in-plain 1.2s ease 0.3s both;
}

.boot-orb-a {
  width: min(70vw, 340px);
  height: min(70vw, 340px);
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(212, 168, 75, 0.28), transparent 68%);
}

.boot-orb-b {
  width: min(50vw, 220px);
  height: min(50vw, 220px);
  right: -8%;
  bottom: 8%;
  background: radial-gradient(circle, rgba(194, 59, 42, 0.16), transparent 70%);
}

.boot-orb-c {
  width: min(42vw, 180px);
  height: min(42vw, 180px);
  left: -6%;
  top: 12%;
  background: radial-gradient(circle, rgba(126, 200, 216, 0.1), transparent 70%);
}

@keyframes boot-orb-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  to { opacity: 1; }
}

.boot-orb-b,
.boot-orb-c {
  animation-name: boot-orb-in-plain;
}

@keyframes boot-orb-in-plain {
  from { opacity: 0; }
  to { opacity: 1; }
}

.boot-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 75% 65% at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

/* —— Contenu central —— */
.boot-intro-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  /* Pas de safe-bottom ici : créait une zone vide type « barre » en bas de l’intro */
  padding: max(24px, var(--safe-top)) 24px 24px;
  opacity: 0;
}

body.boot-play .boot-intro-inner {
  animation: boot-inner-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes boot-inner-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.boot-logo-stage {
  position: relative;
  width: min(248px, 64vw);
  aspect-ratio: 1;
}

.boot-logo-glow {
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 168, 75, 0.32), transparent 68%);
  opacity: 0;
  pointer-events: none;
}

body.boot-play .boot-logo-glow {
  animation: boot-glow-pulse 2.8s ease 0.4s both;
}

@keyframes boot-glow-pulse {
  0% { opacity: 0; transform: scale(0.9); }
  35% { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0.45; transform: scale(1.05); }
}

.boot-logo-card {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: size;
  /* Même blanc que logo.png (coins ~#fefefe) — plus de contour carré visible */
  border-radius: 28px;
  background: #fefefe;
  overflow: hidden;
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(212, 168, 75, 0.28);
  opacity: 0;
  transform: scale(0.88) translateY(12px);
}

body.boot-play .boot-logo-card {
  animation: boot-card-deal 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.06s both;
}

@keyframes boot-card-deal {
  0% {
    opacity: 0;
    transform: translateY(56px) rotate(-16deg) scale(0.88);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  }
  62% {
    opacity: 1;
    transform: translateY(-6px) rotate(2deg) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.boot-suits {
  position: absolute;
  inset: -18%;
  pointer-events: none;
  z-index: 0;
}

.boot-suit {
  position: absolute;
  font-size: clamp(1.05rem, 4.2vw, 1.35rem);
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.boot-suit.s-spade,
.boot-suit.s-club { color: #e8e4dc; }
.boot-suit.s-heart,
.boot-suit.s-diamond { color: #c23b2a; }

.boot-suit.s-spade { top: 6%; left: 4%; }
.boot-suit.s-heart { top: 6%; right: 4%; }
.boot-suit.s-diamond { bottom: 8%; left: 6%; }
.boot-suit.s-club { bottom: 8%; right: 6%; }

body.boot-play .boot-suit.s-spade {
  animation: boot-suit-deal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.35s both;
}
body.boot-play .boot-suit.s-heart {
  animation: boot-suit-deal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.45s both;
}
body.boot-play .boot-suit.s-diamond {
  animation: boot-suit-deal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.55s both;
}
body.boot-play .boot-suit.s-club {
  animation: boot-suit-deal 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.65s both;
}

@keyframes boot-suit-deal {
  0% { opacity: 0; transform: translateY(18px) scale(0.4) rotate(-24deg); }
  70% { opacity: 1; transform: translateY(-3px) scale(1.12) rotate(4deg); }
  100% { opacity: 0.88; transform: none; }
}

.boot-logo {
  display: block;
  width: 100%;
  height: 100%;
  /* cover + même fond : le carré du PNG se fond dans la carte */
  object-fit: cover;
  padding: 0;
  box-sizing: border-box;
  background: #fefefe;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Guide fantôme très léger (presque invisible, pure référence) */
.boot-logo-ghost {
  position: absolute;
  inset: 0;
  opacity: 0;
  filter: none;
}

body.boot-play .boot-logo-ghost {
  animation: boot-ghost-in 0.6s ease 0.2s both;
}

@keyframes boot-ghost-in {
  from { opacity: 0; }
  to { opacity: 0.06; }
}

/*
  Écriture RTL : le logo est déjà peint.
  Un cache blanc se rétracte vers la gauche (scaleX = GPU).
  Le trait or suit le bord avec translate3d — plus de width/layout.
*/
.boot-write-track {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.boot-logo-ink {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.boot-logo-write {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: none;
  object-fit: cover;
  filter: none;
  opacity: 1;
}

.boot-write-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #fefefe;
  transform-origin: left center;
  transform: translate3d(0, 0, 0) scaleX(1);
  will-change: transform;
  backface-visibility: hidden;
}

body.boot-play .boot-write-cover {
  animation: boot-uncover 1.65s cubic-bezier(0.4, 0, 0.2, 1) 0.62s both;
}

@keyframes boot-uncover {
  from { transform: translate3d(0, 0, 0) scaleX(1); }
  to { transform: translate3d(0, 0, 0) scaleX(0); }
}

/* Reflet discret une fois le mot entièrement visible */
.boot-shine {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.35) 49%,
    rgba(255, 255, 255, 0.55) 50.5%,
    rgba(255, 255, 255, 0.2) 52%,
    transparent 60%
  );
  transform: translateX(-130%);
  opacity: 0;
}

body.boot-play .boot-shine {
  animation: boot-shine 0.75s cubic-bezier(0.4, 0, 0.2, 1) 2.5s both;
}

@keyframes boot-shine {
  0% {
    transform: translateX(-130%);
    opacity: 0;
  }
  12% {
    opacity: 0.7;
  }
  100% {
    transform: translateX(130%);
    opacity: 0;
  }
}

/* Front d’écriture : glisse de droite à gauche (transform only) */
.boot-pen {
  position: absolute;
  top: 12%;
  bottom: 12%;
  left: 100%;
  z-index: 4;
  width: 2px;
  margin-left: -1px;
  pointer-events: none;
  opacity: 0;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(212, 168, 75, 0.15) 12%,
    rgba(232, 200, 122, 0.95) 50%,
    rgba(212, 168, 75, 0.15) 88%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(212, 168, 75, 0.45);
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

body.boot-play .boot-pen {
  animation: boot-pen-rtl 1.65s cubic-bezier(0.4, 0, 0.2, 1) 0.62s both;
}

@keyframes boot-pen-rtl {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  6% { opacity: 1; }
  94% { opacity: 1; }
  100% {
    transform: translate3d(-100cqw, 0, 0);
    opacity: 0;
  }
}

.boot-pen-core {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  background: #e8c87a;
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(232, 200, 122, 0.85);
}

/* —— Marque sous le logo —— */
.boot-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 4.5rem;
}

.boot-wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 6.2vw, 2.05rem);
  font-weight: 700;
  color: var(--cream);
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.15;
  opacity: 0;
  transform: translateY(14px);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

body.boot-play .boot-wordmark {
  animation: boot-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) 2.48s both;
}

.boot-wordmark em {
  font-style: normal;
  color: var(--gold);
  font-weight: 700;
}

.boot-rule {
  display: block;
  width: 0;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 168, 75, 0.15),
    rgba(212, 168, 75, 0.85),
    rgba(212, 168, 75, 0.15),
    transparent
  );
}

body.boot-play .boot-rule {
  animation: boot-rule 0.65s cubic-bezier(0.16, 1, 0.3, 1) 2.62s both;
}

@keyframes boot-rule {
  from { width: 0; opacity: 0; }
  to { width: min(140px, 42vw); opacity: 1; }
}

.boot-tag {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 240, 225, 0.55);
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
}

body.boot-play .boot-tag {
  animation: boot-fade-up 0.65s cubic-bezier(0.16, 1, 0.3, 1) 2.76s both;
}

@keyframes boot-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ─── Transition intro → home (2ᵉ fenêtre progressive) ─── */
body.boot-pending #app {
  opacity: 0;
  visibility: visible; /* reste sous l’intro pour le crossfade */
  pointer-events: none;
}

body.boot-pending .home-card {
  animation: none !important;
  opacity: 1; /* le conteneur est prêt ; les enfants gèrent l’apparition */
  transform: none;
  pointer-events: none;
}

/* Pendant l’intro : enfants du home invisibles (préparés pour le stagger) */
body.boot-pending .home-card > * {
  opacity: 0;
  transform: translateY(18px);
}

body.boot-done #app {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}

body.boot-done .home-card {
  animation: none !important;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Apparition en cascade des blocs de la carte home */
body.boot-done .home-card > * {
  animation: home-reveal 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

body.boot-done .home-card > .logo-wrap {
  animation-delay: 0.06s;
}
body.boot-done .home-card > .home-wordmark {
  animation-delay: 0.14s;
}
body.boot-done .home-card > .home-ornament {
  animation-delay: 0.18s;
}
body.boot-done .home-card > .home-kicker {
  animation-delay: 0.22s;
}
body.boot-done .home-card > .field {
  animation-delay: 0.3s;
}
body.boot-done .home-card > .home-steps {
  animation-delay: 0.4s;
}
body.boot-done .btn-settings-home {
  animation: home-reveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}
body.boot-done .home-felt-rail {
  animation: home-rail-in 1s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}
body.boot-done .home-pip.pip-n { animation: home-pip-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both; }
body.boot-done .home-pip.pip-e { animation: home-pip-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.52s both; }
body.boot-done .home-pip.pip-s { animation: home-pip-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.62s both; }
body.boot-done .home-pip.pip-w { animation: home-pip-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.72s both; }

@keyframes home-rail-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes home-pip-in {
  from { opacity: 0; }
  to { opacity: 0.2; }
}

@keyframes home-reveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Fond home : s’affirme en douceur avec le crossfade */
body.boot-pending .home-bg {
  opacity: 0.85;
}
body.boot-done .home-bg {
  opacity: 1;
  transition: opacity 1s ease;
}

@media (prefers-reduced-motion: reduce) {
  body.boot-play .boot-intro-inner,
  body.boot-play .boot-logo-card,
  body.boot-play .boot-logo-ghost,
  body.boot-play .boot-logo-ink,
  body.boot-play .boot-write-track,
  body.boot-play .boot-write-cover,
  body.boot-play .boot-logo-glow,
  body.boot-play .boot-pen,
  body.boot-play .boot-shine,
  body.boot-play .boot-wordmark,
  body.boot-play .boot-rule,
  body.boot-play .boot-tag,
  body.boot-play .boot-orb-a,
  body.boot-play .boot-orb-b,
  body.boot-play .boot-orb-c,
  body.boot-play .boot-intro-bg::before,
  body.boot-play .boot-suit,
  body.boot-play .boot-intro-bg,
  body.boot-done .home-card > *,
  body.boot-done .home-felt-rail,
  body.boot-done .home-pip {
    animation: none !important;
  }

  body.boot-done .home-felt-rail {
    opacity: 1;
  }

  body.boot-done .home-pip {
    opacity: 0.2;
  }

  .boot-intro {
    transition: none !important;
  }

  body.boot-done #app {
    transition: none !important;
  }

  .boot-write-cover {
    display: none;
  }

  .boot-intro-inner,
  .boot-logo-card {
    opacity: 1;
    transform: none;
  }

  .boot-logo-ghost {
    opacity: 0;
  }

  .boot-pen,
  .boot-shine,
  .boot-suits {
    display: none;
  }

  .boot-wordmark,
  .boot-tag {
    opacity: 1;
    transform: none;
  }

  .boot-rule {
    width: min(140px, 42vw);
    opacity: 1;
  }
}

/* ─── HOME ───
   App chrome plein écran : surface feutre edge-to-edge, pas une carte web.
*/
#screen-home {
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  /* Safe area contenu ; hauteur visible (pas 100lvh — trop grand barre URL) */
  padding: max(12px, var(--safe-top)) max(16px, var(--safe-right)) 12px max(16px, var(--safe-left));
  position: relative;
  overflow: hidden;
  background: #000;
  box-sizing: border-box;
  min-height: 100svh;
  min-height: 100dvh;
  min-height: var(--app-height, 100dvh);
  width: 100%;
}

/* Bandeau bas : lien web iPhone / PC — masqué hors app native (Capacitor) */
.home-web-invite {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  justify-content: center;
  padding:
    0
    max(12px, var(--safe-right))
    max(12px, var(--safe-bottom))
    max(12px, var(--safe-left));
  pointer-events: none;
  box-sizing: border-box;
}

html.is-native .home-web-invite {
  display: flex;
}

/* Espace bas accueil = hauteur du bandeau partage, PAS une réserve système */
html.is-native #screen-home {
  padding-bottom: 80px;
}
/* Android natif : pas de chin sur #screen-home (feutre jusqu’au bord).
   Le bandeau #home-web-invite est en overlay — on relève le contenu. */
html.is-android.is-native #screen-home {
  padding-bottom: 12px !important;
}
html.is-android.is-native .home-card {
  padding-bottom: 88px;
}

.name-lock {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.3;
  opacity: 0.72;
}

.account-panel {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 0;
  background: #fff;
  color: #1f1f1f;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.btn-google:disabled {
  opacity: 0.6;
}

.btn-google-g {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1a73e8;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
}

.google-slot {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.account-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--gold-soft, #e6d3a1);
}

.account-in {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  background: rgba(6, 20, 16, 0.45);
}

.account-me {
  display: flex;
  align-items: center;
  gap: 10px;
}

.friend-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--gold-soft, #e6d3a1);
  background: #12221b;
  border: 1.5px solid rgba(247, 240, 225, 0.22);
}

.account-me .friend-letter {
  width: 36px;
  height: 36px;
  font-size: 15px;
}

.account-me-copy {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.account-me-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-code,
.account-out,
.friend-remove,
.friend-add button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.account-code {
  padding: 0;
  text-align: left;
  font-size: 12px;
  color: var(--gold-soft, #e6d3a1);
}

.account-out,
.friend-remove {
  font-size: 12px;
  opacity: 0.8;
}

.friend-add {
  display: flex;
  gap: 8px;
}

.friend-add input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
}

.friend-add button {
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(212, 168, 75, 0.2);
  color: var(--gold-soft, #e6d3a1);
  font-weight: 650;
}

.friend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  max-height: 132px;
  overflow: auto;
}

.friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.friend-who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.friend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #8a8a8a;
}

.friend-dot.on {
  background: #3ddc84;
}

.friend-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.friend-empty {
  font-size: 12px;
  opacity: 0.75;
}

.btn-share-web {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(420px, 100%);
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(6, 20, 16, 0.72);
  color: var(--cream);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-share-web:active,
.btn-share-web.is-pressed {
  transform: scale(0.98);
  border-color: rgba(212, 168, 75, 0.65);
}

.share-web-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(247, 240, 225, 0.08);
  border: 1px solid rgba(212, 168, 75, 0.22);
  color: var(--gold-soft);
}

.share-ico {
  display: block;
  opacity: 0.95;
}

.share-web-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.share-web-title {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--cream);
  line-height: 1.2;
}

.share-web-sub {
  font-size: 0.72rem;
  line-height: 1.3;
  color: rgba(247, 240, 225, 0.62);
}

.share-web-action {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(212, 168, 75, 0.16);
  color: var(--gold);
}

.share-web-action .share-ico-copy {
  display: block;
  opacity: 0.95;
}

.home-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(232, 200, 122, 0.14), transparent 55%),
    linear-gradient(180deg, transparent 52%, #050806 78%, #000 100%),
    radial-gradient(ellipse 80% 70% at 50% 36%, #1a6b50 0%, #0c3b2e 52%, #000 100%);
  /* Calque GPU unique : le bruit SVG + weave restent figés */
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.home-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}

.home-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.home-bg-weave {
  position: absolute;
  inset: 0;
  opacity: 0.09;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.035) 0 1px,
      transparent 1px 6px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.05) 0 1px,
      transparent 1px 6px
    );
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* Filet de table — discret, pas une carte flottante */
.home-felt-rail {
  display: none;
}

/* Boussole des couleurs — sens horaire N→E→S→O */
.home-compass {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.home-pip {
  position: absolute;
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.home-pip.pip-n {
  top: max(16px, calc(var(--safe-top) + 6px));
  left: 50%;
  transform: translateX(-50%);
}

.home-pip.pip-s {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
}

.home-pip.pip-e {
  right: max(14px, var(--safe-right));
  top: 50%;
  transform: translateY(-50%);
}

.home-pip.pip-w {
  left: max(14px, var(--safe-left));
  top: 50%;
  transform: translateY(-50%);
}

html.is-native .home-pip.pip-s {
  bottom: 88px;
}

.home-card {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: none;
  margin-inline: auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 12px 4px 16px;
  box-shadow: none;
  backdrop-filter: none;
  animation: rise-in 0.7s var(--ease-out) both;
  box-sizing: border-box;
}

@media (min-width: 560px) {
  .home-card.home-stack {
    max-width: 440px;
    margin-inline: auto;
  }
}



@keyframes rise-in {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.logo-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 4px 0 0;
  flex: 0 0 auto;
}

.logo-wrap::before {
  content: "";
  position: absolute;
  width: min(138px, 38vw);
  height: min(138px, 38vw);
  border-radius: 32px;
  background: radial-gradient(circle, rgba(232, 200, 122, 0.2), transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.app-logo {
  position: relative;
  z-index: 1;
  width: min(104px, 28vw);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 22px;
  background: #fefefe;
  padding: 7px 6px 4px;
  box-shadow: var(--elev-2);
}

.logo-mark {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.logo-mark .suit {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.s-heart, .s-diamond, .red { color: var(--coral); }
.s-spade, .s-club, .black { color: #e8e4dc; }

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  font-weight: 700;
  text-align: center;
  margin: 2px 0 0;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

h1 em {
  font-style: normal;
  color: var(--gold);
}

.home-wordmark {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 5.6vw, 1.9rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.home-wordmark em {
  font-style: normal;
  color: var(--gold);
}

.home-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 0;
  pointer-events: none;
}

.home-ornament-line {
  display: block;
  width: 34px;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 168, 75, 0.55),
    transparent
  );
}

.home-ornament-pip {
  font-family: var(--font-display);
  font-size: 0.62rem;
  line-height: 1;
  color: var(--gold);
  opacity: 0.88;
}

.home-kicker {
  margin: 6px 0 16px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-soft);
  opacity: 0.9;
}

.tagline {
  display: none;
}

.field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  padding: 10px 14px 12px;
  border-radius: var(--radius);
  background: var(--surface-group);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(212, 168, 75, 0.08);
}

.field::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 168, 75, 0.32),
    transparent
  );
  pointer-events: none;
}

.field span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 650;
  color: rgba(232, 200, 122, 0.78);
}

.field input,
.code-input {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--cream);
  padding: 8px 0 4px;
  font-size: 16px; /* 16px min : évite zoom iOS */
  outline: none;
  width: 100%;
  min-height: 36px;
  box-shadow: none;
  transition: color var(--duration);
}

.code-input {
  background: var(--surface-group);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 52px;
  box-shadow: var(--elev-1);
}

.field input:focus,
.code-input:focus {
  border-color: var(--gold);
  box-shadow: none;
}

.code-input:focus {
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.18);
}

.home-steps {
  position: relative;
  width: 100%;
  min-height: 0;
}

.home-step {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  flex: 0 0 auto;
}

.home-step.is-leave {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  animation: home-step-out 0.26s cubic-bezier(0.4, 0, 0.2, 1) both;
  pointer-events: none;
}

.home-step.is-enter {
  animation: home-step-in 0.34s var(--ease-out) both;
}

@keyframes home-step-out {
  to {
    opacity: 0;
    transform: translateX(var(--step-x, -16px)) scale(0.98);
  }
}

@keyframes home-step-in {
  from {
    opacity: 0;
    transform: translateX(var(--step-x, 18px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#home-step-mode.home-step {
  flex: 0 0 auto;
  justify-content: flex-start;
  margin-top: 2px;
}

#home-step-multi.home-step {
  flex: 0 1 auto;
  margin-top: 4px;
}

.home-step.hidden {
  display: none !important;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  flex: 0 0 auto;
  align-content: start;
  width: 100%;
}

@media (min-width: 701px) {
  .mode-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

.btn-mode {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 88px;
  max-height: none;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-group);
  color: var(--cream);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow: var(--elev-1), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.18s var(--ease-out), background 0.18s, border-color 0.18s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-mode::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 168, 75, 0.28),
    transparent
  );
  pointer-events: none;
}

.btn-mode:active,
.btn-mode.is-pressed {
  transform: scale(0.975);
  background: var(--surface-press);
  border-color: rgba(212, 168, 75, 0.45);
  box-shadow: 0 0 0 1px rgba(212, 168, 75, 0.28);
}

.btn-mode .mode-mini-card {
  transition: transform 0.22s var(--ease-spring);
}

.btn-mode:active .mode-mini-card,
.btn-mode.is-pressed .mode-mini-card {
  transform: rotate(-10deg) translateY(-3px);
}

.btn-mode:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-mode:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-mode-accent {
  border-color: rgba(212, 168, 75, 0.28);
  background: rgba(212, 168, 75, 0.1);
}

.btn-mode-accent:active {
  background: rgba(212, 168, 75, 0.18);
  border-color: rgba(212, 168, 75, 0.55);
}

.mode-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 62px;
  background: transparent;
  border-radius: 0;
  line-height: 0;
  color: inherit;
}

.mode-icon::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 53px;
  border-radius: 5px;
  background: #f3eee4;
  border: 1px solid #1a1a1a;
  transform: rotate(11deg) translate(7px, 1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  z-index: 0;
  pointer-events: none;
}

.mode-mini-card {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 59px;
  aspect-ratio: 20 / 31;
  border-radius: 5px;
  background: #fff;
  border: 1px solid #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  box-sizing: border-box;
}

.mode-mini-index {
  position: absolute;
  top: 2px;
  left: 3px;
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
}

.mode-mini-index-br {
  top: auto;
  left: auto;
  right: 3px;
  bottom: 2px;
  transform: rotate(180deg);
}

.mode-pip {
  display: block;
  width: 17px;
  height: 20px;
  flex-shrink: 0;
  overflow: visible;
}

.mode-pip-spade {
  width: 18px;
  height: 21px;
}

.mode-mini-black,
.mode-mini-black .mode-pip,
.mode-mini-black .mode-mini-index {
  color: #16110c;
}

.mode-mini-red,
.mode-mini-red .mode-pip,
.mode-mini-red .mode-mini-index {
  color: #c23b2a;
}

.btn-mode-accent .mode-icon {
  background: transparent;
  color: inherit;
}

.mode-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.mode-go {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-top: 1.5px solid rgba(232, 200, 122, 0.42);
  border-right: 1.5px solid rgba(232, 200, 122, 0.42);
  transform: rotate(45deg);
  transition: border-color 0.18s ease, transform 0.18s var(--ease-out);
}

.btn-mode:active .mode-go,
.btn-mode.is-pressed .mode-go {
  border-color: var(--gold);
  transform: rotate(45deg) translate(1px, -1px);
}

.mode-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mode-desc {
  font-size: 0.72rem;
  line-height: 1.25;
  color: rgba(247, 240, 225, 0.62);
  max-width: none;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 2px;
  min-height: var(--touch);
  background: transparent;
  border: none;
  color: var(--gold-soft);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, transform 0.15s var(--ease-out), opacity 0.15s ease;
}

.btn-back::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -1px;
}

.btn-back:active,
.btn-back.is-pressed {
  color: var(--gold);
  opacity: 0.85;
  transform: translateX(-3px);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-actions #btn-create {
  min-height: 54px;
}

.join-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(247, 240, 225, 0.4);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.join-divider::before,
.join-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(212, 168, 75, 0.2);
}

.join-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.join-row .code-input {
  flex: 1 1 auto;
  min-width: 0;
}

.join-row #btn-join {
  flex: 0 0 auto;
  min-width: 76px;
  padding-left: 16px;
  padding-right: 16px;
}

.code-input {
  flex: 1;
  min-width: 0;
  text-align: center;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

.hint {
  display: none;
}

@media (max-width: 380px) {
  .mode-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-mode {
    min-height: 76px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 12px 14px;
    text-align: left;
  }

  .mode-icon {
    width: 42px;
    height: 56px;
  }

  .mode-icon::after {
    width: 30px;
    height: 47px;
  }

  .mode-mini-card {
    width: 34px;
    height: 53px;
  }

  .mode-pip,
  .mode-pip-spade {
    width: 16px;
    height: 19px;
  }

  .mode-desc {
    max-width: none;
  }

  .btn-mode .mode-title,
  .btn-mode .mode-desc {
    display: block;
  }
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
  min-height: 52px;
  box-sizing: border-box;
  transition: transform var(--duration) var(--ease-out), background var(--duration), box-shadow var(--duration), filter var(--duration);
}

.btn:active,
.btn.is-pressed { transform: scale(0.96); filter: brightness(0.93); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn:disabled,
.btn:disabled.is-pressed { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

/* Utilisé par Contrer / Surcontrer / badges */
.hidden {
  display: none !important;
}

.btn-warning.can-act {
  animation: pulse-gold 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 2px rgba(212, 168, 75, 0.55), 0 4px 14px rgba(196, 122, 26, 0.45);
}

@keyframes pulse-gold {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.btn-primary {
  background: var(--gold);
  color: #1a1208;
  box-shadow: var(--elev-2);
}

.btn-primary:active,
.btn-primary.is-pressed {
  filter: brightness(0.93);
  transform: scale(0.96);
}

.btn-secondary {
  background: rgba(247, 240, 225, 0.08);
  color: var(--cream);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.btn-ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-warning { background: #c47a1a; color: #fff; }
.btn-danger { background: var(--coral); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 10px 12px; font-size: 0.85rem; min-height: 40px; }

.btn-icon {
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  min-width: var(--touch);
  min-height: var(--touch);
  flex-shrink: 0;
}

.btn-icon svg {
  display: block;
  width: 18px;
  height: 18px;
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.topbar-main {
  justify-content: space-between;
}

.topbar-sub {
  justify-content: flex-start;
  gap: 6px;
  /* Masque la 2e ligne si rien à afficher (enchère / donne) */
}

.topbar-sub:not(:has(.hand-scoreboard:not(.hidden), .trump-chip:not(.hidden))) {
  display: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-menu:active {
  transform: scale(0.96);
  background: rgba(212, 168, 75, 0.22);
  border-color: rgba(212, 168, 75, 0.55);
}

.btn-menu-icon {
  display: block;
  width: 20px;
  height: 20px;
  overflow: visible;
  flex-shrink: 0;
}

.btn-menu-label {
  display: none;
}

@media (max-width: 380px) {
  .btn-menu-label {
    display: none;
  }
  .btn-menu {
    padding: 8px;
    min-width: 40px;
  }
}

/* Paramètres (accueil) — bas, discret, toujours visible sans scroll long */
.btn-settings-home {
  position: absolute;
  top: max(10px, var(--safe-top));
  right: max(10px, var(--safe-right));
  z-index: 5;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(212, 168, 75, 0.22);
  border-radius: 50%;
  background: rgba(6, 20, 16, 0.42);
  color: var(--gold-soft);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-settings-home:focus-visible {
  color: var(--gold);
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.btn-settings-home:active,
.btn-settings-home.is-pressed {
  color: var(--gold);
  background: var(--surface-press);
  transform: scale(0.94);
}

.btn-settings-home .btn-settings-icon {
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
  opacity: 0.95;
}

.btn-settings-home .btn-settings-label {
  display: none;
}

/* Overlay Paramètres */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.34s;
}

.settings-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
}

.settings-overlay.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.26s ease,
    visibility 0s linear 0.28s;
}

.settings-overlay[hidden] {
  display: none !important;
}

/* Fermé : pas de snapshot blur (WebView le calcule encore si visibility:hidden) */
.settings-overlay:not(.is-open):not(.is-leaving) {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

@media (min-width: 560px) {
  .settings-overlay {
    align-items: center;
    padding: 24px;
  }
}

.settings-panel {
  width: 100%;
  max-width: 440px;
  max-height: min(88dvh, 560px);
  overflow-y: auto;
  padding: 10px 16px 20px;
  border-radius: var(--radius-sheet);
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  border-bottom: none;
  box-shadow: var(--elev-sheet);
  transform: translate3d(0, 36px, 0);
  opacity: 0.92;
  transition:
    transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.settings-overlay.is-open .settings-panel,
.settings-overlay.is-leaving .settings-panel {
  will-change: transform, opacity;
}

.settings-overlay.is-open .settings-panel {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.settings-overlay.is-leaving .settings-panel {
  transform: translate3d(0, 28px, 0);
  opacity: 0;
}

.settings-panel > .sheet-handle {
  display: block;
}

@media (min-width: 560px) {
  .settings-panel {
    border-radius: 16px;
    border-bottom: 1px solid var(--panel-border, rgba(212, 168, 75, 0.28));
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    transform: translate3d(0, 14px, 0);
  }

  .settings-overlay.is-leaving .settings-panel {
    transform: translate3d(0, 12px, 0);
  }
}

.settings-overlay.is-open .settings-header,
.settings-overlay.is-open .settings-section {
  animation: settings-item-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.settings-overlay.is-open .settings-header {
  animation-delay: 0.05s;
}

.settings-overlay.is-open .settings-section:nth-of-type(1) {
  animation-delay: 0.1s;
}

.settings-overlay.is-open .settings-section:nth-of-type(2) {
  animation-delay: 0.16s;
}

.settings-overlay.is-leaving .settings-header,
.settings-overlay.is-leaving .settings-section {
  animation: none;
}

@keyframes settings-item-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.settings-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-soft, #e8c87a);
}

.settings-close {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-group);
  color: var(--cream);
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
}

.settings-close:active {
  background: var(--surface-press);
  transform: scale(0.94);
}

.settings-section {
  margin-bottom: 16px;
}

.settings-section-title {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 200, 122, 0.75);
}

.settings-group {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-group);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 14px 14px;
  min-height: 56px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--duration) ease;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row:active {
  background: var(--surface-press);
}

.settings-row.is-off {
  opacity: 0.78;
}

.settings-row-icon {
  display: none;
}

.settings-row-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-row-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f2efe6;
}

.settings-row-hint {
  font-size: 0.75rem;
  color: rgba(242, 239, 230, 0.55);
}

/* Switch visuel */
.settings-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  transition: background 0.18s ease;
}

.settings-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ddd;
  transition: transform 0.18s ease, background 0.18s ease;
}

.settings-row.is-on .settings-switch {
  background: rgba(46, 160, 110, 0.85);
}

.settings-row.is-on .settings-switch-knob {
  transform: translateX(20px);
  background: #fff;
}

.settings-quit-btn {
  margin-top: 4px;
}

.settings-quit-hint {
  margin: 10px 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(242, 239, 230, 0.5);
  text-align: center;
}

body.settings-open {
  overflow: hidden;
}

/* ─── GAME LAYOUT ─── */
#screen-game {
  flex-direction: column;
  height: 100svh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  /* Feutre pour le tapis ; le HAUT (score / caméra) est noir via .topbar */
  background: #0c3b2e;
  /* safe-top dans la topbar noire, pas ici (sinon bande verte sous la caméra) */
  padding-top: 0;
  padding-bottom: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  position: relative;
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 5px;
  /*
   * Bande laque : zone caméra/status + score.
   * safe-top inclus dans le padding pour peindre sous l’encoche en noir.
   */
  padding: calc(8px + var(--safe-top)) 12px 10px;
  min-height: calc(var(--topbar-h) + var(--safe-top));
  background:
    linear-gradient(180deg, #050605 0%, #0a0c0a 72%, #101610 100%);
  border-bottom: 1px solid rgba(212, 168, 75, 0.2);
  box-shadow: 0 1px 0 rgba(212, 168, 75, 0.06);
  z-index: 50;
  flex-shrink: 0;
  position: relative;
}

.room-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  min-width: 0;
  flex-shrink: 1;
}

.room-badge .label {
  color: rgba(247, 240, 225, 0.5);
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

.room-badge strong {
  letter-spacing: 0.16em;
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  user-select: all;
  -webkit-user-select: all;
}

/* Solo : pas de code à copier */
#screen-game.is-solo .room-badge .btn-icon,
#btn-copy[hidden] {
  display: none !important;
}

/* Code de table bien visible dans le lobby (pas derrière le flou) */
.share-code {
  margin: 0 0 14px;
  padding: 14px 12px 12px;
  border-radius: 16px;
  background: rgba(247, 240, 225, 0.04);
  border: 1px solid var(--line);
  text-align: center;
}

.share-code-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-soft);
  opacity: 0.9;
  margin-bottom: 6px;
}

.share-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.share-code-value {
  font-family: var(--font-ui);
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold);
  line-height: 1.2;
  user-select: all;
  -webkit-user-select: all;
  padding: 2px 4px;
  min-width: 4.5em;
}

.share-code-hint {
  display: none;
}

.scoreboard {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(247, 240, 225, 0.07), rgba(247, 240, 225, 0.025));
  padding: 5px 8px 5px 6px;
  border-radius: 14px;
  border: 1px solid rgba(212, 168, 75, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.scoreboard .team {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.12;
  min-width: 4.2em;
  padding: 3px 8px;
  border-radius: 9px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.scoreboard .team .team-code {
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(247, 240, 225, 0.48);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.scoreboard .team .team-names {
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(247, 240, 225, 0.78);
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  opacity: 1;
  line-height: 1.2;
}

.scoreboard .team strong {
  font-size: 1.12rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-top: 1px;
}

.team.t0 strong { color: var(--gold-soft); }
.team.t1 strong { color: #8fd0dc; }

.scoreboard .team.is-us {
  background: rgba(212, 168, 75, 0.12);
}

.scoreboard .team.is-us .team-code::after {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--gold);
  transform: rotate(45deg);
  flex-shrink: 0;
}

.scoreboard .team.is-us .team-names {
  color: var(--gold-soft);
}

.score-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px;
  flex-shrink: 0;
}

.score-diamond {
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(212, 168, 75, 0.45);
}

.target {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(232, 200, 122, 0.62);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Score de la donne en direct */
.hand-scoreboard {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(247, 240, 225, 0.04);
  border: 1px solid rgba(247, 240, 225, 0.12);
  box-shadow: none;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(50%, 280px);
}

.hand-scoreboard.hidden { display: none !important; }

.hand-scoreboard .hs-label {
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(232, 200, 122, 0.7);
  font-weight: 600;
  white-space: nowrap;
}

.hand-scoreboard .hs-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  min-width: 2.2em;
}

.hand-scoreboard .hs-team span {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
}

.hand-scoreboard .hs-team strong {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s, transform 0.2s;
}

.hand-scoreboard .hs-team.t0 strong { color: var(--gold-soft); }
.hand-scoreboard .hs-team.t1 strong { color: #7ec8d8; }

.hand-scoreboard .hs-team.leading strong {
  transform: scale(1.08);
  text-shadow: 0 0 10px currentColor;
}

.hand-scoreboard .hs-sep {
  opacity: 0.35;
  font-weight: 700;
}

.hand-scoreboard .hs-meta {
  font-size: 0.68rem;
  color: rgba(247, 240, 225, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11em;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: 8px;
  margin-left: 2px;
}

.hand-scoreboard .hs-meta:empty {
  display: none;
}

@media (min-width: 701px) {
  .hand-scoreboard {
    padding: 5px 14px;
    gap: 10px;
    max-width: none;
  }
  .hand-scoreboard .hs-team strong { font-size: 1.15rem; }
  .hand-scoreboard .hs-meta { font-size: 0.75rem; max-width: 16em; }
  .hand-scoreboard .hs-label { font-size: 0.65rem; }
}

/* Chip atout / dernière enchère — ligne du bas de la topbar */
.trump-chip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 5px 12px 5px 8px;
  border-radius: 14px;
  background: rgba(8, 22, 18, 0.55);
  border: 1px solid rgba(212, 168, 75, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.18);
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  opacity: 0;
  transform: translateY(-7px);
}

.trump-chip.is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.trump-chip.is-leaving {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.24s ease;
}

.trump-chip.hidden { display: none; }

.trump-chip-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-soft);
  opacity: 0.85;
  white-space: nowrap;
  flex-shrink: 0;
}

.trump-chip.is-bid .trump-chip-label::after {
  content: none;
}

.trump-chip-suit {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 700;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(247, 240, 225, 0.08);
  border: 1px solid rgba(247, 240, 225, 0.1);
}

.trump-chip-suit.suit-red { color: #e85a4f; }
.trump-chip-suit.suit-black { color: #f0ebe3; }

.trump-chip-value {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--cream);
  white-space: nowrap;
  flex-shrink: 0;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: 0.01em;
}

.trump-chip-bidder {
  font-size: 0.68rem;
  font-weight: 550;
  color: rgba(232, 200, 122, 0.82);
  flex: 1 1 8em;
  min-width: 0;
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.25;
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid rgba(212, 168, 75, 0.28);
}

.trump-chip-bidder[hidden] {
  display: none !important;
}

.trump-chip.is-bid {
  border-color: rgba(126, 200, 216, 0.34);
  background: rgba(14, 32, 36, 0.55);
}

.trump-chip.is-bid .trump-chip-label {
  color: #9fd4e0;
}

.trump-chip.is-bid .trump-chip-bidder {
  color: rgba(184, 224, 234, 0.88);
  border-left-color: rgba(126, 200, 216, 0.32);
}

.trump-chip.is-contract {
  border-color: rgba(212, 168, 75, 0.48);
  background: rgba(212, 168, 75, 0.12);
}

.trump-chip.is-swap .trump-chip-suit {
  animation: trump-suit-in 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.trump-chip.is-swap .trump-chip-value {
  animation: trump-val-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.trump-chip.is-lock-in {
  animation: trump-lock 0.48s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes trump-suit-in {
  from { opacity: 0.35; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes trump-val-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

@keyframes trump-lock {
  0% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 0 rgba(212, 168, 75, 0); }
  45% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 3px rgba(212, 168, 75, 0.28); }
  100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.18); }
}

.conn {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  flex-shrink: 0;
}

.conn[data-state="connected"] { color: #6dce8a; }
.conn[data-state="connecting"] { color: var(--gold); }
.conn[data-state="disconnected"] { color: var(--coral); }

/* ─── TABLE ─── */
.table-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #071410;
}

.felt {
  flex: 1 1 auto;
  position: relative;
  margin: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse 120% 90% at 50% 40%, #17614a 0%, #114536 52%, #0a2a22 100%);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  min-height: 0;
  isolation: isolate;
}

.felt::before {
  display: none;
}

.felt-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.03) 0 1px,
      transparent 1px 7px
    );
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
  /* Bitmap figé : le bruit SVG ne se recalcule pas à chaque vol de carte */
  contain: strict;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}



.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 12;
  max-width: 34%;
}

.seat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.seat.active-turn .avatar {
  box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(212, 168, 75, 0.6);
  animation: pulse-ring 1.4s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 10px rgba(212, 168, 75, 0.5); }
  50% { box-shadow: 0 0 0 4px var(--gold), 0 0 18px rgba(212, 168, 75, 0.8); }
}

.seat-north { top: 6px; left: 50%; transform: translateX(-50%); }
.seat-east {
  right: 4px;
  top: 42%;
  transform: translateY(-50%);
  align-items: flex-end;
}
.seat-west {
  left: 4px;
  top: 42%;
  transform: translateY(-50%);
  align-items: flex-start;
}
.seat-east .seat-name { align-items: flex-end; text-align: right; }
.seat-west .seat-name { align-items: flex-start; text-align: left; }

.avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 6;
  overflow: visible;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #12221b;
  border: 1.5px solid rgba(247, 240, 225, 0.22);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold-soft);
  flex-shrink: 0;
}

.avatar.empty {
  opacity: 0.35;
  border-style: dashed;
}

.avatar.bot {
  border-color: rgba(232, 200, 122, 0.35);
  color: var(--gold-soft);
}

/* Bulle d’enchère — queue en triangle CSS (stable, pas de losange cassé) */
.bid-bubble {
  --bubble-bg: rgba(10, 20, 16, 0.96);
  --bubble-border: rgba(212, 168, 75, 0.55);
  position: absolute;
  z-index: 14;
  max-width: 96px;
  padding: 4px 9px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: var(--cream);
  background: var(--bubble-bg);
  border: 1px solid var(--bubble-border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  user-select: none;
  overflow: visible;
}

.bid-bubble.hidden {
  display: none !important;
}

.bid-bubble.is-pass {
  --bubble-border: rgba(255, 255, 255, 0.28);
  color: rgba(247, 240, 225, 0.78);
  font-weight: 600;
}

.bid-bubble.is-bid {
  --bubble-border: rgba(212, 168, 75, 0.72);
  color: var(--gold-soft);
}

/* Contre / surcontre — pastille courte, ne déborde pas */
.bid-bubble.is-double,
.bid-bubble.is-redouble {
  max-width: none;
  min-width: 0;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
}

.bid-bubble.is-double {
  --bubble-bg: rgba(48, 28, 8, 0.96);
  --bubble-border: rgba(240, 180, 90, 0.85);
  color: #ffd27a;
}

.bid-bubble.is-redouble {
  --bubble-bg: rgba(48, 14, 12, 0.96);
  --bubble-border: rgba(255, 120, 100, 0.85);
  color: #ffb0a0;
}

.bid-bubble.is-latest {
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.45),
    0 0 12px rgba(212, 168, 75, 0.22);
}

/* Queue : triangle bordure (::before) + triangle fond (::after) */
.bid-bubble::before,
.bid-bubble::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  pointer-events: none;
}

.bid-bubble.pop {
  animation: bid-bubble-pop-y 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Nord / Ouest / moi : bulle à droite → pointe vers la gauche */
.seat-north .bid-bubble,
.seat-west .bid-bubble,
.seat-me .bid-bubble {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}

.seat-north .bid-bubble::before,
.seat-west .bid-bubble::before,
.seat-me .bid-bubble::before {
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 7px 6px 0;
  border-color: transparent var(--bubble-border) transparent transparent;
}

.seat-north .bid-bubble::after,
.seat-west .bid-bubble::after,
.seat-me .bid-bubble::after {
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px 6px 5px 0;
  border-color: transparent var(--bubble-bg) transparent transparent;
}

/* Est : bulle à gauche → pointe vers la droite */
.seat-east .bid-bubble {
  right: calc(100% + 8px);
  left: auto;
  top: 50%;
  transform: translateY(-50%);
}

.seat-east .bid-bubble::before {
  right: -7px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 7px;
  border-color: transparent transparent transparent var(--bubble-border);
}

.seat-east .bid-bubble::after {
  right: -5px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px 0 5px 6px;
  border-color: transparent transparent transparent var(--bubble-bg);
}

@keyframes bid-bubble-pop-y {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.82);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

.seat-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 0.72rem;
  font-weight: 600;
  max-width: 132px;
  overflow: visible;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  text-align: center;
  line-height: 1.15;
}

.seat-who {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.seat-role {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

.cards-count {
  font-size: 0.6rem;
  opacity: 0.7;
}

/* Opponent card backs — assez grands pour le motif PNG (évite moiré / flou) */
/* Opponent card backs — même ratio que les faces (20/31), cadre visible */
.hand-opp {
  display: flex;
  gap: 0;
  height: 54px;
  pointer-events: none;
  align-items: flex-end;
}

.hand-opp .card-back {
  /* Ratio carte standard (comme --card-h / --card-w = 1.55 ≈ 20/31) */
  width: 32px;
  height: auto;
  aspect-ratio: 20 / 31;
  /* Chevauchement modéré : on voit le bord de chaque dos (pas une seule bande) */
  margin-left: -11px;
  border-radius: 3px;
  overflow: hidden;
  /* Contour + ombre pour séparer les cartes du motif zellige continu */
  box-shadow:
    0 0 0 1px rgba(15, 20, 30, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.45);
  border: none;
  background-color: #e8eef2;
  position: relative;
  filter: none;
  flex-shrink: 0;
}

.hand-opp .card-back img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* contain = image entière (cadre crème) sans étirer ni rogner */
  object-fit: contain;
  object-position: center center;
  display: block;
  background-color: transparent;
  border: none;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.hand-opp .card-back:first-child { margin-left: 0; }

.hand-vertical {
  flex-direction: column;
  height: auto;
  width: 34px;
  align-items: center;
}

.hand-vertical .card-back {
  margin-left: 0;
  /* Moins de smash vertical : chaque dos reste lisible */
  margin-top: -16px;
  width: 30px;
  height: auto;
  aspect-ratio: 20 / 31;
}

.hand-vertical .card-back:first-child { margin-top: 0; }

/* Trick center */
.trick {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(268px, 72vw);
  height: min(236px, 40vh);
  transform: translate(-50%, -50%);
  z-index: 8;
}

.trick::before {
  display: none;
}

.trick-slot {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  aspect-ratio: 20 / 31;
}

/* Cartes du pli — un peu plus grandes au centre */
.trick-slot[data-seat="0"] {
  left: 50%;
  top: 0;
  transform: translateX(-50%) scale(0.92);
  transform-origin: top center;
}
.trick-slot[data-seat="1"] {
  right: 0;
  top: 50%;
  transform: translateY(-50%) scale(0.92);
  transform-origin: right center;
}
.trick-slot[data-seat="2"] {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) scale(0.92);
  transform-origin: bottom center;
}
.trick-slot[data-seat="3"] {
  left: 0;
  top: 50%;
  transform: translateY(-50%) scale(0.92);
  transform-origin: left center;
}

/*
 * Cartes du pli : AUCUN filter (drop-shadow GPU laisse une tache sur le feutre
 * au ramassage). Ombre + contour atout via box-shadow / ::after uniquement.
 */
.trick-slot .card,
.trick-slot .card.trump-glow,
.trick-slot .card.playable,
.trick-slot .card.disabled {
  animation: none;
  filter: none !important;
  -webkit-filter: none !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.42);
  transition: transform 0.18s var(--ease-spring), box-shadow 0.18s ease;
  isolation: auto;
}

.trick-slot .card.from-flight {
  visibility: hidden !important;
  opacity: 0 !important;
  animation: none !important;
}

.trick-slot .card.from-flight.play-land {
  visibility: visible !important;
  opacity: 1 !important;
  animation: play-land 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.trick-slot .card .card-img,
.trick-slot .card.trump-glow .card-img,
.trick-slot .card img {
  filter: none !important;
  -webkit-filter: none !important;
}

/* Gagnant du pli mis en avant pendant la pause (4 cartes visibles) */
.trick-slot.winner .card {
  transform: scale(1.06);
  z-index: 2;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 12px rgba(212, 168, 75, 0.45);
}
.trick-slot.winner .card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(var(--card-w) * 0.04);
  border: 2px solid var(--gold);
  box-shadow: 0 0 14px rgba(212, 168, 75, 0.65);
  pointer-events: none;
  z-index: 3;
}

/* Slot vide pendant le vol — aucun enfant / aucune ombre résiduelle */
.trick-slot.collecting {
  pointer-events: none;
}
.trick-slot.collecting .card {
  display: none !important;
}

@keyframes play-card {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes play-land {
  from { transform: translateY(2px); }
  to { transform: none; }
}

.card-fly-play {
  border-radius: calc(var(--card-w) * 0.06);
  overflow: hidden;
  background: transparent;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
  filter: none;
  will-change: transform;
  line-height: 0;
  font-size: 0;
  pointer-events: none;
}

.card-fly-play .card-img,
.card-fly-play img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

/*
 * Clones qui volent vers le coin du gagnant (anim d’origine).
 * Pas de drop-shadow : le filter lag pendant transform/opacity
 * et laisse une ombre fantôme collée à la table.
 */
.card-fly-collect {
  border-radius: 0;
  overflow: visible;
  background-color: transparent;
  box-shadow: none !important;
  filter: none !important;
  -webkit-filter: none !important;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
  line-height: 0;
  font-size: 0;
  transition: none;
}

.card-fly-collect::after {
  display: none !important;
  content: none !important;
}

.card-fly-collect .card-img,
.card-fly-collect img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background-color: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  filter: none !important;
  -webkit-filter: none !important;
  transition: none;
}

.card-fly-collect.is-back {
  box-shadow: none !important;
  filter: none !important;
  -webkit-filter: none !important;
}

.card-fly-collect.is-back .card-img,
.card-fly-collect.is-back img {
  transform: none !important;
  filter: none !important;
  -webkit-filter: none !important;
}

/* Badge table désactivé : masquait le joueur d’en face (Nord).
   L’info contrat/enchère reste dans le chip topbar. */
.contract-badge {
  display: none !important;
}

.contract-badge .cb-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-soft);
  opacity: 0.9;
}

.contract-badge .cb-suit {
  font-size: 1.25rem;
  line-height: 1;
}

.contract-badge .cb-suit.suit-red { color: #e85a4f; }
.contract-badge .cb-suit.suit-black { color: #f5f0e8; }

.contract-badge .cb-name {
  opacity: 0.85;
  font-weight: 500;
  font-size: 0.8rem;
}

.contract-badge .cb-extra {
  font-size: 0.72rem;
  color: var(--gold);
  opacity: 0.95;
}

.contract-badge.hidden { display: none; }

/* Desktop : badge table + chip topbar bien visibles */
@media (min-width: 701px) {
  .contract-badge {
    top: 14px;
    font-size: 0.95rem;
    padding: 8px 18px;
    gap: 8px;
  }

  .contract-badge .cb-suit { font-size: 1.45rem; }

  .trump-chip {
    padding: 5px 14px 5px 12px;
    gap: 8px;
  }

  .trump-chip-suit {
    width: 1.85em;
    height: 1.85em;
    font-size: 1.25rem;
  }

  .trump-chip-value { font-size: 0.88rem; }

  .trump-chip-label { font-size: 0.65rem; }
}

/* Bloc central contre / surcontre : « Karim a contré Amine » */
.call-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(88%, 320px);
  padding: 14px 20px;
  border-radius: 16px;
  background: rgba(12, 18, 14, 0.94);
  border: 1px solid rgba(240, 180, 90, 0.55);
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  animation: call-banner-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.call-banner.hidden {
  display: none !important;
}

.call-banner-text {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--cream);
  text-align: center;
}

.call-banner.is-double {
  border-color: rgba(240, 180, 90, 0.6);
}

.call-banner.is-redouble {
  border-color: rgba(255, 130, 110, 0.65);
}

.call-banner.is-redouble .call-banner-text {
  color: #ffd0c4;
}

@keyframes call-banner-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.call-banner.pop {
  animation: call-banner-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.table-msg {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 16;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  max-width: min(90%, 320px);
  text-align: center;
  pointer-events: none;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-msg:empty {
  display: none;
}

/* Pendant la donne : le hint sous la main suffit — évite le texte coupé par les vols */
#screen-game.is-dealing .table-msg {
  display: none;
}

/* ─── CARTES — PNG transparent (image seule, pas de fond blanc) ─── */
.card {
  width: var(--card-w);
  height: var(--card-h);
  aspect-ratio: 20 / 31;
  border-radius: 0;
  background-color: transparent;
  background-image: none;
  box-shadow: none;
  /* Ombre qui suit le contour alpha de la carte */
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35))
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
  position: relative;
  user-select: none;
  transition: transform 0.18s var(--ease-spring), filter 0.2s;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: visible;
  flex-shrink: 0;
  isolation: isolate;
  padding: 0;
  border: none;
  line-height: 0;
  font-size: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card .card-img {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center center;
  background-color: transparent;
  pointer-events: none;
  -webkit-user-drag: none;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  vertical-align: top;
}

.card.playable {
  cursor: pointer;
}

.card.disabled {
  filter: brightness(0.72) saturate(0.5);
  cursor: not-allowed;
  pointer-events: none;
}

/*
 * Contour or arrondi pour atouts.
 * box-shadow sur .card (border-radius:0) = rectangle droit — on utilise
 * ::after avec border-radius calé sur les coins PNG (~3–4% de la largeur)
 * + liseré alpha sur l’image pour coller au vrai contour.
 */
.card.trump-glow {
  box-shadow: none;
  /* ombre de profondeur uniquement (pas le trait or) */
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35))
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.card.trump-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: calc(var(--card-w) * 0.04);
  border: 2.5px solid #d4a84b;
  box-shadow:
    0 0 0 1px rgba(212, 168, 75, 0.25),
    0 0 12px rgba(212, 168, 75, 0.55);
  pointer-events: none;
  z-index: 3;
}

/* Liseré qui suit l’alpha arrondi du PNG (renforce les coins) */
.card.trump-glow .card-img {
  filter:
    drop-shadow(1px 0 0 #d4a84b)
    drop-shadow(-1px 0 0 #d4a84b)
    drop-shadow(0 1px 0 #d4a84b)
    drop-shadow(0 -1px 0 #d4a84b)
    drop-shadow(0 0 4px rgba(212, 168, 75, 0.75));
}

/* Atout non jouable : grisé comme les autres cartes illégales (pas de liseré or) */
.card.disabled.trump-glow {
  filter: brightness(0.72) saturate(0.5);
  cursor: not-allowed;
  pointer-events: none;
}
.card.disabled.trump-glow::after {
  display: none;
}
.card.disabled.trump-glow .card-img {
  filter: none;
}

/* ─── MY HAND ─── */
.my-area {
  flex: 0 0 auto;
  /* 8px fixe — jamais env(safe-area-inset-bottom) (bande verte iOS/PWA) */
  padding: 6px 4px 10px;
  background: linear-gradient(
    to top,
    #050807 0%,
    rgba(7, 16, 13, 0.88) 52%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  /* Sous les panneaux lobby/enchères (sinon les boutons sont incliquables) */
  z-index: 20;
  min-height: calc(var(--card-h) + 48px);
  position: relative;
}

.seat-me {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.seat-me .avatar {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.seat-me .seat-name {
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  font-size: 0.75rem;
  max-width: none;
  overflow: visible;
}

.seat-me .seat-who {
  max-width: 9em;
}

.seat-me .seat-role {
  font-size: 0.62rem;
}

.seat-me.active-turn .avatar {
  box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(212, 168, 75, 0.6);
}

.turn-hint {
  font-size: 0.7rem;
  color: var(--gold);
  font-weight: 600;
  min-height: 1em;
}

.my-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  max-width: 100vw;
  min-height: calc(var(--card-h) + 8px);
  padding: 0 4px 4px;
  overflow: visible;
  position: relative;
}

.my-hand .card {
  margin-left: calc(var(--card-w) * -0.54);
  flex-shrink: 0;
  animation: deal-in 0.45s var(--ease-out) both;
  /* Ombre drop-shadow déjà rasterisée ; seuls les transform bougent */
  will-change: transform;
}

.my-hand .card:first-child {
  margin-left: 0;
}

.my-hand .card.no-deal-in {
  animation: none;
}

.my-hand .card.deal-reveal {
  animation: deal-flip 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes deal-in {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes deal-flip {
  from {
    opacity: 0.35;
    transform: translateY(-18px) scale(0.75) rotateY(70deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Paquet au centre pendant la distribution */
.deal-deck {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--card-w) * 0.72);
  height: calc(var(--card-h) * 0.72);
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
}

.deal-deck-card {
  position: absolute;
  inset: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  filter: none;
  transform: translate(
      calc(var(--i, 0) * 1.5px - 1.5px),
      calc(var(--i, 0) * -1.5px)
    )
    rotate(calc(var(--i, 0) * -2deg));
  background-color: transparent;
}

.deal-deck-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}

/* Cartes volantes (distribution) — left/top/width/height animés (Android) */
.card-fly-deal {
  border-radius: calc(var(--card-w) * 0.06);
  overflow: hidden;
  background-color: transparent;
  /* ombre légère sans filter GPU (le drop-shadow floute le dos en vol) */
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  filter: none;
  will-change: transform;
  line-height: 0;
  font-size: 0;
  transform-origin: center center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Sous topbar (50), my-area (20), noms (12) — au-dessus du feutre */
  z-index: 8;
}

.card-fly-deal .card-img,
.card-fly-deal img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* force un re-raster propre pendant le resize animé */
  transform: translateZ(0);
}

/* Table un peu plus calme pendant la distribution
   — ne bloque PAS le lobby (changement de place / lancer) */
#screen-game.is-dealing:not([data-phase="lobby"]) .panel,
#screen-game.is-dealing:not([data-phase="lobby"]) .sheet {
  pointer-events: none;
}

#screen-game.is-dealing[data-phase="lobby"] .panel,
#screen-game.is-dealing[data-phase="lobby"] .sheet {
  pointer-events: auto;
}

#screen-game.is-dealing .table-msg {
  color: var(--gold);
  font-weight: 600;
}

/* Sur mobile les mains adverses sont cachées : les montrer pendant donne + ramassage */
#screen-game.is-dealing .hand-opp,
#screen-game.is-picking-up .hand-opp,
#screen-game.is-dealing .hand-opp.hand-vertical,
#screen-game.is-picking-up .hand-opp.hand-vertical {
  display: flex !important;
  opacity: 1;
  z-index: 4;
}

.avatar.deal-catch {
  animation: deal-catch-pulse 0.35s ease;
}

.my-hand .card.pickup-fan {
  animation: pickup-fan 0.62s cubic-bezier(0.18, 0.86, 0.22, 1) both;
}

@keyframes pickup-fan {
  0% {
    opacity: 0.85;
    transform: translateY(22px) scale(0.88) rotate(0deg);
  }
  42% {
    opacity: 1;
    transform: translateY(-14px) scale(1.05) rotate(var(--r, 0deg));
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(var(--r, 0deg));
  }
}

.hand-opp.pickup-scoop .card-back {
  animation: pickup-card-n 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hand-opp.pickup-scoop .card-back:nth-child(1) { animation-delay: 0s; }
.hand-opp.pickup-scoop .card-back:nth-child(2) { animation-delay: 0.05s; }
.hand-opp.pickup-scoop .card-back:nth-child(3) { animation-delay: 0.1s; }
.hand-opp.pickup-scoop .card-back:nth-child(4) { animation-delay: 0.15s; }
.hand-opp.pickup-scoop .card-back:nth-child(5) { animation-delay: 0.2s; }

.seat-east .hand-opp.pickup-scoop .card-back {
  animation-name: pickup-card-e;
}

.seat-west .hand-opp.pickup-scoop .card-back {
  animation-name: pickup-card-w;
}

@keyframes pickup-card-n {
  to {
    opacity: 0;
    transform: translateY(-34px) scale(0.28);
  }
}

@keyframes pickup-card-e {
  to {
    opacity: 0;
    transform: translateX(26px) scale(0.28);
  }
}

@keyframes pickup-card-w {
  to {
    opacity: 0;
    transform: translateX(-26px) scale(0.28);
  }
}

.seat.pickup-reach .avatar {
  animation: pickup-reach 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pickup-reach {
  0% { transform: scale(1); }
  40% { transform: scale(1.1) translateY(3px); }
  100% { transform: scale(1); }
}

@keyframes deal-catch-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(212, 168, 75, 0);
  }
  40% {
    transform: scale(1.12);
    box-shadow: 0 0 0 4px rgba(212, 168, 75, 0.45);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(212, 168, 75, 0);
  }
}

/* Fan only on larger screens */
@media (min-width: 701px) {
  .my-hand .card:nth-child(1) { --r: -12deg; }
  .my-hand .card:nth-child(2) { --r: -8deg; }
  .my-hand .card:nth-child(3) { --r: -4deg; }
  .my-hand .card:nth-child(4) { --r: -1deg; }
  .my-hand .card:nth-child(5) { --r: 1deg; }
  .my-hand .card:nth-child(6) { --r: 4deg; }
  .my-hand .card:nth-child(7) { --r: 8deg; }
  .my-hand .card:nth-child(8) { --r: 12deg; }

  .my-hand .card {
    transform: rotate(var(--r, 0deg));
    transform-origin: bottom center;
  }



  .felt {
    border-radius: 0;
    margin: 0;
  }

  .avatar {
    width: 42px;
    height: 42px;
    font-size: 0.95rem;
  }

  .seat-name { font-size: 0.75rem; max-width: 148px; }
  .seat-north { top: 10px; }
  .seat-east { right: 12px; top: 50%; }
  .seat-west { left: 12px; top: 50%; }

  .trick {
    width: 280px;
    height: 248px;
    top: 50%;
  }

  .trick-slot[data-seat="0"],
  .trick-slot[data-seat="1"],
  .trick-slot[data-seat="2"],
  .trick-slot[data-seat="3"] {
    transform: scale(1);
  }
  .trick-slot[data-seat="0"] { transform: translateX(-50%) scale(1); }
  .trick-slot[data-seat="1"] { transform: translateY(-50%) scale(1); }
  .trick-slot[data-seat="2"] { transform: translateX(-50%) scale(1); }
  .trick-slot[data-seat="3"] { transform: translateY(-50%) scale(1); }
}

/* ─── PANELS / SHEETS ─── */
.sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 40;
  backdrop-filter: blur(2px);
  pointer-events: none; /* ne bloque jamais les boutons du panneau */
}

.sheet-backdrop.visible {
  display: block;
}

.sheet-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(247, 240, 225, 0.28);
  margin: 4px auto 12px;
}

.panel {
  position: absolute;
  right: 12px;
  /* coords depuis le haut physique de #screen-game (= padding edge) */
  top: calc(var(--safe-top) + var(--topbar-h) + 8px);
  width: min(300px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  z-index: 80;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: none;
  display: none;
  animation: panel-in 0.3s var(--ease-out);
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

.panel.visible { display: block; }

/*
 * Enchères : bas centré, hauteur auto (pas de scroll interne).
 * Contenu compact pour tout afficher d’un coup.
 */
#panel-bid.panel {
  --bid-x: -50%;
  display: block;
  right: auto;
  left: 50%;
  top: auto;
  /* + nom joueur (seat-me) au-dessus des cartes ≈ +20px */
  bottom: calc(var(--card-h) + 72px + var(--safe-bottom));
  width: min(360px, calc(100% - 24px));
  max-height: none;
  height: auto;
  overflow: hidden;
  z-index: 90;
  padding: 12px 12px 10px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--bid-x), 20px, 0);
  transition:
    opacity 0.26s ease,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear 0.28s,
    width 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.28s ease,
    bottom 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 0.28s ease,
    background 0.28s ease;
}

#panel-bid.panel.visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(var(--bid-x), 0, 0);
  transition:
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s,
    width 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.28s ease,
    bottom 0.32s cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 0.28s ease,
    background 0.28s ease;
}

/* Contrer / après-contre : barre compacte centrée, côtés de la table libres */
#panel-bid.panel.bid-mode-double,
#panel-bid.panel.bid-mode-resolve {
  width: min(300px, calc(100% - 48px));
  max-height: none;
  bottom: calc(var(--card-h) + 68px + var(--safe-bottom));
  padding: 10px 14px 12px;
  border-radius: 16px;
  background: rgba(12, 40, 32, 0.94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* Lobby / résultat restent à droite sur grand écran (pas de joueur masqué) */
#panel-lobby.panel,
#panel-result.panel {
  right: 12px;
  left: auto;
  top: calc(var(--topbar-h) + var(--safe-top) + 8px);
  bottom: auto;
  transform: none;
}

.panel .btn,
.panel .sit-btn,
.panel button {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  touch-action: manipulation;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 10px;
  color: var(--cream);
  letter-spacing: 0.02em;
}

.panel-desc {
  font-size: 0.85rem;
  color: rgba(247, 240, 225, 0.7);
  margin: 0 0 12px;
  line-height: 1.4;
}

.seat-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.seat-team {
  border-radius: 16px;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
}

.seat-team-ns,
.seat-team-eo {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}

.seat-team-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.seat-team-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.seat-team-ns .seat-team-badge {
  color: #1a1410;
  background: var(--gold);
  border-color: rgba(255, 255, 255, 0.2);
}

.seat-team-eo .seat-team-badge {
  color: #0a1a1e;
  background: #7ec8d8;
  border-color: rgba(255, 255, 255, 0.2);
}

.seat-team-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.seat-team-label {
  font-weight: 800;
  font-size: 1rem;
  color: var(--cream);
  line-height: 1.2;
}

.seat-team-ns .seat-team-label {
  color: var(--gold-soft);
}

.seat-team-eo .seat-team-label {
  color: #b6e6f0;
}

.seat-team-hint {
  font-size: 0.72rem;
  color: rgba(247, 240, 225, 0.55);
}

.seat-team-seats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.seat-vs {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px;
}

.seat-vs-line {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.28),
    transparent
  );
}

.seat-vs-pill {
  flex-shrink: 0;
  min-width: 2.2em;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  color: rgba(247, 240, 225, 0.7);
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
}

.sit-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 8px;
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: var(--cream);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s, transform 0.1s;
}

.sit-btn .sit-place {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.15;
}

.sit-btn .sit-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0.65;
}

.seat-team-ns .sit-btn {
  border-color: rgba(212, 168, 75, 0.4);
}

.seat-team-eo .sit-btn {
  border-color: rgba(126, 200, 216, 0.4);
}

.seat-team-ns .sit-btn .sit-sub {
  color: var(--gold-soft);
}

.seat-team-eo .sit-btn .sit-sub {
  color: #9fd8e4;
}

.sit-btn:active:not(:disabled) {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.1);
}

.seat-team-ns .sit-btn:active:not(:disabled) {
  background: rgba(212, 168, 75, 0.24);
}

.seat-team-eo .sit-btn:active:not(:disabled) {
  background: rgba(126, 200, 216, 0.22);
}

.sit-btn.taken {
  opacity: 0.45;
  cursor: not-allowed;
}

.sit-btn.mine {
  font-weight: 700;
}

.seat-team-ns .sit-btn.mine {
  background: rgba(212, 168, 75, 0.32);
  border-color: var(--gold);
  color: var(--gold-soft);
  box-shadow: 0 0 0 2px rgba(212, 168, 75, 0.3);
}

.seat-team-eo .sit-btn.mine {
  background: rgba(126, 200, 216, 0.28);
  border-color: #7ec8d8;
  color: #b6e6f0;
  box-shadow: 0 0 0 2px rgba(126, 200, 216, 0.32);
}

.target-score-block {
  margin: 4px 0 14px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.target-score-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.target-score-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--cream);
}

.target-score-hint {
  font-size: 0.72rem;
  color: rgba(247, 240, 225, 0.55);
  text-align: right;
}

.target-score-block.is-owner .target-score-hint {
  color: var(--gold-soft);
}

.target-score-pick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.target-score-btn {
  padding: 10px 4px;
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}

.target-score-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.target-score-btn.selected {
  border-color: var(--gold);
  background: rgba(212, 168, 75, 0.28);
  color: var(--gold-soft);
  box-shadow: 0 0 0 1px rgba(212, 168, 75, 0.25);
}

.target-score-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.target-score-block.is-readonly .target-score-btn:not(.selected) {
  opacity: 0.4;
}

.target-score-block.is-readonly .target-score-btn.selected {
  opacity: 1;
}

.bot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.85rem;
  gap: 8px;
}

/* —— Panneau enchères compact (sans scroll) —— */
#panel-bid .sheet-handle {
  display: none !important;
}

.bid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.bid-head h2 {
  margin: 0;
  font-size: 1rem;
  text-align: left;
  line-height: 1.2;
}

.bid-min-pill {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold-soft);
  background: rgba(212, 168, 75, 0.16);
  border: 1px solid rgba(212, 168, 75, 0.35);
}

.bid-min-pill strong {
  font-weight: 800;
  color: var(--gold);
}

.bid-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  overflow: visible;
}

.bid-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bid-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(247, 240, 225, 0.5);
}

.suit-pick {
  display: flex;
  gap: 6px;
  justify-content: stretch;
}

.suit-btn {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 40px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, background 0.2s;
}

.suit-btn:active { transform: scale(1.04); }
.suit-btn.selected {
  border-color: var(--gold);
  background: rgba(212, 168, 75, 0.22);
  box-shadow: 0 0 0 1px rgba(212, 168, 75, 0.25);
}

.suit-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.bid-values {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.bid-values button {
  padding: 6px 2px;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.bid-values button:active:not(:disabled) {
  background: rgba(212, 168, 75, 0.35);
  border-color: rgba(212, 168, 75, 0.5);
}

.bid-values button.bid-capot {
  background: linear-gradient(135deg, #8b5a2b, #c9a227);
  color: #fff;
  font-weight: 700;
  border-color: #e8c547;
  min-width: 4.5rem;
}
.bid-values button.bid-capot:not(:disabled):active {
  filter: brightness(1.08);
  transform: scale(0.97);
}
.bid-values button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  color: rgba(247, 240, 225, 0.35);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

/* Points verrouillés : attendre le choix d'atout */
.bid-values.needs-suit button:disabled {
  opacity: 0.28;
  filter: grayscale(0.85);
  color: rgba(180, 175, 165, 0.45);
  background: rgba(40, 38, 34, 0.35);
  border-color: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.bid-values:not(.needs-suit) button:not(:disabled) {
  opacity: 1;
  filter: none;
}

/* Après un contre : enchères fermées */
.bid-values.locked-double button,
.suit-pick.locked .suit-btn {
  opacity: 0.28;
  filter: grayscale(0.85);
  pointer-events: none;
  cursor: not-allowed;
}

.bid-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.bid-actions .btn {
  flex: 1 1 auto;
  min-width: 80px;
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Mode barre Contrer seule (autres joueurs parient) */
#panel-bid.bid-mode-double .bid-body,
#panel-bid.bid-mode-double .bid-min-pill,
#panel-bid.bid-mode-double .sheet-handle {
  display: none !important;
}

#panel-bid.bid-mode-double .bid-head {
  margin-bottom: 8px;
  justify-content: center;
}

#panel-bid.bid-mode-double .bid-head h2 {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(247, 240, 225, 0.75);
  text-align: center;
}

#panel-bid.bid-mode-double .bid-actions {
  margin: 0;
}

#panel-bid.bid-mode-double #btn-double {
  flex: 1 1 100%;
  min-height: 52px;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
  animation: bid-pulse 1.6s ease-in-out infinite;
}

/* Après contre : Accepter / Surcontrer uniquement */
#panel-bid.bid-mode-resolve .bid-body,
#panel-bid.bid-mode-resolve .bid-min-pill {
  display: none !important;
}

#panel-bid.bid-mode-resolve .bid-head {
  justify-content: center;
  margin-bottom: 8px;
}

#panel-bid.bid-mode-resolve .bid-head h2 {
  text-align: center;
  color: #f0b45a;
}

@keyframes bid-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 180, 90, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(240, 180, 90, 0); }
}

.bid-log {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  max-height: 90px;
  overflow-y: auto;
  color: rgba(247, 240, 225, 0.7);
}

.bid-log[hidden] {
  display: none !important;
}

.bid-log li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.result-teams {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}

.result-teams[hidden] {
  display: none !important;
}

.rt-team {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rt-team.t0.is-us,
.rt-team.t1.is-us {
  border-color: rgba(212, 168, 75, 0.35);
  background: rgba(212, 168, 75, 0.1);
}

.rt-team.is-winner {
  border-color: rgba(109, 206, 138, 0.55);
  background: rgba(109, 206, 138, 0.12);
  box-shadow: 0 0 16px rgba(109, 206, 138, 0.12);
}

.rt-code {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(247, 240, 225, 0.55);
  flex: 0 0 auto;
}

.rt-names {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream);
  flex: 1 1 auto;
  min-width: 0;
}

.rt-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0c3b2e;
  background: #6dce8a;
  padding: 3px 8px;
  border-radius: 999px;
}

.result-scores {
  display: flex;
  gap: 10px;
  margin: 12px 0 16px;
  justify-content: center;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

#btn-result-menu.hidden {
  display: none !important;
}

.result-scores .rs {
  text-align: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  min-width: 80px;
  flex: 1;
  border: 1px solid transparent;
}

.result-scores .rs.is-us {
  border-color: rgba(212, 168, 75, 0.4);
  background: rgba(212, 168, 75, 0.1);
}

.result-scores .rs .rs-code {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.55;
}

.result-scores .rs .rs-names {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(247, 240, 225, 0.9);
  margin: 2px 0 4px;
  line-height: 1.25;
  word-break: break-word;
}

.result-scores .rs strong {
  display: block;
  font-size: 1.35rem;
  color: var(--gold);
}

.result-scores .rs.t1 strong {
  color: #7ec8d8;
}

.result-scores .rs small {
  display: block;
  margin-top: 2px;
  opacity: 0.7;
  font-size: 0.75rem;
}

/*
 * Toast — pastille compacte centrée (left/right + margin, PAS top+bottom).
 * Ne pas réutiliser @keyframes rise-in (transform:none casse le centrage).
 */
.toast {
  position: fixed;
  top: max(10px, calc(var(--safe-top) + 10px));
  bottom: auto !important;
  left: 0;
  right: 0;
  width: fit-content;
  max-width: min(220px, 72vw);
  min-width: 0;
  height: auto !important;
  max-height: 3.6em;
  margin: 0 auto;
  padding: 6px 12px;
  box-sizing: border-box;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  color: var(--cream);
  border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.35);
  z-index: 10050;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transform: none;
  animation: none;
}

/* En jeu : sous Nord, pas sur le score ni le nom du partenaire */
#screen-game.active ~ .toast {
  top: calc(var(--topbar-h) + var(--safe-top) + 78px);
}

.toast.is-visible,
.toast:not([hidden]) {
  display: inline-flex;
  animation: toast-pop 0.22s var(--ease-out) both;
}

@keyframes toast-pop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toast.belote {
  border-color: var(--gold);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 7px 14px;
  max-width: min(200px, 70vw);
  white-space: nowrap;
}

/* Contre / surcontre : toast compact (pas d’overflow) */
.toast.toast-call {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 6px 12px;
  max-width: min(160px, 60vw);
  border-color: rgba(240, 180, 90, 0.55);
  color: #ffd27a;
  background: rgba(20, 14, 8, 0.94);
}

/* ═══════════════════════════════════════════
   PHONE LAYOUT (≤700px)
═══════════════════════════════════════════ */
@media (max-width: 700px) {
  :root {
    --card-w: clamp(76px, (100vw - 28px) / 4.55, 90px);
    --card-h: calc(var(--card-w) * var(--card-ratio));
    --card-radius: calc(var(--card-w) * 0.05);
    --hand-overlap: calc(var(--card-w) * 0.52);
    /* 1 ligne ~44px ; 2 lignes ~78px — approx pour le backdrop */
    --topbar-h: 44px;
    --hand-area-h: calc(var(--card-h) + 24px);
  }

  /* ── Topbar mobile : bande noire + safe-top (caméra) JAMAIS retirés ── */
  .topbar {
    padding: calc(6px + var(--safe-top)) 8px 6px;
    gap: 4px;
    min-height: calc(var(--topbar-h) + var(--safe-top));
  }

  .topbar:has(.topbar-sub .hand-scoreboard:not(.hidden)),
  .topbar:has(.topbar-sub .trump-chip:not(.hidden)) {
    --topbar-h: 78px;
  }

  .topbar-main {
    gap: 4px;
  }

  .topbar-sub {
    gap: 4px;
    padding-top: 1px;
  }

  .room-badge {
    gap: 0;
    flex: 0 1 auto;
    max-width: 28%;
  }

  .room-badge .label { display: none; }

  .room-badge strong {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .room-badge .btn-icon {
    min-width: 40px;
    min-height: 40px;
    padding: 6px;
    font-size: 0.95rem;
  }

  /* Backdrop sous la topbar : le code reste net */
  .sheet-backdrop.visible {
    top: calc(var(--topbar-h) + var(--safe-top));
  }

  /* Score partie : code + noms + points (compact) */
  .scoreboard {
    gap: 4px;
    padding: 3px 5px;
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
    max-width: 58%;
    border-radius: 12px;
  }

  .scoreboard .team {
    flex-direction: column;
    gap: 0;
    align-items: center;
    padding: 2px 5px;
    min-width: 0;
    max-width: 46%;
  }

  .scoreboard .team .team-code {
    font-size: 0.48rem;
    letter-spacing: 0.08em;
  }

  .scoreboard .team.is-us .team-code::after {
    width: 4px;
    height: 4px;
  }

  .scoreboard .team .team-names {
    font-size: 0.55rem;
    max-width: 7.2em;
  }

  .scoreboard .team strong {
    font-size: 0.92rem;
  }

  .score-mid {
    gap: 3px;
  }

  .score-diamond {
    width: 5px;
    height: 5px;
  }

  .scoreboard .target {
    font-size: 0.5rem;
  }

  .hand-scoreboard .hs-team.is-us .hs-code {
    color: var(--gold-soft);
    font-weight: 700;
  }

  .topbar-right {
    gap: 4px;
    margin-left: 0;
    flex: 0 0 auto;
  }

  .btn-menu {
    min-width: var(--touch);
    min-height: var(--touch);
    padding: 8px;
  }

  .btn-menu-label {
    display: none;
  }

  /* Ligne 2 : donne + enchère/contrat, chacun sa place */
  .hand-scoreboard {
    padding: 3px 7px;
    gap: 4px;
    flex: 0 1 auto;
    max-width: 42%;
    min-width: 0;
  }

  .hand-scoreboard .hs-label { display: none; }

  .hand-scoreboard .hs-team {
    flex-direction: row;
    gap: 2px;
    align-items: baseline;
    min-width: 0;
  }

  .hand-scoreboard .hs-team span {
    font-size: 0.48rem;
  }

  .hand-scoreboard .hs-team strong {
    font-size: 0.82rem;
  }

  .hand-scoreboard .hs-meta {
    display: none; /* trop large sur mobile — info déjà en toast / table */
  }

  .trump-chip {
    padding: 3px 8px;
    gap: 3px 5px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .trump-chip-label { display: none; }

  .trump-chip-suit {
    width: 1.45em;
    height: 1.45em;
    font-size: 0.95rem;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .trump-chip-value {
    font-size: 0.72rem;
    flex-shrink: 0;
    overflow: visible;
    text-overflow: clip;
  }

  .trump-chip-bidder {
    font-size: 0.62rem;
    flex: 1 1 100%;
    max-width: none;
    padding-left: 0;
    margin-left: 0;
    border-left: none;
    /* 2e ligne sous la couleur/valeur : tout le texte visible */
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.2;
  }

  .conn {
    font-size: 0;
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    min-width: 8px;
  }

  .conn[data-state="connected"] { background: #6dce8a; }
  .conn[data-state="connecting"] { background: var(--gold); }
  .conn[data-state="disconnected"] { background: var(--coral); }

  /* Table takes remaining space between bar and hand */
  .table-wrap {
    flex: 1;
    min-height: 0;
    background: #071410;
  }

  .felt {
    flex: 1;
    margin: 0;
    border-radius: 0;
    min-height: 0;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.4);
  }

  /* Hide bulky opponent card stacks — count badge is enough */
  .hand-opp {
    display: none !important;
  }

  .seat {
    gap: 1px;
    max-width: 36%;
  }

  .seat-name {
    max-width: 118px;
  }

  .avatar {
    width: 38px;
    height: 38px;
    font-size: 0.82rem;
    border-width: 1.5px;
  }

  .seat-name {
    font-size: 0.68rem;
    max-width: 96px;
  }

  .cards-count {
    font-size: 0.55rem;
    background: rgba(0, 0, 0, 0.45);
    padding: 1px 5px;
    border-radius: 999px;
  }

  .seat-north { top: 4px; }
  .seat-east { right: 2px; top: 40%; }
  .seat-west { left: 2px; top: 40%; }

  .trick {
    width: min(220px, 64vw);
    height: min(196px, 36vh);
    top: 54%;
  }

  .trick-slot[data-seat="0"] { transform: translateX(-50%) scale(0.9); }
  .trick-slot[data-seat="1"] { transform: translateY(-50%) scale(0.9); }
  .trick-slot[data-seat="2"] { transform: translateX(-50%) scale(0.9); }
  .trick-slot[data-seat="3"] { transform: translateY(-50%) scale(0.9); }

  .table-msg {
    font-size: 0.68rem;
    bottom: 6px;
    padding: 4px 10px;
  }

  /* Hand: rail sombre sous les cartes */
  .my-area {
    padding: 6px 4px 10px;
    min-height: calc(var(--card-h) + 40px);
    background: linear-gradient(
      to top,
      #050807 0%,
      rgba(7, 16, 13, 0.92) 58%,
      transparent 100%
    );
  }

  .my-hand {
    min-height: calc(var(--card-h) + 4px);
    padding-bottom: 2px;
  }

  .my-hand .card {
    margin-left: calc(var(--card-w) * -0.54);
    transform: none !important;
    border-radius: var(--card-radius);
  }

  .my-hand .card:first-child {
    margin-left: 0;
  }



  /* Bottom sheets — la main reste visible en bas */
  .sheet-backdrop.visible {
    display: block;
  }

  .sheet-handle {
    display: block;
  }

  .panel.sheet {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: min(70dvh, 520px);
    border-radius: 20px 20px 0 0;
    padding: 10px 14px calc(18px + var(--safe-bottom));
    z-index: 90;
    animation: sheet-up 0.32s var(--ease-out);
    border-left: none;
    border-right: none;
    border-bottom: none;
    pointer-events: auto;
  }

  /*
   * Lobby / résultat : bottom sheet bas.
   * #panel-result.panel pose top:… (spécificité #id) et écrasait .panel.sheet
   * → panneau trop haut / buggué en portrait. On force le bas.
   */
  #panel-lobby.panel.sheet,
  #panel-result.panel.sheet {
    z-index: 100;
    position: fixed;
    left: 0;
    right: 0;
    top: auto !important;
    bottom: 0 !important;
    width: 100%;
    max-width: none;
    max-height: min(78dvh, 560px);
    transform: none !important;
    margin: 0;
    border-radius: 20px 20px 0 0;
    padding: 12px 16px calc(20px + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: sheet-up 0.32s var(--ease-out);
  }

  #panel-result.panel.sheet h2 {
    text-align: center;
    margin-bottom: 6px;
  }

  #panel-result.panel.sheet #result-msg {
    text-align: center;
    font-size: 0.88rem;
    margin: 0 0 10px;
  }

  #panel-result.panel.sheet .btn-block {
    margin-top: 12px;
    position: sticky;
    bottom: 0;
  }

  /* Enchères : panneau au-dessus de la main, cartes visibles en bas */
  #screen-game.is-bidding .my-area {
    z-index: 95;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  }

  /* Enchère complète : au-dessus de la main + nom joueur */
  #screen-game.is-bidding #panel-bid.panel.sheet {
    bottom: calc(var(--card-h) + 62px + var(--safe-bottom));
    max-height: none !important;
    height: auto;
    overflow: hidden !important;
    border-radius: 16px;
    margin: 0 8px;
    width: auto;
    left: 8px;
    right: 8px;
    --bid-x: 0px;
    padding: 10px 12px 10px;
    z-index: 90;
  }

  /* Contrer / resolve : barre centrée (pas full-width) — Est & Ouest visibles */
  #screen-game.is-bidding #panel-bid.panel.sheet.bid-mode-double,
  #screen-game.is-bidding #panel-bid.panel.sheet.bid-mode-resolve {
    left: 50%;
    right: auto;
    width: min(280px, calc(100vw - 48px));
    max-width: none;
    max-height: none !important;
    height: auto;
    overflow: hidden !important;
    --bid-x: -50%;
    margin: 0;
    padding: 8px 12px 10px;
    border-radius: 14px;
    background: rgba(12, 40, 32, 0.94);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    bottom: calc(var(--card-h) + 58px + var(--safe-bottom));
  }

  /* Enchères : jamais de flou de fond (bulles visibles) */
  #screen-game.is-bidding .sheet-backdrop {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Lobby / fin de partie : la zone ne capte pas les taps.
     Ne jamais masquer la main (pli, donne, enchères). */
  #screen-game[data-phase="lobby"] .my-area,
  #screen-game[data-phase="game_over"] .my-area {
    pointer-events: none;
  }

  /* Enchères phone : dense, tout visible d’un coup */
  #screen-game.is-bidding #panel-bid .bid-head {
    margin-bottom: 6px;
  }

  #screen-game.is-bidding #panel-bid .bid-head h2 {
    font-size: 0.95rem;
  }

  #screen-game.is-bidding #panel-bid .bid-body {
    gap: 6px;
    margin-bottom: 6px;
  }

  #screen-game.is-bidding #panel-bid .suit-btn {
    height: 46px;
    font-size: 1.35rem;
    border-radius: 12px;
  }

  #screen-game.is-bidding #panel-bid .bid-values {
    gap: 6px;
  }

  #screen-game.is-bidding #panel-bid .bid-values button {
    min-height: 44px;
    padding: 8px 2px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  #screen-game.is-bidding #panel-bid .bid-actions .btn {
    min-height: 46px;
    padding: 10px 12px;
    font-size: 0.92rem;
  }

  @keyframes sheet-up {
    from { opacity: 0; transform: translateY(40%); }
    to { opacity: 1; transform: none; }
  }

  .panel.sheet.visible {
    display: block;
  }

  .panel h2 {
    font-size: 1.2rem;
    text-align: center;
  }

  .panel-desc {
    text-align: center;
    font-size: 0.8rem;
  }

  .bid-values {
    grid-template-columns: repeat(4, 1fr);
  }

  .bid-values button {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .suit-btn {
    height: 50px;
    font-size: 1.55rem;
  }

  .home-card {
    padding: 8px 4px 12px;
  }
}

/* Écrans bas : compact sans écraser les boutons ni les pips */
@media (max-height: 780px) {
  .app-logo {
    width: min(88px, 22vw);
    padding: 6px;
  }

  .home-wordmark {
    font-size: 1.4rem;
    margin-top: 8px;
  }

  .home-kicker {
    margin: 4px 0 10px;
  }

  .tagline {
    margin-bottom: 8px;
  }

  .btn-mode {
    min-height: 80px;
    padding: 10px 12px;
  }

  .hint {
    margin-top: 6px;
    font-size: 0.68rem;
  }
}

@media (max-height: 680px) {
  .app-logo {
    width: min(72px, 18vw);
    padding: 5px;
    border-radius: 14px;
  }

  h1,
  .home-wordmark {
    font-size: 1.28rem;
  }

  .tagline {
    display: none;
  }

  .hint {
    display: none;
  }

  .btn-mode {
    min-height: 74px;
  }

  .mode-mini-card {
    width: 32px;
    height: 50px;
  }

  .home-card {
    padding: 8px 8px 10px;
  }

  .field {
    margin-bottom: 8px;
  }

  .field input {
    padding: 8px 10px;
    min-height: 40px;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  :root {
    --card-w: clamp(72px, (100vw - 24px) / 4.45, 82px);
    --card-h: calc(var(--card-w) * var(--card-ratio));
    --card-radius: calc(var(--card-w) * 0.05);
    --hand-overlap: calc(var(--card-w) * 0.51);
  }

  .scoreboard .target { display: none; }

  .bid-values {
    grid-template-columns: repeat(4, 1fr);
  }

  .bid-values button {
    min-height: 40px;
    font-size: 0.88rem;
  }
}

/* ═══════════════════════════════════════════
   LANDSCAPE
   Portrait reste la référence. En largeur >700
   le téléphone bascule en règles « desktop » :
   ici on recompose un layout bas (hauteur faible)
   propre, sans piles adverses ni éventail lourd.
═══════════════════════════════════════════ */

/*
 * Paysage
 * - Feutre plein écran
 * - UI hors Dynamic Island / coins (env() direct + plancher fort ;
 *   les variables --safe-* sont aussi posées par JS pour Safari)
 */
@media (orientation: landscape) {
  /* Plancher large : island iPhone ~59px — env() en direct (pas seulement via var) */
  #screen-home {
    padding-top: max(12px, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: 12px !important; /* jamais env(bottom) — bande verte */
    padding-left: max(64px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(64px, env(safe-area-inset-right, 0px)) !important;
    box-sizing: border-box !important;
  }

  .home-compass {
    display: none;
  }

  .home-felt-rail {
    inset: 8px;
    border-radius: 18px;
  }



  .home-card {
    width: min(440px, 100%) !important;
    max-width: min(440px, calc(100vw - 144px)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .boot-intro-inner {
    padding-top: max(16px, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: 16px !important;
    padding-left: max(64px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(64px, env(safe-area-inset-right, 0px)) !important;
    box-sizing: border-box !important;
  }

  .toast {
    left: max(64px, env(safe-area-inset-left, 0px)) !important;
    right: max(64px, env(safe-area-inset-right, 0px)) !important;
    width: fit-content !important;
    max-width: calc(100vw - 128px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .settings-overlay {
    padding-top: max(10px, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
    padding-left: max(64px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(64px, env(safe-area-inset-right, 0px)) !important;
    align-items: center;
    box-sizing: border-box !important;
  }

  /* Jeu : feutre jusqu’aux bords (pas de cadre noir qui crée une bande) */
  #screen-game {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
    background: #0c3b2e;
  }

  .topbar {
    padding-left: max(16px, env(safe-area-inset-left, 0px), var(--safe-left, 0px)) !important;
    padding-right: max(16px, env(safe-area-inset-right, 0px), var(--safe-right, 0px)) !important;
  }

  .table-wrap {
    width: 100%;
  }

  .felt {
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35) !important;
  }

  .my-area {
    padding-left: max(16px, env(safe-area-inset-left, 0px), var(--safe-left, 0px)) !important;
    padding-right: max(16px, env(safe-area-inset-right, 0px), var(--safe-right, 0px)) !important;
    padding-bottom: 8px !important;
    background: linear-gradient(
      to top,
      #050807 0%,
      rgba(7, 16, 13, 0.78) 48%,
      transparent 100%
    );
  }

  .seat-east {
    right: max(12px, env(safe-area-inset-right, 0px), var(--safe-right, 0px)) !important;
  }

  .seat-west {
    left: max(12px, env(safe-area-inset-left, 0px), var(--safe-left, 0px)) !important;
  }

  #panel-bid.panel,
  #panel-lobby.panel,
  #panel-result.panel {
    max-width: min(420px, calc(100vw - 128px)) !important;
  }
}

/* iPhone / téléphone paysage bas : plancher encore plus sûr (island) */
@media (orientation: landscape) and (max-height: 500px) {
  #screen-home {
    padding-left: max(72px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(72px, env(safe-area-inset-right, 0px)) !important;
  }

  .topbar {
    padding-left: max(56px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(56px, env(safe-area-inset-right, 0px)) !important;
  }

  .my-area {
    padding-left: max(56px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(56px, env(safe-area-inset-right, 0px)) !important;
  }

  .seat-west {
    left: max(52px, env(safe-area-inset-left, 0px)) !important;
  }

  .seat-east {
    right: max(52px, env(safe-area-inset-right, 0px)) !important;
  }
}

/* —— Téléphone / tablette basse en paysage —— */
@media (orientation: landscape) and (max-height: 560px) {
  :root {
    --card-w: clamp(56px, min(36vh / 1.55, (100vw - 16px) / 5.8), 74px);
    --card-h: calc(var(--card-w) * var(--card-ratio));
    --card-radius: calc(var(--card-w) * 0.05);
    --hand-overlap: calc(var(--card-w) * 0.42);
    --topbar-h: 34px;
    --hand-area-h: calc(var(--card-h) + 16px);
  }

  /* Boot : logo compact */
  .boot-logo-stage {
    width: min(132px, 28vmin);
  }
  .boot-logo-write {
    width: min(132px, 28vmin);
    width: 100cqw;
  }
  .boot-wordmark {
    font-size: 1.15rem;
  }
  .boot-tag {
    font-size: 0.72rem;
  }

  /* Accueil compact — padding island déjà forcé en !important plus haut */
  #screen-home {
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .home-card {
    width: 100% !important;
    max-width: 440px !important;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 8px 12px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .logo-wrap {
    margin: 0 0 4px;
  }

  .app-logo {
    width: min(72px, 16vw);
    padding: 5px;
    border-radius: 12px;
  }

  .logo-wrap::before {
    width: min(96px, 22vw);
    height: min(96px, 22vw);
  }

  .home-ornament {
    margin: 4px 0 0;
  }

  .home-ornament-line {
    width: 24px;
  }

  .home-kicker {
    margin: 4px 0 10px;
  }

  h1 {
    font-size: 1.35rem;
    margin: 2px 0 0;
  }

  .tagline {
    margin: 0 0 8px;
    font-size: 0.78rem;
  }

  .field {
    margin-bottom: 8px;
  }

  .mode-grid {
    gap: 8px;
  }

  .btn-mode {
    padding: 8px 12px;
    min-height: 68px;
    flex-direction: row;
    text-align: left;
  }

  .mode-icon {
    width: 38px;
    height: 50px;
  }

  .mode-icon::after {
    width: 26px;
    height: 40px;
  }

  .mode-mini-card {
    width: 30px;
    height: 46px;
  }

  .mode-pip,
  .mode-pip-spade {
    width: 14px;
    height: 17px;
  }

  .mode-go {
    width: 6px;
    height: 6px;
  }

  .mode-title {
    font-size: 0.95rem;
  }

  .mode-desc {
    font-size: 0.72rem;
  }

  .home-actions {
    gap: 8px;
  }

  .hint {
    margin-top: 6px;
    font-size: 0.72rem;
  }

  .btn-settings-home {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
  }

  /* Paramètres en carte centrée (pas full-sheet bas) */
  .settings-overlay {
    align-items: center;
    padding: 10px max(12px, var(--safe-right)) 10px max(12px, var(--safe-left));
  }

  .settings-panel {
    max-height: min(92dvh, 420px);
    border-radius: 16px;
    border-bottom: 1px solid var(--panel-border, rgba(212, 168, 75, 0.28));
    padding: 12px 14px;
  }

  /* ── Jeu ── (padding latéral déjà 0 via @media landscape global) */
  #screen-game {
    padding-bottom: 0;
  }

  .topbar {
    padding: calc(2px + var(--safe-top)) 8px 3px;
    padding-left: max(16px, env(safe-area-inset-left, 0px), var(--safe-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px), var(--safe-right, 0px));
    gap: 2px;
    min-height: calc(var(--topbar-h) + var(--safe-top));
  }

  .topbar:has(.topbar-sub .hand-scoreboard:not(.hidden)),
  .topbar:has(.topbar-sub .trump-chip:not(.hidden)) {
    --topbar-h: 56px;
  }

  .topbar-main {
    gap: 6px;
  }

  .topbar-sub {
    gap: 6px;
    padding-top: 0;
  }

  .room-badge .label {
    display: none;
  }

  .room-badge strong {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
  }

  .room-badge .btn-icon {
    min-width: 30px;
    min-height: 30px;
    padding: 2px;
  }

  .scoreboard {
    gap: 6px;
    padding: 2px 8px;
    border-radius: 10px;
  }

  .scoreboard .team .team-code {
    font-size: 0.48rem;
  }

  .scoreboard .team .team-names {
    font-size: 0.55rem;
    max-width: 6em;
  }

  .scoreboard .team strong {
    font-size: 0.8rem;
  }

  .scoreboard .target {
    font-size: 0.5rem;
  }

  .hand-scoreboard {
    padding: 2px 6px;
    gap: 4px;
  }

  .hand-scoreboard .hs-label {
    display: none;
  }

  .hand-scoreboard .hs-meta {
    display: none;
  }

  .hand-scoreboard .hs-team strong {
    font-size: 0.78rem;
  }

  .trump-chip {
    padding: 2px 7px;
    gap: 2px 5px;
    border-radius: 10px;
  }

  .trump-chip-label {
    display: none;
  }

  .trump-chip-suit {
    width: 1.35em;
    height: 1.35em;
    font-size: 0.88rem;
    border-radius: 6px;
  }

  .trump-chip-value {
    font-size: 0.7rem;
  }

  .trump-chip-bidder {
    font-size: 0.58rem;
    flex: 1 1 100%;
    max-width: none;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    white-space: normal;
  }

  .btn-menu {
    min-width: 32px;
    min-height: 32px;
    padding: 4px;
  }

  .btn-menu-label {
    display: none;
  }

  .conn {
    font-size: 0;
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: 50%;
    min-width: 8px;
  }

  .conn[data-state="connected"] {
    background: #6dce8a;
  }
  .conn[data-state="connecting"] {
    background: var(--gold);
  }
  .conn[data-state="disconnected"] {
    background: var(--coral);
  }

  .table-wrap {
    flex: 1;
    min-height: 0;
  }

  .felt {
    flex: 1;
    margin: 0;
    border-radius: 0;
    min-height: 0;
    box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.32);
  }

  /* Pas de piles adverses en paysage bas (comme portrait phone) */
  .hand-opp {
    display: none !important;
  }

  .seat {
    gap: 1px;
    max-width: 28%;
  }

  .avatar {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
  }

  .seat-name {
    font-size: 0.62rem;
    max-width: 118px;
  }

  .seat-role {
    font-size: 0.5rem;
  }

  .cards-count {
    font-size: 0.5rem;
    padding: 0 4px;
  }

  .seat-north {
    top: 2px;
  }
  .seat-east {
    right: 6px;
    top: 46%;
  }
  .seat-west {
    left: 6px;
    top: 46%;
  }

  .trick {
    width: min(200px, 36vw);
    height: min(176px, 46vh);
    top: 52%;
  }

  .trick-slot[data-seat="0"] {
    transform: translateX(-50%) scale(0.82);
  }
  .trick-slot[data-seat="1"] {
    transform: translateY(-50%) scale(0.82);
  }
  .trick-slot[data-seat="2"] {
    transform: translateX(-50%) scale(0.82);
  }
  .trick-slot[data-seat="3"] {
    transform: translateY(-50%) scale(0.82);
  }

  .table-msg {
    font-size: 0.62rem;
    bottom: 4px;
    padding: 3px 8px;
  }

  .call-banner {
    font-size: 0.75rem;
    padding: 4px 10px;
  }

  /* Main : rangée plate, zone basse compacte — fondu vers le feutre */
  .my-area {
    padding: 1px 4px 6px;
    min-height: calc(var(--card-h) + 18px);
    gap: 0;
    background: linear-gradient(
      to top,
      #050807 0%,
      rgba(7, 16, 13, 0.72) 52%,
      transparent 100%
    );
  }

  .seat-me {
    min-height: 0;
    gap: 6px;
    margin-bottom: 0;
  }

  .seat-me .avatar {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
  }

  .seat-me .seat-name {
    font-size: 0.65rem;
  }

  .turn-hint {
    font-size: 0.62rem;
    min-height: 0;
  }

  .my-hand {
    min-height: calc(var(--card-h) + 2px);
    padding-bottom: 0;
  }

  /* Annule l’éventail desktop (min-width 701) */
  .my-hand .card {
    margin-left: calc(var(--card-w) * -0.54);
    transform: none !important;
    border-radius: var(--card-radius);
  }

  .my-hand .card:first-child {
    margin-left: 0;
  }



  /* Lobby / résultat : carte centrée (largeur paysage dispo) */
  .sheet-backdrop.visible {
    display: block;
    top: 0;
  }

  .sheet-handle {
    display: none;
  }

  #panel-lobby.panel.sheet,
  #panel-result.panel.sheet {
    position: fixed;
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    width: min(440px, 78vw);
    max-width: none;
    max-height: min(88dvh, 360px);
    transform: translate(-50%, -50%) !important;
    border-radius: 16px;
    margin: 0;
    padding: 10px 14px 12px;
    animation: landscape-panel-in 0.28s var(--ease-out);
    border: 1px solid var(--panel-border);
    z-index: 100;
    overflow-y: auto;
  }

  @keyframes landscape-panel-in {
    from {
      opacity: 0;
      transform: translate(-50%, -46%) scale(0.97);
    }
    to {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }
  }

  #panel-lobby.panel.sheet h2,
  #panel-result.panel.sheet h2 {
    font-size: 1.05rem;
    text-align: center;
    margin-bottom: 6px;
  }

  #panel-lobby .panel-desc {
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 8px;
  }

  #panel-lobby .share-code {
    margin-bottom: 8px;
    padding: 8px;
  }

  #panel-lobby .share-code-value {
    font-size: 1.35rem;
    letter-spacing: 0.16em;
  }

  #panel-lobby .seat-picker {
    gap: 6px;
  }

  #panel-lobby .sit-btn {
    min-height: 40px;
    padding: 6px 8px;
  }

  /* Enchères paysage : bas centré (pas à droite — masquait le joueur Est) */
  #screen-game.is-bidding .my-area {
    z-index: 95;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.4);
  }

  #screen-game.is-bidding #panel-bid.panel.sheet {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: calc(var(--card-h) + 48px + var(--safe-bottom));
    width: min(400px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
    max-width: none;
    max-height: none !important;
    height: auto;
    margin: 0;
    --bid-x: -50%;
    border-radius: 12px;
    padding: 6px 10px 8px;
    z-index: 90;
    overflow: hidden !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  }

  #screen-game.is-bidding #panel-bid.panel.sheet.bid-mode-double,
  #screen-game.is-bidding #panel-bid.panel.sheet.bid-mode-resolve {
    width: min(260px, calc(100vw - 48px));
    max-height: none !important;
    overflow: hidden !important;
    padding: 6px 10px 8px;
    border-radius: 12px;
    bottom: calc(var(--card-h) + 44px + var(--safe-bottom));
  }

  #screen-game.is-bidding #panel-bid .suit-btn {
    height: 40px;
    font-size: 1.2rem;
  }

  #screen-game.is-bidding #panel-bid .bid-values button {
    min-height: 40px;
    padding: 6px 2px;
    font-size: 0.84rem;
  }

  #screen-game.is-bidding #panel-bid .bid-actions .btn {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 0.86rem;
  }

  #screen-game.is-bidding .sheet-backdrop {
    display: none !important;
  }

  #screen-game.is-bidding #panel-bid .bid-head h2 {
    font-size: 0.92rem;
  }

  #screen-game.is-bidding #panel-bid .suit-btn {
    height: 40px;
    font-size: 1.25rem;
  }

  #screen-game.is-bidding #panel-bid .bid-values {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  #screen-game.is-bidding #panel-bid .bid-values button {
    min-height: 34px;
    padding: 4px 2px;
    font-size: 0.82rem;
  }

  #screen-game.is-bidding #panel-bid .bid-actions {
    gap: 6px;
  }

  #screen-game.is-bidding #panel-bid .bid-actions .btn {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  #screen-game[data-phase="lobby"] .my-area,
  #screen-game[data-phase="game_over"] .my-area {
    pointer-events: none;
  }

  .toast {
    top: max(6px, calc(var(--safe-top) + 6px));
    max-width: min(200px, 55vw);
    font-size: 0.68rem;
    padding: 5px 10px;
  }

  #screen-game.active ~ .toast {
    top: calc(var(--topbar-h) + var(--safe-top) + 56px);
  }

  .scoreboard .team .team-names {
    display: none;
  }
}

/* Tablette / paysage confortable : resserre un peu, plateau toujours full-bleed */
@media (orientation: landscape) and (min-height: 561px) and (max-height: 820px) and (max-width: 1200px) {
  :root {
    --card-w: clamp(72px, min(24vh / 1.55, (100vw - 24px) / 5.1), 96px);
    --card-h: calc(var(--card-w) * var(--card-ratio));
    --card-radius: calc(var(--card-w) * 0.05);
    --hand-overlap: calc(var(--card-w) * 0.46);
  }

  .felt {
    margin: 0;
    border-radius: 0;
  }

  .my-area {
    min-height: calc(var(--card-h) + 36px);
  }

  .trick {
    width: 190px;
    height: 168px;
  }
}

@media (min-width: 701px) {
  .sheet-backdrop {
    display: none !important;
  }

  .sheet-handle {
    display: none;
  }
}

/* En paysage bas, le backdrop peut servir pour lobby/résultat (centré) */
@media (orientation: landscape) and (max-height: 560px) {
  .sheet-backdrop.visible {
    display: block !important;
  }

  #screen-game.is-bidding .sheet-backdrop {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════
   ANDROID — fenêtres compactes / proportionnées
   (WebView + Capacitor : sheets trop hautes sinon)
═══════════════════════════════════════════ */
html.is-android {
  --android-sheet-max: min(58dvh, 420px);
  --android-result-max: min(56dvh, 400px);
  --android-settings-max: min(70dvh, 460px);
}

/* Sheets bas (lobby / résultat / génériques) */
html.is-android .panel.sheet {
  max-height: var(--android-sheet-max) !important;
  padding: 8px 12px calc(12px + var(--safe-bottom)) !important;
  border-radius: 16px 16px 0 0 !important;
}

html.is-android #panel-lobby.panel.sheet,
html.is-android #panel-result.panel.sheet {
  max-height: min(72dvh, 520px) !important;
  padding: 10px 14px calc(14px + var(--safe-bottom)) !important;
  border-radius: 16px 16px 0 0 !important;
  width: 100% !important;
  left: 0 !important;
  right: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto !important;
  z-index: 90 !important;
}

/* Score + Lancer toujours accessibles en bas du sheet */
html.is-android #panel-lobby .target-score-block {
  position: sticky;
  bottom: 52px;
  z-index: 3;
  background: rgba(12, 40, 32, 0.96);
}

html.is-android #panel-lobby #btn-start {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin-top: 8px !important;
}

html.is-android #panel-lobby.panel.sheet h2,
html.is-android #panel-result.panel.sheet h2 {
  font-size: 1.1rem !important;
  margin: 0 0 6px !important;
  line-height: 1.2;
}

html.is-android #panel-result.panel.sheet #result-msg,
html.is-android #panel-lobby.panel.sheet .panel-desc {
  font-size: 0.8rem !important;
  margin: 0 0 8px !important;
  line-height: 1.35;
}

html.is-android .result-teams {
  gap: 6px;
  margin: 6px 0 2px;
}

html.is-android .rt-team {
  padding: 7px 10px;
  gap: 4px 8px;
  border-radius: 10px;
}

html.is-android .result-scores {
  gap: 8px;
  margin: 8px 0 10px;
}

html.is-android .result-scores .rs {
  padding: 8px 8px;
  min-width: 0;
  border-radius: 10px;
}

html.is-android .result-scores .rs strong {
  font-size: 1.15rem;
}

html.is-android .result-scores .rs .rs-names {
  font-size: 0.68rem;
}

html.is-android #panel-result.panel.sheet .btn-block,
html.is-android #panel-lobby.panel.sheet .btn-block {
  margin-top: 8px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.92rem;
}

html.is-android #panel-lobby .share-code {
  margin-bottom: 8px;
  padding: 8px 10px;
}

html.is-android #panel-lobby .share-code-value {
  font-size: 1.35rem;
  letter-spacing: 0.14em;
}

html.is-android #panel-lobby .sit-btn {
  min-height: 42px;
  padding: 6px 8px;
}

html.is-android #panel-lobby .seat-picker {
  gap: 6px;
}

/* Enchères Android : pas de max-height (évite le scroll), UI dense */
html.is-android #screen-game.is-bidding #panel-bid.panel.sheet {
  max-height: none !important;
  height: auto !important;
  overflow: hidden !important;
  padding: 8px 10px 8px !important;
  margin: 0 8px !important;
  border-radius: 12px !important;
}

html.is-android #screen-game.is-bidding #panel-bid .bid-head {
  margin-bottom: 5px !important;
}

html.is-android #screen-game.is-bidding #panel-bid .bid-head h2 {
  font-size: 0.9rem !important;
}

html.is-android #screen-game.is-bidding #panel-bid .bid-body {
  gap: 5px !important;
  margin-bottom: 5px !important;
}

html.is-android #screen-game.is-bidding #panel-bid .suit-btn {
  height: 46px !important;
  font-size: 1.35rem !important;
}

html.is-android #screen-game.is-bidding #panel-bid .bid-values button {
  min-height: 44px !important;
  padding: 8px 4px !important;
  font-size: 0.9rem !important;
}

html.is-android #screen-game.is-bidding #panel-bid .bid-actions .btn {
  min-height: 46px !important;
  padding: 10px 12px !important;
  font-size: 0.92rem !important;
}

html.is-android #screen-game.is-bidding #panel-bid.panel.sheet.bid-mode-double,
html.is-android #screen-game.is-bidding #panel-bid.panel.sheet.bid-mode-resolve {
  max-height: none !important;
  overflow: hidden !important;
  width: min(280px, calc(100vw - 40px)) !important;
  left: 50% !important;
  right: auto !important;
  --bid-x: -50%;
  padding: 8px 12px 10px !important;
}

/* Paramètres */
html.is-android .settings-panel {
  max-height: var(--android-settings-max) !important;
  max-width: min(400px, calc(100vw - 24px));
  padding: 14px 14px calc(14px + var(--safe-bottom)) !important;
  border-radius: 16px 16px 0 0;
}

html.is-android .settings-header h2 {
  font-size: 1.05rem;
}

html.is-android .settings-row {
  padding: 12px 12px;
  margin-bottom: 0;
  min-height: 52px;
}

html.is-android .settings-row-label {
  font-size: 0.9rem;
}

/* Accueil : colonne native, pas une carte flottante */
html.is-android .home-card {
  width: 100%;
  padding: 8px 4px 16px;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

html.is-android .app-logo {
  width: min(104px, 28vw);
  padding: 7px 6px 4px;
  border-radius: 22px;
}

html.is-android h1,
html.is-android .home-wordmark {
  font-size: clamp(1.4rem, 5.4vw, 1.9rem);
  margin: 10px 0 0;
}

html.is-android .btn-mode {
  min-height: 88px;
  max-height: none;
  padding: 12px 14px;
}

/* Paysage Android : modales centrées plus petites */
@media (orientation: landscape) {
  html.is-android #panel-lobby.panel.sheet,
  html.is-android #panel-result.panel.sheet {
    left: 50% !important;
    right: auto !important;
    top: 50% !important;
    bottom: auto !important;
    width: min(380px, 72vw) !important;
    max-height: min(82dvh, 320px) !important;
    transform: translate(-50%, -50%) !important;
    border-radius: 14px !important;
    padding: 10px 12px !important;
  }

  html.is-android .settings-panel {
    max-height: min(85dvh, 340px) !important;
    border-radius: 14px !important;
    border-bottom: 1px solid var(--panel-border);
  }

  html.is-android .home-card {
    width: 100%;
    max-width: 440px;
    padding: 8px 8px 12px;
    margin-inline: auto;
  }
}

@media (hover: hover) and (pointer: fine) {
  .btn-mode:hover {
    border-color: rgba(212, 168, 75, 0.45);
    background: rgba(247, 240, 225, 0.06);
  }
  .btn-mode:hover .mode-go {
    border-color: var(--gold);
  }
  .btn-mode-accent:hover {
    background: rgba(212, 168, 75, 0.16);
  }
  .btn-back:hover,
  .btn-settings-home:hover,
  .btn-menu:hover {
    color: var(--gold);
  }
  .settings-row:hover {
    background: var(--surface-press);
  }
  .settings-close:hover {
    background: var(--surface-press);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  #page-veil {
    transition: none !important;
  }
}

/*
 * ═══════════════════════════════════════════════════════════════════
 * iOS PWA « Sur l’écran d’accueil » — AUCUNE barre bas, réserve HAUT
 * ═══════════════════════════════════════════════════════════════════
 * Réfs :
 *  - WebKit viewport-fit=cover + env(safe-area-inset-*)
 *  - Karma (dev.to) : min-height: calc(100% + safe-area-inset-top)
 *    → empêche la bande bas sous black-translucent
 *  - Sebastix : black-translucent + padding-top SEULEMENT sur le header
 *
 * Double barre verte bas = padding-bottom: env(safe-area-inset-bottom)
 * empilé sur #screen-home + my-area + règles paysage. → forcé à 0.
 */
html.is-ios,
html.is-standalone {
  /* Zéro réserve bas : le feutre peint sous le home indicator */
  --safe-bottom: 0px !important;
  /* Karma hack : black-translucent sans ça = chin gap bas */
  min-height: calc(100% + env(safe-area-inset-top, 0px));
  height: -webkit-fill-available;
  background: #0c3b2e !important;
}

html.is-ios body,
html.is-standalone body {
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background: #0c3b2e !important;
  /* pas de position:fixed */
}

html.is-ios #app,
html.is-standalone #app {
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background: #0c3b2e !important;
}

/* Accueil : chrome bas (nav / theme-color) noir, pas feutre */
html.on-home,
html.on-home body,
html.on-home #app,
html.is-ios.on-home,
html.is-ios.on-home body,
html.is-ios.on-home #app,
html.is-standalone.on-home,
html.is-standalone.on-home body,
html.is-standalone.on-home #app {
  background: #000 !important;
}

/* Intro : bords physiques, fond uni — pas de bande */
html.is-ios .boot-intro,
html.is-standalone .boot-intro {
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0 !important;
  background: #0c3b2e !important;
}

html.is-ios .boot-intro-inner,
html.is-standalone .boot-intro-inner {
  /* Haut seulement (status) ; bas fixe petit, PAS safe-area */
  padding-top: max(24px, env(safe-area-inset-top, 0px), var(--safe-top, 0px)) !important;
  padding-bottom: 20px !important;
  padding-left: max(16px, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(16px, env(safe-area-inset-right, 0px)) !important;
}

/* Accueil : padding HAUT status bar, bas collé (0 safe-area) */
html.is-ios #screen-home,
html.is-standalone #screen-home {
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background: #0c3b2e !important;
  padding-top: max(12px, env(safe-area-inset-top, 0px), var(--safe-top, 0px)) !important;
  padding-bottom: 10px !important; /* PAS env(safe-area-inset-bottom) */
  padding-left: max(12px, env(safe-area-inset-left, 0px), var(--safe-left, 0px)) !important;
  padding-right: max(12px, env(safe-area-inset-right, 0px), var(--safe-right, 0px)) !important;
}

html.is-ios #screen-home .home-bg,
html.is-standalone #screen-home .home-bg {
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 100% !important;
}

/* Jeu iOS/PWA : bas collé ; haut = topbar noire (score + status) */
html.is-ios #screen-game,
html.is-standalone #screen-game {
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  height: var(--app-height, 100dvh);
  background: #0c3b2e !important;
  padding-bottom: 0 !important;
  padding-top: 0 !important;
}

html.is-ios .topbar,
html.is-standalone .topbar {
  padding-top: calc(8px + max(env(safe-area-inset-top, 0px), var(--safe-top, 0px))) !important;
  min-height: calc(var(--topbar-h) + max(env(safe-area-inset-top, 0px), var(--safe-top, 0px))) !important;
  background: #000000 !important;
  border-bottom: 1px solid rgba(212, 168, 75, 0.22);
}

/*
 * Android natif — bas collé au pixel (pas de « safe bottom »).
 * La réserve bas n’a d’intérêt que pour le home indicator iOS.
 * Sur Android immersif (nav masquée) elle ne fait qu’une bande feutre inutile.
 */
html.is-android.is-native,
html.is-android.is-native body,
html.is-android.is-native #app {
  height: 100% !important;
  min-height: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #0c3b2e !important;
}

html.is-android.is-native #screen-game,
html.is-android.is-native #screen-game.active {
  /* haut noir via .topbar, pas de padding feutre */
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  background: #0c3b2e !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: auto !important;
  width: auto !important;
}

html.is-android.is-native .topbar {
  padding-top: calc(8px + var(--safe-top)) !important;
  padding-bottom: 8px !important;
  min-height: calc(var(--topbar-h) + var(--safe-top)) !important;
  background: #000000 !important;
  border-bottom: 1px solid rgba(212, 168, 75, 0.2) !important;
}

/* Main collée au bord bas — 0 réserve */
html.is-android.is-native .my-area {
  padding: 2px 2px 8px !important;
  min-height: calc(var(--card-h) + 36px) !important;
}

html.is-android.is-native #screen-home,
html.is-android.is-native #screen-home.active {
  padding-bottom: 12px !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
}

html.is-android.is-native .home-card {
  padding-bottom: 88px !important;
}

html.is-android.is-native .home-web-invite {
  padding-bottom: 8px !important;
  bottom: 0 !important;
}

html.is-android.is-native .panel.sheet,
html.is-android.is-native .settings-panel,
html.is-android.is-native #panel-lobby.panel.sheet,
html.is-android.is-native #panel-result.panel.sheet {
  padding-bottom: 12px !important;
  bottom: 0 !important;
}

html.is-android.is-native #screen-game.is-bidding #panel-bid.panel.sheet {
  bottom: calc(var(--card-h) + 48px) !important;
  padding-bottom: 10px !important;
}

/* Annule toute règle responsive qui réintroduit safe-area bas sur Android */
html.is-android.is-native .panel.sheet,
html.is-android.is-native #panel-bid.panel.sheet,
html.is-android.is-native #panel-lobby.panel.sheet,
html.is-android.is-native #panel-result.panel.sheet {
  /* le calc(... + var(--safe-bottom)) devient +0 */
}

/* Main / sheets : PAS de safe-bottom (sinon 2e barre verte) */
html.is-ios .my-area,
html.is-standalone .my-area {
  padding-bottom: 8px !important;
}

html.is-ios .panel.sheet,
html.is-standalone .panel.sheet,
html.is-ios .settings-panel,
html.is-standalone .settings-panel {
  padding-bottom: 16px !important;
}

html.is-ios #panel-bid.panel.sheet,
html.is-standalone #panel-bid.panel.sheet {
  bottom: calc(var(--card-h) + 56px) !important;
}

/* Annuler toutes les règles paysage qui forcent env(safe-area-inset-bottom) */
@media (orientation: landscape) {
  html.is-ios #screen-home,
  html.is-standalone #screen-home {
    padding-top: max(12px, env(safe-area-inset-top, 0px), var(--safe-top, 0px)) !important;
    padding-bottom: 8px !important;
  }
  html.is-ios .boot-intro-inner,
  html.is-standalone .boot-intro-inner {
    padding-bottom: 12px !important;
  }
  html.is-ios .my-area,
  html.is-standalone .my-area {
    padding-bottom: 6px !important;
  }
  html.is-ios .settings-overlay,
  html.is-standalone .settings-overlay {
    padding-bottom: 10px !important;
  }
}

/* display-mode standalone (manifest) — même règles si classe JS absente */
@media (display-mode: standalone), (display-mode: fullscreen) {
  html {
    --safe-bottom: 0px !important;
    min-height: calc(100% + env(safe-area-inset-top, 0px));
    background: #0c3b2e !important;
  }
  html.on-home {
    background: #000 !important;
  }
  #screen-home {
    padding-bottom: 10px !important;
  }
  .my-area {
    padding-bottom: 8px !important;
  }
}

/* ═══════════════════════════════════════════
   PC navigateur — plein écran visible
   Classe .is-desktop posée en JS (souris + ≥1024×680).
   iOS / Android / natif : aucune de ces règles.
═══════════════════════════════════════════ */
html.is-desktop {
  --app-height: 100dvh;
  --card-w: clamp(108px, min(15.5vmin, (100vw - 96px) / 6.4), 158px);
  --card-h: calc(var(--card-w) * var(--card-ratio));
  --card-radius: calc(var(--card-w) * 0.06);
  --hand-overlap: calc(var(--card-w) * 0.48);
  --hand-area-h: calc(var(--card-h) + 36px);
}

html.is-desktop,
html.is-desktop body,
html.is-desktop #app {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

html.is-desktop #screen-home.active,
html.is-desktop #screen-game.active {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

/* Annule les marges paysage iPhone (island 64px) */
html.is-desktop #screen-home {
  padding: 24px 32px !important;
}

html.is-desktop .home-card,
html.is-desktop .home-card.home-stack {
  max-width: min(560px, calc(100vw - 64px)) !important;
  width: 100% !important;
}

html.is-desktop .settings-overlay {
  padding: 24px !important;
}

html.is-desktop .toast {
  left: auto !important;
  right: auto !important;
  max-width: min(420px, calc(100vw - 48px)) !important;
}

html.is-desktop .trick {
  width: calc(var(--card-w) * 2.45);
  height: calc(var(--card-h) * 1.65);
  top: 50%;
}

html.is-desktop .seat-north { top: 14px; }
html.is-desktop .seat-east { right: 22px; top: 48%; }
html.is-desktop .seat-west { left: 22px; top: 48%; }

html.is-desktop .avatar {
  width: 46px;
  height: 46px;
  font-size: 1rem;
}

html.is-desktop .my-area {
  padding-left: 20px !important;
  padding-right: 20px !important;
  padding-bottom: 12px !important;
}

html.is-desktop #panel-bid.panel {
  bottom: calc(var(--card-h) + 76px);
  width: min(400px, calc(100% - 48px));
}

/* collect-ghost-fix 20260719 + pwa-only-top 20260804 */

