/* ===== Skyjo — direction artistique du livret de règles : bleu ciel Magilano, lettres blanches cernées de noir, dos de
   carte arc-en-ciel à mosaïque, cartes colorées selon la valeur (bleu foncé −2/−1, bleu clair 0, vert 1-4, jaune 5-8,
   rouge 9-12). Tout est préfixé « sj- ». ===== */

.sj, .rb {
  --sj-sky: #00a0e4;
  --sj-sea: #0a5f98;
  --sj-deep: #06375d;
  --sj-ink: #052a47;
  --sj-yellow: #ffd93b;
  --sj-yellow-d: #b79200;
  --sj-white: #fff;
  --sj-text: #f2f9ff;
  --sj-text-2: #a9d4ee;
  --sj-line: rgb(255 255 255 / .2);
  --sj-red: #ff6a5c;
  --sj-green: #6fdc8c;
  --sj-display: 'Fraunces', Georgia, serif;
  --sj-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.sj {
  /* Largeur d'une carte à moi : ce que la hauteur de l'écran laisse une fois le reste posé. */
  --w-me: clamp(40px, min(calc((100dvh - 500px) / 4.48), 19vw), 100px);
  --ow: clamp(22px, min(6.2vw, 3.8dvh), 30px); /* cartes des autres joueurs */
  --pw: clamp(44px, min(13vw, 8.4dvh), 84px); /* pioche, défausse, carte en main */

  position: fixed; inset: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  overflow: hidden; overflow: clip; color: var(--sj-text); font-family: var(--sj-body); font-weight: 600; line-height: 1.3;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 28 49'%3E%3Cpath fill='%23fff' fill-opacity='.045' fill-rule='evenodd' d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.34V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 90% 70% at 50% 38%, #1493d4 0, #0a5f98 55%, #06375d 100%);
}
.sj [hidden] { display: none !important; }
.sj h1, .sj h2, .sj h3, .sj p, .sj ol, .sj ul { margin: 0; padding: 0; }
.sj .icon { width: 1.15em; height: 1.15em; flex: none; display: block; }
.sj :focus-visible { outline: 3px solid var(--sj-yellow); outline-offset: 2px; }
.sj button { font-family: inherit; }

/* ---- haut de l'écran ---- */
.sj-hud { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(7px + env(safe-area-inset-top)) 12px 5px; }
.sj-hud-r { display: flex; align-items: center; gap: 6px; flex: none; }
.sj-pill {
  display: flex; align-items: center; gap: 8px; min-width: 0; height: 38px; padding: 0 14px; border-radius: 999px;
  background: var(--sj-deep); border: 2px solid rgb(255 255 255 / .55); font: 800 .95rem/1 var(--sj-body); white-space: nowrap;
}
.sj-pill .sj-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sj-text-2); flex: none; }
.sj-pill.mine { background: var(--sj-yellow); border-color: #fff; color: #2b2000; }
.sj-pill.mine .sj-dot { background: #2b2000; animation: sj-blink 1.1s ease-in-out infinite; }
.sj-pill-t { overflow: hidden; text-overflow: ellipsis; }
.sj-chip, .sj-round-btn {
  height: 38px; border-radius: 999px; border: 2px solid rgb(255 255 255 / .55); background: var(--sj-deep); color: var(--sj-text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0; font: 800 .85rem var(--sj-body);
}
.sj-chip { padding: 0 11px; }
.sj-round-btn { width: 38px; font: 800 1.15rem var(--sj-display); }
.sj-chip:hover, .sj-round-btn:hover { background: var(--sj-ink); }
.sj-round-btn b { font-weight: 800; }
.sj-chip .icon { width: 1.05em; height: 1.05em; }

/* ---- les autres joueurs : une tuile chacun, en bandeau qui défile ---- */
.sj-opps {
  display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 4px 10px 6px; scrollbar-width: none; scroll-snap-type: x proximity;
  justify-content: safe center; align-items: flex-start; max-width: 1240px; width: 100%; margin: 0 auto;
}
.sj-opps::-webkit-scrollbar { display: none; }
.sj-opp {
  flex: none; scroll-snap-align: center; display: grid; gap: 4px; justify-items: center; padding: 5px 6px 4px; border-radius: 14px;
  min-width: calc(var(--ow) * 4.3 + 12px); background: rgb(255 255 255 / .1); box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .16); transition: background .25s, box-shadow .25s;
}
.sj-opp.active { background: rgb(255 217 59 / .2); box-shadow: inset 0 0 0 2.5px var(--sj-yellow); }
.sj-opp.fin { box-shadow: inset 0 0 0 2.5px var(--sj-green); }
.sj-opp-h { display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; }
.sj-av { position: relative; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; background: var(--c, #555); border: 2px solid #fff; flex: none; }
.sj-av .cam-bubble { position: absolute; inset: 0; border-radius: 50%; }
.sj-av.v-talk { box-shadow: 0 0 0 3px #6fdc8c, 0 0 16px 2px rgb(111 220 140 / .6); }
.sj-opp-n { flex: 1; min-width: 0; font-size: .78rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sj-total { flex: none; min-width: 26px; padding: 1px 6px; border-radius: 999px; background: #fff; color: var(--sj-ink); font: 800 .78rem/1.35 var(--sj-body); text-align: center; }
.sj-opps .sj-grid { --gw: var(--ow); }
.sj-opp-f { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; font-size: .66rem; font-weight: 800; color: var(--sj-text-2); white-space: nowrap; }
.sj-opp-f .ok { color: var(--sj-green); }
.sj-opp-f .flag { display: inline-flex; align-items: center; gap: 3px; color: var(--sj-green); }
.sj-opp-f .flag .icon { width: .95em; height: .95em; }
.sj-opp-f .last { color: var(--sj-yellow); }
.sj-shown { flex: none; padding: 0 5px; border-radius: 6px; background: rgb(0 0 0 / .28); color: #fff; font-size: .72rem; }

/* ---- le centre : pioche, défausse, carte en main ---- */
.sj-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 0; padding: 4px 12px; overflow: hidden; }
.sj-piles { display: flex; gap: clamp(12px, 5vw, 30px); align-items: flex-end; justify-content: center; }
.sj-pile { display: grid; justify-items: center; gap: 1px; position: relative; }
.sj-pile > .sj-card, .sj-pile .sj-stack { --w: var(--pw); }
.sj-lbl { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; line-height: 1; }
.sj-pile b { font: 800 .95rem/1 var(--sj-body); }
.sj-pile small, .sj-held small { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sj-text-2); font-weight: 800; }
.sj-pile.hot .sj-card:last-of-type, .sj-pile.hot .sj-stack .s1 { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--sj-yellow), 0 0 18px 4px rgb(255 217 59 / .6); animation: sj-glow 1.3s ease-in-out infinite; }
.sj-stack { position: relative; display: block; width: var(--w); aspect-ratio: 5 / 7; }
.sj-stack .sj-card { position: absolute; inset: 0; }
.sj-stack .s2 { transform: translate(-3px, -3px); }
.sj-stack .s3 { transform: translate(-6px, -6px); }
.sj-stack .s1 { position: relative; }
.sj-held { display: grid; justify-items: center; gap: 1px; min-width: calc(var(--pw) * 1.1); }
.sj-held > .sj-card { --w: calc(var(--pw) * 1.1); box-shadow: 0 0 0 calc(var(--w) * .03) #0b0b1a, 0 0 0 calc(var(--w) * .07) rgb(255 255 255 / .85), 0 8px 14px -6px rgb(0 0 0 / .8); }
.sj-held.empty .sj-slot-ghost { display: block; width: calc(var(--pw) * 1.1); aspect-ratio: 5 / 7; border: 2px dashed var(--sj-line); border-radius: 8px; }
.sj-banner { display: flex; align-items: center; gap: 7px; max-width: 560px; padding: 5px 12px; border-radius: 999px; background: rgb(111 220 140 / .2); border: 1.5px solid var(--sj-green); font-size: .78rem; font-weight: 800; text-align: left; line-height: 1.2; }
.sj-banner .icon { color: var(--sj-green); }
.sj-ticker { list-style: none; display: grid; text-align: center; font-size: .78rem; line-height: 1.25; color: var(--sj-text-2); max-width: 640px; }
.sj-ticker li { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.sj-ticker li.new { color: var(--sj-text); font-weight: 800; animation: sj-in .35s ease-out; }

/* ---- mon côté : en-tête, mes cartes, le panneau d'action ---- */
.sj-dock { display: grid; gap: 6px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); max-width: 760px; width: 100%; margin: 0 auto; }
.sj-me { display: grid; gap: 5px; justify-items: center; padding: 0 10px; }
.sj-me-h { display: flex; align-items: center; gap: 8px; width: min(100%, calc(var(--w-me) * 4.3 + 24px)); min-width: 0; padding: 3px 8px 3px 4px; border-radius: 999px; transition: background .25s, box-shadow .25s; }
.sj-me-h.active { background: rgb(255 217 59 / .2); box-shadow: inset 0 0 0 2.5px var(--sj-yellow); }
.sj-me-h .sj-av { width: 32px; height: 32px; font-size: 1.1rem; }
.sj-me-n { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.sj-me-n b { font-weight: 800; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28vw; }
.sj-me-n em { font-style: normal; font-size: .62rem; color: var(--sj-yellow); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.sj-flag { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 800; color: var(--sj-green); }
.sj-flag .icon { width: 1em; height: 1em; }
.sj-me-stats { margin-left: auto; display: flex; gap: 6px; }
.sj-stat { display: grid; justify-items: center; line-height: 1; padding: 3px 9px; border-radius: 10px; background: rgb(0 0 0 / .26); }
.sj-stat small { font-size: .55rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sj-text-2); font-weight: 800; }
.sj-stat b { font: 800 1.1rem/1.15 var(--sj-body); }
.sj-stat.tot { background: #fff; color: var(--sj-ink); }
.sj-stat.tot small { color: #4a6a82; }

.sj-panel {
  margin: 0 10px; padding: 8px 10px; min-height: 88px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
  background: rgb(5 42 71 / .82); border: 2px solid var(--sj-line); border-radius: 16px; transition: border-color .25s;
}
.sj-panel.ask { border-color: var(--sj-yellow); }
.sj-ask { font-size: .9rem; font-weight: 700; line-height: 1.25; }
.sj-count { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--sj-yellow); color: #2b2000; font-size: .78rem; }
.sj-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sj-btn {
  flex: 1 1 150px; min-height: 46px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border-radius: 12px; border: 2px solid transparent; font: 800 .98rem/1.15 var(--sj-body); text-align: center; touch-action: manipulation;
  transition: transform .12s, filter .12s;
}
.sj-btn:active:not(:disabled) { transform: translateY(1px); }
.sj-btn:disabled { opacity: .5; cursor: default; }
.sj-btn.primary { background: var(--sj-yellow); color: #2b2000; border-color: #fff3b0; box-shadow: 0 3px 0 var(--sj-yellow-d); }
.sj-btn.alt { background: #fff; color: var(--sj-ink); border-color: #cfe9f8; box-shadow: 0 3px 0 #7fb2d0; }
.sj-btn.ghost { background: transparent; color: var(--sj-text); border-color: rgb(255 255 255 / .45); }
.sj-btn:hover:not(:disabled) { filter: brightness(1.06); }

/* ---- une carte ---- */
.sj-card {
  --w: 56px; --hi: #fff; --mid: #999; --lo: #555;
  position: relative; display: block; flex: none; width: var(--w); aspect-ratio: 5 / 7; container-type: inline-size; padding: 0; margin: 0; border: 0;
  border-radius: calc(var(--w) * .09); color: #23222b; cursor: default; text-align: left; font: inherit; overflow: hidden;
  box-shadow: 0 0 0 calc(var(--w) * .03) #0b0b1a, 0 4px 8px -4px rgb(0 0 0 / .75); transition: transform .18s, box-shadow .18s, filter .18s, opacity .25s;
}
button.sj-card { cursor: pointer; }
.sj-card.up {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cpath fill='%23fff' fill-opacity='.3' fill-rule='evenodd' d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.34V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/svg%3E") 0 0 / 32cqw auto,
    radial-gradient(ellipse 62% 50% at 50% 50%, var(--hi) 0, var(--mid) 62%, var(--lo) 100%);
}
.sj-card.b-deep { --hi: #9a96e8; --mid: #4c49b0; --lo: #2b2980; }
.sj-card.b-sky { --hi: #e1f6fd; --mid: #4cc4ee; --lo: #1c9ad2; }
.sj-card.b-green { --hi: #e0f6cf; --mid: #5cb946; --lo: #2e892c; }
.sj-card.b-yellow { --hi: #fffcd2; --mid: #f9e92b; --lo: #e0c200; }
.sj-card.b-red { --hi: #fbbdb4; --mid: #ea4a3e; --lo: #bd221e; }
.sj-num {
  position: absolute; inset: 0; display: grid; place-items: center; padding-bottom: 2cqw; font: 800 58cqw/1 var(--sj-display); letter-spacing: -.03em;
  color: #23222b; text-shadow: 0 0 .09em rgb(255 255 255 / .95), 0 0 .22em rgb(255 255 255 / .75);
}
.sj-card.two .sj-num { font-size: 44cqw; letter-spacing: -.07em; }
.sj-corner {
  position: absolute; display: grid; place-items: center; width: 36cqw; height: 25cqw; border-radius: 50%; background: #fff; color: #23222b;
  font: 800 16cqw/1 var(--sj-display); box-shadow: 0 0 0 .7cqw rgb(0 0 0 / .22);
}
.sj-card.two .sj-corner { font-size: 13cqw; }
.sj-corner.tl { left: 4cqw; top: 4cqw; }
.sj-corner.br { right: 4cqw; bottom: 4cqw; transform: rotate(180deg); }
@container (max-width: 34px) { .sj-corner { display: none; } .sj-num { font-size: 66cqw; padding: 0; } .sj-card.two .sj-num { font-size: 52cqw; } }
.sj-card.down { background: #4b2a8f url("/img/skyjo/back.jpg") center / 100% 100% no-repeat; }
.sj-card.gone { background: rgb(0 0 0 / .14); box-shadow: inset 0 0 0 2px rgb(255 255 255 / .22); border: 0; }
.sj-card.gone::after { content: ''; position: absolute; inset: 18%; border-radius: 50%; border: 0; }
.sj-card.can { box-shadow: 0 0 0 calc(var(--w) * .03) #0b0b1a, 0 0 0 calc(var(--w) * .07) #fff, 0 0 0 calc(var(--w) * .12) var(--sj-yellow); transform: translateY(-2px); animation: sj-glow 1.4s ease-in-out infinite; }
button.sj-card.can:hover { transform: translateY(-4px); }
.sj-card.sel { transform: translateY(-7px) scale(1.04); z-index: 2; animation: none; box-shadow: 0 0 0 calc(var(--w) * .03) #0b0b1a, 0 0 0 calc(var(--w) * .08) #fff, 0 0 0 calc(var(--w) * .15) var(--sj-yellow), 0 10px 16px -4px rgb(0 0 0 / .7); }
.sj-card.preview { filter: saturate(1.1); }
.sj-card.preview::after { content: ''; position: absolute; inset: 0; border-radius: inherit; border: calc(var(--w) * .035) dashed #fff; pointer-events: none; }
.sj-card.cleared { opacity: .42; filter: grayscale(.55); }
.sj-card.flip { animation: sj-flip .55s cubic-bezier(.2, .8, .2, 1); }
.sj-card.swapped, .sj-card.pop { animation: sj-pop .4s cubic-bezier(.2, .8, .2, 1); }

/* ---- une grille de 12 cartes : 4 colonnes de 3, remplie colonne par colonne ---- */
.sj-grid { --gw: 56px; display: grid; grid-template-columns: repeat(4, var(--gw)); grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: calc(var(--gw) * .1); justify-content: center; }
.sj-grid .sj-card { --w: var(--gw); }
.sj-grid.mine { --gw: var(--w-me); }
.sj-grid.mine .sj-card { box-shadow: 0 0 0 calc(var(--w) * .03) #0b0b1a, 0 6px 10px -5px rgb(0 0 0 / .8); }
.sj-grid.mine .sj-card.can { box-shadow: 0 0 0 calc(var(--w) * .03) #0b0b1a, 0 0 0 calc(var(--w) * .07) #fff, 0 0 0 calc(var(--w) * .12) var(--sj-yellow); }
.sj-grid.mine .sj-card.sel { box-shadow: 0 0 0 calc(var(--w) * .03) #0b0b1a, 0 0 0 calc(var(--w) * .08) #fff, 0 0 0 calc(var(--w) * .15) var(--sj-yellow), 0 10px 16px -4px rgb(0 0 0 / .7); }
.sj-grid.mini { --gw: clamp(19px, 5.4vw, 27px); gap: 2px; }
.sj-grid.mini .sj-card { box-shadow: 0 0 0 1px #0b0b1a; }

/* ---- animations : couche posée par-dessus la table ---- */
.sj-fx { position: fixed; inset: 0; z-index: 80; pointer-events: none; overflow: hidden; }
.sj-float {
  position: fixed; transform: translate(-50%, -50%); padding: 6px 16px; border-radius: 999px; background: var(--sj-yellow); color: #2b2000;
  font: 800 1.3rem/1.1 var(--sj-display); border: 3px solid #fff; box-shadow: 0 6px 16px rgb(0 0 0 / .45); white-space: nowrap; animation: sj-float 1.6s ease-out forwards;
}
@keyframes sj-blink { 50% { opacity: .35; } }
@keyframes sj-glow { 50% { filter: brightness(1.12); } }
@keyframes sj-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes sj-fade { from { opacity: 0; } }
@keyframes sj-rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes sj-pop { 0% { transform: scale(.6) rotate(-5deg); opacity: .4; } 60% { transform: scale(1.12); } 100% { transform: none; opacity: 1; } }
@keyframes sj-flip { 0% { transform: perspective(380px) rotateY(88deg) scale(.92); filter: brightness(1.8); } 100% { transform: none; filter: none; } }
@keyframes sj-float { from { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 18% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 75% { opacity: 1; transform: translate(-50%, -70%) scale(1); } to { opacity: 0; transform: translate(-50%, -120%) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .sj *, .sj *::before { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- fenêtres : scores, menu, journal ---- */
.sj-sheet-wrap { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-end; justify-content: center; background: rgb(3 20 36 / .72); backdrop-filter: blur(3px); }
.sj-sheet-wrap.open { display: flex; animation: sj-fade .2s ease both; }
.sj-sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; overflow: auto; display: grid; gap: 12px; align-content: start; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--sj-deep); border: 2px solid rgb(255 255 255 / .35); border-bottom: 0; border-radius: 22px 22px 0 0; animation: sj-rise .28s cubic-bezier(.2, .8, .2, 1) both;
}
@media (min-width: 700px) { .sj-sheet-wrap { align-items: center; } .sj-sheet { border-radius: 22px; border-bottom: 2px solid rgb(255 255 255 / .35); } }
.sj-sheet h2 { font: 800 1.4rem/1.1 var(--sj-display); }
.sj-sheet h2 em { font: 700 .85rem var(--sj-body); font-style: normal; color: var(--sj-text-2); }
.sj-sheet-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.sj-sheet-btns .sj-btn { flex: 1 1 140px; }
.sj-muted { color: var(--sj-text-2); font-size: .88rem; font-weight: 600; }
.sj-muted.small { font-size: .78rem; }
.sj-journal { list-style: none; display: grid; gap: 4px; max-height: 46dvh; overflow: auto; font-size: .85rem; }
.sj-journal li { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--sj-line); }
.sj-jt { flex: none; width: 2.2em; color: var(--sj-yellow); font-weight: 800; }
.sj-tablewrap { overflow: auto; border-radius: 12px; border: 1.5px solid var(--sj-line); }
.sj-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.sj-table th, .sj-table td { padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--sj-line); white-space: nowrap; }
.sj-table th[scope="row"] { text-align: left; font-weight: 800; }
.sj-table thead th { background: rgb(0 0 0 / .25); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sj-text-2); }
.sj-table tr.me { background: rgb(255 217 59 / .14); }
.sj-table td.tot, .sj-table th.tot { background: rgb(255 255 255 / .1); }
.sj-table td.tot b { font: 800 1.05rem var(--sj-body); }
.sj-table td.dbl { color: var(--sj-yellow); font-weight: 800; }
.sj-table sup { font-size: .65em; margin-left: 1px; }

/* ---- plein écran : qui commence, décompte, fin de partie ---- */
.sj-overlay { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: 14px; overflow: auto; background: rgb(3 20 36 / .82); backdrop-filter: blur(4px); }
.sj-overlay.open { display: flex; animation: sj-fade .3s ease both; }
.sj-over-card {
  width: min(100%, 460px); margin: auto; display: grid; gap: 12px; justify-items: center; text-align: center; padding: 18px 16px 16px; border-radius: 22px;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #0e7fbe, var(--sj-deep) 70%); border: 2px solid rgb(255 255 255 / .5); box-shadow: 0 24px 60px -10px rgb(0 0 0 / .7);
  animation: sj-rise .35s cubic-bezier(.2, .8, .2, 1) both;
}
.sj-over-card.wide { width: min(100%, 640px); }
.sj-logo { width: min(62%, 220px); height: auto; filter: drop-shadow(0 4px 8px rgb(0 0 0 / .45)); }
.sj-over-card h1 { font: 800 1.9rem/1.05 var(--sj-display); }
.sj-overlay.win .sj-over-card h1 { color: var(--sj-yellow); }
.sj-verdict { font: 800 1.15rem var(--sj-display); color: var(--sj-yellow); }
.sj-sums { list-style: none; display: grid; gap: 6px; width: 100%; }
.sj-sums li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: rgb(255 255 255 / .1); text-align: left; }
.sj-sums li.win { background: rgb(255 217 59 / .22); box-shadow: inset 0 0 0 2px var(--sj-yellow); }
.sj-sums-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.sj-sums-c { display: flex; gap: 4px; }
.sj-sums b { font: 800 1.2rem var(--sj-body); min-width: 1.6em; text-align: right; }
.sj-first { padding: 2px 8px; border-radius: 999px; background: var(--sj-yellow); color: #2b2000; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.sj-sums li:not(.win) .sj-first { display: none; }
.sj-ranks { list-style: none; display: grid; gap: 8px; width: 100%; max-height: 52dvh; overflow: auto; padding: 2px; }
.sj-ranks li { display: grid; gap: 6px; padding: 8px 10px; border-radius: 14px; background: rgb(255 255 255 / .1); text-align: left; }
.sj-ranks li.me { box-shadow: inset 0 0 0 2px rgb(255 255 255 / .55); }
.sj-ranks li.champ { background: rgb(255 217 59 / .24); box-shadow: inset 0 0 0 2px var(--sj-yellow); }
.sj-rank-h { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sj-pos { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--sj-ink); font: 800 .9rem var(--sj-body); }
.sj-ranks li.champ .sj-pos { background: var(--sj-yellow); color: #2b2000; }
.sj-pos .icon { width: 1.1rem; height: 1.1rem; }
.sj-rank-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.sj-rank-pts { display: flex; align-items: baseline; gap: 5px; flex: none; }
.sj-rank-pts b { font: 800 1.35rem var(--sj-display); }
.sj-rank-pts small, .sj-rank-tot small { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sj-text-2); font-weight: 800; }
.sj-dbl { padding: 1px 7px; border-radius: 999px; background: var(--sj-red); color: #fff; font-size: .72rem; font-weight: 800; }
.sj-rank-tot { display: grid; justify-items: center; line-height: 1; flex: none; padding: 3px 9px; border-radius: 10px; background: #fff; color: var(--sj-ink); }
.sj-rank-tot small { color: #4a6a82; }
.sj-rank-tot b { font: 800 1.1rem/1.2 var(--sj-body); }
.sj-rank-grid { display: flex; justify-content: center; }
.sj-rank-note { font-size: .78rem; color: var(--sj-text-2); }

@media (min-width: 760px) {
  .sj-over-card.wide { width: min(100%, 880px); }
  .sj-over-card.wide .sj-ranks { grid-template-columns: 1fr 1fr; max-height: 56dvh; }
  .sj-grid.mini { --gw: 26px; }
}

/* ---- grand écran : les autres joueurs et le centre à gauche, mes cartes en grand à droite ---- */
@media (min-width: 900px) {
  .sj {
    --w-me: clamp(52px, min(calc((100dvh - 270px) / 4.48), calc((100vw - 600px) / 4.3), 124px), 124px);
    --ow: clamp(28px, 3vw, 44px);
    --pw: clamp(56px, min(6vw, 11dvh), 104px);
    grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto minmax(0, 1fr);
  }
  .sj-hud { grid-column: 1 / -1; padding-left: 20px; padding-right: 20px; }
  .sj-opps { grid-column: 1; grid-row: 2; flex-wrap: wrap; justify-content: center; overflow: visible; max-width: none; gap: 10px; padding-top: 10px; }
  .sj-mid { grid-column: 1; grid-row: 3; }
  .sj-dock { grid-column: 2; grid-row: 2 / span 2; align-self: center; width: auto; max-width: none; padding: 0 28px calc(8px + env(safe-area-inset-bottom)) 8px; }
  .sj-me-h { width: 100%; }
  .sj-panel { margin: 0 10px; width: calc(var(--w-me) * 4.4 + 8px); max-width: 100%; justify-self: center; }
  .sj-opp-n { font-size: .88rem; }
  .sj-av { width: 28px; height: 28px; }
  .sj-ticker { font-size: .9rem; }
}
/* ---- à 2 joueurs : de grandes têtes, comme des caméras (l'avatar ou la vidéo remplit le rond) ---- */
.sj[data-opps="1"] { --hd: 66px; --hd-me: 56px; }
.sj[data-opps="1"] .sj-av { width: var(--hd); height: var(--hd); font-size: calc(var(--hd) * .52); border-width: 3px; }
.sj[data-opps="1"] .sj-me-h .sj-av { width: var(--hd-me); height: var(--hd-me); font-size: calc(var(--hd-me) * .52); }
.sj[data-opps="1"] .sj-me-h { padding: 4px 10px 4px 4px; gap: 10px; border-radius: 28px; }
.sj[data-opps="1"] .sj-me-n b { font-size: 1.05rem; }
.sj[data-opps="1"] .sj-opp { grid-template-columns: auto auto; column-gap: 12px; align-items: center; padding: 8px 12px 6px; }
.sj[data-opps="1"] .sj-opp-h { grid-row: 1; grid-column: 1; flex-direction: column; gap: 3px; width: auto; align-items: center; }
.sj[data-opps="1"] .sj-opp .sj-grid { grid-row: 1; grid-column: 2; }
.sj[data-opps="1"] .sj-opp-n { flex: none; max-width: 110px; font-size: .95rem; text-align: center; }
.sj[data-opps="1"] .sj-opp-f { grid-row: 2; grid-column: 1 / -1; }
@media (max-width: 899px) {
  /* l'en-tête de mon côté est plus haut : mes cartes en tiennent compte */
  .sj[data-opps="1"] { --w-me: clamp(40px, min(calc((100dvh - 520px) / 4.48), 19vw), 100px); }
}
@media (min-width: 900px) {
  /* Les têtes grandissent avec l'écran (comme des caméras de visio) ; mes cartes prennent ce qu'il reste en hauteur. */
  .sj[data-opps="1"] {
    --hd: clamp(128px, 27dvh, 320px); --hd-me: clamp(92px, 17dvh, 200px);
    --w-me: clamp(52px, min(calc((100dvh - 240px - var(--hd-me)) / 4.48), calc((100vw - 600px) / 4.3), 124px), 124px);
  }
  .sj[data-opps="1"] .sj-opp { column-gap: 18px; padding: 12px 18px 8px; }
  .sj[data-opps="1"] .sj-opp-n { font-size: clamp(1.15rem, 2.4dvh, 1.7rem); max-width: 260px; }
  .sj[data-opps="1"] .sj-total { font-size: 1rem; }
  .sj[data-opps="1"] .sj-me-n b { font-size: clamp(1.25rem, 2.6dvh, 1.8rem); max-width: 14vw; }
  .sj[data-opps="1"] .sj-opp-f { font-size: .8rem; }
}
@media (max-width: 560px) {
  .sj-ticker li:not(.new) { display: none; }
}
@media (max-height: 700px) {
  .sj-ticker { display: none; }
}
@media (max-height: 620px) {
  .sj-panel { min-height: 0; padding: 6px 8px; }
  .sj-ask { font-size: .8rem; }
  .sj-btn { min-height: 40px; }
}
@media (max-width: 420px) {
  .sj-pill { padding: 0 11px; font-size: .88rem; }
  .sj-chip .sj-round { display: none; }
  .sj-stat { padding: 3px 7px; }
}

/* ---- dans le carnet de règles : les vraies cartes ---- */
.rb-art.g-skyjo { width: auto; display: block; }
.rb-art.g-skyjo .sj-card { --w: 64px; }
.rb-art.rb-mini.g-skyjo .sj-card { --w: 44px; }
.rb-groups.skyjo .rb-art.rb-card-art { width: auto; }
.rb-groups.skyjo .rb-art.rb-card-art .sj-card { --w: 42px; }
.rb-groups.skyjo .rb-cards { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: .5rem; }
.rb-groups.skyjo .rb-card { padding: 8px 10px; gap: .65rem; align-items: center; }
.rb-groups.skyjo .rb-card p { display: none; }
.rb-groups.skyjo .rb-card-head { margin: 0; flex-direction: column; align-items: flex-start; gap: .15rem; }
.rb-groups.skyjo .rb-card-head strong { font-size: 1.25rem; }
.rb-sj-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
