/* Client web « jouer en ligne » (doc 16, étape 1). Mobile en portrait d'abord, puis paysage/PC.
   Identité « Émeraude » de l'appli et de la page d'accueil (client/TabletopClient/Palette.cs,
   web/style.css ; 2026-10-25) : mêmes couleurs, même police, mêmes arrondis, mêmes emblèmes de jeux.
   --brass garde son nom historique : c'est la couleur principale (jaune moutarde). */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --bg: #0F5C49;           /* Palette.Emerald.Background */
  --panel: #1A6B57;        /* Surface */
  --panel-2: #136250;      /* SurfaceAlt */
  --field: #0B4B3B;        /* champs de saisie, fonds creusés */
  --ink: #FFF8EC;          /* Foreground */
  --muted: #C8E4D8;        /* Muted */
  --brass: #F6BE4F;        /* Primary */
  --on-primary: #3A2604;   /* OnPrimary */
  --accent: #F08A6A;       /* Accent */
  --felt: #0B4B3B;         /* tapis des jeux de cartes et de dés */
  --felt-ink: #EAFAF1;
  --go: #7BE0A6;           /* en ligne, prêt */
  --danger: #F2836B;       /* Destructive */
  --line: rgba(255, 248, 236, 0.13); /* Border */
  --radius: 18px;          /* CardRadius */
  --button-radius: 14px;   /* ButtonRadius */
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 248, 236, 0.06) 1.2px, transparent 0) 0 0 / 26px 26px,
    radial-gradient(900px 500px at 85% -120px, rgba(246, 190, 79, 0.16) 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100%;
  padding: max(0.9rem, env(safe-area-inset-top)) 0.9rem calc(1.5rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.boot { color: var(--muted); text-align: center; margin-top: 3rem; }

/* Barre de tête : titre + identité. */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}
.topbar h1 { font-size: 1.3rem; color: var(--ink); margin: 0; flex: 1; letter-spacing: -0.02em; font-weight: 800; }
.topbar .back { background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 1.5rem; cursor: pointer; width: 2.3rem; height: 2.3rem; border-radius: 50%; line-height: 1; padding: 0 0 0.15rem; font-family: inherit; flex: none; }
.topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; row-gap: 0.5rem; }
  .topbar .who { order: 10; flex-basis: 100%; justify-content: flex-end; }
}
.brand-icon { width: 32px; height: 32px; border-radius: 9px; flex: none; box-shadow: 0 3px 10px rgba(3, 28, 21, 0.35); }
.who { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 0.4rem; }
.who button { font-size: 0.8rem; }

h2 { color: var(--ink); font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; margin: 1.3rem 0 0.7rem; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Boutons. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  border-radius: var(--button-radius);
  background: var(--panel-2);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--brass); color: var(--on-primary); border-color: transparent; box-shadow: 0 4px 0 #C8902A; }
.btn.primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #C8902A; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.row.tight { gap: 0.4rem; }
.spacer { flex: 1; }

/* Champs. */
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 0.8rem 0 0.3rem; }
input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font-size: 1.1rem;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--button-radius);
  color: var(--ink);
  font-family: inherit;
}
input[type="text"]:focus { outline: 2px solid var(--brass); border-color: transparent; }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 700; }
.options { margin-bottom: 0.8rem; }
.option-select { width: 100%; padding: 0.6rem 0.7rem; font-size: 1rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--button-radius); color: var(--ink); font-family: inherit; margin-bottom: 0.4rem; }

/* Cartes / panneaux. */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.error { color: var(--danger); font-size: 0.9rem; margin: 0.5rem 0; min-height: 1.1em; }

/* Liste des jeux. */
.games { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; grid-template-columns: 1fr; }
@media (min-width: 520px) { .games { grid-template-columns: 1fr 1fr; } }
.game-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  transition: transform 0.15s ease, background 0.15s ease;
}
.game-card:hover { background: #1F7560; transform: translateY(-2px); }
.game-card:hover .emblem { animation: wiggle 0.5s ease; }
.game-card-text { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.game-card h3 { margin: 0; font-size: 1.1rem; }
.emblem { flex: none; border-radius: 26%; }
.sheet-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.4rem; }
.sheet-head h2 { margin: 0; font-size: 1.6rem; }
@keyframes wiggle { 30% { transform: rotate(-8deg) scale(1.06); } 60% { transform: rotate(6deg) scale(1.06); } }
.game-card .meta { color: var(--brass); font-size: 0.82rem; font-weight: 700; }

/* Table (salle d'attente). */
.code-box { text-align: center; padding: 1rem; }
.code-box .code { font-size: 2.2rem; font-weight: 800; letter-spacing: 0.35em; color: var(--brass); padding-left: 0.35em; }
.code-box .link { word-break: break-all; color: var(--muted); font-size: 0.85rem; margin-top: 0.4rem; }
.code-box .code.long { font-size: 1.25rem; letter-spacing: 0.12em; padding-left: 0.12em; word-break: break-all; }
.who .who-name { font-weight: 600; color: var(--ink, inherit); max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seats { list-style: none; padding: 0; margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.seat { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.seat .dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--muted); flex: none; }
.seat.on .dot { background: var(--go); }
.seat .name { flex: 1; font-weight: 600; }
.seat .tag { font-size: 0.75rem; color: var(--muted); }
.seat .tag.ready { color: var(--go); }
.seat.me { border-color: var(--brass); }

/* Recherche de partie. */
.search-status { text-align: center; padding: 1.5rem 1rem; }
.search-status .big { font-size: 1.3rem; font-weight: 700; color: var(--brass); }
.search-status .quiet { margin-top: 1rem; font-weight: 700; color: var(--brass); }
.search-status .btn + .btn { margin-top: 0.6rem; }
.spinner { width: 2.4rem; height: 2.4rem; border: 3px solid var(--line); border-top-color: var(--brass); border-radius: 50%; margin: 1rem auto; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--ink); border: 0; color: var(--bg); font-weight: 700; padding: 0.6rem 1rem; border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,0.4); z-index: 50; max-width: 90%; }

/* Compte à rebours « prêt ? ». */
.ready-check { text-align: center; }
.ready-check .count { font-size: 2rem; font-weight: 800; color: var(--brass); }

/* Écran de partie (placeholder étape 1 ; le plateau de l'étape 2 s'y insère). */
.game-screen { flex: 1; display: flex; flex-direction: column; gap: 0.8rem; }
.players-bar { display: flex; gap: 0.6rem; }
.player-chip { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 0.7rem; display: flex; align-items: center; gap: 0.5rem; }
.player-chip.active { border-color: var(--brass); }
.player-chip .name { font-weight: 600; font-size: 0.9rem; }
.debug-view { background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; }

.footer-note { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: auto; padding-top: 1rem; }
a { color: var(--brass); }

/* ===== Plateau et partie (étape 2) ===== */
.game-screen { flex: 1; display: flex; flex-direction: column; gap: 0.7rem; }
.players-bar { display: flex; gap: 0.6rem; }
.player-chip { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.6rem; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.player-chip.active { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass) inset; }
.player-chip .name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-chip .score { margin-left: auto; font-weight: 700; color: var(--brass); }
.piece-icon { width: 1.9rem; height: 1.9rem; flex: none; }

.turn { margin: 0.1rem 0; font-size: 0.95rem; }

.board-wrap { position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
.board-svg { width: 100%; height: auto; display: block; border-radius: 14px; overflow: hidden; background: var(--felt); box-shadow: 0 4px 18px rgba(0,0,0,0.35); touch-action: manipulation; }
.cell-hit { cursor: pointer; }

/* Sélecteur de choix (promotion, type d'unité). */
.chooser { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.5); border-radius: 10px; }
.chooser-panel { background: var(--panel); border: 1px solid var(--brass); border-radius: var(--radius); padding: 0.9rem; max-width: 90%; }
.btn.choice { flex-direction: column; gap: 0.2rem; padding: 0.5rem 0.7rem; }
.choice-icon { width: 2.6rem; height: 2.6rem; }

.notices { display: flex; flex-direction: column; gap: 0.25rem; }
.notice { margin: 0; font-size: 0.85rem; color: var(--ink); background: rgba(255, 248, 236, 0.08); border-left: 3px solid var(--brass); padding: 0.35rem 0.65rem; border-radius: 8px; }

.trays { display: flex; flex-direction: column; gap: 0.4rem; }
.tray { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.6rem; }
.tray-owner { font-size: 0.78rem; color: var(--muted); display: block; margin-bottom: 0.2rem; }
.tray-items { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tray-item { display: inline-flex; align-items: center; gap: 0.15rem; }
.tray-item .piece-icon { width: 1.6rem; height: 1.6rem; }
.tray-count { font-size: 0.8rem; color: var(--muted); }

.pass-actions:empty { display: none; }
.pass-actions { margin-top: 0.2rem; }
.game-controls { margin-top: 0.3rem; align-items: center; }

/* Modale (règles, confirmations). */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 60; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 460px; width: 100%; max-height: 80vh; overflow: auto; }
.modal-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.05rem; }
.modal-body { padding: 1rem; }

/* ===== Huit ! (cartes) ===== */
.eights-screen { flex: 1; display: flex; flex-direction: column; gap: 0.7rem; }
.eights-table { display: flex; justify-content: center; gap: 1.5rem; padding: 0.7rem; background: var(--felt); border-radius: var(--radius); box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.25); }
.pile { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.pile .muted { color: #dfeee6; font-size: 0.78rem; }
.eights-hand { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; padding: 0.3rem; }

.card { width: 3rem; height: 4.3rem; border-radius: 8px; display: flex; align-items: center; justify-content: center; border: 2px solid rgba(0,0,0,0.3); box-shadow: 0 2px 6px rgba(0,0,0,0.3); color: #fff; user-select: none; flex: none; }
.card .card-label { font-size: 1.4rem; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.card.color-0 { background: #c0392b; }
.card.color-1 { background: #d4a017; }
.card.color-2 { background: #2f8f4e; }
.card.color-3 { background: #2d6cb5; }
.card.color-wild { background: conic-gradient(#c0392b, #d4a017, #2f8f4e, #2d6cb5, #c0392b); }
.card.back { background: repeating-linear-gradient(45deg, #1A6B57, #1A6B57 6px, #136250 6px, #136250 12px); color: var(--ink); border-color: rgba(255, 248, 236, 0.35); }
/* Briscola, Scopa : cartes italiennes claires, couleur au symbole, points au coin. */
.card.italian { position: relative; flex-direction: column; gap: 0.1rem; background: #f6efe0; color: #2a2018; border-color: #b9a57e; }
.card.italian .card-label { font-size: 1.15rem; text-shadow: none; }
.card.italian .card-suit { font-size: 1.2rem; line-height: 1; }
.card.italian .card-points { position: absolute; top: 2px; right: 4px; font-size: 0.65rem; font-weight: 700; opacity: 0.75; }
.card.italian.suit-0 .card-suit { color: #b8860b; }
.card.italian.suit-1 .card-suit { color: #b8322a; }
.card.italian.suit-2 .card-suit { color: #2d5d9f; }
.card.italian.suit-3 .card-suit { color: #2f7a43; }
.card.italian.dim { opacity: 0.6; }
.card.italian.small { width: 2.4rem; height: 3.4rem; }
.card.italian.small .card-label { font-size: 0.95rem; }
.card.slot { background: transparent; border: 2px dashed rgba(255,255,255,0.35); box-shadow: none; }
.briscola-stock { display: flex; align-items: center; gap: 0.3rem; }
.briscola-stock .card.trump { outline: 2px solid var(--brass); }
.briscola-trick { gap: 0.3rem; }
.scopa-table { align-items: flex-start; }
.scopa-cloth { flex: 1; }
.card.italian.french.suit-0 .card-suit, .card.italian.french.suit-3 .card-suit { color: #2a2018; }
.card.italian.french.suit-1 .card-suit, .card.italian.french.suit-2 .card-suit { color: #b8322a; }
.cribbage-board { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.4rem 0; }
.cribbage-board .muted { font-size: 0.75rem; margin: 0; }
.cribbage-track { height: 0.6rem; border-radius: 0.3rem; background: rgba(255,255,255,0.08); overflow: hidden; }
.cribbage-peg { height: 100%; border-radius: 0.3rem; background: var(--brass); }
.cribbage-track.seat-1 .cribbage-peg { background: #c0392b; }
.card.slot.small { width: 2.4rem; height: 3.4rem; }
.bulls-entry { display: flex; justify-content: center; gap: 0.5rem; margin: 0.6rem 0; }
.bulls-slot { width: 2.6rem; height: 3rem; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 800; border-radius: 8px; border: 2px solid var(--line); color: var(--muted, #a89a86); }
.bulls-slot.filled { border-color: var(--brass); color: var(--ink); }
.bulls-pad { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.bulls-keys { display: grid; grid-template-columns: repeat(6, 2.8rem); gap: 0.35rem; }
.bulls-key { padding: 0.5rem 0; font-size: 1.1rem; }
.bulls-history { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 0.8rem; }
.bulls-column ol { margin: 0; padding-left: 1.4rem; }
.bulls-column li { display: flex; flex-direction: column; margin-bottom: 0.3rem; }
.bulls-code { font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: 0.15em; font-weight: 700; }
.bulls-result { font-size: 0.8rem; color: var(--muted, #a89a86); }
.domino { display: inline-flex; flex-direction: row; align-items: stretch; background: #f6efe0; color: #2a2018; border: 2px solid #b9a57e; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.3); user-select: none; flex: none; }
.domino .domino-half { width: 1.9rem; height: 2.4rem; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; }
.domino .domino-half + .domino-half { border-left: 2px solid #b9a57e; }
.domino.small .domino-half { width: 1.35rem; height: 1.8rem; font-size: 0.9rem; }
.domino.double { border-color: var(--brass); }
.domino.playable { cursor: pointer; outline: 2px solid var(--brass); }
.domino.playable:hover { transform: translateY(-4px); transition: transform 0.1s; }
.domino.dim { opacity: 0.6; }
.domino.slot { width: 3.8rem; height: 2.4rem; background: transparent; border: 2px dashed rgba(255,255,255,0.35); box-shadow: none; }
.dominoes-line { flex-wrap: wrap; justify-content: center; gap: 0.15rem; }
.dominoes-hand { flex-wrap: wrap; gap: 0.4rem; }
.mahjong-grid { display: grid; gap: 3px; padding: 0.6rem; background: var(--felt); border-radius: var(--radius); }
.mahjong-empty { aspect-ratio: 3 / 4; }
.mahjong-tile { aspect-ratio: 3 / 4; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f6efe0; color: #2a2018; border-radius: 4px; border: 1px solid #b9a57e; opacity: 0.55; user-select: none; line-height: 1; }
.mahjong-tile .mj-symbol { font-size: 1rem; }
.mahjong-tile .mj-number { font-size: 0.6rem; font-weight: 700; }
.mahjong-tile.mj-layer-1 { box-shadow: 2px 2px 0 #8c7a5b; }
.mahjong-tile.mj-layer-2 { box-shadow: 3px 3px 0 #8c7a5b, 4px 4px 0 #6b5a3e; }
.mahjong-tile.mj-layer-3, .mahjong-tile.mj-layer-4 { box-shadow: 3px 3px 0 #8c7a5b, 5px 5px 0 #6b5a3e, 6px 6px 0 #4a3a2a; }
.mahjong-tile.free { opacity: 1; cursor: pointer; outline: 2px solid var(--brass); }
.mahjong-tile.selected { background: #f1d27a; outline: 3px solid #c0392b; }
.mahjong-tile.mj-color-0 .mj-symbol { color: #b8322a; }
.mahjong-tile.mj-color-1 .mj-symbol { color: #2d5d9f; }
.mahjong-tile.mj-color-2 .mj-symbol { color: #2f7a43; }
.mahjong-tile.mj-color-3 .mj-symbol { color: #b8860b; }
.mahjong-tile.mj-color-4 .mj-symbol { color: #7a3b8f; }
.mahjong-tile.mj-color-5 .mj-symbol { color: #2a2018; }
.durak-pair { position: relative; width: 4.2rem; height: 6.1rem; }
.durak-pair .card { position: absolute; left: 0; top: 0; }
.durak-pair .card.durak-cover { left: 1.2rem; top: 1.8rem; }
.scopa-cards { flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
.scopa-option { display: inline-flex; flex-direction: row; align-items: center; gap: 0.2rem; padding: 0.3rem; height: auto; }
.chooser-panel .row:has(.scopa-option) { flex-wrap: wrap; gap: 0.5rem; }
.card.playable { cursor: pointer; outline: 2px solid var(--brass); }
.card.playable:hover { transform: translateY(-4px); transition: transform 0.1s; }
.card.dim { opacity: 0.5; }
.chooser.inline { position: static; inset: auto; background: none; padding: 0.4rem 0; display: block; }
.chooser.inline .chooser-panel { max-width: none; }
.color-chip.color-0 { background: #c0392b; color: #fff; border-color: transparent; }
.color-chip.color-1 { background: #d4a017; color: var(--on-primary); border-color: transparent; }
.color-chip.color-2 { background: #2f8f4e; color: #fff; border-color: transparent; }
.color-chip.color-3 { background: #2d6cb5; color: #fff; border-color: transparent; }

/* Paysage et PC : plateau à gauche, panneaux à droite si la place le permet. */
@media (min-width: 760px) and (orientation: landscape) {
  .app { max-width: 920px; }
  .game-screen { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); grid-template-areas: "bar bar" "board turn" "board notices" "board trays" "board actions" "board controls"; align-items: start; column-gap: 1rem; }
  .players-bar { grid-area: bar; }
  .game-screen > .play-mat { grid-area: board; }
  .board-wrap { max-width: min(62vh, 560px); }
  .turn { grid-area: turn; }
  .notices { grid-area: notices; }
  .trays { grid-area: trays; }
  .pass-actions { grid-area: actions; }
  .game-controls { grid-area: controls; }
}

/* Fin de partie : bandeau au-dessus du plateau, qui reste visible. */
.result-panel { border-color: var(--brass); }
.result-panel h2 { margin: 0 0 0.4rem; font-size: 1.6rem; }

/* L'attribut hidden doit gagner sur les display des composants (.btn, .row…). */
[hidden] { display: none !important; }
.chooser-panel > .btn.small { margin-top: 0.7rem; }
.player-chip .score { white-space: nowrap; }

/* Choix « contre l'ordinateur » sur la fiche d'un jeu. */
.ai-box { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.9rem; }
.ai-box h3 { margin: 0 0 0.5rem; color: var(--ink); font-size: 1.1rem; }

/* Règles complètes. */
.rules p { margin: 0 0 0.8rem; line-height: 1.5; }
.rules strong { color: var(--brass); display: block; margin-bottom: 0.15rem; }

/* Duel animé (Récif) : décoratif, ne capte aucun toucher. */
.duel-overlay { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 60; }
.duel-overlay > * { grid-area: 1 / 1; }
.duel-stage { display: flex; align-items: center; gap: 0.8rem; padding: 1rem 1.3rem; background: rgba(11, 75, 59, 0.94);
  border: 2px solid var(--brass); border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); animation: duel-in 0.18s ease-out; }
.duel-piece .piece-icon { width: 96px; height: 96px; display: block; }
.duel-piece.falls { animation: duel-fall 0.5s ease-in 0.75s forwards; }
.duel-vs { font-size: 2rem; font-weight: 800; color: var(--brass); }
.duel-verdict { align-self: end; margin-bottom: 30vh; background: var(--panel); border: 1px solid var(--line); padding: 0.3rem 0.8rem; border-radius: 999px; animation: duel-in 0.18s ease-out; }
@keyframes duel-in { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes duel-fall { to { transform: scale(0.6) rotate(-12deg); opacity: 0.12; } }
@media (prefers-reduced-motion: reduce) { .duel-stage, .duel-piece.falls, .duel-verdict { animation: none; } .duel-piece.falls { opacity: 0.25; } }

/* Options (barre du haut) et passation. */
.topbar .gear { margin-left: 0.4rem; font-size: 1.05rem; padding: 0.25rem 0.55rem; }
.handoff { padding: 2rem 1rem; }
.handoff h2 { font-size: 1.5rem; }

/* Journal du Huit !. */
.eights-log { margin-top: 0.8rem; font-size: 0.88rem; color: var(--muted); }
.eights-log h3 { margin: 0 0 0.3rem; font-size: 0.95rem; color: var(--brass); }
.eights-log p { margin: 0.1rem 0; }

/* Signaler un problème. */
.feedback-text { width: 100%; min-height: 8rem; resize: vertical; padding: 0.6rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: inherit; box-sizing: border-box; }

/* Yams (doc 16 § 10.42) : dés à garder, feuille de score. */
.yacht-screen { flex: 1; display: flex; flex-direction: column; gap: 0.7rem; }
.yacht-dice { display: flex; justify-content: center; gap: 0.5rem; padding: 0.9rem 0.5rem; background: var(--felt); border-radius: var(--radius); }
.die { background: none; border: none; padding: 0; width: min(17vw, 4.2rem); aspect-ratio: 1; cursor: pointer; transition: transform 0.12s; }
.die:disabled { cursor: default; }
.die .die-face rect { fill: #f8fafc; stroke: #1c1712; stroke-width: 3; }
.die .die-face circle { fill: #1c1712; }
.die.blank .die-face rect { fill: rgba(255,255,255,0.12); stroke: rgba(255,255,255,0.25); }
.die.held { transform: translateY(-6px); }
.die.held .die-face rect { stroke: var(--brass); stroke-width: 9; }
.die.small { width: min(9vw, 2.2rem); cursor: default; }
.tt-aside { display: flex; gap: 0.3rem; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 2.4rem; }
.tt-points { font-size: 1.3rem; font-weight: 700; margin: 0.2rem 0; }
.yacht-sheet table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.yacht-sheet th, .yacht-sheet td { padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--line); text-align: center; }
.yacht-sheet th[scope="row"] { text-align: left; font-weight: 500; color: var(--ink); }
.yacht-sheet thead th { color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 8rem; }
.yacht-sheet thead th.active { color: var(--brass); }
.yacht-sheet tr.total th, .yacht-sheet tr.total td { font-weight: 800; color: var(--brass); border-bottom: none; }
.yacht-sheet .score-pick { min-width: 3rem; padding: 0.2rem 0.5rem; }

/* Profil et amis (étape 5.2). */
.stats-row { display: flex; gap: 0.6rem; }
.stat { flex: 1; text-align: center; background: var(--panel-2); border-radius: var(--radius); padding: 0.6rem 0.3rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--brass); }
.achievements { list-style: none; padding: 0; margin: 0; }
.achievement { padding: 0.25rem 0; color: var(--muted); }
.achievement.on { color: var(--ink); }
.achievement.on > span:first-child { color: var(--brass); }
.ratings { width: 100%; border-collapse: collapse; }
.ratings td { padding: 0.3rem 0.2rem; border-bottom: 1px solid var(--line); }
.ratings td:last-child { text-align: right; font-weight: 700; color: var(--brass); }
.friends { list-style: none; padding: 0; margin: 0; }
.friend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.friend .name { font-weight: 600; }
.friend .friend-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.friend .friend-actions .option-select { width: auto; margin: 0; }
.presence { width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--muted); flex: none; }
.presence.online { background: #4ade80; }
.presence.playing { background: var(--brass); }
.safety-row { margin-top: 0.6rem; justify-content: center; }

/* Labo Récif (compte admin) */
.lab-table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; }
.lab-table th, .lab-table td { padding: 0.25rem 0.3rem; text-align: left; }
.lab-table th { color: var(--muted, #9a8f7f); font-weight: 600; font-size: 0.85rem; }
.lab-input { width: 4.2rem; padding: 0.35rem 0.4rem; font-size: 1rem; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-family: inherit; }
.lab-input:disabled { opacity: 0.35; }
/* Pas d'animations décoratives pour qui préfère les réduire. */
@media (prefers-reduced-motion: reduce) {
  .game-card:hover .emblem { animation: none; }
}

/* Tapis de jeu (Ui/PlayMat.cs de l'appli, BoardSkin.DefaultMat) : feutre tabac éclairé au centre et
   assombri vers les bords, grain de fibres, surpiqûre crème à 9 px du bord. Tout le matériel du jeu
   (plateau, table de cartes et main, dés) s'y pose, jamais sur le fond vert de l'interface. */
.play-mat {
  position: relative;
  padding: clamp(19px, 4vw, 34px);
  border-radius: calc(var(--radius) + 4px);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95 0.32' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.95 0 0 0 0 0.85 0 0 0 0.11 -0.02'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 75% 70% at 50% 45%, #4A372E 0%, #3E2C24 55%, #281D17 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), inset 0 0 36px rgba(0, 0, 0, 0.35), 0 10px 26px rgba(3, 28, 21, 0.4);
}
.play-mat::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px dashed rgba(245, 224, 184, 0.42);
  border-radius: calc(var(--radius) - 2px);
  pointer-events: none;
}
.play-mat > * { position: relative; }
.game-screen > .play-mat { width: 100%; max-width: calc(560px + 68px); margin: 0 auto; }
/* Sur le tapis, les tables de cartes et de dés n'ont plus leur propre fond. */
.play-mat .eights-table, .play-mat .yacht-dice, .play-mat .mahjong-grid { background: rgba(0, 0, 0, 0.12); box-shadow: none; }
.play-mat .eights-hand { padding-bottom: 0; }
.play-mat > h2 { margin: 0.9rem 0 0.5rem; font-size: 1.05rem; color: rgba(245, 224, 184, 0.85); }
.play-mat .board-svg { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); }

/* ───── Accueil et fiche du jeu comme l'appli (2026-10-25) ───── */
.home-actions { display: flex; flex-direction: column; gap: 0.7rem; margin: 0.9rem 0 0.4rem; }
.quick-play {
  display: flex; align-items: center; gap: 0.9rem; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  background: var(--brass); color: var(--on-primary); border: 0; border-radius: var(--radius); padding: 1rem 1.2rem;
  box-shadow: 0 5px 0 #C8902A; transition: transform 0.12s ease;
}
.quick-play:hover { transform: translateY(-2px); }
.quick-play:active { transform: translateY(3px); box-shadow: 0 2px 0 #C8902A; }
.quick-icon { font-size: 1.9rem; line-height: 1; }
.quick-text { display: flex; flex-direction: column; }
.quick-text strong { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.quick-text span { font-size: 0.95rem; opacity: 0.85; }
.row.split > .btn { flex: 1 1 0; }
.invite-pick { border: 2px dashed var(--brass); }
.invite-pick h2 { margin-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.9rem; }
.chip {
  font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer; padding: 0.5rem 1rem; border-radius: 999px;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--brass); color: var(--on-primary); border-color: transparent; }

.sheet-head > div { min-width: 0; }
.sheet-meta { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.sheet-desc { margin: 0.6rem 0 1rem; }
.mode-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.5rem; margin: 0 0 1rem; }
.mode-tiles:empty { display: none; }
.mode-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 0.8rem 0.3rem; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.95rem; color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--button-radius);
}
.mode-tile[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }
.mode-icon svg { width: 30px; height: 30px; display: block; fill: currentColor; }
.mode-icon svg .hole { fill: var(--panel-2); }
.mode-tile[aria-pressed="true"] .mode-icon svg .hole { fill: var(--ink); }
.mode-icon svg.outline { fill: none; stroke: currentColor; stroke-width: 4; }
.caption { margin: 0 0 0.45rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.sheet-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.6rem; }
.sheet-actions:empty { display: none; }
.btn.big { font-size: 1.15rem; padding: 0.95rem 1.2rem; }
.wait-hint { margin: -0.2rem 0 0; text-align: center; font-size: 0.85rem; color: var(--muted); }

/* Grand écran : le plateau prend la hauteur de la fenêtre (sans déborder ni se déformer), la colonne
   de droite garde une largeur fixe. Avant, il restait petit au milieu d'un grand fond vert. */
@media (min-width: 900px) and (orientation: landscape) {
  .app:has(.game-screen) { max-width: 1280px; }
  .game-screen { grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); }
  .game-screen > .play-mat { max-width: none; }
  .board-wrap { max-width: min(100%, calc((100vh - 230px) * var(--board-aspect, 1))); }
  /* Plateau très large (awalé) : la colonne de droite passe dessous, le plateau prend toute la largeur. */
  .game-screen:has(.board-wrap.wide) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "turn" "board" "notices" "trays" "actions" "controls"; }
  .game-screen:has(.board-wrap.wide) .turn { text-align: center; }
}
