@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Inter:wght@400;500;600;700&display=swap");
:root {
  --bg: #0C111B;
  --panel: #1A2435;
  --mat-2: #212D42;
  --line: #2A3850;
  --text: #e8edf5;
  --muted: #8d9bb3;
  --accent: #D9AC59;
  --gold: #D9AC59;
  --good: #3fbf7f;
  --select: #D9AC59;
  /* hauteur d'un tapis : deux tapis + mains + barre centrale tiennent dans l'écran */
  /* --zoom (réglage "Plateau") : au-delà de 1, le plateau dépasse l'écran et défile */
  --zoom: 1.2;
  --hand-h: clamp(76px, calc(11vh * var(--zoom)), 170px);
  --chrome: 78px;  /* barre du haut + sous-menu ; 0 quand ils sont masqués (mode plateau agrandi) */
  --mat-h: clamp(220px, calc((100vh - var(--chrome) - 12px - 30px - 16px - 44px - var(--hand-h) - 8px) / 2 * var(--zoom)), 1100px);
}
html.bars-hidden { --chrome: 0px; }
/* Barres masquées : seuls l'état de la partie, la pendule et les réglages restent, en petit en haut à droite */
html.bars-hidden .subnav { display: none; }
html.bars-hidden .topbar {
  position: fixed; top: 6px; right: 6px; z-index: 50; padding: 4px 8px; gap: 8px; border: 1px solid var(--line);
  border-radius: 8px; background: rgba(8, 13, 21, .85); max-width: min(560px, 60vw);
}
html.bars-hidden .topbar .brand, html.bars-hidden .topbar .nav, html.bars-hidden .topbar .newgame-link,
html.bars-hidden .topbar .view-tools label { display: none; }
html.bars-hidden .topbar .status { min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}
button, select {
  font: inherit; color: var(--text); background: var(--mat-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px;
}
button { cursor: pointer; }
button:hover { border-color: var(--select); }
button:disabled { opacity: .5; cursor: wait; }

/* ---------------------------------------------------------------- barre du haut */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--line); background: #080d15;
}
.brand { font-weight: 800; font-size: 18px; letter-spacing: .5px; }
.brand span { color: var(--accent); }
.status { flex: 1; color: var(--muted); min-width: 200px; }
.status b { color: var(--text); }
.clock { display: flex; gap: 10px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.clock span { padding: 2px 8px; border-radius: 6px; background: var(--mat-2); }
.clock span.run { color: var(--text); box-shadow: inset 0 -2px 0 var(--gold); }
.clock span.low { color: var(--accent); }
.status .first { color: var(--gold); }
.newgame { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.newgame-link { background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; padding: 5px 12px;
  border-radius: 6px; font-size: 13px; }
.no-game { grid-column: 1 / -1; margin: auto; text-align: center; padding: 60px 20px; color: var(--muted); }
.no-game p { font-size: 18px; color: var(--text); margin: 0 0 16px; }
.no-game a { color: var(--accent); }
.no-game .primary-link { display: inline-block; background: var(--accent); color: #fff; font-weight: 600;
  text-decoration: none; padding: 10px 20px; border-radius: 8px; margin-bottom: 14px; }
.no-game-mode .opp-hand, .no-game-mode .mat, .no-game-mode .midline, .no-game-mode .hand { display: none; }
.no-game-mode .newgame-link { display: none; }
.newgame label { color: var(--muted); font-size: 12px; }
.newgame button { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.view-tools { display: flex; gap: 8px; align-items: center; }
.view-tools label { color: var(--muted); font-size: 12px; }
.panel-hidden .panel { display: none; }
.replay-mode .view-tools { display: flex; }

/* barre secondaire (Jouer : IA / Multijoueur / Tournois ; Stats : stats / matchups) */
.subnav { display: flex; gap: 4px; padding: 6px 16px; border-bottom: 1px solid var(--line); background: #0a1019; flex-wrap: wrap; }
.subnav a { color: var(--muted); text-decoration: none; padding: 4px 12px; border-radius: 6px; font-size: 13px; }
.subnav a:hover { color: var(--text); background: var(--mat-2); }
.subnav a.current { color: var(--text); background: var(--mat-2); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------------------------------------------------------------- mise en page */
.layout { flex: 1; display: flex; min-height: 0; }
.board {
  position: relative; flex: 1; overflow: auto; padding: 6px 12px;
  display: flex; flex-direction: column; align-items: safe center; gap: 4px;
  background: radial-gradient(ellipse at center, #16233a, var(--bg) 75%);
}
.panel {
  width: 340px; flex-shrink: 0; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; background: var(--panel); overflow: auto;
}

/* ---------------------------------------------------------------- tapis */
.mat {
  --card-h: calc(var(--mat-h) * 0.26);
  --card-w: calc(var(--card-h) * 0.716);
  position: relative; flex-shrink: 0;
  height: var(--mat-h); aspect-ratio: 1414 / 1000;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .55);
  transition: box-shadow .3s;
}
.mat .bg {
  position: absolute; inset: 0; background: #3a1d22 center/100% 100% no-repeat;
  filter: saturate(.85) brightness(.82);
}
.mat.opp .bg { transform: rotate(180deg); }
.mat.active-turn { box-shadow: 0 0 0 3px var(--gold), 0 6px 24px rgba(0, 0, 0, .55); }
.zone {
  position: absolute; display: flex; align-items: center; justify-content: center;
}
.zone.characters { gap: 2.2%; }
.zone .count {
  position: absolute; bottom: 4px; right: 4px; z-index: 5;
  background: rgba(0, 0, 0, .8); border-radius: 10px; padding: 0 7px;
  font-size: max(12px, calc(var(--mat-h) * .035)); font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none;
}
.zone.cost { justify-content: flex-start; padding: 0 2%; }
.zone.cost .don {
  position: absolute; height: 76%; aspect-ratio: .716; top: 12%;
  border-radius: 4px; background: url(/assets/back/don) center/cover;
  box-shadow: 0 0 0 1px rgba(242, 184, 59, .8), 0 1px 4px rgba(0,0,0,.6);
  transition: transform .25s;
}
.zone.cost .don.face { background-image: url(/cards/Don); }
.zone.cost .don.rested { transform: rotate(90deg) scale(.8); filter: brightness(.65); }
.zone.cost .don.clickable { cursor: pointer; }
.zone.cost .don.clickable:hover { box-shadow: 0 0 0 2px var(--gold); }
.zone.cost.selected .don.clickable { box-shadow: 0 0 0 2px var(--gold), 0 0 10px var(--gold); }
.pile {
  position: relative; height: 92%; aspect-ratio: .716; border-radius: 6px;
  background: url(/assets/back/regular) center/cover; box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.pile.don { background-image: url(/assets/back/don); }
.pile.empty { background: rgba(0, 0, 0, .25); box-shadow: none; border: 1px dashed rgba(255,255,255,.2); }
.zone.trash .card { height: 92%; width: auto; aspect-ratio: .716; }
.zone.life { flex-direction: column; justify-content: flex-start; }
.lifecard {
  position: absolute; left: 4%; width: 92%; aspect-ratio: 1 / .716;
  border-radius: 5px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,.6);
}
.lifecard::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 71.6%; height: 139.7%;
  background: url(/assets/back/regular) center/cover;
  transform: translate(-50%, -50%) rotate(90deg);
}
.zone.life.flash { animation: lifeflash .8s ease-out; }

/* ---------------------------------------------------------------- cartes */
.card {
  position: relative; width: var(--card-w); height: var(--card-h); flex-shrink: 0;
  border-radius: 6px; cursor: pointer; user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.card img { width: 100%; height: 100%; border-radius: 6px; display: block; pointer-events: none; }
.card .fallback {
  position: absolute; inset: 0; padding: 4px; font-size: 10px; display: flex;
  align-items: center; justify-content: center; text-align: center; border-radius: 6px;
  background: #2b3a55; border: 1px solid var(--line);
}
.card.rested { transform: rotate(90deg) scale(.82); }
.card.actionable { box-shadow: 0 0 0 2px rgba(242, 184, 59, .55), 0 2px 6px rgba(0,0,0,.6); }
.card.selected { box-shadow: 0 0 0 3px var(--gold), 0 0 16px var(--gold); z-index: 3; }
.card.targetable { animation: pulse 1s ease-in-out infinite; z-index: 3; }
.card.highlight { box-shadow: 0 0 0 3px var(--select), 0 0 14px var(--select); }
.card.battle-attacker { box-shadow: 0 0 0 3px var(--accent), 0 0 18px var(--accent); z-index: 4; }
.card.battle-target { box-shadow: 0 0 0 3px #ff8a3d, 0 0 18px #ff8a3d; z-index: 4; }
.card.unscripted::after {
  content: "effet non codé"; position: absolute; top: 3px; left: 3px; right: 3px;
  font-size: 8px; text-align: center; background: rgba(0,0,0,.75); color: var(--muted);
  border-radius: 3px;
}
.badge {
  position: absolute; font-size: max(11px, calc(var(--card-h, 100px) * .1)); font-weight: 700; border-radius: 10px;
  padding: 0 6px; font-variant-numeric: tabular-nums; pointer-events: none;
}
.badge.power { bottom: 3px; right: 3px; background: rgba(0, 0, 0, .82); }
.badge.power.up { color: var(--good); }
.badge.power.down { color: var(--accent); }
.badge.don { top: 3px; right: 3px; background: var(--gold); color: #000; }
.card { isolation: isolate; }  /* les DON!! attachés passent sous la carte, pas sous le tapis */
.don-stack { position: absolute; inset: 0; z-index: -1; }
.don-under {
  position: absolute; inset: 0 6%; border-radius: 5px; background: url(/cards/Don) center/cover;
  box-shadow: 0 0 0 1px rgba(242, 184, 59, .9), 0 2px 4px rgba(0, 0, 0, .6); cursor: pointer;
}
.don-stack.pop .don-under { animation: pulse .6s ease-out; }
.zone.cost .don.giveback { box-shadow: 0 0 0 2px var(--gold), 0 0 10px var(--gold); }
.card-status {
  position: absolute; left: 2px; right: 2px; top: 50%; transform: translateY(-50%); display: flex;
  flex-direction: column; gap: 2px; align-items: center; pointer-events: none; z-index: 2;
}
.card-status span {
  background: rgba(150, 20, 20, .9); color: #fff; font-weight: 700; text-align: center; border-radius: 3px;
  font-size: max(9px, calc(var(--card-h, 100px) * .085)); line-height: 1.2; padding: 1px 4px; max-width: 100%;
  text-transform: uppercase; letter-spacing: .02em;
}
.badge.cost {
  top: 2px; left: 2px; min-width: 1.6em; text-align: center; border-radius: 50%; padding: 1px 4px;
  font-size: max(12px, calc(var(--card-h, 100px) * .12)); border: 2px solid #fff;
}
.badge.cost.down { background: #a8322e; color: #fff; }  /* perd des niveaux : rouge */
.badge.cost.up { background: #1f7a4a; color: #fff; }  /* gagne des niveaux : vert */
.badge.pop { animation: pop .45s ease-out; }
.card.back { background: url(/assets/back/regular) center/cover; cursor: default; }

.opp-hand { display: flex; justify-content: center; min-height: 30px; }
.opp-hand .card { width: calc(22px * var(--zoom)); height: calc(30px * var(--zoom)); margin: 0 -3px; }
.hand {
  position: relative; z-index: 5; display: flex; justify-content: center; gap: 6px;
  min-height: var(--hand-h);
}
.hand .card { --card-h: var(--hand-h); width: calc(var(--hand-h) * .716); height: var(--hand-h); transition: transform .15s; }
.hand .card:hover { transform: translateY(-8px); }
.hand .card.selected { transform: translateY(-12px); }

/* ---------------------------------------------------------------- ligne centrale */
.midline {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  min-height: 44px; width: 100%;
}
.battle { font-weight: 600; color: var(--muted); }
.battle .vs { color: var(--accent); margin: 0 8px; }
.battle .pw { color: var(--text); font-size: 16px; }
.hint { color: var(--gold); font-weight: 600; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bar button { padding: 7px 16px; font-weight: 600; }
.bar button.end { background: var(--accent); border-color: var(--accent); }
.bar button.ok { background: #21503a; border-color: #2f7a55; }
.cardmenu {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 8px;
  background: #121d2e; border: 1px solid var(--gold); border-radius: 8px;
  box-shadow: 0 0 12px rgba(242, 184, 59, .25); animation: enter .2s ease-out;
}
.cardmenu .title { font-size: 12px; color: var(--gold); font-weight: 600; }
.cardmenu button { padding: 5px 10px; }

/* ---------------------------------------------------------------- menu contextuel */
.menu {
  position: fixed; z-index: 50; min-width: 180px; max-width: 280px;
  background: #121d2e; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .6); padding: 6px; display: flex; flex-direction: column; gap: 4px;
}
.menu[hidden] { display: none; }
.menu button { text-align: left; }
.menu .title { font-size: 11px; color: var(--muted); padding: 2px 4px; }

/* ---------------------------------------------------------------- panneau */
.preview { padding: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; min-height: 150px; }
.preview img { width: 130px; border-radius: 8px; align-self: flex-start; }
.preview .txt { font-size: 12px; overflow: auto; max-height: 220px; }
.preview .txt h3 { margin: 0 0 4px; font-size: 14px; }
.preview .txt p { margin: 4px 0; white-space: pre-line; }
.preview .list { font-size: 12px; color: var(--muted); }
.empty-hint { color: var(--muted); font-size: 12px; margin: auto; text-align: center; }
.label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.prompt { padding: 10px 12px; font-weight: 600; border-bottom: 1px solid var(--line); }
.prompt.waiting { color: var(--muted); font-weight: 400; }
.prompt .cards { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.prompt .card { width: 64px; height: 90px; }
.analysis { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.analysis .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.analysis .caption { font-size: 12px; color: var(--muted); }
.analysis button.advise { background: #1f3550; border-color: var(--select); font-weight: 600; }
.lethal-plans { display: flex; flex-direction: column; gap: 6px; }
.lethal { padding: 6px 10px; border-radius: 8px; background: var(--mat-2); border: 1px solid var(--line); }
.lethal-head { display: flex; justify-content: space-between; align-items: center; }
.lethal ol { margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.lethal .don { color: var(--gold); font-weight: 700; }
.lethal b { font-size: 16px; }
.lethal.maybe { border-color: var(--gold); }
.lethal.maybe b { color: var(--gold); }
.lethal.sure { border-color: var(--good); }
.lethal.sure b { color: var(--good); }
.preview .odds { color: var(--select); }
.winbar { position: relative; height: 18px; border-radius: 9px; background: #3a2124; overflow: hidden; }
.winbar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #2f6b49, var(--good)); transition: width .4s; }
.winbar .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.moves { display: flex; flex-direction: column; gap: 4px; }
.move { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; text-align: left; }
.move .rank { color: var(--gold); font-weight: 700; }
.move .wr { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.all-actions, .log-wrap { border-bottom: 1px solid var(--line); }
.all-actions summary, .log-wrap summary { padding: 6px 12px; cursor: pointer; color: var(--muted); }
.actions { padding: 4px 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.actions h4 { margin: 8px 0 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.actions button { text-align: left; width: 100%; }
.actions button.advised, .bar button.advised { border-color: var(--gold); }
.actions button.advised::before { content: "★ "; color: var(--gold); }
.log { margin: 0; padding: 0 12px 10px 34px; font-size: 12px; color: var(--muted); max-height: 260px; overflow: auto; }
.log li:last-child { color: var(--text); }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 60;
}
.overlay .box {
  background: var(--mat-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px 32px; text-align: center; animation: enter .3s ease-out;
}
.overlay h2 { margin: 0 0 8px; }

/* ---------------------------------------------------------------- animations */
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--select), 0 0 6px var(--select); }
  50% { box-shadow: 0 0 0 3px var(--select), 0 0 20px var(--select); }
}
@keyframes lifeflash {
  0% { background: rgba(224, 57, 62, .7); }
  100% { background: transparent; }
}
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.6); }
  100% { transform: scale(1); }
}
@keyframes enter {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}
.ghost { position: fixed; z-index: 40; pointer-events: none; }
.seat-switch {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 70;
  background: rgba(8, 13, 21, .92); border: 2px solid var(--gold); border-radius: 12px;
  padding: 18px 32px; font-size: 20px; font-weight: 700; pointer-events: none;
}

.reveal-pop {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 70;
  background: rgba(8, 13, 21, .94); border: 2px solid var(--gold); border-radius: 12px;
  padding: 12px; text-align: center; cursor: pointer; box-shadow: 0 8px 30px rgba(0,0,0,.7);
}
.reveal-pop img { display: block; width: clamp(160px, 22vh, 260px); border-radius: 8px; margin: 6px auto; }
.reveal-pop .label { color: var(--gold); font-weight: 700; }
.reveal-pop .name { font-size: 13px; color: var(--muted); }

/* flèche d'attaque */
.battle-arrow { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 20; overflow: visible;
  filter: drop-shadow(0 0 4px rgba(224, 57, 62, .7)); }
.battle-arrow line { animation: arrow-in .35s ease-out; }
@keyframes arrow-in { from { opacity: 0; } to { opacity: .9; } }

/* cartes regardées (dessus du deck) */
.look {
  width: 300px; flex-shrink: 0; border-left: 1px solid var(--line); background: var(--panel);
  padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 8px;
}
.look h3 { margin: 0; font-size: 15px; }
.look .muted { color: var(--muted); font-size: 12px; margin: 0; }
.look .small { font-size: 11px; }
.look-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.look-cards .card { width: 100%; height: auto; aspect-ratio: .716; }
.look-cards .card.valid { box-shadow: 0 0 0 3px var(--gold), 0 0 12px var(--gold); }
.look-cards .card.valid:hover { transform: translateY(-3px); }
.look-cards .card.invalid { filter: grayscale(.8) brightness(.55); cursor: default; }
.look-bar { display: flex; gap: 8px; justify-content: flex-end; }
.look-bar .primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.look-order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-height: 30px;
  border: 1px dashed var(--line); border-radius: 6px; padding: 4px; }
.look-order li { display: flex; align-items: center; gap: 6px; background: var(--mat-2); border-radius: 6px; padding: 3px 6px; }
.look-order li img { width: 40px; border-radius: 3px; }
.look-order li span { flex: 1; font-size: 12px; }
.look-order li button { padding: 2px 7px; }
.pile.face { background-size: cover; box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0,0,0,.6); }
.lifecard.face::before { background-image: var(--face); }
.lifecard.face { box-shadow: 0 0 0 2px var(--gold), 0 2px 5px rgba(0,0,0,.6); }

@media (max-width: 1000px) {
  .layout { flex-direction: column; overflow: auto; }
  .board { flex: none; overflow: visible; }
  .panel { width: 100%; border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .look { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  :root { --mat-h: min(calc((100vw - 24px) / 1.414 * var(--zoom)), 980px); }
}

/* ================================================================ revue de partie */
.replay-panel { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.replay-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.replay-head a { color: var(--muted); }
.replay-head .win { color: var(--good); font-weight: 700; margin-left: 6px; }
.replay-head .loss { color: var(--accent); font-weight: 700; margin-left: 6px; }
.replay-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.replay-nav button { padding: 4px 9px; }
.replay-nav .counter { font-size: 12px; color: var(--muted); min-width: 64px; text-align: center; }
.replay-slider { width: 100%; }
.replay-move { border-left: 3px solid var(--line); padding: 6px 10px; background: var(--mat-2); border-radius: 6px; }
.replay-move.mine { border-left-color: var(--select); }
.replay-move.theirs { border-left-color: var(--accent); }
.replay-move .played { font-weight: 600; margin-top: 2px; }
.replay-eval { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.replay-eval .row { display: flex; justify-content: space-between; gap: 8px; }
.replay-eval .row.best { color: var(--good); cursor: default; }
.replay-eval .neg { color: var(--accent); }
.replay-eval .warning { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); padding: 6px 8px; border-radius: 6px; }
.replay-summary { font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.replay-summary .bar-wrap { width: 100%; height: 6px; background: var(--mat-2); border-radius: 3px; overflow: hidden; }
.replay-summary .bar-wrap div { height: 100%; background: var(--select); transition: width .4s; }
.grade { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.grade.best { background: #2f8f5b; color: #fff; }
.grade.good { background: #4d6b58; color: #fff; }
.grade.inacc { background: #a8892f; color: #fff; }
.grade.mistake { background: #c26a2c; color: #fff; }
.grade.blunder { background: #b8423a; color: #fff; }
.replay-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; font-size: 12px; }
.replay-list .turn { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 6px 4px 2px; }
.replay-list .step { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 4px; cursor: pointer; }
.replay-list .step:hover { background: var(--mat-2); }
.replay-list .step.current { background: var(--mat-2); box-shadow: inset 3px 0 0 var(--select); }
.replay-list .step.theirs .txt { color: var(--muted); }
.replay-list .icon { width: 16px; text-align: center; }
.replay-list .txt { flex: 1; }
.replay-list .dot { width: 9px; height: 9px; border-radius: 50%; }
.replay-list .dot.inacc { background: #a8892f; }
.replay-list .dot.mistake { background: #c26a2c; }
.replay-list .dot.blunder { background: #b8423a; }
.replay-mode .all-actions { display: none; }
.replay-error { color: var(--accent); }
.replay-mode .newgame { display: none; }
.spectator-mode .newgame, .spectator-mode #analysis, .spectator-mode .all-actions, .spectator-mode #bar { display: none; }
.replay-comments { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.replay-comments .comment { background: var(--mat-2); border-radius: 6px; padding: 4px 8px; }
.replay-comments form { display: flex; gap: 4px; }
.replay-comments input { flex: 1; font: inherit; color: var(--text); background: var(--mat-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.replay-list .has-comment { font-size: 11px; }

/* parties entre joueurs */
.prompt .resign { display: block; margin: 8px auto 0; font-size: 12px; }
.pvp-mode #analysis .advise, .pvp-mode #advise-depth { display: none; }

/* un élément masqué reste masqué même si une règle lui donne un affichage */
[hidden] { display: none !important; }


/* ================================================================ thème StockPiece (fond #0C111B, panneaux #1A2435, or #D9AC59) */
:root { --gold-2: #F0CD86; --danger: #E0636B; --on-gold: #1A1306; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, .brand { font-family: Cinzel, Georgia, serif; }
.topbar { background: rgba(12, 17, 27, .96); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.brand::before { content: ""; width: 30px; height: 30px; flex: none; margin-right: 9px;
  background: url("/logo.svg") center / contain no-repeat; }
.brand span { color: var(--gold); }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--mat-2); }
.nav a.current, .nav a.current:hover { color: var(--text); background: var(--panel); box-shadow: inset 0 -2px 0 var(--gold); }
button:hover, select:hover { border-color: var(--gold); }
/* boutons principaux : dorés, texte sombre */
button.primary, .newgame-link, .newgame button, .bar button.end, .look-bar .primary, .no-game .primary-link,
.home .tile-link.primary, a.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: var(--gold); color: var(--on-gold);
  font-weight: 600;
}
button.primary:hover, .newgame-link:hover { filter: brightness(1.06); border-color: var(--gold-2); }
.clock span.low, .error { color: var(--danger); }
::selection { background: rgba(217, 172, 89, .35); }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 6px 10px; }
  .nav { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .nav a { padding: 6px 9px; white-space: nowrap; }
}
/* revue de partie : main adverse visible, et choix des mains affichées */
.opp-hand.revealed { gap: 3px; flex-wrap: wrap; }
.opp-hand.revealed .card { width: calc(46px * var(--zoom)); height: calc(64px * var(--zoom)); margin: 0; }
.replay-hands { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 6px 0; font-size: 12px; color: var(--muted); }
.replay-hands span { margin-right: 4px; }
.replay-hands button { padding: 3px 8px; font-size: 12px; }
.replay-hands button.on { border-color: var(--accent); color: var(--accent); }
.lethal-play { font-size: 12px; margin: 2px 0 4px; }
