/* ==========================================================================
   Présages en ligne — même logique de table que Mindbug (pièce éclairée, tapis, objets posés,
   consigne sur carton), aux couleurs du jeu : bleu nuit, or, papier crème, les 4 couleurs des cartes.
   ========================================================================== */
@font-face { font-family: "Young Serif"; src: url("fonts/young-serif.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }

:root {
  --night: #131a3d;
  --night-2: #1d2654;
  --gold: #f4b43c;
  --gold-deep: #b5781a;
  --paper: #f4ecd9;
  --paper-2: #e6d8b6;
  --ink: #1b1f3f;
  --muted: #b7b4d6;
  --vert: #3fb37f;
  --jaune: #f4a62a;
  --rouge: #e9334b;
  --bleu: #2bb1e6;
  --laurel: #5a54b5;
  --serif: "Young Serif", Georgia, serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --card-ratio: 1.725;   /* hauteur / largeur des cartes */
  --hand-w: clamp(84px, 13vh, 150px);
  --slot-w: 9.85cqw;     /* emplacement des cartes jouées sur le tapis (×1,9 par rapport au plateau d'origine) */
  --team-w: 6.2cqw;      /* la carte d'équipe (avec l'aide des couleurs) */
  --discard-w: 6.75cqw;  /* la défausse, en bas à gauche */
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  color: var(--paper); font: 600 15px/1.4 var(--body); overflow: hidden;
  background:
    radial-gradient(70vw 60vh at 50% 40%, #ffd79a1f, transparent 70%),
    radial-gradient(130vw 100vh at 50% 50%, transparent 40%, #04061ae6 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='12' cy='18' r='1' opacity='.35'/%3E%3Ccircle cx='70' cy='40' r='.8' opacity='.25'/%3E%3Ccircle cx='100' cy='95' r='1.1' opacity='.3'/%3E%3Ccircle cx='40' cy='88' r='.7' opacity='.2'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(#0d1233, #070a20);
}
[hidden] { display: none !important; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
a { color: inherit; }
.lamp { position: fixed; left: 50%; top: -35vh; width: 120vw; height: 90vh; translate: -50% 0; pointer-events: none;
  background: radial-gradient(closest-side, #ffe2a81c, transparent); }

/* ---------- Boutons : jetons dorés ou cartons ---------- */
button { cursor: pointer; font-family: var(--serif); font-size: 16px; color: var(--ink);
  padding: 8px 18px 7px; border-radius: 10px; border: 0; border-bottom: 4px solid #a8946a;
  background: linear-gradient(var(--paper), var(--paper-2)); box-shadow: 0 6px 14px #0007; transition: translate .08s, filter .12s; }
button:hover { filter: brightness(1.07); }
button:active { translate: 0 3px; border-bottom-width: 1px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.gold { background: linear-gradient(#ffd77a, var(--gold)); border-bottom-color: var(--gold-deep); }
button.big { width: 100%; font-size: 19px; padding: 11px 18px 9px; }
button.link { background: none; border: 0; box-shadow: none; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; }
input { background: #0c1130; color: var(--paper); border: 2px solid #3c4579; border-radius: 10px; padding: 9px 12px; font-weight: 700; }
input:focus { outline: none; border-color: var(--gold); }

/* Feuille de papier sombre bordée d'or (comme le cadre des cartes) */
.sheet { background: linear-gradient(#1b2350f5, #121940f5); border: 2px solid var(--gold); border-radius: 18px;
  box-shadow: 0 0 0 5px #0b0f2a, 0 0 0 6px #f4b43c55, 0 30px 70px #000c; padding: 26px 30px 22px; }

/* ---------- Accueil ---------- */
.screen { position: relative; height: 100%; }
#lobby, #waiting { display: grid; place-items: center; padding: 3vh 16px; overflow: auto; }
#lobby .sheet { width: min(430px, 94vw); text-align: center; position: relative; }
.lobbyCard { width: 108px; margin: -86px auto 6px; display: block; border-radius: 9px; rotate: -6deg;
  box-shadow: 0 0 0 3px var(--gold), 0 18px 30px #000c; }
h1 { margin: 6px 0 0; font: 400 clamp(44px, 7vw, 60px)/1 var(--serif); color: var(--gold); letter-spacing: .02em; }
h2 { margin: 0; font: 400 28px var(--serif); color: var(--gold); }
.sub { color: var(--muted); margin: 8px 0 20px; }
.field { display: block; text-align: left; margin: 12px 0 0; color: var(--gold); font-family: var(--serif); font-size: 14px; }
.field input { width: 100%; margin-top: 5px; font-size: 17px; }
.seg { display: flex; gap: 8px; margin-top: 6px; }
.seg button { flex: 1; font-size: 20px; background: #0c1130; color: var(--paper); border-bottom-color: #070a20; box-shadow: none; outline: 2px solid #3c4579; }
.seg button[aria-checked="true"] { background: linear-gradient(#ffd77a, var(--gold)); color: var(--ink); outline-color: var(--gold); }
#create { margin-top: 18px; }
.or { margin: 16px 0 8px; color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
#code { text-transform: uppercase; text-align: center; letter-spacing: 6px; font: 400 20px var(--serif); }
.links { display: flex; justify-content: center; gap: 18px; margin: 18px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- Salon d'attente ---------- */
#waiting .sheet { width: min(520px, 94vw); text-align: center; }
.code { font: 400 58px var(--serif); letter-spacing: 12px; color: var(--gold); margin: 2px 0 14px; text-shadow: 0 0 30px #f4b43c66; }
#seats { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; text-align: left; }
#seats li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; background: #0c1130; border: 1px solid #333c70; }
#seats li .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 400 14px var(--serif); color: var(--ink); background: var(--gold); }
#seats li.empty { color: var(--muted); border-style: dashed; }
#seats li .tag { margin-left: auto; font-size: 12px; color: var(--muted); }
#seats li button { margin-left: auto; font-size: 12px; padding: 3px 10px 2px; border-bottom-width: 2px; }
.hint { color: var(--muted); font-size: 14px; }
#settings { text-align: left; margin: 4px 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid #333c70; background: #0c113099; }
#settings h3 { margin: 0 0 4px; font: 400 17px var(--serif); color: var(--gold); }
#settings .field { margin-top: 4px; }
#settings select { width: 100%; margin-top: 6px; padding: 8px 10px; border-radius: 10px; border: 2px solid #3c4579; background: #0c1130; color: var(--paper); font: 700 15px var(--body); }
#settings select:disabled { opacity: .8; }
#settings .hint { margin: 6px 0 10px; font-size: 13px; }

/* ---------- Table ---------- */
#game { display: grid; grid-template-rows: 1fr auto auto; height: 100dvh; padding: 0 1.4vw; }
#roundInfo { font: 400 17px var(--serif); color: var(--gold); }
#teams { display: flex; gap: 14px; }
.teamChip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: #0c1130cc; border: 1px solid #3c4579; font-size: 13px; }
.teamChip img { width: 26px; height: 26px; }
.teamChip .wins { display: flex; gap: 3px; }
.teamChip .wins i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--gold); }
.teamChip .wins i.on { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.teamChip.mine { border-color: var(--gold); }

/* Bandeau de gauche (manche, équipes, dernier pli) et son bouton */
#drawerBtn { position: absolute; top: 8px; left: 1.2vw; z-index: 30; height: 44px; padding: 0 16px 0 12px; border-radius: 22px;
  display: flex; align-items: center; gap: 8px; font: 400 16px var(--serif); }
#drawerBtn svg { width: 22px; height: 22px; }
#drawer { position: fixed; z-index: 76; left: 0; top: 0; bottom: 0; width: min(330px, 86vw); padding: 18px 18px 22px; overflow: auto;
  display: flex; flex-direction: column; gap: 12px; color: var(--paper);
  background: linear-gradient(#1b2350fa, #10163cfa); border-right: 2px solid var(--gold); box-shadow: 0 0 0 4px #0b0f2a, 20px 0 50px #000c;
  translate: -105% 0; transition: translate .3s cubic-bezier(.3,.8,.3,1); }
#drawer.open { translate: 0 0; }
#drawer header { display: flex; align-items: center; justify-content: space-between; }
#drawer h2 { font-size: 26px; }
#drawer h3 { margin: 4px 0 0; font: 400 17px var(--serif); color: var(--gold); }
#drawerClose { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; }
#drawer #teams { display: flex; flex-direction: column; gap: 8px; }
#drawer .teamChip { padding: 8px 12px 8px 8px; border-radius: 14px; font-size: 14px; }
#drawer .teamChip img { width: 42px; height: 42px; }
#drawer .teamText { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
#drawer .teamText b { font: 400 15px var(--serif); color: var(--gold); }
#drawer #trickBtn { font-size: 15px; padding: 9px 14px 7px; }
#drawer .hint { margin-top: auto; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { #drawer { transition: none; } }

/* Fenêtre des actions spéciales, au centre du tapis */
#actionBox { position: absolute; left: 47.6%; top: 50%; translate: -50% -50%; z-index: 6; width: min(30cqw, 420px); padding: 1.4cqw 1.8cqw 1.6cqw; text-align: center;
  background: linear-gradient(#1b2350f8, #121940f8); border: .2cqw solid var(--gold); border-radius: 1.2cqw; box-shadow: 0 0 0 .5cqw #0b0f2a, 0 2cqw 5cqw #000d; }
#actionBox h3 { margin: 0; font: 400 clamp(18px, 2.2cqw, 28px) var(--serif); color: var(--gold); }
#actionBox p { margin: .6cqw 0 1cqw; font-size: clamp(13px, 1.25cqw, 17px); }
#actionDrop { padding: 1.4cqw 1cqw; border: .2cqw dashed #f4b43c99; border-radius: .9cqw; color: var(--muted); font: 700 clamp(13px, 1.2cqw, 16px) var(--body); }
#actionBox.dropping #actionDrop { border-color: var(--bleu); color: var(--paper); background: #2bb1e622; }
#actionBox.dropping { box-shadow: 0 0 0 .5cqw #0b0f2a, 0 0 3cqw #2bb1e6; }
#actionButtons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#actionButtons button { font-size: clamp(13px, 1.2cqw, 16px); }
#actionBox:not([hidden]) ~ #clock { opacity: .25; }

/* Le tapis : le plateau du jeu, légèrement incliné */
#matWrap { min-height: 0; display: grid; place-items: center; perspective: 1600px; padding: 9vh 0 1vh; }
/* le cadre du tapis : le tapis, et derrière lui les cartes tenues par les autres joueurs */
#matBox { position: relative; aspect-ratio: 5000 / 2954; height: min(100%, calc((100vw - 22vw) / 1.6926)); max-width: 100%; container-type: size; }
#handsLayer { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
#mat { position: absolute; inset: 0; z-index: 1;
  background: var(--mat, url("img/plateau-6.jpg")) center / 100% 100% no-repeat; border-radius: 2.2% / 3.7%;
  box-shadow: 0 26px 60px #000d, 0 6px 14px #0009; transform: rotateX(8deg); transform-origin: 50% 80%;
  --cw: calc(100cqw * 0.068); container-type: size; }
/* une place autour de la table : plaque + carte posée, positionnées en % du plateau */
#seatLayer { position: absolute; inset: 0; }
.seat { position: absolute; inset: 0; pointer-events: none; }
.seat > * { pointer-events: auto; }
.slot { position: absolute; width: var(--slot-w); aspect-ratio: 1 / var(--card-ratio); translate: -50% -50%; border-radius: .4cqw; }
.slot.dropHere { box-shadow: 0 0 0 .3cqw var(--bleu), 0 0 3cqw #2bb1e6; }
/* la carte d'équipe, sur l'emplacement au rond (à l'envers pour les places d'en face, comme sur le plateau) */
.teamCard { position: absolute; width: var(--team-w); aspect-ratio: 1 / var(--card-ratio); translate: -50% -50%; border-radius: .4cqw;
  background: center / cover no-repeat; box-shadow: 0 .4cqw 1cqw #000a; }
.teamCard.flip { rotate: 180deg; }
.slot.turn { box-shadow: 0 0 0 .25cqw var(--gold), 0 0 2.2cqw #f4b43ccc; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 .25cqw var(--gold), 0 0 3.4cqw #f4b43c; } }
.slot.target { cursor: pointer; box-shadow: 0 0 0 .3cqw var(--bleu), 0 0 2.4cqw #2bb1e6; }
.plate { position: absolute; translate: -50% -50%; z-index: 2; display: flex; align-items: center; gap: .6cqw; white-space: nowrap;
  padding: .35cqw 1cqw .35cqw .35cqw; border-radius: 999px; color: var(--ink);
  background: linear-gradient(var(--paper), var(--paper-2)); box-shadow: 0 .4cqw 1cqw #000a; font-size: 1.15cqw; }
.plate img { width: 2.6cqw; height: 2.6cqw; filter: drop-shadow(0 .1cqw .25cqw #0008); }
.plate .who { font: 400 1.35cqw var(--serif); max-width: 11cqw; overflow: hidden; text-overflow: ellipsis; }
.plate .count { display: flex; align-items: center; gap: .3cqw; font-weight: 800; color: #4b4a6e; }
.plate .count::before { content: ""; width: 1cqw; height: 1.6cqw; border-radius: .2cqw; background: url("img/back.jpg") center / cover; box-shadow: 0 0 0 .1cqw var(--gold); }
.plate.beside { translate: 0 -50%; }
.plate.beside img { display: none; }   /* la carte d'équipe juste à côté suffit */
.plate.beside .who { max-width: 8.5cqw; }
.plate.me { background: linear-gradient(#ffe4a0, var(--gold)); }
.plate.off .who { opacity: .5; }
.plate.target { cursor: pointer; outline: .3cqw solid var(--bleu); }
.plate .lead { font-size: 1cqw; color: var(--gold-deep); }

/* Cartes */
.card { position: relative; display: block; aspect-ratio: 1 / var(--card-ratio); border-radius: 6% / 3.5%; background: var(--night) center / cover no-repeat;
  box-shadow: 0 .5em 1.2em #000b; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; container-type: inline-size; }
/* Texte court et gros posé sur le cartouche de l'image (l'icône éclair/sablier reste visible à gauche) */
.card .txt { position: absolute; left: 17.5%; right: 3.2%; top: 82.2%; bottom: 2.2%; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0 1.5cqw; background: #eeead1; border-radius: 0 0 5cqw 0; color: #1b1f3f;
  font: 800 9.4cqw/1.04 var(--body); letter-spacing: -.01em; overflow: hidden; pointer-events: none; }
.card .txt.long { font-size: 7.7cqw; line-height: 1.02; }
.card .txt.xlong { font-size: 7cqw; line-height: 1.02; }
.card .txt b { font-weight: 1000; color: #0b0d24; }
@container (max-width: 58px) { .txt { display: none; } }   /* trop petite pour être lue : l'image seule */
.card.zoomable { cursor: zoom-in; }
.slot .card { width: 100%; }
.card.back { background-image: url("img/back.jpg"); }
.card.win { box-shadow: 0 0 0 3px var(--gold), 0 0 26px var(--gold); }
.card.out { filter: grayscale(.6) brightness(.7); }

/* Les cartes que tiennent les autres joueurs : debout derrière le tapis, de dos, comme à une vraie table */
.oppHand { position: absolute; display: flex; align-items: flex-end; }
.oppHand i { width: 6.2cqw; aspect-ratio: 1 / var(--card-ratio); margin-left: -3.9cqw; border-radius: .45cqw; background: url("img/back.jpg") center / cover;
  box-shadow: -.3cqw 0 .8cqw #000a, 0 0 0 .12cqw #f4b43c66; rotate: calc(var(--o) * 3deg); transform-origin: 50% 170%; translate: 0 calc(var(--o) * var(--o) * .12cqw); }
.oppHand i:first-child { margin-left: 0; }
.oppHand.top { translate: -50% -100%; }
.oppHand.side { transform: translate(-50%, -50%) rotate(var(--r)); }
.teamCard { cursor: zoom-in; pointer-events: auto; }

/* Sur ordinateur, les cartes tenues sont derrière le tapis ; l'éventail sur le tapis ne sert que sur téléphone */
.fan { display: none; }
/* Cartes en main des autres joueurs, de dos, en éventail */
.fan { position: absolute; translate: -50% -50%; align-items: flex-end; pointer-events: none; z-index: 1; }
.fan i { width: 1.9cqw; aspect-ratio: 1 / var(--card-ratio); margin: 0 -.5cqw; border-radius: .2cqw; background: url("img/back.jpg") center / cover;
  box-shadow: 0 .15cqw .4cqw #000b, 0 0 0 .08cqw #f4b43c88; rotate: calc(var(--o) * 7deg); transform-origin: 50% 130%; translate: 0 calc(var(--o) * var(--o) * .12cqw); }

/* En direct : la carte qui remporterait le tour, celles qui seraient défaussées */
.slot.leading { box-shadow: 0 0 0 .3cqw var(--gold), 0 0 2.6cqw #f4b43c; }
.slot.doomed .card { filter: saturate(.7) brightness(.8); }
.slot.discarding { box-shadow: 0 0 0 .3cqw var(--rouge), 0 0 2.6cqw #e9334b; }
.liveTag { position: absolute; translate: -50% -50%; z-index: 3; white-space: nowrap; pointer-events: none;
  padding: .2cqw .8cqw; border-radius: 99px; font: 800 1.05cqw var(--body); background: #3b1220e6; color: #ffb3bf; border: .1cqw solid #e9334b; }
.liveTag.lead { background: linear-gradient(#ffd77a, var(--gold)); color: var(--ink); border-color: #fff3c4; }

/* Chronomètre au centre, avec la flèche vers celui qui doit jouer */
#clock { position: absolute; left: 47.6%; top: 50%; translate: -50% -50%; width: 8.2cqw; aspect-ratio: 1; z-index: 2; pointer-events: none; }
#clockFace { position: absolute; inset: 0; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle at 50% 35%, #26307a, #10153c); border: .25cqw solid var(--gold);
  box-shadow: 0 0 0 .4cqw #0b0f2acc, 0 .8cqw 2cqw #000c; }
#clockTime { font: 400 2.6cqw/1 var(--serif); color: var(--paper); }
#clockWho { display: block; max-width: 7cqw; margin-top: .3cqw; font: 800 .9cqw var(--body); color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#clock.mine #clockFace { border-color: #ffe39a; box-shadow: 0 0 0 .4cqw #0b0f2acc, 0 0 2.4cqw #f4b43caa; }
#clock.urgent #clockTime { color: #ff6b80; animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { scale: 1.15; } }
#clockArrow { position: absolute; left: 50%; top: 50%; width: 0; height: 0; rotate: var(--a, 0rad); transition: rotate .45s cubic-bezier(.3,1.4,.5,1); }
#clockArrow::before { content: ""; position: absolute; left: 3.4cqw; top: -.35cqw; width: 2.2cqw; height: .7cqw; border-radius: .35cqw; background: var(--gold); }
#clockArrow::after { content: ""; position: absolute; left: 5.2cqw; top: -1.5cqw; border-left: 2.6cqw solid var(--gold); border-top: 1.5cqw solid transparent;
  border-bottom: 1.5cqw solid transparent; filter: drop-shadow(0 0 .7cqw #f4b43c); }

/* Défausse : au centre, en travers */
#discardPile { position: absolute; left: 9.5%; top: 81%; width: var(--discard-w); aspect-ratio: 1 / var(--card-ratio); translate: -50% -50%;
  border-radius: .5cqw; border: .15cqw dashed #f4b43c88; }
#discardPile .card { position: absolute; inset: 0; width: 100%; }
#discardPile .n { position: absolute; right: -1.2cqw; top: -1cqw; min-width: 2.2cqw; padding: .2cqw .5cqw; border-radius: .6cqw;
  background: var(--paper); color: var(--ink); font: 400 1.2cqw var(--serif); text-align: center; z-index: 2; }

/* Bannière de fin de manche */
#banner { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 20; padding: 1.6cqw 3.4cqw 1.4cqw; text-align: center;
  background: linear-gradient(#1b2350f8, #121940f8); border: .2cqw solid var(--gold); border-radius: 1.2cqw; box-shadow: 0 0 0 .5cqw #0b0f2a, 0 2cqw 5cqw #000d; }
#banner h3 { margin: 0; font: 400 3.2cqw var(--serif); color: var(--gold); }
#banner p { margin: .6cqw 0 0; font-size: 1.5cqw; white-space: pre-line; line-height: 1.5; }
#banner img { width: 8cqw; margin: 1cqw auto 0; display: block; border-radius: .6cqw; }

/* Consigne sur un carton */
#status { text-align: center; padding: 6px 0 0; position: relative; z-index: 5; min-height: 64px; }
#prompt { display: inline-block; margin: 0 0 6px; padding: 8px 22px 6px; border-radius: 4px; font: 400 clamp(15px, 2.1vh, 19px)/1.25 var(--serif); color: var(--ink);
  background: linear-gradient(#fbf3e1, #eadbb9); box-shadow: 0 3px 0 #b9a379, 0 12px 22px #000b; rotate: -.6deg; max-width: min(860px, 94vw); }
#prompt.wait { color: #5d5a7e; background: linear-gradient(#e9e1cf, #d6cab0); }
#prompt.win { font-size: 26px; box-shadow: 0 0 0 3px var(--gold), 0 0 30px var(--gold); }
#choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#choices button { font-size: 15px; }
#lastEvent { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
#lastEvent:empty { display: none; }
#lawBadge { position: absolute; left: 1vw; top: 6px; padding: 6px 12px; border-radius: 8px; font: 400 14px var(--serif); background: var(--jaune); color: var(--ink); box-shadow: 0 4px 10px #0009; }

/* Main en éventail */
#handWrap { display: flex; justify-content: center; padding: 6px 0 calc(14px + env(safe-area-inset-bottom)); position: relative; z-index: 4; }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: calc(var(--hand-w) * var(--card-ratio) * .7); }
.hand .card { width: var(--hand-w); margin: 0 calc(var(--hand-w) * var(--ov, -.08)); transform: rotate(var(--rot, 0deg)) translateY(var(--drop, 0px)); transform-origin: 50% 120%; transition: transform .15s; }
.hand .card.playable { cursor: pointer; box-shadow: 0 0 0 2px var(--gold), 0 0 16px #f4b43caa, 0 .5em 1.2em #000b; }
.hand .card:hover { transform: translateY(-22%) scale(1.14); z-index: 3; }
.hand .card.selected { transform: translateY(-26%) scale(1.12); z-index: 4; box-shadow: 0 0 0 3px var(--bleu), 0 0 24px var(--bleu), 0 .5em 1.2em #000b; }
.hand .card.dim { filter: brightness(.55) saturate(.7); }

/* Aperçu au survol et carte en grand */
#peek { position: fixed; z-index: 70; pointer-events: none; height: min(56vh, 480px); aspect-ratio: 1 / var(--card-ratio); border-radius: 3%;
  background: center / cover no-repeat; box-shadow: 0 0 0 4px #0b0f2a, 0 24px 70px #000e; }

/* Glisser une carte sur le tapis */
.hand .card.draggable { cursor: grab; touch-action: none; }
.hand .card.dragSource { opacity: .25; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }
.dragGhost { z-index: 9500; scale: 1.08; rotate: -3deg; box-shadow: 0 0 0 3px var(--gold), 0 24px 40px #000c; }
#mat.dropping { box-shadow: 0 0 0 .3cqw #2bb1e6aa, 0 26px 60px #000d, 0 6px 14px #0009; }

/* Mode test (accueil) */
#testPanel { margin-top: 12px; padding: 12px; border-radius: 12px; border: 1px dashed #3c4579; text-align: left; }
#testPanel .hint { margin: 0 0 10px; font-size: 13px; }
.testRow { display: grid; gap: 6px; }
.testRow button { font-size: 14px; padding: 6px 12px 5px; }

/* Départage d'une égalité */
#tie { position: fixed; inset: 0; z-index: 74; display: grid; place-items: center; background: #050716d9; padding: 16px; }
#tie .sheet { width: min(900px, 96vw); max-height: 94dvh; overflow: auto; text-align: center; }
#tie h3 { margin: 0; font: 400 clamp(26px, 4vw, 38px) var(--serif); color: var(--gold); }
#tieSub { margin: 6px 0 16px; color: var(--muted); }
#tieCols { display: flex; justify-content: center; gap: clamp(12px, 3vw, 40px); flex-wrap: wrap; }
.tieCol { flex: 1 1 220px; max-width: 380px; padding: 14px 12px 12px; border-radius: 14px; background: #0c1130; border: 2px solid #333c70;
  transition: opacity .4s, border-color .4s, box-shadow .4s; }
.tieCol header { display: flex; align-items: center; justify-content: center; gap: 8px; font: 400 18px var(--serif); }
.tieCol header img { width: 30px; height: 30px; }
.tieCol .who { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.tiePile { position: relative; height: 128px; width: 74px; margin: 0 auto; }
.tiePile .card { position: absolute; left: calc(var(--k) * 3px); bottom: calc(var(--k) * 7px); width: 70px; rotate: calc((var(--k) - 1) * 3deg); }
.tiePile { margin-bottom: 18px; }
.tiePile:empty { height: 0; }
.tieRow { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; perspective: 600px; }
.tieRow .card { width: 64px; }
.tieRow .card.last { width: 110px; }
.tieCol .score { margin: 10px 0 0; font: 400 20px var(--serif); color: var(--paper); }
.tieCol.out { opacity: .4; }
.tieCol.won { border-color: var(--gold); box-shadow: 0 0 0 3px #f4b43c55, 0 0 30px #f4b43c88; }
#tieVerdict { margin: 16px 0 0; font: 400 17px var(--serif); color: var(--muted); min-height: 1.4em; }
#tieVerdict.win { color: var(--gold); font-size: 20px; }

/* Dernier pli */
#trickBtn { font-size: 13px; padding: 4px 12px 3px; border-bottom-width: 3px; }
#trick { position: fixed; inset: 0; z-index: 72; display: grid; place-items: center; background: #050716cc; padding: 16px; }
#trick .sheet { width: min(860px, 96vw); max-height: 94dvh; overflow: auto; text-align: center; }
#trick h3 { margin: 0 0 14px; font: 400 24px var(--serif); color: var(--gold); }
#trickCards { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: 16px; }
.trickCell { margin: 0; width: clamp(96px, 12vw, 128px); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trickCell .card { width: 100%; }
.trickCell .card.none { display: grid; place-items: center; background: #0c1130; border: 2px dashed #3c4579; box-shadow: none; color: var(--muted); }
.trickCell .card.gone { filter: grayscale(.5) brightness(.75); }
.trickCell.won .card { box-shadow: 0 0 0 3px var(--gold), 0 0 22px var(--gold); }
.trickCell figcaption { font: 400 14px var(--serif); line-height: 1.2; overflow-wrap: anywhere; }
.trickCell .mark { display: block; font: 700 12px var(--body); color: var(--muted); }
.trickCell.won .mark { color: var(--gold); }
#viewer { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #050716ee; cursor: zoom-out; padding: 3vh; }
#viewImg { height: min(84vh, 140vw); border-radius: 3%; box-shadow: 0 0 0 4px #0b0f2a, 0 30px 80px #000; }
#viewText { margin: 0; max-width: 520px; text-align: center; color: var(--muted); }

/* Menu */
#menuBtn { position: absolute; top: 8px; right: 1.2vw; z-index: 30; width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
#menuBtn svg { width: 24px; height: 24px; transition: rotate .4s; }
#menuBtn[aria-expanded="true"] svg { rotate: 90deg; }
#tools { position: absolute; top: 60px; right: 1.2vw; z-index: 30; display: flex; flex-direction: column; gap: 4px; min-width: 230px; padding: 10px; border-radius: 12px;
  background: linear-gradient(#fbf3e1, #eadbb9); box-shadow: 0 3px 0 #b9a379, 0 18px 34px #000c; }
#tools button, #tools a { text-align: left; font: 400 15px var(--serif); color: var(--ink); text-decoration: none; padding: 7px 10px; border-radius: 8px; background: none; border: 0; box-shadow: none; }
#tools button:hover, #tools a:hover { background: #fff8e6; }
#tools button:last-child { color: #a3122a; }
#logPanel { position: absolute; z-index: 25; padding: 12px 14px; border-radius: 12px; color: var(--ink);
  background: linear-gradient(#fbf3e1, #eadbb9); box-shadow: 0 3px 0 #b9a379, 0 18px 34px #000c; }
#logPanel { top: 60px; right: 1.2vw; width: 330px; max-height: 60vh; display: flex; flex-direction: column; }
#logPanel h3 { margin: 0 0 6px; font: 400 16px var(--serif); color: #8a5a10; }
#log { margin: 0; padding: 0; list-style: none; overflow: auto; font-size: 13px; }
#log li { padding: 3px 0; border-bottom: 1px solid #d8c69e; }

/* Aide, son */
#help { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: #050716cc; padding: 16px; }
#help .sheet { width: min(520px, 94vw); }
#help h3, #soundPanel h3 { margin: 0 0 10px; font: 400 24px var(--serif); color: var(--gold); }
.colors { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; vertical-align: -2px; }
.dot.vert { background: var(--vert); } .dot.jaune { background: var(--jaune); } .dot.rouge { background: var(--rouge); } .dot.bleu { background: var(--bleu); }
.dot.malice { background: conic-gradient(var(--vert) 0 25%, var(--jaune) 0 50%, var(--rouge) 0 75%, var(--bleu) 0); }
#soundPanel { position: fixed; z-index: 75; left: 50%; top: 50%; translate: -50% -50%; display: grid; gap: 12px; min-width: 260px; }
#soundPanel label { display: flex; align-items: center; gap: 10px; }
#soundPanel input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--gold); }
#soundPanel .vol input { flex: 1; accent-color: var(--gold); }
#toast { position: fixed; bottom: 18px; left: 50%; translate: -50% 0; z-index: 90; padding: 9px 20px; border-radius: 10px;
  background: var(--rouge); color: #fff; font: 400 15px var(--serif); box-shadow: 0 10px 24px #000a; }

/* Carte qui vole (animations) */
.flying { position: fixed; z-index: 60; pointer-events: none; }

/* Grand écran : la consigne et les boutons passent à droite de la main, dans la zone libre */
@media (min-width: 1100px) {
  #game { grid-template-rows: 1fr auto; }
  #status { position: absolute; right: 1.6vw; bottom: calc(18px + env(safe-area-inset-bottom)); width: clamp(220px, calc((100vw - var(--hand-w) * 6) / 2 - 3vw), 380px);
    min-height: 0; padding: 0; text-align: center; }
  #prompt { display: block; max-width: none; rotate: -1deg; }
  #choices { justify-content: center; }
  #lawBadge { position: static; display: inline-block; margin-bottom: 8px; }
}

/* ---------- Téléphone (portrait) : les places en grille, sans le plateau en entier ---------- */
#rotate { display: none; }
@media (max-width: 760px) {
  :root { --hand-w: clamp(58px, 17vw, 84px); }
  #matWrap { overflow-y: auto; }
  #teams { gap: 6px; }
  .teamChip { font-size: 11px; padding-right: 8px; }
  #matWrap { place-items: stretch; perspective: none; padding: 0; }
  #matBox { height: auto; width: 100%; aspect-ratio: auto; container-type: normal; }
  #handsLayer { display: none; }
  .fan { display: flex; }
  /* sur téléphone, pas de plateau imprimé (ses emplacements ne correspondraient pas à la grille) : un tapis uni étoilé */
  #mat { position: relative; inset: auto; height: auto; width: 100%; aspect-ratio: auto; transform: none; border-radius: 14px; padding: 10px 8px; container-type: inline-size;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; align-content: start;
    background: radial-gradient(120% 90% at 50% 40%, #2a2f8a, #141a4a 70%); border: 2px solid var(--gold); box-shadow: 0 0 0 4px #0b0f2a, 0 18px 40px #000c; }
  #seatLayer { display: contents; }
  .seat { position: static; inset: auto; translate: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .seat .plate, .seat .slot { position: static; translate: none; rotate: none !important; }
  .teamCard { display: none; }
  .plate { font-size: 11px; padding: 2px 8px 2px 2px; gap: 4px; max-width: 100%; }
  .plate img { width: 18px; height: 18px; }
  .plate .who { font-size: 12px; max-width: 17vw; }
  #status { min-height: 0; padding-top: 4px; }
  #prompt { font-size: 14px; padding: 6px 12px 5px; margin-bottom: 4px; }
  #lastEvent { display: none; }
  .plate .count::before { width: 7px; height: 11px; }
  .slot { width: 19vw; max-width: 96px; border-radius: 6px; outline: 1px dashed #f4b43c55; }
  #game { padding-top: 58px; }
  #drawerBtn { left: 8px; }
  #actionBox { position: fixed; left: 50%; top: 46%; width: min(92vw, 380px); padding: 16px; border-radius: 14px; z-index: 40; }
  #actionBox h3 { font-size: 22px; }
  #actionBox p { font-size: 14px; margin: 6px 0 12px; }
  #actionDrop { padding: 16px 10px; font-size: 14px; border-width: 2px; border-radius: 10px; }
  .fan { position: static; translate: none; margin-top: 2px; }
  .fan i { width: 9px; margin: 0 -2px; border-radius: 2px; translate: none; }
  .liveTag { position: static; translate: none; order: 5; font-size: 10px; padding: 1px 7px; margin-top: 2px; }
  #clock { position: relative; left: auto; top: auto; translate: none; width: 64px; order: 98; align-self: end; justify-self: center; }
  #clockArrow { display: none; }
  #clockTime { font-size: 20px; }
  #clockWho { font-size: 9px; max-width: 56px; margin-top: 1px; }
  #tie .sheet { padding: 16px 10px 14px; }
  #tieSub { font-size: 13px; margin-bottom: 10px; }
  #tieCols { flex-wrap: nowrap; gap: 8px; }
  .tieCol { flex: 1 1 0; min-width: 0; padding: 10px 6px; }
  .tieCol header { font-size: 15px; flex-direction: column; gap: 4px; }
  .tieCol .who { font-size: 11px; }
  .tiePile { width: 52px; height: 96px; }
  .tiePile .card { width: 48px; }
  .tieRow .card { width: 44px; }
  .tieRow .card.last { width: 84px; }
  .tieCol .score { font-size: 15px; }
  #tieVerdict { font-size: 14px; }
  #tieVerdict.win { font-size: 16px; }
  #trick .sheet { padding: 16px 10px 14px; }
  #trickCards { gap: 10px 8px; }
  .trickCell { width: 27vw; }
  .trickCell figcaption { font-size: 13px; }
  .plate.beside img { display: block; }
  .plate .who, .plate.beside .who { max-width: 21vw; }
  /* la défausse devient une case de la grille, après les places */
  #discardPile { position: relative; left: auto !important; top: auto !important; translate: none; rotate: none; order: 99; align-self: end; justify-self: center; width: 12vw; max-width: 60px; border-radius: 6px; }
  #discardPile .n { rotate: none; right: -18px; top: -6px; font-size: 11px; min-width: 18px; }
  #banner { position: fixed; font-size: 14px; } #banner h3 { font-size: 22px; } #banner p { font-size: 14px; } #banner img { width: 60px; }
  #lawBadge { position: static; display: inline-block; margin-bottom: 4px; }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body:has(#game:not([hidden])) #rotate { position: fixed; inset: 0; z-index: 99; display: grid; place-content: center; justify-items: center; gap: 14px;
    background: #0d1233f2; text-align: center; font: 400 22px var(--serif); padding: 20px; }
  #rotate .phoneIcon { width: 46px; height: 76px; border: 4px solid var(--gold); border-radius: 10px; }
}
@media (hover: none) {
  .hand .card:hover { transform: rotate(var(--rot, 0deg)) translateY(var(--drop, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .slot.turn { animation: none; }
  * { transition: none !important; }
}

/* Retour à la page d'accueil des jeux (play-angel.site) */
.hubLink { position: fixed; top: 14px; left: 14px; z-index: 20; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 7px 12px;
  border-radius: 999px; text-decoration: none; font-weight: 800; font-size: 14px; color: var(--ink);
  background: linear-gradient(#fbf3e1, #eadbb9); box-shadow: 0 3px 0 #b9a379, 0 10px 20px #0009; }
.hubLink:hover { filter: brightness(1.06); }
.hubLink svg { width: 18px; height: 18px; }

/* Bouton du tutoriel et couleurs de la bulle du tutoriel guidé */
#tutoBtn { margin-top: 10px; }
#tutoBtn small { display: block; font: 700 12px var(--body); opacity: .75; }
:root { --guide-bg: #f4ecd9; --guide-ink: #1b1f3f; --guide-border: #1b1f3f; --guide-accent: #f4b43c; --guide-title: #5a54b5;
  --guide-title-font: "Young Serif", Georgia, serif; --guide-title-weight: 400; --guide-font: "Nunito", system-ui, sans-serif;
  --guide-button: #e6d8b6; --guide-shade: #0a0d22db; }
