/* Jass à quatre — plein écran : la table 3D occupe tout l'écran, menu, tableau de bord et résultats en incrustation.
   Vert bouteille, laiton, bois sombre ; lettrage épais. */
:root {
  --ink: #f4efe3; --dim: rgba(244, 239, 227, .66); --panel: rgba(8, 26, 18, .86); --line: rgba(244, 239, 227, .18);
  --accent: #e8c15a; --red: #ff6b6b; --bg: #0a2a1c; --gold: var(--accent);
  --f-title: 'Alfa Slab One', 'Rockwell', 'Arial Black', serif; --f: 'Barlow Condensed', 'Segoe UI', system-ui, sans-serif;
  --mbh-row: rgba(255, 255, 255, .07); --mbh-me: rgba(232, 193, 90, .14); --mbh-on-accent: #0a2a1c;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 600 17px/1.35 var(--f); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#stage { position: fixed; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#gl { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; cursor: pointer; }

/* ── Tableau de bord ─────────────────────────────────────────── */
.hud { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 14px; padding: max(10px, env(safe-area-inset-top)) 166px 0 14px; pointer-events: none; text-shadow: 0 2px 6px rgba(0, 0, 0, .7); }   /* à droite, la place des trois boutons ; les compteurs passent à la ligne s'il le faut */
.stat { display: grid; }
.stat small { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.stat b { font: 400 1.35rem/1.05 var(--f-title); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trump b { font-size: 1.6rem; }
.trump.red b { color: var(--red); }
.hud .tools { position: absolute; right: 14px; top: max(10px, env(safe-area-inset-top)); z-index: 7; display: flex; flex-direction: row; flex-wrap: nowrap; gap: 8px; pointer-events: auto; }   /* toujours en ligne, en portrait comme en paysage ; au-dessus du menu et des fiches, sinon le menu avale les clics */
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.seat { position: absolute; padding: 3px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; pointer-events: none; }
.seat-n { top: calc(max(10px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translateX(-50%); }
.seat-w { left: 10px; top: 46%; }
.seat-e { right: 10px; top: 46%; }
.msg { position: absolute; left: 50%; top: var(--msg-top, auto); bottom: auto; transform: translateX(-50%); z-index: 3; width: max-content; max-width: min(94%, 520px); padding: 6px 12px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; text-align: center; font-size: 1rem; pointer-events: none; }
.msg:empty { display: none; }

/* ── Choix de l'atout ────────────────────────────────────────── */
.choose { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; gap: 14px; padding: 16px; background: rgba(4, 14, 9, .62); text-align: center; }
.choose p { margin: 0; font: 400 1.4rem/1.1 var(--f-title); color: var(--accent); }
.suits { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.suits button { width: 76px; height: 90px; border: 2px solid rgba(255, 255, 255, .5); border-radius: 12px; background: #fff; font-size: 2.1rem; display: grid; place-items: center; line-height: 1; }
.suits button small { font-size: .72rem; font-weight: 700; color: #0a2a1c; }
.suits button.red { color: #d6262b; }
.suits button.black { color: #1a1a1a; }
.suits button:hover { transform: translateY(-3px); border-color: var(--accent); }
.quiet { padding: 8px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; justify-self: center; }

/* ── Menu ───────────────────────────────────────────────────── */
.menu { position: absolute; inset: 0; z-index: 4; display: grid; align-content: end; gap: 14px; padding: 20px clamp(18px, 6vw, 60px) max(22px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(4, 14, 9, 0) 0%, rgba(4, 14, 9, .55) 30%, rgba(4, 14, 9, .92) 70%); overflow: auto; }
.menu h1 { margin: 0; font: 400 clamp(2.4rem, 11vw, 4.6rem)/.9 var(--f-title); text-transform: uppercase; color: var(--accent); text-shadow: 3px 3px 0 #000, 0 0 30px rgba(232, 193, 90, .35); }
.menu .lead { margin: 0; font-size: 1.15rem; max-width: 560px; }
.menu .help { margin: 0; color: var(--dim); font-size: .92rem; max-width: 560px; }
.menu-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cta { min-height: 54px; padding: 10px 34px; border: 0; border-radius: 10px; background: linear-gradient(180deg, #f7dd8a, var(--accent)); color: #0a2a1c; font: 400 1.35rem/1 var(--f-title); text-transform: uppercase; letter-spacing: .04em; box-shadow: 0 5px 0 #8a6a16, 0 12px 24px rgba(0, 0, 0, .45); }
.cta:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a6a16; }
.cta:disabled { opacity: .5; cursor: wait; }
.best { margin: 0; color: var(--dim); font-size: .95rem; }
.credit { margin: 0; color: var(--dim); font-size: .78rem; opacity: .8; }
.menu .mbh { max-width: 560px; }

/* ── Fin de donne, résultat ──────────────────────────────────── */
.veil { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(4, 14, 9, .66); overflow: auto; }
.sheet { width: min(460px, 100%); padding: 20px; display: grid; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; text-align: center; justify-items: center; }
.sheet h2 { margin: 0; font: 400 1.7rem/1 var(--f-title); text-transform: uppercase; color: var(--accent); }
.sheet .big { font: 400 3.2rem/1 var(--f-title); }
.sheet .big small { font-size: .35em; color: var(--dim); margin-left: .3em; }
.sheet p { margin: 0; color: var(--dim); }
.scores { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; width: 100%; }
.scores div { padding: 8px; border-radius: 8px; background: rgba(255, 255, 255, .06); }
.scores small { display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.scores b { font: 400 1.3rem/1.1 var(--f-title); }
.sheet ol { margin: 0; padding: 0; list-style: none; width: 100%; display: grid; gap: 4px; }
.sheet li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .06); font-size: 1rem; }
.sheet li.ok { background: rgba(122, 201, 67, .18); }
.sheet li.ko { background: rgba(255, 107, 107, .18); }
.sheet li .r { font: 400 1rem/1.3 var(--f-title); color: var(--accent); }
.sheet .mbh { width: 100%; }
@media (max-width: 520px) { .hud { gap: 2px 10px; } .stat b { font-size: 1.15rem; } .stat small { font-size: .62rem; } .scores b { font-size: 1.1rem; } }
@media (orientation: landscape) and (min-width: 700px) {
  .menu { align-content: center; justify-content: start; background: linear-gradient(90deg, rgba(4, 14, 9, .88), rgba(4, 14, 9, .45) 55%, rgba(4, 14, 9, 0)); }
}
/* pas de flash bleu au toucher (surbrillance de tap des navigateurs mobiles) */
#stage, #gl, button { -webkit-tap-highlight-color: transparent; }
#gl { outline: none; }
/* le message vit juste sous l'éventail (Karl) : --msg-top est recalculé à chaque redimensionnement dans game.js */
/* fiche des règles */
#rules { z-index: 6; }
.sheet.rules { text-align: left; justify-items: stretch; max-height: calc(100dvh - 32px); overflow: auto; }
.sheet.rules h2 { text-align: center; }
.sheet.rules dl { margin: 0; display: grid; gap: 4px; }
.sheet.rules dt { margin-top: 8px; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.sheet.rules dd { margin: 0; font-size: 1rem; line-height: 1.35; color: var(--ink); }
.sheet.rules .cta { justify-self: center; }
/* plan de table en haut au milieu : table carrée translucide, quatre places, la nôtre en blanc, celle qui joue s'allume */
.seat { display: none; }
.seatmap { position: absolute; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 3; width: 74px; height: 74px; border-radius: 10px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3); pointer-events: none; }
.seatmap i { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, .3); border: 1px solid rgba(255, 255, 255, .5); transition: transform .2s, background .2s; }
.seatmap i[data-p="2"] { left: 50%; top: 6px; transform: translateX(-50%); }
.seatmap i[data-p="1"] { right: 6px; top: 50%; transform: translateY(-50%); }
.seatmap i[data-p="0"] { left: 50%; bottom: 6px; transform: translateX(-50%); background: #fff; border-color: #fff; }
.seatmap i[data-p="3"] { left: 6px; top: 50%; transform: translateY(-50%); }
.seatmap i.turn { box-shadow: 0 0 0 3px var(--accent), 0 0 12px var(--accent); background: var(--accent); }
.seatmap i[data-p="0"].turn { background: #fff; }
/* en ligne : bouton, salon d'attente, liste des joueurs */
.cta.online { background: linear-gradient(180deg, #8fdc5a, #68b934); color: #0b2f12; box-shadow: 0 5px 0 #3f8a1a, 0 12px 24px rgba(0, 0, 0, .45); }
.cta.online:active { box-shadow: 0 2px 0 #3f8a1a; }
.players { margin: 0; padding: 0; list-style: none; width: 100%; display: grid; gap: 4px; }
.players li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .06); font-size: 1rem; }
.players li.me { background: rgba(232, 193, 90, .18); }
.players li.bot { color: var(--dim); }
.players li.empty { color: var(--dim); font-style: italic; }
.players li small { color: var(--dim); }
.seatmap i::after { content: attr(data-name); position: absolute; left: 50%; top: 110%; transform: translateX(-50%); white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis; font-size: .6rem; line-height: 1; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; display: none; }
.seatmap.online { width: 108px; height: 108px; }   /* un peu plus grand qu'en local, le nom du partenaire déborde à gauche du carré */
.seatmap.online i::after { display: block; }
.seatmap.online i[data-p="2"]::after { left: auto; right: 120%; top: 50%; transform: translateY(-50%); text-align: right; }   /* partenaire : à gauche de son rond */
.seatmap.online i[data-p="3"]::after { left: 50%; top: auto; bottom: 120%; transform: translateX(-50%); }                      /* joueur de gauche : au-dessus de son rond */
.seatmap.online i[data-p="1"]::after { left: 50%; top: 120%; transform: translateX(-50%); }                                    /* joueur de droite : sous son rond */
.seatmap.online i[data-p="0"]::after { left: 120%; top: 50%; bottom: auto; transform: translateY(-50%); }                      /* toi : à droite de ton rond */

/* portrait (téléphone debout) : les trois boutons en colonne à droite, le plan de table au milieu en haut, les compteurs à gauche sur plusieurs lignes */
@media (orientation: portrait) {
  .hud .tools { flex-direction: column; }
  .hud { padding-right: calc(50% + 62px); gap: 2px 8px; }
  .stat small { letter-spacing: .08em; }
}
