/* Bridge SEF mobile — tapis vert, cartes, boîte d'enchères. */
:root {
  --tapis: #0d3b26;
  --tapis2: #0a2f1e;
  --or: #f2a73b;
  --vert: #13a538;
  --rouge-vul: #c62828;
  --texte: #f4f1e8;
  --echelle: 1;
  /* couleurs des 4 couleurs (jeu « 4 couleurs » par défaut, comme l'exemple) */
  --c0: #1d6fa5;   /* ♣ */
  --c1: #e58a00;   /* ♦ */
  --c2: #d81b25;   /* ♥ */
  --c3: #141414;   /* ♠ */
}
body.deux-couleurs { --c0: #141414; --c1: #d81b25; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: radial-gradient(ellipse at 50% 40%, #145236 0%, var(--tapis) 55%, var(--tapis2) 100%);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#scene {
  position: fixed;
  top: env(safe-area-inset-top); bottom: env(safe-area-inset-bottom);
  left: env(safe-area-inset-left); right: env(safe-area-inset-right);
  overflow: hidden; overflow: clip;  /* clip : l'éventail qui dépasse en bas ne fait pas défiler l'écran */
}
.abs { position: absolute; }

/* ------------------------------------------------------------- En-tête */
.entete {
  position: absolute; left: 0; right: 0; top: 0; height: 42px;
  display: flex; align-items: center; gap: 6px; padding: 0 6px 0 12px;
  background: rgba(0, 0, 0, .28);
  font-size: calc(14px * var(--echelle));
}
.entete .info { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete .info b { color: var(--or); font-weight: 700; }
.bouton-icone {
  width: 38px; height: 38px; border: 0; border-radius: 10px; padding: 7px;
  background: rgba(255, 255, 255, .08); color: var(--texte);
  display: grid; place-items: center; cursor: pointer;
}
.bouton-icone:active { background: rgba(255, 255, 255, .22); }
.bouton-icone svg { width: 22px; height: 22px; }

/* ------------------------------------------------------------- Cartes */
.carte {
  position: absolute; width: var(--cw); height: calc(var(--cw) * 1.45);
  background: #fffdf8; border-radius: calc(var(--cw) * .08);
  border: 1px solid #b9b4a8; box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
  color: var(--coul); overflow: hidden;
  font-family: "Georgia", "Times New Roman", serif;
  transition: transform .18s ease, filter .18s;
}
.carte.s0 { --coul: var(--c0); } .carte.s1 { --coul: var(--c1); }
.carte.s2 { --coul: var(--c2); } .carte.s3 { --coul: var(--c3); }
.coin {
  position: absolute; top: calc(var(--cw) * .04); width: calc(var(--cw) * .26);
  display: flex; flex-direction: column; align-items: center; line-height: .95;
}
.coin.hg { left: calc(var(--cw) * .02); }
.coin.hd { right: calc(var(--cw) * .02); }
.coin.bd { right: calc(var(--cw) * .02); top: auto; bottom: calc(var(--cw) * .04); transform: rotate(180deg); }
.coin b { font-size: calc(var(--cw) * .25); font-weight: 700; letter-spacing: -.06em; font-family: system-ui, Arial, sans-serif; }
.coin i { font-style: normal; font-size: calc(var(--cw) * .2); }
.pip { position: absolute; font-size: calc(var(--cw) * .25); line-height: 1; transform: translate(-50%, -50%); }
.pip.inv { transform: translate(-50%, -50%) rotate(180deg); }
.pip.as { font-size: calc(var(--cw) * .62); }
.figure {
  position: absolute; left: 22%; right: 22%; top: 16%; bottom: 16%;
  border: calc(var(--cw) * .02) solid var(--coul); border-radius: calc(var(--cw) * .05);
  background: linear-gradient(160deg, #fff6dd, #f3dfae);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.figure .lettre { font-size: calc(var(--cw) * .42); font-weight: 700; line-height: 1; }
.figure .couronne { font-size: calc(var(--cw) * .2); color: #b8860b; line-height: 1; }
.figure .sym { font-size: calc(var(--cw) * .22); line-height: 1; }

.carte.img { background: none; border: 0; box-shadow: none; overflow: visible; filter: drop-shadow(0 1px 2px rgba(0,0,0,.55)); }
.carte.img img { width: 100%; height: 100%; display: block; pointer-events: none; }
.carte.img.terne { filter: brightness(.72) saturate(.7) drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.dos-img { position: absolute; overflow: hidden; border-radius: 5px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.dos-img img { position: absolute; display: block; }
.dos {
  position: absolute; border-radius: 6px; border: 2px solid #c8a650;
  background:
    repeating-linear-gradient(45deg, rgba(200, 166, 80, .35) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(200, 166, 80, .35) 0 2px, transparent 2px 7px),
    #1b2a55;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.carte.jouable { cursor: pointer; }
.carte.jouable.colonne { box-shadow: 0 0 0 2px var(--or), 0 1px 3px rgba(0,0,0,.5); }
.carte.terne { filter: brightness(.72) saturate(.7); }
.carte.conseil { animation: pulse 0.7s ease-in-out 3; box-shadow: 0 0 0 3px #39e05b, 0 0 14px #39e05b; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px #39e05b, 0 0 24px #39e05b; } }
.carte.posee { animation: poser .22s ease-out; }
@keyframes poser { from { opacity: 0; scale: .7; } to { opacity: 1; scale: 1; } }

/* ------------------------------------------------------------- Cadre et étiquettes */
.cadre { position: absolute; border: 3px solid #b8761c; border-radius: 4px; pointer-events: none; }
.etiquette {
  position: absolute; display: flex; align-items: stretch; height: 30px;
  background: #1c2024; border-radius: 6px; overflow: hidden; white-space: nowrap;
  font-size: calc(17px * var(--echelle)); box-shadow: 0 1px 4px rgba(0,0,0,.5);
  transform: translate(-50%, -50%);
}
.etiquette .siege {
  width: 30px; display: grid; place-items: center; font-weight: 700; color: #fff;
  background: var(--vert); text-decoration: none;
}
.etiquette .siege.vul { background: var(--rouge-vul); }
.etiquette .siege.donneur { text-decoration: underline; text-underline-offset: 3px; }
.etiquette .nom { padding: 0 10px; display: grid; place-items: center; }
.etiquette.humain .nom { background: #e8892a; color: #fff; }
.etiquette.actif { outline: 2px solid #ffe066; }
.etiquette.verticale { flex-direction: column; height: auto; width: 30px; }
.etiquette.verticale .siege { height: 30px; width: 30px; }
.etiquette.verticale .nom { writing-mode: vertical-rl; padding: 10px 0; }
.etiquette.verticale.gauche { flex-direction: column-reverse; }
.etiquette.verticale.gauche .nom { transform: rotate(180deg); }
.badge-contrat {
  display: grid; place-items: center; padding: 0 8px; font-weight: 800;
  background: #cfe6ff; color: #0b3d91; font-size: calc(17px * var(--echelle));
}
.badge-contrat .s2, .badge-contrat .s1 { color: var(--c2); }
.etiquette.verticale .badge-contrat { padding: 5px 0; font-size: calc(13px * var(--echelle)); }

.compte { position: absolute; color: var(--or); font-size: calc(20px * var(--echelle)); font-weight: 600; line-height: 1.05; }

/* ------------------------------------------------------------- Bulles d'enchères */
.bulle {
  position: absolute; padding: 3px 9px; border-radius: 7px; transform: translate(-50%, -50%);
  background: #e9edf2; color: #111; font-weight: 800; font-size: calc(18px * var(--echelle));
  box-shadow: 0 1px 4px rgba(0,0,0,.5); white-space: nowrap;
}
.bulle.passe { background: var(--vert); color: #fff; font-size: calc(13px * var(--echelle)); }
.bulle.contre { background: #7a2d1c; color: #ffd9cf; }
.bulle.surcontre { background: #0f6f78; color: #d3fbff; }

/* ------------------------------------------------------------- Tableau des enchères */
.tab-encheres {
  position: absolute; border-collapse: collapse; font-size: calc(16px * var(--echelle));
  background: rgba(0, 0, 0, .22); border-radius: 8px; overflow: hidden;
}
.tab-encheres th { font-weight: 600; color: #cfd8d2; padding: 4px 0; font-size: calc(13px * var(--echelle)); }
.tab-encheres th.vul { color: #ff8a80; }
.tab-encheres td { text-align: center; padding: 2px 0; height: 26px; font-weight: 700; }
.tab-encheres td.annonce { cursor: pointer; }
.tab-encheres td.derniere span { outline: 2px solid var(--or); border-radius: 5px; padding: 0 5px; }
.tab-encheres td .passe { color: #8fe3a2; font-weight: 600; font-size: .85em; }
.sym.s0 { color: #6fc3ff; } .sym.s1 { color: #ffb347; } .sym.s2 { color: #ff6b6b; } .sym.s3 { color: #f4f1e8; }
body.deux-couleurs .sym.s0 { color: #f4f1e8; } body.deux-couleurs .sym.s1 { color: #ff6b6b; }
.sym.s4 { color: #9cc9ff; }

/* ------------------------------------------------------------- Boîte d'enchères */
.boite { position: absolute; }
.tuile {
  position: absolute; display: grid; place-items: center; border-radius: 9px; cursor: pointer;
  font-weight: 900; border: 2px solid rgba(0, 0, 0, .55);
  font-size: calc(var(--th) * .62); letter-spacing: -.03em;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15);
}
.tuile small { font-size: .55em; font-weight: 900; }
.tuile.t4 { background: #cfe6ff; color: #0b3d91; }
.tuile.t3 { background: #c4c9d3; color: #10141c; }
.tuile.t2 { background: #ffc8ce; color: #c4001a; }
.tuile.t1 { background: #ffd8a3; color: #d06400; }
.tuile.t0 { background: #d6e6ef; color: #1d5f8a; }
body.deux-couleurs .tuile.t0 { background: #e3e6ea; color: #111; }
body.deux-couleurs .tuile.t1 { background: #ffd2d6; color: #c4001a; }
.tuile.choisie, .choisie { outline: 4px solid var(--or); outline-offset: 1px; z-index: 2; transform: scale(1.06); }
.tuile:active { filter: brightness(.9); }
.bouton-passe, .bouton-x, .bouton-xx {
  position: absolute; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  font-weight: 900; border: 2px solid rgba(0,0,0,.5); font-size: calc(var(--th) * .7);
}
.bouton-passe { background: var(--vert); color: #fff; font-family: Georgia, serif; letter-spacing: .02em; }
.bouton-x { background: #7a2d1c; color: #f0c2b6; }
.bouton-xx { background: #0f6f78; color: #c9f6fb; }
.desactive { opacity: .32; pointer-events: none; }
.info-boite { position: absolute; color: var(--or); font-size: calc(17px * var(--echelle)); white-space: nowrap; text-align: center; }

.bandeau {
  position: absolute; left: 8px; right: 8px; z-index: 20;
  background: #fffbe9; color: #222; border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.55); font-size: calc(16px * var(--echelle));
  display: flex; gap: 10px; align-items: center;
}
.bandeau .texte { flex: 1; line-height: 1.25; }
.bandeau .texte b { font-size: 1.1em; }
.bandeau button {
  border: 0; border-radius: 9px; padding: 10px 12px; font-weight: 800; font-size: calc(15px * var(--echelle));
  background: var(--vert); color: #fff; white-space: nowrap;
}
.bandeau button.secondaire { background: #ddd; color: #333; }

/* ------------------------------------------------------------- Mains en texte (initiation) */
.main-texte {
  position: absolute; background: rgba(255,255,255,.92); color: #111; border-radius: 8px;
  padding: 4px 6px; font-size: calc(13px * var(--echelle)); line-height: 1.3; font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.main-texte .titre { font-size: .8em; color: #555; font-weight: 700; }
.main-texte .s0 { color: var(--c0); } .main-texte .s1 { color: var(--c1); }
.main-texte .s2 { color: var(--c2); } .main-texte .s3 { color: var(--c3); }
.etiquette-mort { position: absolute; font-size: calc(13px * var(--echelle)); color: #cfe3d6; font-weight: 600; }

/* ------------------------------------------------------------- Message flottant */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 40; max-width: 92%;
  background: rgba(20, 24, 28, .95); color: #fff; padding: 10px 14px; border-radius: 12px;
  font-size: calc(15px * var(--echelle)); box-shadow: 0 4px 16px rgba(0,0,0,.5); text-align: center;
}
.attente { position: absolute; color: #cfe3d6; font-size: calc(14px * var(--echelle)); transform: translate(-50%, -50%); opacity: .85; }

/* ------------------------------------------------------------- Feuilles (fenêtres) */
.voile { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.feuille {
  width: 100%; max-width: 640px; max-height: 88%; display: flex; flex-direction: column;
  background: #f7f5ef; color: #1d1d1d; border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: monter .2s ease-out;
  font-size: calc(16px * var(--echelle));
}
@keyframes monter { from { transform: translateY(40%); opacity: .4; } }
.feuille header { display: flex; align-items: center; padding: 12px 10px 8px 16px; border-bottom: 1px solid #ddd8cc; }
.feuille header h2 { flex: 1; margin: 0; font-size: 1.15em; }
.feuille header button { border: 0; background: #e6e2d8; border-radius: 50%; width: 36px; height: 36px; font-size: 20px; }
.feuille .contenu { overflow-y: auto; padding: 12px 16px 18px; -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.feuille .pied { display: flex; gap: 10px; padding: 10px 16px 14px; border-top: 1px solid #ddd8cc; }
.feuille .pied button, .gros-bouton {
  flex: 1; border: 0; border-radius: 12px; padding: 14px 10px; font-size: calc(16px * var(--echelle)); font-weight: 700;
  background: var(--vert); color: #fff;
}
.feuille .pied button.secondaire, .gros-bouton.secondaire { background: #e1ddd2; color: #222; }
.menu-liste { list-style: none; margin: 0; padding: 0; }
.menu-liste li {
  display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid #e6e1d6; cursor: pointer;
}
.menu-liste li:active { background: #ece7da; }
.menu-liste li svg { width: 24px; height: 24px; flex: none; color: #0d3b26; }
.menu-liste li .lib { flex: 1; }
.menu-liste li .aide { color: #777; font-size: .82em; }
.menu-liste li.coche .lib::after { content: "  ✓"; color: var(--vert); font-weight: 800; }

.tableau { width: 100%; border-collapse: collapse; font-size: .95em; }
.tableau th, .tableau td { padding: 6px 4px; border-bottom: 1px solid #e3ded2; text-align: center; }
.tableau th { color: #555; font-weight: 600; font-size: .85em; }
.tableau .pos { color: #0a7a2a; font-weight: 700; } .tableau .neg { color: #b3261e; font-weight: 700; }
.coul.s0 { color: var(--c0); } .coul.s1 { color: var(--c1); } .coul.s2 { color: var(--c2); } .coul.s3 { color: var(--c3); } .coul.s4 { color: #0b3d91; }

.diagramme { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto auto; gap: 4px; margin: 8px 0; font-weight: 600; }
.diagramme .m { background: #fff; border: 1px solid #ddd6c6; border-radius: 8px; padding: 4px 6px; line-height: 1.35; font-size: .92em; }
.diagramme .m .t { color: #777; font-size: .8em; }
.diagramme .n { grid-column: 2; grid-row: 1; } .diagramme .o { grid-column: 1; grid-row: 2; }
.diagramme .e { grid-column: 3; grid-row: 2; } .diagramme .s { grid-column: 2; grid-row: 3; }
.diagramme .centre { grid-column: 2; grid-row: 2; display: grid; place-items: center; background: #0d3b26; color: var(--or); border-radius: 8px; font-weight: 800; text-align: center; font-size: .9em; padding: 4px; }
.resume { font-size: 1.15em; font-weight: 800; margin: 2px 0 6px; }
.detail { color: #444; font-size: .92em; margin: 0 0 8px; padding-left: 18px; }
.reglage { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid #e6e1d6; }
.reglage label { flex: 1; }
.reglage select, .reglage input[type=text] { font-size: 1em; padding: 6px 8px; border-radius: 8px; border: 1px solid #ccc; max-width: 55%; }
.reglage input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--vert); }
.note { color: #666; font-size: .88em; line-height: 1.4; }
.encadre { background: #fff; border: 1px solid #ddd6c6; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.levee-derniere { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.levee-derniere div { text-align: center; font-weight: 700; }
.levee-derniere .gagne { background: #fff1c9; border-radius: 8px; }
.devise { text-align: center; color: #0d3b26; font-weight: 700; letter-spacing: .04em; margin-top: 10px; }
