:root {
  --bg: #070c16;
  --bg-2: #0b1322;
  --panel: rgba(16, 26, 46, 0.82);
  --panel-2: rgba(22, 34, 58, 0.9);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef3ff;
  --muted: #90a0be;
  --blue: #4f86ff;
  --blue-soft: rgba(79, 134, 255, 0.16);
  --red: #ef5b57;
  --red-soft: rgba(239, 91, 87, 0.14);
  --gold: #e7c46d;
  --green: #43cf93;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(900px 600px at 8% -10%, rgba(40, 92, 200, 0.28), transparent 65%),
    radial-gradient(800px 600px at 100% 10%, rgba(190, 50, 60, 0.16), transparent 60%),
    radial-gradient(700px 600px at 50% 110%, rgba(231, 196, 109, 0.08), transparent 60%),
    linear-gradient(180deg, #070c16 0%, #0a1120 55%, #070c16 100%);
  background-attachment: fixed;
}

button { font-family: inherit; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 20px 26px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--gold);
  background: linear-gradient(150deg, rgba(231, 196, 109, 0.2), rgba(79, 134, 255, 0.1));
  border: 1px solid rgba(231, 196, 109, 0.35);
  box-shadow: inset 0 0 20px rgba(231, 196, 109, 0.08);
}

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-meta { display: flex; gap: 8px; margin-left: auto; }

.badge {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-live {
  color: var(--gold);
  border-color: rgba(231, 196, 109, 0.28);
  background: rgba(231, 196, 109, 0.08);
}

.topbar-actions { display: flex; gap: 10px; }

.btn {
  border: 1px solid rgba(120, 165, 255, 0.4);
  border-radius: 10px;
  padding: 9px 14px;
  background: linear-gradient(180deg, #3f74e8, #2c58bb);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(31, 78, 180, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: none;
}

/* ---------- layout ---------- */
.layout {
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 0 26px 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 20px;
  align-items: start;
}

.table {
  position: relative;
  min-width: 0;
  padding: 16px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 30%),
    var(--panel);
  box-shadow: var(--shadow);
}

/* ---------- score bar ---------- */
.scorebar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.score-side {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.score-side.ai { justify-content: flex-end; text-align: right; }

.score-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.score-value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--blue);
}

.score-side.ai .score-value { color: var(--red); }

.score-sub { color: var(--muted); font-size: 10px; white-space: nowrap; }

.score-meta { min-width: 0; }

.score-campaign {
  margin-top: 2px;
  color: rgba(144, 160, 190, 0.82);
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 99px;
  vertical-align: middle;
}

.score-center {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.score-center-row { display: flex; align-items: center; gap: 8px; }

.score-status {
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.score-hint { color: var(--muted); font-size: 8px; white-space: nowrap; }

.btn-sm { padding: 5px 11px; border-radius: 8px; font-size: 11px; }

.score-lane-pips { display: flex; gap: 3px; margin-top: 5px; }

.score-lane-pips .pip {
  width: 22px;
  height: 14px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 7px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.score-lane-pips .pip.player { color: #dce7ff; background: rgba(79, 134, 255, 0.45); }
.score-lane-pips .pip.ai { color: #ffe1df; background: rgba(239, 91, 87, 0.45); }

/* ---------- board ---------- */
.board { display: flex; flex-direction: column; gap: 10px; }

.lane-row {
  position: relative;
  padding: 9px 10px 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(79, 134, 255, 0.045), transparent 22%, transparent 78%, rgba(239, 91, 87, 0.045)),
    rgba(8, 14, 27, 0.55);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.lane-row.is-player {
  border-color: rgba(79, 134, 255, 0.32);
  box-shadow: inset 0 0 32px rgba(79, 134, 255, 0.04);
}

.lane-row.is-ai {
  border-color: rgba(239, 91, 87, 0.3);
  box-shadow: inset 0 0 32px rgba(239, 91, 87, 0.035);
}

.lane-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 1px 2px 7px;
}

.lane-title { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }

.lane-step {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid rgba(231, 196, 109, 0.28);
  background: rgba(231, 196, 109, 0.08);
  color: var(--gold);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lane-name {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.lane-blurb { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.25; }

.lane-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding-top: 2px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.lane-score .p-me { color: var(--blue); }
.lane-score .p-ai { color: var(--red); }
.lane-score .p-vs { color: var(--muted); opacity: 0.6; }

.lane-control {
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lane-control.player { color: var(--blue); border-color: rgba(79, 134, 255, 0.3); background: rgba(79, 134, 255, 0.08); }
.lane-control.ai { color: var(--red); border-color: rgba(239, 91, 87, 0.3); background: rgba(239, 91, 87, 0.08); }

.lane-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }

.cell {
  position: relative;
  min-width: 0;
  height: clamp(108px, 12vh, 132px);
  padding: 6px;
  border-radius: 11px;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.012);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.cell--occupied { border-style: solid; border-color: rgba(255, 255, 255, 0.08); padding: 5px; }
.cell--own { box-shadow: inset 0 0 0 1px rgba(79, 134, 255, 0.08); }
.cell--foe { box-shadow: inset 0 0 0 1px rgba(239, 91, 87, 0.08); }

.cell--legal {
  border-style: solid;
  border-color: color-mix(in srgb, var(--faction, #e7c46d) 66%, transparent);
  background:
    radial-gradient(90% 90% at 50% 40%, color-mix(in srgb, var(--faction, #e7c46d) 9%, transparent), transparent 72%),
    color-mix(in srgb, var(--faction, #e7c46d) 11%, transparent);
  cursor: pointer;
  animation: cellPulse 1.8s ease-in-out infinite;
}

.cell--legal:hover {
  background:
    radial-gradient(90% 90% at 50% 40%, color-mix(in srgb, var(--faction, #e7c46d) 18%, transparent), transparent 72%),
    color-mix(in srgb, var(--faction, #e7c46d) 20%, transparent);
  transform: translateY(-1px);
}

/* Marianne en filigrane aux couleurs du camp + coût de la carte. */
.cell-legal {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--faction, #e7c46d);
}

.cell-legal-mark {
  width: clamp(34px, 4.4vw, 52px);
  height: clamp(34px, 4.4vw, 52px);
  fill: currentColor;
  opacity: 0.26;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--faction, #e7c46d) 35%, transparent));
}

.cell-legal-cost {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  opacity: 0.9;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.cell--target {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 2px rgba(231, 196, 109, 0.35), 0 0 22px rgba(231, 196, 109, 0.14);
}

.cell--range-add { box-shadow: inset 0 0 0 2px rgba(67, 207, 147, 0.55); background: rgba(67, 207, 147, 0.09); }
.cell--range-capture { box-shadow: inset 0 0 0 2px rgba(239, 91, 87, 0.55); background: rgba(239, 91, 87, 0.09); }
.cell--range-both { box-shadow: inset 0 0 0 2px rgba(231, 196, 109, 0.6); background: rgba(231, 196, 109, 0.1); }

.cell--drop-hover {
  border-color: var(--gold) !important;
  background:
    radial-gradient(90% 90% at 50% 40%, rgba(231, 196, 109, 0.22), transparent 72%),
    rgba(231, 196, 109, 0.14) !important;
  box-shadow: 0 0 0 2px rgba(231, 196, 109, 0.55), 0 0 26px rgba(231, 196, 109, 0.22);
  transform: translateY(-2px);
}

.cell--drop-hover .cell-legal-mark { opacity: 0.5; }

.cell-cost {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}

.cell-cost.ok { color: var(--gold); background: rgba(231, 196, 109, 0.14); border: 1px solid rgba(231, 196, 109, 0.3); }
.cell-cost.ko { color: var(--red); background: rgba(239, 91, 87, 0.12); border: 1px solid rgba(239, 91, 87, 0.25); }

.cell-pawns {
  height: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
}

.pawn-dots { display: flex; gap: 2px; }
.pawn-dots i {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pawn-dots.player i.on { background: var(--blue); border-color: rgba(156, 190, 255, 0.8); box-shadow: 0 0 5px rgba(79, 134, 255, 0.65); }
.pawn-dots.ai i.on { background: var(--red); border-color: rgba(255, 178, 175, 0.8); box-shadow: 0 0 5px rgba(239, 91, 87, 0.6); }

/* board cards */
.board-card {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 6px 7px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--party) 50%, transparent);
  border-left-width: 3px;
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--party) 28%, transparent), transparent 62%),
    linear-gradient(165deg, #17233c 0%, #0d1628 62%, #0a1220 100%);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.board-card--player { border-left-color: var(--blue); }
.board-card--ai { border-left-color: var(--red); }
.board-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--party);
}
.board-card--candidate { border-color: rgba(231, 196, 109, 0.55); }
.board-card--new { animation: cardIn 0.32s ease-out; }

.board-card-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0.5;
  pointer-events: none;
}

.board-card-art .art-svg { width: 100%; height: 100%; }

.board-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 18, 32, 0.08) 0%, rgba(10, 18, 32, 0.58) 42%, rgba(10, 18, 32, 0.93) 100%);
}

.board-card > *:not(.board-card-art) { position: relative; z-index: 1; }

.board-card-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }

.party-chip {
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff;
  background: color-mix(in srgb, var(--party) 72%, #000 10%);
  white-space: nowrap;
}

.board-card-cost { color: rgba(255, 255, 255, 0.62); font-size: 8px; font-weight: 800; white-space: nowrap; }

.board-card-name {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: clamp(10px, 1vw, 13px);
  font-weight: 700;
  line-height: 1.05;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-card-role {
  margin-top: 4px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-card-power {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 0.9;
  color: #fff;
  text-shadow: 0 0 16px color-mix(in srgb, var(--party) 45%, transparent);
}

.board-card-power small { font-family: var(--sans); font-size: 9px; font-weight: 800; }
.board-card-power small.up { color: var(--green); }
.board-card-power small.down { color: var(--red); }
.board-card-power small.mod {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(239, 91, 87, 0.16);
  box-shadow: inset 0 0 0 1px rgba(239, 91, 87, 0.24);
}
.board-card-power small.mod.up {
  background: rgba(67, 207, 147, 0.14);
  box-shadow: inset 0 0 0 1px rgba(67, 207, 147, 0.22);
}

/* ---------- hand / cards ---------- */
.hand-zone {
  margin-top: 10px;
  padding: 10px 12px 4px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}

.zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted { color: var(--muted); font-weight: 500; letter-spacing: 0.04em; text-transform: none; }

.hand {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 2px 10px;
  min-height: 226px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.hand::-webkit-scrollbar { height: 6px; }
.hand::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 99px; }

.card {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  border-radius: 11px;
  padding: 9px 7px 7px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--party) 52%, transparent);
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--party) 30%, transparent), transparent 62%),
    linear-gradient(165deg, #17233c 0%, #0d1628 62%, #0a1220 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--party);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--party) 55%, transparent);
}

.card--hand {
  width: 134px;
  height: 200px;
  flex: 0 0 auto;
  cursor: pointer;
  padding: 11px 9px 9px;
}

.card--hand.is-selected {
  transform: translateY(-8px);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.5),
    0 0 0 2px var(--gold),
    0 0 30px rgba(231, 196, 109, 0.18);
}

.card--hand.is-mulligan {
  transform: translateY(-5px);
  border-color: var(--gold);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(231, 196, 109, 0.8),
    0 0 26px rgba(231, 196, 109, 0.2);
}

.card--hand.is-mulligan .card-name { color: var(--gold); }

.card--hand:hover { transform: translateY(-6px); }

.card--hand[draggable="true"] { cursor: grab; }
.card--hand[draggable="true"]:active { cursor: grabbing; }
.card--hand.is-dragging,
.card--hand.is-dragging:hover {
  cursor: grabbing;
  opacity: 0.42;
  transform: scale(0.96) rotate(-1deg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }

/* ---------- portraits vectoriels ---------- */
.art-svg { display: block; }

.card-art {
  position: relative;
  flex: 0 0 auto;
  height: 48px;
  margin: 4px -3px 0;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #0a1220;
}

.card-art .art-svg { width: 100%; height: 100%; }

.card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 38%, rgba(10, 18, 32, 0.62) 100%);
  pointer-events: none;
}

.card--candidate .card-art { height: 42px; }

.cost-badge {
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(231, 196, 109, 0.3);
  background: rgba(231, 196, 109, 0.1);
  color: var(--gold);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 5px;
  min-height: 0;
}

.card-name {
  margin: 0;
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: clamp(11px, 1vw, 13px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-role {
  margin-top: 3px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-tendance {
  margin-top: 2px;
  color: rgba(144, 160, 190, 0.72);
  font-size: 7px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-range { display: flex; justify-content: center; margin-top: auto; padding-top: 4px; }

.card-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  margin-top: 4px;
}

.card-signs { display: flex; gap: 3px; padding-bottom: 1px; }

.sign {
  width: 10px; height: 10px;
  display: grid; place-items: center;
  border-radius: 3px;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
}
.sign.plus { color: var(--green); background: rgba(67, 207, 147, 0.12); }
.sign.minus { color: var(--red); background: rgba(239, 91, 87, 0.12); }

.power-wrap { display: flex; align-items: baseline; gap: 3px; }

.power {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 0.9;
  color: #fff;
  text-shadow: 0 0 16px color-mix(in srgb, var(--party) 45%, transparent);
}

/* candidate cards */
.card--candidate {
  padding-top: 18px;
  border-color: rgba(231, 196, 109, 0.55);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(231, 196, 109, 0.15);
}
.card--candidate.card--hand { padding-top: 21px; }

.candidate-ribbon {
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 2px 4px;
  text-align: center;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1b1608;
  background: linear-gradient(180deg, #f3d98d, #d9b34e);
}
.card--hand .candidate-ribbon { font-size: 7px; padding: 3px 4px; }

.detail-candidate {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(231, 196, 109, 0.14);
  border: 1px solid rgba(231, 196, 109, 0.35);
  color: var(--gold);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- range grid ---------- */
.range-grid {
  display: grid;
  gap: 2px;
  width: max-content;
  padding: 3px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.range-row { display: flex; gap: 2px; }

.range-cell {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.18);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.range-cell--card { color: var(--gold); background: rgba(231, 196, 109, 0.12); }
.range-cell--add { color: var(--green); background: rgba(67, 207, 147, 0.12); }
.range-cell--capture { color: var(--red); background: rgba(239, 91, 87, 0.12); }
.range-cell--both { color: var(--gold); background: rgba(231, 196, 109, 0.12); }

.range-grid--small { gap: 1px; padding: 2px; border-radius: 4px; }
.range-grid--small .range-row { gap: 1px; }
.range-grid--small .range-cell { width: 7px; height: 7px; font-size: 4px; border-radius: 2px; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

#detail,
.log {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

#detail { padding: 18px; min-height: 300px; }

.detail-empty h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 20px; }

.detail-empty p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.detail-empty ul {
  margin: 0;
  padding: 0 0 0 16px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.deck-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

.deck-stat {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.deck-stat b { display: block; font-size: 16px; color: var(--text); }
.deck-stat span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }

.faction-box {
  margin-top: 12px;
  padding: 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--faction);
  background: color-mix(in srgb, var(--faction) 7%, transparent);
}
.faction-box b { display: block; font-size: 10.5px; margin-bottom: 3px; }
.faction-box p { margin: 0 0 5px; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.faction-box span { color: rgba(231, 196, 109, 0.8); font-size: 9.5px; line-height: 1.4; }

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.detail-art {
  position: relative;
  height: 152px;
  margin: -4px 0 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #0a1220;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.detail-art .art-svg { width: 100%; height: 100%; }

.detail-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(10, 18, 32, 0.72) 100%);
  pointer-events: none;
}

.detail-party {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: 5px;
  color: #fff;
  background: var(--party);
}

.detail-role { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

#detail h2 { margin: 0 0 10px; font-family: var(--serif); font-size: 23px; line-height: 1.05; }

.detail-stats { display: flex; gap: 8px; margin-bottom: 14px; }

.stat {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat b { display: block; color: var(--text); font-family: var(--serif); font-size: 17px; letter-spacing: 0; }
.stat small { font-family: var(--sans); font-size: 10px; color: var(--muted); }

.detail-power-mod {
  margin: -6px 0 12px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}
.detail-power-mod.up { color: var(--green); background: rgba(67, 207, 147, 0.08); border: 1px solid rgba(67, 207, 147, 0.18); }
.detail-power-mod.down { color: var(--red); background: rgba(239, 91, 87, 0.08); border: 1px solid rgba(239, 91, 87, 0.18); }

.detail-range {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.detail-range-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.detail-range-head b { font-size: 11px; }
.detail-range-head span { color: var(--muted); font-size: 10px; line-height: 1.35; }

.detail-range .range-grid { margin: 0 auto; }

.range-legend {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 8.5px;
}

.range-legend span { display: inline-flex; align-items: center; gap: 3px; }
.range-legend i { font-style: normal; font-weight: 800; }
.range-legend .lg-add { color: var(--green); }
.range-legend .lg-capture { color: var(--red); }
.range-legend .lg-both { color: var(--gold); }

.trait {
  display: flex;
  gap: 9px;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.trait .trait-mark {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.trait.plus .trait-mark { color: var(--green); background: rgba(67, 207, 147, 0.12); }
.trait.minus .trait-mark { color: var(--red); background: rgba(239, 91, 87, 0.12); }

.trait b { display: block; font-size: 11.5px; margin-bottom: 2px; }
.trait p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.trait-real {
  margin-top: 5px !important;
  padding-top: 5px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  color: rgba(144, 160, 190, 0.78) !important;
  font-size: 10px !important;
  font-style: italic;
}

.detail-note { margin: 10px 0 0; color: rgba(144, 160, 190, 0.75); font-size: 10px; line-height: 1.5; }

.log { padding: 14px 16px; max-height: 330px; display: flex; flex-direction: column; }

.log h3 { margin: 0 0 9px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.log-list { margin: 0; padding: 0; list-style: none; overflow-y: auto; font-size: 11px; line-height: 1.45; }

.log-list li { padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); color: var(--muted); }
.log-list li:first-child { border-top: 0; }

.log-turn {
  display: inline-block;
  min-width: 17px;
  margin-right: 5px;
  color: rgba(231, 196, 109, 0.75);
  font-size: 9px;
  font-weight: 700;
}

.log-list li.play { color: #cdd8ee; }
.log-list li.destroy { color: #ffb0ad; }
.log-list li.effect { color: #e8d29b; }
.log-list li.pawn { color: #a9d7ff; }
.log-list li.system { color: var(--gold); }

.disclaimer {
  color: rgba(144, 160, 190, 0.6);
  font-size: 9.5px;
  line-height: 1.5;
  padding: 0 4px;
}

/* ---------- overlays / toast ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(8px);
}

.overlay.hidden { display: none; }

.modal-card {
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(700px 300px at 50% -10%, rgba(79, 134, 255, 0.15), transparent 70%),
    #101a2e;
  box-shadow: var(--shadow);
}

.modal-card h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 30px; line-height: 1; }

.modal-card h3 {
  margin: 20px 0 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.modal-card p, .modal-card li { color: var(--muted); font-size: 12.5px; line-height: 1.6; }

.modal-card ul { margin: 6px 0 0; padding-left: 18px; }

.modal-kicker {
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.modal-note { margin-top: 14px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }

.rules-sub { color: rgba(144, 160, 190, 0.72); font-size: 10.5px; }

.rules-patterns { list-style: none; padding-left: 0 !important; }
.rules-pattern {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.rules-pattern:first-child { border-top: 0; }
.rules-pattern .range-grid { flex: 0 0 auto; }

/* result */
.result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 8px;
  font-family: var(--serif);
}

.result-score .rs-player, .result-score .rs-ai { font-size: 56px; font-weight: 700; line-height: 1; }
.result-score .rs-player { color: var(--blue); }
.result-score .rs-ai { color: var(--red); }
.result-score .rs-vs { color: var(--muted); font-size: 20px; }

.result-breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.result-side {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.result-side b { display: block; font-size: 11px; margin-bottom: 4px; }
.result-side span { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.6; }

.result-lanes { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }

.result-lane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(70px, auto);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.result-lane.player { border-left: 3px solid var(--blue); }
.result-lane.ai { border-left: 3px solid var(--red); }
.result-lane.tie { border-left: 3px solid rgba(255, 255, 255, 0.18); }

.result-lane-name { font-size: 11px; font-weight: 700; }
.result-lane-powers { font-family: var(--serif); font-size: 16px; font-weight: 700; }
.result-lane-powers b:first-child { color: var(--blue); }
.result-lane-powers b:last-child { color: var(--red); }
.result-lane-powers i { color: var(--muted); font-style: normal; margin: 0 3px; }
.result-lane-owner { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-align: right; }
.result-rule { margin-top: 10px !important; font-size: 10.5px !important; }

.toast-layer {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(239, 91, 87, 0.4);
  background: rgba(35, 12, 16, 0.92);
  color: #ffc2bf;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.2s ease-out;
}

/* ---------- faction selection ---------- */
.modal-card--wide { width: min(960px, 100%); }

.faction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

.faction-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px 15px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--faction) 38%, var(--line));
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--faction) 22%, transparent), transparent 65%),
    rgba(255, 255, 255, 0.025);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.faction-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px color-mix(in srgb, var(--faction) 35%, transparent);
}

.faction-swatch {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--faction), var(--accent));
}

.faction-name {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.faction-parties { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.faction-nuances { margin-top: 3px; color: rgba(144, 160, 190, 0.82); font-size: 9px; line-height: 1.4; }
.faction-candidate { margin-top: 6px; color: var(--gold); font-size: 11px; font-weight: 800; }
.faction-tagline { color: var(--text); font-size: 10.5px; font-style: italic; }

.faction-deck {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.faction-deck b { color: var(--accent); }

.villain-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(176, 74, 99, 0.18);
  border: 1px solid rgba(176, 74, 99, 0.45);
  color: #e39aab;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- deck builder ---------- */
.deck-modal { width: min(1040px, 100%); }

.theme-picker {
  margin-top: 12px;
  padding: 10px 11px 9px;
  border-radius: 12px;
  border: 1px solid rgba(231, 196, 109, 0.24);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(231, 196, 109, 0.08), transparent 58%),
    rgba(0, 0, 0, 0.2);
}

.theme-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.theme-picker-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.theme-picker-title b { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.theme-picker-hint { color: var(--muted); font-size: 9px; line-height: 1.3; }

.theme-picker-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.theme-count {
  padding: 3px 7px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.theme-count.is-ready { color: #1b1608; border-color: transparent; background: linear-gradient(180deg, #f3d98d, #d9b34e); }

.theme-search {
  width: 168px;
  padding: 5px 9px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: rgba(5, 9, 16, 0.6);
  color: var(--text);
  font: inherit;
  font-size: 9.5px;
  outline: none;
}
.theme-search:focus { border-color: rgba(231, 196, 109, 0.55); }
.theme-search::placeholder { color: rgba(180, 194, 220, 0.5); }

.theme-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 132px;
  margin-top: 8px;
  padding: 3px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px 4px 6px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(220, 228, 245, 0.82);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}
.theme-chip:hover { color: #fff; border-color: rgba(231, 196, 109, 0.45); transform: translateY(-1px); }
.theme-chip.is-active {
  color: #1b1608;
  border-color: transparent;
  background: linear-gradient(180deg, #f3d98d, #d9b34e);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.theme-chip.is-filtered { display: none; }
.theme-icon { font-size: 11px; line-height: 1; }
.theme-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.theme-check { width: 10px; text-align: center; opacity: 0.75; font-size: 9px; }

.theme-picker-foot {
  margin-top: 6px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.3;
}
.theme-picker-foot b { color: var(--gold); }

.deck-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.deck-random-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.02);
}

.deck-random-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.deck-random-hint { color: var(--muted); font-size: 9px; }

.filter-chip {
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.filter-chip:hover { color: var(--text); border-color: rgba(231, 196, 109, 0.4); }

.filter-chip.is-active {
  color: #1b1608;
  border-color: transparent;
  background: linear-gradient(180deg, #f3d98d, #d9b34e);
}

.deck-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}

.deck-count { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.deck-count.is-valid { color: var(--green); }
.deck-hint { color: var(--muted); font-size: 10px; }

.deck-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.deck-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 9px 8px 8px;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--party) 42%, var(--line));
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--party) 22%, transparent), transparent 62%),
    linear-gradient(165deg, #17233c 0%, #0d1628 62%, #0a1220 100%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.deck-card:hover { transform: translateY(-2px); opacity: 0.86; }

.deck-card.is-selected {
  opacity: 1;
  border-color: rgba(231, 196, 109, 0.55);
  box-shadow: 0 0 0 1px rgba(231, 196, 109, 0.28), 0 10px 22px rgba(0, 0, 0, 0.35);
}

.deck-card.is-locked {
  opacity: 0.32;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.deck-card.is-locked:hover { transform: none; opacity: 0.45; }

/* Cartes événement / collectifs : bordure pointillée et trame discrète. */
.deck-card--special {
  border-style: dashed;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.022) 0 6px, transparent 6px 12px),
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--party) 22%, transparent), transparent 62%),
    linear-gradient(165deg, #17233c 0%, #0d1628 62%, #0a1220 100%);
}

.deck-card-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0.34;
  pointer-events: none;
}

.deck-card-art .art-svg { width: 100%; height: 100%; }

.deck-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 18, 32, 0.05) 0%, rgba(10, 18, 32, 0.62) 46%, rgba(10, 18, 32, 0.9) 100%);
}

.deck-card-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.family-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 99px;
  background: var(--family, var(--party));
  box-shadow: 0 0 6px color-mix(in srgb, var(--family, var(--party)) 60%, transparent);
  vertical-align: 1px;
}

.deck-check {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  border: 1px solid rgba(231, 196, 109, 0.4);
  background: rgba(10, 16, 28, 0.85);
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
}

.deck-card .cost-badge { position: absolute; top: 28px; right: 7px; }

.deck-card-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding-right: 16px; }

.deck-card-name {
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.05;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 25px;
}

.deck-card-tendance {
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-card-middle { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 3px; }

.deck-card-power { text-align: right; }
.deck-card-power b { display: block; font-family: var(--serif); font-size: 22px; line-height: 0.9; }
.deck-card-power span { display: block; color: var(--muted); font-size: 6.5px; text-transform: uppercase; letter-spacing: 0.08em; }

.deck-card-traits { display: flex; flex-direction: column; gap: 2px; margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.mini-plus, .mini-minus { font-size: 8px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-plus { color: rgba(67, 207, 147, 0.9); }
.mini-minus { color: rgba(239, 91, 87, 0.85); }

.deck-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; color: var(--muted); font-size: 7px; letter-spacing: 0.04em; }

/* ---------- animation ---------- */
@keyframes cardIn {
  from { transform: translateY(10px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes cellPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 196, 109, 0.0); }
  50% { box-shadow: 0 0 0 3px rgba(231, 196, 109, 0.09); }
}

@keyframes toastIn {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- cartes collectionnables ---------- */
.card {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--party) 58%, #0a1220);
  background: #0a1220;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.card::before { display: none; }

.card--hand {
  width: 150px;
  height: 204px;
  flex: 0 0 auto;
  cursor: pointer;
  padding: 0;
}

.card--preview {
  width: 172px;
  height: 234px;
  flex: 0 0 auto;
}

.card-portrait {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 10%, color-mix(in srgb, var(--party) 28%, transparent), transparent 62%),
    #0a1220;
}

.card-portrait .art-svg {
  width: 100%;
  height: 100%;
  transform: scale(1.04);
  transition: transform 0.3s ease;
}

.art-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  filter: saturate(0.82) contrast(1.06) brightness(0.96);
  transform: scale(1.02);
  transition: transform 0.35s ease, filter 0.35s ease;
}

.card--hand:hover .art-photo { transform: scale(1.07); filter: saturate(0.95) contrast(1.08) brightness(1); }

.card-portrait--photo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(110% 80% at 50% 8%, color-mix(in srgb, var(--party) 26%, transparent), transparent 58%),
    linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--party) 18%, transparent) 100%);
  mix-blend-mode: color;
  opacity: 0.55;
}

.card-portrait--photo .art-photo {
  filter: saturate(0.75) contrast(1.08) brightness(0.95);
}

.card--hand:hover .card-portrait .art-svg { transform: scale(1.08); }

.card-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 9, 16, 0.62) 0%, rgba(5, 9, 16, 0.02) 26%, rgba(5, 9, 16, 0.08) 48%, rgba(5, 9, 16, 0.78) 68%, rgba(5, 9, 16, 0.97) 100%),
    linear-gradient(90deg, rgba(5, 9, 16, 0.42) 0%, transparent 22%, transparent 78%, rgba(5, 9, 16, 0.42) 100%);
}

.card-topline {
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 3px;
}

.card-power-gem {
  width: 35px;
  height: 39px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
  clip-path: polygon(50% 0, 100% 18%, 100% 82%, 50% 100%, 0 82%, 0 18%);
  background: linear-gradient(160deg, #fff0b8 0%, #e7c46d 38%, #b8892f 100%);
  color: #1b1608;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.card-power-gem b {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 800;
  line-height: 0.8;
}

.card-power-gem small {
  font-size: 5px;
  font-weight: 900;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

.card-party-crest {
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: color-mix(in srgb, var(--party) 72%, #000 12%);
  color: #fff;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.card-cost-pips {
  margin-left: auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(5, 9, 16, 0.62);
  border: 1px solid rgba(231, 196, 109, 0.32);
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.card-nameplate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 51px;
  z-index: 3;
  padding: 15px 8px 3px;
  text-align: center;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 9, 16, 0.88) 34%, rgba(5, 9, 16, 0.96) 100%);
  border-bottom: 1px solid color-mix(in srgb, var(--party) 42%, transparent);
}

.card-kicker {
  display: block;
  color: color-mix(in srgb, var(--family) 78%, #fff 22%);
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-name {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.005em;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-ability-strip {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 21px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ability {
  display: block;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(5, 9, 16, 0.72);
  border-left: 2px solid;
  font-size: 6.4px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(240, 244, 255, 0.92);
}

.ability b { font-size: 7px; }
.ability--plus { border-left-color: var(--green); }
.ability--plus b { color: var(--green); }
.ability--minus { border-left-color: var(--red); }
.ability--minus b { color: var(--red); }

.card-footer {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 15px;
}

.card-footer .range-grid--tiny { margin: 0; }
.card-footer .card-tendance {
  max-width: 82px;
  color: rgba(180, 194, 220, 0.7);
  font-size: 5.4px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.range-grid--tiny { gap: 1px; }
.range-grid--tiny .range-row { gap: 1px; }
.range-grid--tiny .range-cell {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  font-size: 4px;
  border-width: 1px;
}

.card--hand.is-selected {
  transform: translateY(-8px) scale(1.015);
  box-shadow:
    0 20px 38px rgba(0, 0, 0, 0.55),
    0 0 0 2px var(--gold),
    0 0 34px rgba(231, 196, 109, 0.24);
}

.card--hand.is-mulligan {
  transform: translateY(-5px);
  border-color: var(--gold);
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(231, 196, 109, 0.82),
    0 0 28px rgba(231, 196, 109, 0.24);
}

.card--hand.is-mulligan .card-name { color: var(--gold); }
.card--hand:hover { transform: translateY(-6px) scale(1.015); }
.card--hand[draggable="true"] { cursor: grab; }
.card--hand[draggable="true"]:active { cursor: grabbing; }
.card--hand.is-dragging,
.card--hand.is-dragging:hover {
  cursor: grabbing;
  opacity: 0.42;
  transform: scale(0.96) rotate(-1deg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.card--candidate {
  padding: 0;
  border: 2px solid rgba(231, 196, 109, 0.78);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(231, 196, 109, 0.22),
    0 0 26px rgba(231, 196, 109, 0.12);
}

.card--candidate.card--hand { padding-top: 0; }

.card--candidate .candidate-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 5;
  padding: 2px 7px 3px;
  border-radius: 0 0 5px 5px;
  font-size: 5.5px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1b1608;
  background: linear-gradient(180deg, #f7e3a4, #d9b34e);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.card--special { border-style: dashed; }
.card--special .card-kicker { color: #e39aab; }

/* ---------- mini-cartes du plateau ---------- */
.board-card {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--party) 50%, transparent);
  background: #0a1220;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.board-card--player { border-color: color-mix(in srgb, var(--blue) 58%, transparent); }
.board-card--ai { border-color: color-mix(in srgb, var(--red) 58%, transparent); }
.board-card::before { display: none; }

.board-card-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  opacity: 1;
}

.board-card-art .art-svg { width: 100%; height: 100%; }
.board-card-art .art-photo,
.deck-card-art .art-photo { width: 100%; height: 100%; object-fit: cover; object-position: center 16%; }

.board-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 9, 16, 0.05) 0%, rgba(5, 9, 16, 0.2) 42%, rgba(5, 9, 16, 0.88) 100%);
}

.board-card-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(5, 9, 16, 0.5) 0%, transparent 26%, transparent 58%, rgba(5, 9, 16, 0.9) 100%);
}

.board-card-top {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 3px;
}

.board-card-power {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  margin: 0;
  padding: 1px 6px 0;
  border-radius: 999px;
  background: rgba(5, 9, 16, 0.72);
  border: 1px solid color-mix(in srgb, var(--party) 55%, transparent);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 0.95;
  color: #fff;
  text-shadow: 0 0 14px color-mix(in srgb, var(--party) 55%, transparent);
}

.board-card-power small { font-family: var(--sans); font-size: 8px; font-weight: 800; }
.board-card-power small.up { color: var(--green); }
.board-card-power small.down { color: var(--red); }
.board-card-power small.mod {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(239, 91, 87, 0.16);
  box-shadow: inset 0 0 0 1px rgba(239, 91, 87, 0.24);
}
.board-card-power small.mod.up {
  background: rgba(67, 207, 147, 0.14);
  box-shadow: inset 0 0 0 1px rgba(67, 207, 147, 0.22);
}

.board-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.board-card-cost {
  color: rgba(231, 196, 109, 0.9);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.board-card-nameplate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 12px 5px 4px;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(5, 9, 16, 0.94));
}

.board-card-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.02;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.board-card-role {
  margin-top: 2px;
  color: rgba(180, 194, 220, 0.78);
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-card--candidate { border-color: rgba(231, 196, 109, 0.72); }
.board-card--new { animation: cardIn 0.32s ease-out; }

/* ---------- aperçu dans le panneau de détail ---------- */
.detail-preview {
  display: flex;
  justify-content: center;
  margin: -2px 0 14px;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.42));
}

.detail-preview .card { pointer-events: none; }
.detail-preview .card-name { font-size: 14.5px; }
.detail-preview .card-kicker { font-size: 6.4px; }
.detail-preview .ability { font-size: 6.8px; }
.detail-preview .card-tendance { font-size: 5.8px; }

.detail-credit {
  margin: -8px 0 10px;
  color: rgba(180, 194, 220, 0.55);
  font-size: 7.5px;
  text-align: center;
  letter-spacing: 0.02em;
}
.detail-credit a { color: rgba(231, 196, 109, 0.72); text-decoration: none; }
.detail-credit a:hover { text-decoration: underline; }


/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .deck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Écrans de portable : on garde le plateau et toute la main visibles. */
@media (max-height: 950px) and (min-width: 981px) {
  .lane-row { padding: 7px 10px 8px; }
  .lane-row-head { padding-bottom: 4px; }
  .lane-blurb { display: none; }
  .lane-step { width: 20px; height: 20px; }
}

/* Portables 13 pouces et écrans peu hauts : on compacte encore. */
@media (max-height: 850px) and (min-width: 981px) {
  .topbar { padding: 12px 26px 10px; }
  .scorebar { margin-bottom: 10px; padding: 6px 12px; }
  .board { gap: 7px; }
  .lane-row { padding: 5px 10px 6px; }
  .cell { height: 98px; }
  .board-card { padding: 6px 5px 5px; }
  .board-card-name { margin-top: 4px; font-size: 11.5px; }
  .board-card-role { margin-top: 2px; }
  .hand-zone { margin-top: 7px; padding: 7px 12px 4px; }
  .hand { min-height: 202px; padding: 6px 2px 8px; }
  .card--hand { width: 138px; height: 186px; }
  .card--hand .card-name { font-size: 12.5px; }
  .card--hand .ability { font-size: 6px; }
  .card--hand .card-tendance { display: none; }
}

/* Tablette : une colonne, la main reste accessible. */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .disclaimer { grid-column: 1 / -1; }
  .faction-grid { grid-template-columns: 1fr 1fr; }
  .deck-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  :root { --hand-h: 186px; }
  html, body { overflow-x: hidden; }
  .app { padding-bottom: calc(var(--hand-h) + env(safe-area-inset-bottom, 0px)); }

  .topbar { flex-wrap: wrap; padding: 10px 12px 8px; gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
  .brand h1 { font-size: 15.5px; line-height: 1.1; }
  .brand p { display: none; }
  .topbar-meta { order: 3; width: 100%; margin-left: 0; gap: 6px; }
  .topbar-actions { margin-left: auto; gap: 6px; }
  .btn { padding: 7px 10px; font-size: 11px; border-radius: 8px; }

  .layout { padding: 0 8px 8px; gap: 10px; }
  .table { padding: 8px; border-radius: 18px; }

  .scorebar { flex-wrap: wrap; gap: 6px; padding: 7px 8px; margin-bottom: 8px; border-radius: 12px; }
  .score-side { flex: 1 1 0; gap: 6px; }
  .score-side.ai { order: 2; }
  .score-value { font-size: 22px; }
  .score-label { font-size: 8.5px; letter-spacing: 0.1em; }
  .score-sub, .score-campaign, .score-hint { display: none; }
  .score-center {
    order: 3;
    flex: 1 1 100%;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    padding-top: 5px;
    border-top: 1px solid var(--line);
  }

  .board { gap: 6px; }
  .lane-row { padding: 6px 6px 7px; border-radius: 12px; }
  .lane-row-head { padding: 0 0 4px; gap: 6px; }
  .lane-blurb { display: none; }
  .lane-step { width: 18px; height: 18px; font-size: 7px; border-radius: 5px; }
  .lane-name { font-size: 11.5px; }
  .lane-score { font-size: 9px; gap: 3px; }
  .lane-control { display: none; }
  .lane-grid { gap: 4px; }
  .cell { height: 76px; padding: 3px; border-radius: 8px; gap: 2px; }
  .cell--occupied { padding: 2px; }
  .cell-cost { font-size: 6.5px; padding: 1px 3px; }
  .cell-pawns { gap: 1px; }
  .cell-pawn { width: 5px; height: 5px; }
  .cell-legal-mark { font-size: 15px; }

  .board-card { padding: 4px 3px 3px; border-radius: 7px; }
  .board-card-top { gap: 2px; }
  .board-card-cost { font-size: 6px; }
  .board-card-nameplate { padding: 2px 3px 3px; }
  .board-card-name { font-size: 7.8px; line-height: 1.06; }
  .board-card-role { display: none; }
  .board-card-power { font-size: 14px; }
  .board-card-power small { font-size: 6.5px; }
  .board-card-meta { font-size: 5.8px; }
  .board-card-art::after {
    background: linear-gradient(180deg, rgba(5, 9, 16, 0.02) 0%, rgba(5, 9, 16, 0.24) 38%, rgba(5, 9, 16, 0.96) 100%);
  }

  /* La main est un bandeau fixe : toujours atteignable au pouce. */
  .hand-zone {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--line);
    border-bottom: 0;
    background: linear-gradient(180deg, rgba(10, 18, 32, 0.86), #0a1220 42%);
    backdrop-filter: blur(12px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
  }
  .zone-head { font-size: 8.5px; }
  .hand {
    min-height: 0;
    gap: 8px;
    padding: 5px 2px 3px;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .hand::-webkit-scrollbar { height: 3px; }
  .card--hand {
    width: 116px;
    height: 166px;
    padding: 0;
    border-radius: 9px;
    scroll-snap-align: center;
  }
  .card--hand .card-name { font-size: 9.5px; }
  .card--hand .card-kicker { font-size: 5.4px; }
  .card--hand .ability { font-size: 5.4px; }
  .card--hand .card-tendance { display: none; }
  .card--hand .card-power-gem b { font-size: 13px; }
  .card--hand .card-footer { padding: 0 4px 4px; }
  .card--hand .card-ability-strip { padding: 0 4px; gap: 1px; }

  .sidebar { grid-template-columns: 1fr; gap: 10px; }
  .detail-preview { max-width: 210px; }
  .detail-head h2 { font-size: 20px; }
  .detail-empty h2 { font-size: 17px; }

  /* Modales plein écran utilisables au doigt. */
  .overlay { padding: 6px; align-items: flex-start; }
  .modal-card { max-height: 94vh; padding: 16px; border-radius: 16px; }
  .modal-card h2 { font-size: 21px; }
  .modal-card p, .modal-card li { font-size: 11.5px; }
  .modal-actions { position: sticky; bottom: -16px; margin: 16px -16px -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, transparent, #101a2e 30%); }
  .faction-grid { grid-template-columns: 1fr; gap: 8px; }
  .faction-name { font-size: 18px; }
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .deck-modal .deck-grid { margin-bottom: 68px; }
  .deck-card-name { font-size: 11px; }
  .theme-picker-head { flex-direction: column; gap: 6px; }
  .theme-picker-tools { width: 100%; }
  .theme-search { flex: 1; width: auto; min-width: 0; }
  .theme-chips { max-height: 104px; }
  .theme-name { max-width: 104px; }

  .toast-layer { bottom: calc(var(--hand-h) + 12px); }
}

@media (max-width: 420px) {
  :root { --hand-h: 184px; }
  .cell { height: 62px; }
  .lane-row { padding: 5px 5px 6px; }
  .lane-name { font-size: 10.5px; }
  .board-card-name { font-size: 7.2px; }
  .card--hand { width: 112px; height: 162px; }
  .brand h1 { font-size: 14px; }
  .score-value { font-size: 19px; }
}

/* Téléphone en paysage : la main reste un bandeau bas, le plateau défile. */
@media (max-height: 540px) and (max-width: 980px) {
  :root { --hand-h: 132px; }
  html, body { overflow-x: hidden; }
  .app { padding-bottom: calc(var(--hand-h) + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 6px 12px 4px; }
  .brand p, .topbar-meta { display: none; }
  .layout { padding: 0 8px 8px; }
  .table { padding: 7px; }
  .scorebar { margin-bottom: 6px; padding: 4px 8px; }
  .score-value { font-size: 18px; }
  .lane-row { padding: 4px 6px 5px; }
  .lane-row-head { padding-bottom: 2px; }
  .lane-blurb { display: none; }
  .cell { height: 58px; }
  .board-card-name { font-size: 7.4px; }
  .board-card-role { display: none; }
  .hand-zone {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    margin: 0;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--line);
    border-bottom: 0;
    background: linear-gradient(180deg, rgba(10, 18, 32, 0.9), #0a1220 46%);
    backdrop-filter: blur(12px);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
  }
  .zone-head { display: none; }
  .hand { min-height: 0; padding: 3px 2px; gap: 6px; }
  .card--hand { width: 92px; height: 122px; }
  .card--hand .card-name { font-size: 8px; }
  .card--hand .ability { font-size: 4.8px; }
  .card--hand .card-kicker { font-size: 4.6px; }
  .card--hand .card-tendance { display: none; }
  .toast-layer { bottom: calc(var(--hand-h) + 8px); }
}

/* ---------- tendances politiques ---------- */
.detail-tendance {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-family,
.detail-fictional,
.detail-special {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-family {
  color: var(--family, var(--gold));
  border: 1px solid color-mix(in srgb, var(--family, var(--gold)) 45%, transparent);
  background: color-mix(in srgb, var(--family, var(--gold)) 12%, transparent);
}

.detail-fictional {
  color: #b9c6e2;
  border: 1px dashed rgba(185, 198, 226, 0.35);
  background: rgba(185, 198, 226, 0.06);
}

.detail-special {
  color: #e39aab;
  border: 1px solid rgba(176, 74, 99, 0.45);
  background: rgba(176, 74, 99, 0.16);
}

.faction-families {
  margin-top: 4px;
  color: rgba(144, 160, 190, 0.9);
  font-size: 9.5px;
  line-height: 1.4;
}

.faction-families b { color: var(--accent); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; font-size: 8px; }

/* ---------- plateau lisible : portrait entier à gauche, infos à droite (écran large) ---------- */
.cell--own { border-color: rgba(79, 134, 255, 0.34); background: rgba(79, 134, 255, 0.07); }
.cell--foe { border-color: rgba(239, 91, 87, 0.34); background: rgba(239, 91, 87, 0.07); }

.pawn-dots { gap: 3px; }
.pawn-dots i { width: 8px; height: 8px; }
.cell-pawns { height: 10px; }

/* cases carrées : la carte du plateau est la version « carré » de la carte verticale de la main */
.board { --cell: clamp(92px, 12.6vh, 150px); }
.lane-grid {
  grid-template-columns: repeat(5, minmax(0, var(--cell)));
  justify-content: center;
}
.cell { height: auto; aspect-ratio: 1 / 1; }

.board-card { padding: 0; }
.board-card .board-card-art { inset: 0; opacity: 1; border-radius: inherit; }
.board-card .board-card-art .art-photo { object-position: center 14%; filter: saturate(0.92) contrast(1.05); }
.board-card .board-card-art::after {
  background: linear-gradient(180deg, rgba(5, 9, 16, 0.18) 0%, transparent 22%, transparent 56%, rgba(5, 9, 16, 0.94) 100%);
}
.board-card .board-card-scrim { display: none; }
.board-card .board-card-top {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
}
.board-card .board-card-power { font-size: 22px; padding: 1px 7px 0; }
.board-card .board-card-nameplate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 4px 3px;
  text-align: center;
  background: none;
}
.board-card .board-card-name { font-size: clamp(9px, 0.95vw, 12px); line-height: 1.04; }
.board-card .board-card-role { font-size: 6px; margin-top: 2px; }

/* portée lisible sur la carte : badge en haut à droite du portrait */
.card-range-badge {
  position: absolute;
  top: 38px;
  right: 6px;
  z-index: 3;
  padding: 2px;
  border-radius: 6px;
  background: rgba(5, 9, 16, 0.62);
  backdrop-filter: blur(2px);
}
.card-range-badge .range-grid { margin: 0; padding: 0; background: none; border: 0; }
.card-range-badge .range-grid--small .range-cell { width: 9px; height: 9px; font-size: 7px; border-radius: 2px; }
.card-footer { justify-content: flex-end; }
.card-footer .card-tendance { font-size: 6px; max-width: none; }

/* ---- Carte épurée : coût, puissance, schéma de portée, nom, tag de parti, pouvoir ---- */
.card .card-kicker, .card .card-ability-strip, .card .card-footer, .card .card-power-gem small { display: none; }
.card-topline { top: 6px; left: 6px; right: 6px; align-items: center; }
.card-cost-pips {
  margin: 0; padding: 3px 7px; font-size: 12px; letter-spacing: 0.04em;
  background: rgba(5, 9, 16, 0.78); border-color: rgba(231, 196, 109, 0.55);
}
.card-power-gem { width: 38px; height: 42px; }
.card-power-gem b { font-size: 24px; line-height: 1; }
.card-range-badge { top: auto; bottom: 62px; right: 6px; left: auto; }
.card-range-badge .range-grid--small .range-cell { width: 10px; height: 10px; }
.card-nameplate { bottom: 0; padding: 20px 6px 6px; border-bottom: 0; border-radius: 0 0 12px 12px; }
.card-nameplate .card-name { font-size: 14px; margin: 0 0 4px; }
.card-tags { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; }
.card-tags .card-party-crest { flex: 0 0 auto; font-size: 8px; padding: 2px 5px; }
.card-power-tag {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 8px; font-weight: 800; color: #ffe08a; text-shadow: 0 1px 4px #000;
}
.detail-preview .card-nameplate .card-name { font-size: 12px; }

/* ---- Carte de victoire + paillettes ---- */
#fx-canvas { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }
.victory-card {
  position: relative; margin: 6px auto 14px; width: 210px; min-height: 270px; padding: 22px 14px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  border-radius: 16px; border: 3px solid #e7c46d;
  background: radial-gradient(circle at 50% 35%, #3a2d0c 0%, #1a1306 70%);
  box-shadow: 0 0 0 4px rgba(231, 196, 109, 0.25), 0 18px 50px rgba(231, 196, 109, 0.35);
  animation: victory-pop 0.7s cubic-bezier(.2, 1.4, .4, 1) both;
}
.victory-card h2 { margin: 0; font-family: var(--serif); font-size: 34px; letter-spacing: 0.04em; text-transform: uppercase; color: #ffe08a; }
.victory-crown { font-size: 54px; line-height: 1; color: #ffe08a; text-shadow: 0 0 24px rgba(255, 224, 138, 0.8); }
.victory-card .result-score { margin: 0; font-size: 30px; }
.victory-sub { font-size: 12px; color: #f3e6bd; max-width: 170px; }
.victory-card--lose { border-color: #5b6477; background: radial-gradient(circle at 50% 35%, #232836 0%, #11141c 70%); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); animation-name: defeat-drop; }
.victory-card--lose h2, .victory-card--lose .victory-crown { color: #aab3c7; text-shadow: none; }
.victory-card--tie { border-color: #7b8ba8; }
.victory-card--tie h2, .victory-card--tie .victory-crown { color: #c9d4ea; text-shadow: none; }
@keyframes victory-pop { 0% { transform: scale(0.3) rotate(-8deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes defeat-drop { 0% { transform: translateY(-40px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .victory-card { animation: none; } }

/* ---- Plateau un peu plus compact pour que la main reste visible ---- */
.board { --cell: clamp(84px, 10.4vh, 150px); }

/* ---- Phases de jeu bien visibles ---- */
#phase-ribbon {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 60; display: none;
  align-items: center; gap: 10px; padding: 6px 22px 7px; border-radius: 0 0 14px 14px;
  background: var(--ribbon, #22304f); color: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  font-size: 12px; white-space: nowrap;
}
#phase-ribbon b { font-family: var(--serif); font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; }
#phase-ribbon i { font-style: normal; opacity: 0.8; }
#phase-ribbon .pr-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: pr-pulse 1.1s ease-in-out infinite; }
body[data-phase] #phase-ribbon { display: flex; }
body[data-phase="mulligan"] { --ribbon: #a8741a; --frame: rgba(231, 196, 109, 0.75); }
body[data-phase="player"] { --ribbon: #1f6f43; --frame: rgba(60, 190, 120, 0.7); }
body[data-phase="ai"] { --ribbon: #8a2a3a; --frame: rgba(231, 84, 100, 0.55); }
body[data-phase="over"] { --ribbon: #3b4561; --frame: rgba(120, 140, 180, 0.4); }
body[data-phase]::after {
  content: ""; position: fixed; inset: 0; z-index: 55; pointer-events: none;
  box-shadow: inset 0 0 0 4px var(--frame), inset 0 0 70px -10px var(--frame); transition: box-shadow 0.4s;
}
body[data-phase="ai"] .hand, body[data-phase="ai"] #hand { opacity: 0.55; filter: saturate(0.7); transition: opacity 0.3s; }
@keyframes pr-pulse { 0%, 100% { transform: scale(0.7); opacity: 0.5; } 50% { transform: scale(1.15); opacity: 1; } }
.phase-splash {
  position: fixed; inset: 0; z-index: 70; pointer-events: none; display: grid; place-content: center; justify-items: center; gap: 6px;
  background: radial-gradient(circle, rgba(5, 9, 16, 0.55) 0%, rgba(5, 9, 16, 0) 60%);
  animation: splash 1.7s ease both;
}
.phase-splash b { font-family: var(--serif); font-size: clamp(36px, 7vw, 80px); letter-spacing: 0.05em; text-transform: uppercase; color: #fff4cf; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7), 0 0 40px rgba(231, 196, 109, 0.6); }
.phase-splash span { font-size: 16px; color: #f3e6bd; text-shadow: 0 2px 10px #000; }
@keyframes splash { 0% { opacity: 0; transform: scale(0.8); } 18% { opacity: 1; transform: scale(1.04); } 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .phase-splash { animation: none; } #phase-ribbon .pr-dot { animation: none; } }

/* ---- Légendes (jokers) ---- */
.legend-ribbon { background: linear-gradient(90deg, #8a6a1f, #ffe08a, #8a6a1f) !important; color: #2a1d05 !important; }
.card--legend { box-shadow: 0 0 0 2px #ffe08a, 0 0 22px rgba(255, 224, 138, 0.55); }
.card--legend .card-cost-pips { color: #2a1d05; background: linear-gradient(90deg, #ffe08a, #e7c46d); font-size: 9px; font-weight: 900; }
.card--legend::before { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit; background: linear-gradient(115deg, transparent 35%, rgba(255, 244, 207, 0.35) 50%, transparent 65%); background-size: 250% 100%; animation: legend-shine 3.2s linear infinite; }
@keyframes legend-shine { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .card--legend::before { animation: none; } }

.deck-cost-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---- Plateau : cases au format carte (vertical, comme la main) ---- */
.board { --cell: clamp(74px, 8.6vh, 120px); }
.cell { aspect-ratio: 2 / 3; }
.lane-grid { gap: 8px; }
.board-card .board-card-top { display: flex; align-items: flex-start; justify-content: space-between; top: 4px; left: 4px; right: 4px; }
.board-card .board-card-cost {
  padding: 2px 5px; border-radius: 999px; font-size: 9px; line-height: 1; letter-spacing: 0.03em;
  background: rgba(5, 9, 16, 0.78); border: 1px solid rgba(231, 196, 109, 0.5); color: var(--gold);
}
.board-card .board-card-power { font-size: 24px; padding: 0 6px; line-height: 1.1; }
.board-card .board-card-nameplate { padding: 18px 3px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.board-card .board-card-nameplate .party-chip { font-size: 7px; padding: 1px 4px; }
.board-card .board-card-name { font-size: clamp(9px, 0.85vw, 11px); }
.board-card .board-card-art .art-photo { object-position: center 18%; }

/* ---- Plateau : titre de travée à gauche, cartes verticales plus grandes ---- */
.board { --cell: clamp(72px, 10vh, 130px); }
.lane-row { display: grid !important; grid-template-columns: 200px 1fr; align-items: center; gap: 14px; padding: 8px 14px; }
.lane-row-head { flex-direction: column; align-items: flex-start; gap: 8px; margin: 0; }
.lane-score { align-self: flex-start; }
.lane-grid { justify-content: start; }
.card--hand { height: clamp(150px, 19.5vh, 210px); width: calc(clamp(150px, 19.5vh, 210px) * 0.67); }
.card--hand .card-name { font-size: 13px; }
.lane-grid { justify-content: center; }

/* ---- Plateau : l'image d'abord, le nom au survol (infobulle et panneau de détail) ---- */
.board-card .board-card-art::after { background: linear-gradient(180deg, rgba(5, 9, 16, 0.25) 0%, transparent 24%, transparent 78%, rgba(5, 9, 16, 0.7) 100%); }
.board-card .board-card-nameplate { padding: 0 0 5px; background: none; }
.board-card .board-card-nameplate .party-chip { font-size: 8px; padding: 2px 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.board-card .board-card-art .art-photo { object-position: center 20%; }

/* ---- Responsive : écrans courts, tablettes, téléphones ---- */
@media (max-height: 780px) and (min-width: 701px) {
  .board { --cell: clamp(62px, 9vh, 100px); }
  .card--hand { height: clamp(136px, 19vh, 170px); width: calc(clamp(136px, 19vh, 170px) * 0.67); }
  .card--hand .card-name { font-size: 11px; }
  .card--hand .card-power-tag { display: none; }
}
@media (max-width: 900px) {
  .lane-row { grid-template-columns: 1fr; gap: 6px; padding: 8px 10px; }
  .lane-row-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .lane-blurb { display: none; }
}
@media (max-width: 700px) {
  #phase-ribbon { padding: 4px 14px 5px; gap: 8px; max-width: 94vw; }
  #phase-ribbon b { font-size: 13px; }
  #phase-ribbon i { display: none; }
  body[data-phase] .topbar { margin-top: 30px; }
  .board { --cell: auto; }
  .lane-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; overflow: visible; justify-content: stretch; }
  .lane-grid .cell { width: auto; min-width: 0; }
  .board-card .board-card-power { font-size: 15px; padding: 0 4px; }
  .board-card .board-card-power small { font-size: 8px; }
  .board-card .board-card-cost { font-size: 6px; padding: 1px 3px; }
  .board-card .board-card-nameplate .party-chip { font-size: 6px; padding: 1px 3px; }
  .cell-pawns { height: 8px; }
  .pawn-dots { gap: 1px; }
  .pawn-dots i { width: 5px; height: 5px; }
  .phase-splash b { font-size: 34px; }
}

/* ---- Case légale : aperçu de la carte au format plateau ---- */
.cell--legal { cursor: pointer; box-shadow: 0 0 0 2px rgba(60, 190, 120, 0.7), 0 0 14px rgba(60, 190, 120, 0.35); }
.board-card--ghost { position: absolute; inset: 0; opacity: 0.42; filter: saturate(0.85); pointer-events: none; z-index: 2; animation: ghost-breathe 1.6s ease-in-out infinite; }
.cell--legal:hover .board-card--ghost, .cell--target .board-card--ghost { opacity: 0.95; filter: none; animation: none; box-shadow: 0 0 0 2px #7dffb0, 0 8px 22px rgba(0, 0, 0, 0.5); transform: translateY(-3px) scale(1.04); }
@keyframes ghost-breathe { 0%, 100% { opacity: 0.32; } 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) { .board-card--ghost { animation: none; } }

/* ---- Deck builder : les cartes au format carte, comme en main ---- */
.deck-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 14px; justify-items: center; }
.deck-card.deck-card--face { all: unset; box-sizing: border-box; position: relative; cursor: pointer; width: 134px; height: 200px; border-radius: 12px; transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s; opacity: 0.55; filter: saturate(0.7); }
.deck-card.deck-card--face:hover { transform: translateY(-4px); opacity: 0.9; filter: none; }
.deck-card.deck-card--face.is-selected { opacity: 1; filter: none; box-shadow: 0 0 0 3px #7dffb0, 0 10px 26px rgba(0, 0, 0, 0.5); }
.deck-card.deck-card--face.is-locked, .deck-card.deck-card--face.is-locked:hover { opacity: 0.3; transform: none; cursor: not-allowed; }
.card--deck { width: 134px; height: 200px; padding: 0; cursor: pointer; }
.deck-card--face .deck-check { position: absolute; top: -8px; right: -8px; z-index: 10; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #1f6f43; color: #fff; font-size: 14px; font-weight: 900; box-shadow: 0 2px 8px #000; }
.deck-card--face:not(.is-selected) .deck-check:empty { display: none; }
.deck-card--face .deck-check { visibility: visible; }
.deck-card--face .card-name { text-transform: none; letter-spacing: 0; font-family: var(--serif); font-size: 13px; font-weight: 700; color: #fff; }
.deck-card--face .card-power-tag, .deck-card--face .card-party-crest { text-transform: none; }

/* ---- Casseroles : les affaires documentées se voient sur la carte ---- */
.card-casserole {
  margin: 4px auto 0; max-width: 100%; padding: 2px 6px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 8px; font-weight: 800; color: #fff; background: linear-gradient(90deg, #8a1f2b, #c43a47); border: 1px solid rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); width: fit-content;
}
.card-nameplate { padding-top: 14px; }
.board-card-pan { position: absolute; left: 3px; bottom: 22px; z-index: 4; font-size: 14px; filter: drop-shadow(0 1px 3px #000); transform: rotate(-12deg); }

/* ---- Candidats à la présidentielle : bien repérables en main, sur le plateau et dans le deck builder ---- */
.card--candidate { box-shadow: 0 0 0 3px #f3d98d, 0 0 26px rgba(243, 217, 141, 0.55) !important; border-color: #f3d98d !important; }
.card--candidate .candidate-ribbon {
  left: 0; right: 0; top: 0; transform: none; width: auto; border-radius: 10px 10px 0 0; padding: 3px 4px 4px;
  font-size: 8px; letter-spacing: 0.08em; background: linear-gradient(180deg, #fff0b8, #e7c46d 60%, #c79a2e);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.card--candidate .card-topline { top: 22px; }
.card--candidate .card-range-badge { bottom: 66px; }
.card--candidate::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit; background: linear-gradient(115deg, transparent 38%, rgba(255, 244, 207, 0.28) 50%, transparent 62%); background-size: 250% 100%; animation: legend-shine 3.6s linear infinite; }
.board-card--candidate { box-shadow: 0 0 0 2px #f3d98d, 0 0 16px rgba(243, 217, 141, 0.6); border-color: #f3d98d; }
.board-card-star {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%); z-index: 6; width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; font-size: 13px; color: #3a2b05; background: radial-gradient(circle, #fff0b8, #e7c46d); box-shadow: 0 2px 8px #000, 0 0 12px rgba(243, 217, 141, 0.8);
}
@media (prefers-reduced-motion: reduce) { .card--candidate::after { animation: none; } }

/* ---- Le candidat est le roi : portraits des présidentiables de chaque côté ---- */
.score-side { align-items: center; gap: 10px; }
.score-king { position: relative; flex: 0 0 auto; width: 44px; height: 62px; border-radius: 8px; border: 2px solid #f3d98d; box-shadow: 0 0 14px rgba(243, 217, 141, 0.55); overflow: visible; }
.score-king-art { width: 100%; height: 100%; border-radius: 6px; overflow: hidden; background: #0b1220; }
.score-king-art .art-svg, .score-king-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; }
.score-king b { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; color: #3a2b05; background: radial-gradient(circle, #fff0b8, #e7c46d); box-shadow: 0 2px 6px #000; }
.score-side.ai .score-king { order: 3; }

/* ---- Choix du candidat et écosystème ---- */
.cand-group { margin: 14px 0 6px; }
.cand-group h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-family: var(--serif); font-size: 18px; }
.cand-group h3 i { font-family: inherit; font-style: normal; font-size: 12px; color: var(--muted); }
.cand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faction); align-self: center; }
.cand-row { display: flex; flex-wrap: wrap; gap: 14px; }
.cand-pick { all: unset; box-sizing: border-box; position: relative; cursor: pointer; width: 134px; height: 200px; border-radius: 12px; transition: transform 0.15s, box-shadow 0.15s; }
.cand-pick:hover, .cand-pick:focus-visible { transform: translateY(-6px) scale(1.04); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55); z-index: 3; }
.cand-pick .card--deck { pointer-events: none; }
.eco-layout { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; margin: 12px 0; }
.eco-king .card--deck { transform: scale(1.18); transform-origin: top left; margin-bottom: 40px; margin-right: 24px; }
.eco-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; justify-items: center; }
@media (max-width: 700px) { .eco-layout { grid-template-columns: 1fr; } .eco-king { display: grid; justify-items: center; } .eco-king .card--deck { transform: none; margin: 0; } .cand-row { justify-content: center; } }
.modal-card .card-name { text-transform: none; letter-spacing: 0; color: #fff; font-size: 13px; }
.modal-card .card-power-tag, .modal-card .card-party-crest { text-transform: none; }

/* =====================================================================
   Téléphone (≤ 700 px) : une seule vue sans défilement de page, comme un jeu de cartes mobile.
   Haut : titre + score. Milieu : le plateau. Bas : la main. Détail et journal dans une feuille (ⓘ).
   ===================================================================== */
.phone-only { display: none; }
.sheet-backdrop { display: none; }
.card-brief { display: none; }
@media (max-width: 700px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  .phone-only { display: inline-flex; }
  .app { height: 100dvh; max-width: none; padding: env(safe-area-inset-top) 6px env(safe-area-inset-bottom); display: flex; flex-direction: column; gap: 4px; }
  .topbar { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 4px 2px; margin: 0 !important; background: none; border: 0; }
  .brand { min-width: 0; flex: 1 1 auto; gap: 6px; }
  .brand-mark, .brand p { display: none; }
  .brand h1 { font-size: 13px; line-height: 1.1; white-space: normal; }
  .topbar-meta { display: flex; gap: 4px; flex: 0 0 auto; }
  .topbar-meta .badge { font-size: 9px; padding: 3px 7px; }
  #turn-badge { display: none; }
  .topbar-actions { display: flex; gap: 4px; flex: 0 0 auto; }
  .topbar-actions .btn { padding: 4px 9px; min-width: 30px; font-size: 0; }
  #info-btn::before { content: "ⓘ"; font-size: 15px; }
  #rules-btn::before { content: "?"; font-size: 14px; font-weight: 800; }
  #new-btn::before { content: "↻"; font-size: 15px; }
  #phase-ribbon { top: auto; bottom: auto; position: fixed; top: env(safe-area-inset-top); padding: 3px 12px 4px; }
  body[data-phase] .topbar { margin-top: 22px !important; }

  .layout { flex: 1 1 auto; min-height: 0; display: block; padding: 0; }
  .table { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 4px; padding: 0; background: none; border: 0; box-shadow: none; }

  /* score : portraits des présidentiables, score, passer */
  .scorebar { flex: 0 0 auto; padding: 4px 6px; gap: 6px; border-radius: 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
  .score-side { gap: 6px; min-width: 0; }
  .score-side.ai { justify-content: flex-end; }
  .score-king { width: 30px; height: 44px; border-width: 1.5px; }
  .score-king b { width: 14px; height: 14px; font-size: 9px; top: -7px; }
  .score-value { font-size: 24px; line-height: 1; }
  .score-label { font-size: 8px; }
  .score-meta .score-sub, .score-meta .score-campaign, .score-lane-pips { display: none; }
  .score-center { gap: 2px; }
  .score-status { font-size: 9px; }
  .score-hint { display: none; }
  .scorebar .btn-sm { padding: 5px 10px; font-size: 11px; }

  /* plateau : trois travées empilées, cinq cartes verticales chacune */
  .board { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: space-evenly; gap: 3px; --cell: auto; }
  .lane-row { grid-template-columns: 1fr; gap: 2px; padding: 3px 5px 5px; border-radius: 12px; min-height: 0; }
  .lane-row-head { flex-direction: row; justify-content: space-between; align-items: center; }
  .lane-title { gap: 5px; }
  .lane-step { width: 16px; height: 16px; font-size: 8px; }
  .lane-name { font-size: 11px; }
  .lane-score { gap: 3px; font-size: 11px; }
  .lane-control { font-size: 7px; padding: 1px 5px; }
  .lane-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; justify-content: stretch; overflow: visible; }
  .lane-grid .cell { width: auto; min-width: 0; max-height: 13.5vh; }

  /* main : une bande de cartes qu'on touche pour choisir, puis on touche une case */
  .hand-zone { position: static !important; flex: 0 0 auto; margin: 0 !important; padding: 4px 6px 6px; border-radius: 12px !important; border-bottom: 1px solid var(--line) !important; backdrop-filter: none; background: rgba(0, 0, 0, 0.25); }
  .zone-head { font-size: 9px; margin-bottom: 2px; }
  .hand { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 4px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .card--hand { flex: 0 0 auto; zoom: 0.56; width: 134px; height: 200px; scroll-snap-align: center; }
  .card--hand.is-selected { transform: translateY(-6px); }
  .card--hand:hover { transform: none; }
  .card-brief.is-on { display: block; font-size: 10.5px; line-height: 1.3; padding: 5px 8px; margin: 2px 0 4px; border-radius: 10px; background: rgba(5, 9, 16, 0.7); border: 1px solid rgba(231, 196, 109, 0.4); max-height: 64px; overflow: hidden; }
  .card-brief b { color: #fff; }
  .brief-plus { color: #9fe3b4; }
  .brief-minus { display: block; color: #ffb0b0; }
  .card-brief button { float: right; margin-left: 6px; padding: 1px 8px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #fff; font-size: 10px; }
  .hand-empty { font-size: 11px; }

  /* feuille : détail de la carte et journal */
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; max-height: 72dvh; overflow-y: auto; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); background: #0d1526; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6); transform: translateY(110%); visibility: hidden; pointer-events: none; transition: transform 0.25s ease, visibility 0s 0.25s; }
  .sidebar { top: auto; }
  .sidebar > * { flex: 0 0 auto; }
  #detail { height: auto !important; max-height: none !important; min-height: 0; overflow: visible; }
  .sidebar .log { max-height: none; }
  body.sheet-open .sidebar { transform: translateY(0); visibility: visible; pointer-events: auto; transition: transform 0.25s ease; }
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }

  /* écrans modaux : candidats et écosystème en cartes réduites */
  .modal-card { width: 100%; max-width: none; max-height: 96dvh; border-radius: 18px; padding: 16px 12px; }
  .modal-card h2 { font-size: 22px; }
  .cand-row { gap: 6px; justify-content: flex-start; }
  .cand-pick { zoom: 0.7; }
  .eco-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .eco-grid .card--deck, .eco-king .card--deck { zoom: 0.7; }
  .deck-grid { grid-template-columns: repeat(3, 1fr); gap: 8px 4px; }
  .deck-card.deck-card--face { zoom: 0.7; }
  .modal-actions { flex-wrap: wrap; gap: 6px; position: sticky; bottom: 0; padding-top: 8px; background: linear-gradient(0deg, #0d1526 70%, transparent); }
  .modal-actions .btn { flex: 1 1 40%; font-size: 12px; padding: 9px 8px; }
  .victory-card { width: 190px; min-height: 240px; }
}
@media (max-width: 380px) { .card--hand { zoom: 0.5; } }

/* échange de main : une carte à remplacer est rouge et grisée, pour ne pas se confondre avec le doré des candidats et des légendes */
.card--hand.is-mulligan { transform: translateY(-5px); border-color: #ff6b6b !important; box-shadow: 0 0 0 3px #ff6b6b, 0 0 22px rgba(255, 90, 90, 0.55) !important; }
.card--hand.is-mulligan .card-portrait, .card--hand.is-mulligan .card-scrim { filter: grayscale(0.85) brightness(0.65); }
.card--hand.is-mulligan::before, .card--hand.is-mulligan::after { animation: none; background: none; }
.card--hand.is-mulligan .card-name { color: #ffb0b0; }
.swap-badge { position: absolute; z-index: 6; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-8deg); padding: 6px 12px; border-radius: 8px; background: #d63a3a; color: #fff; border: 2px solid #fff; font-size: 12px; font-weight: 900; letter-spacing: 0.04em; white-space: nowrap; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); pointer-events: none; }

/* ---- Coût : pastilles rondes, identiques sur la carte, le plateau et l'aperçu ---- */
.cost-dots { display: inline-flex; align-items: center; justify-content: center; gap: 0.3em; padding: 0.38em 0.55em; min-height: 1.6em; border-radius: 999px; background: rgba(5, 9, 16, 0.82); border: 1px solid rgba(231, 196, 109, 0.6); line-height: 1; font-size: 11px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.cost-dots i { display: block; width: 0.78em; height: 0.78em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #e7c46d 55%, #a8741a); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45); }
.cost-dots.cost-joker { color: #ffe08a; font-size: 12px; font-weight: 900; font-style: normal; min-width: 1.9em; padding: 0.25em 0.5em; }
.board-card .cost-dots { font-size: 8px; }
.card .cost-dots { font-size: 12px; }
.card--legend .cost-dots { background: linear-gradient(90deg, #ffe08a, #e7c46d); border-color: #fff4cf; color: #2a1d05; }
@media (max-width: 700px) { .board-card .cost-dots { font-size: 6.5px; padding: 0.3em 0.45em; } }

/* ---- Cases interdites : voile rouge et picto « sens interdit » ---- */
.fx-veil { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none; border-radius: inherit; background: repeating-linear-gradient(135deg, rgba(214, 48, 48, 0.26) 0 7px, rgba(120, 18, 18, 0.34) 7px 14px); transition: opacity 0.15s; }
.fx-veil b { position: relative; width: clamp(18px, 2.6vw, 34px); aspect-ratio: 1; border-radius: 50%; border: 3px solid #ff5a5a; background: rgba(40, 6, 6, 0.55); box-shadow: 0 0 10px rgba(255, 70, 70, 0.6); }
.fx-veil b::after { content: ""; position: absolute; left: 50%; top: 50%; width: 100%; height: 3px; background: #ff5a5a; transform: translate(-50%, -50%) rotate(-45deg); border-radius: 2px; }
.cell--forbidden { cursor: not-allowed; }
.cell--forbidden .fx-veil { opacity: 0.8; }
.cell--forbidden:hover .fx-veil { opacity: 1; }
.cell--blocked-card .fx-veil { opacity: 0; }
.cell--blocked-card:hover { cursor: not-allowed; }
.cell--blocked-card:hover .fx-veil { opacity: 0.95; }
.is-previewing .cell--blocked-card:hover .fx-veil { opacity: 0; }
.fx-hide-veil .fx-veil { display: none; }

/* ---- Aperçu de ce que la carte va changer ---- */
.fx { position: absolute; z-index: 8; pointer-events: none; }
.fx-pawn { left: 50%; bottom: 14%; translate: -50% 0; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: clamp(9px, 0.95vw, 12px); font-weight: 800; white-space: nowrap; border: 2px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55); animation: fx-pop 0.35s cubic-bezier(.2, 1.6, .4, 1); }
.fx-pawn em { font-style: normal; font-size: 1.15em; }
.fx-pawn i { width: 0.8em; height: 0.8em; border-radius: 50%; background: #fff; }
.fx-pawn--add { background: #1fa971; color: #fff; }
.fx-pawn--cap { background: #d63a3a; color: #fff; bottom: 34%; }
.fx-card { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: inherit; gap: 2px; text-align: center; animation: fx-pop 0.4s cubic-bezier(.2, 1.6, .4, 1); }
.fx-delta b { font-size: clamp(13px, 1.7vw, 24px); font-weight: 900; line-height: 1; padding: 3px 8px; border-radius: 10px; border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6); }
.fx-delta span { font-size: clamp(8px, 0.8vw, 11px); font-weight: 800; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); color: #fff; }
.fx-delta.is-good { background: radial-gradient(circle, rgba(31, 169, 113, 0.5), rgba(31, 169, 113, 0.12) 70%); }
.fx-delta.is-good b { background: #1fa971; color: #fff; }
.fx-delta.is-bad { background: radial-gradient(circle, rgba(214, 58, 58, 0.55), rgba(214, 58, 58, 0.14) 70%); }
.fx-delta.is-bad b { background: #d63a3a; color: #fff; }
.fx-destroy { background: rgba(120, 10, 10, 0.62); animation: fx-pop 0.4s cubic-bezier(.2, 1.6, .4, 1), fx-shake 0.5s 0.4s ease-in-out 2; }
.fx-destroy b { font-size: clamp(20px, 2.6vw, 34px); line-height: 1; filter: drop-shadow(0 2px 6px #000); }
.fx-destroy span { font-size: clamp(8px, 0.85vw, 12px); font-weight: 900; color: #fff; background: #b11d1d; padding: 1px 7px; border-radius: 6px; text-transform: uppercase; }
.fx-lane { position: static; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.35); animation: fx-pop 0.3s ease-out; }
.fx-lane b { font-size: 1.1em; }
.lane-row.fx-lane-up { box-shadow: 0 0 0 2px rgba(31, 169, 113, 0.85), 0 0 22px rgba(31, 169, 113, 0.35); }
.lane-row.fx-lane-down { box-shadow: 0 0 0 2px rgba(214, 58, 58, 0.85), 0 0 22px rgba(214, 58, 58, 0.35); }
.fx-lane-up .fx-lane { color: #8ff0c0; border-color: #1fa971; }
.fx-lane-down .fx-lane { color: #ffb0b0; border-color: #d63a3a; }
.fx-confirm { left: 50%; bottom: -22px; translate: -50% 0; white-space: nowrap; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #1fa971; color: #fff; border: 1px solid #fff; z-index: 9; }
.cell--target .board-card--ghost { z-index: 7; }
@keyframes fx-pop { from { scale: 0.3; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes fx-shake { 0%, 100% { translate: 0 0; } 25% { translate: -2px 0; } 75% { translate: 2px 0; } }
@media (max-width: 700px) {
  .fx-pawn { font-size: 8px; padding: 2px 5px; border-width: 1.5px; }
  .fx-lane { margin-left: 4px; font-size: 9px; padding: 1px 6px; }
  .fx-delta b { padding: 1px 4px; border-width: 1.5px; }
}
@media (prefers-reduced-motion: reduce) { .fx, .fx-pawn, .fx-destroy { animation: none !important; } }

@media (max-width: 700px) {
  .score-meta { min-width: 0; }
  .score-label { display: block; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .score-side.ai .score-label { margin-left: auto; }
}

/* =====================================================================
   DESIGN SYSTEM — jetons et règles de cohérence (voir design-system.html)
   Un sens par couleur :
   - or      = rang : présidentiable (★)
   - violet  = rang : légende (♛)
   - cyan    = sélection d'une carte
   - rouge   = à remplacer, interdit, malus
   - vert    = case légale, bonus, carte dans le deck
   Une seule carte (134 × 200), mise à l'échelle par `zoom` selon le contexte.
   ===================================================================== */
:root {
  --c-select: #5cc8ff;
  --c-rank: #f3d98d;
  --c-legend: #c4b0ff;
  --c-swap: #ff6b6b;
  --c-legal: #3cbe78;
  --c-forbid: #ff5a5a;
  --c-good: #1fa971;
  --c-bad: #d63a3a;
  --card-w: 134px;
  --card-h: 200px;
  --hand-zoom: 0.9;
}

/* Même boîte pour toutes les cartes : main, deck, choix du candidat, détail. */
.card--hand, .card--deck, .card--preview { width: var(--card-w); height: var(--card-h); padding: 0; flex: 0 0 auto; }
.card--hand { zoom: var(--hand-zoom); }
.detail-preview .card--preview { zoom: 1.28; }
@media (min-height: 1000px) { :root { --hand-zoom: 1; } }
@media (max-height: 780px) and (min-width: 701px) { :root { --hand-zoom: 0.78; } }
@media (max-width: 700px) { .card--hand { zoom: 0.56; } .detail-preview .card--preview { zoom: 1.2; } }
@media (max-width: 380px) { .card--hand { zoom: 0.5; } }
/* Même typographie quel que soit le contexte. */
.card .card-nameplate .card-name { font-size: 14px; }
.card .card-power-tag { font-size: 8px; }

/* Sélection (cyan), distincte de l'or du rang. */
.card--hand.is-selected { border-color: var(--c-select) !important; box-shadow: 0 0 0 3px var(--c-select), 0 0 26px rgba(92, 200, 255, 0.55), 0 18px 34px rgba(0, 0, 0, 0.55) !important; transform: translateY(-8px) scale(1.015); }
.deck-card.deck-card--face.is-selected { box-shadow: 0 0 0 3px var(--c-legal), 0 10px 26px rgba(0, 0, 0, 0.5); }

/* Rang : présidentiable = or, légende = violet platine. */
.card--candidate { box-shadow: 0 0 0 3px var(--c-rank), 0 0 26px rgba(243, 217, 141, 0.5) !important; border-color: var(--c-rank) !important; }
.card--legend { box-shadow: 0 0 0 3px var(--c-legend), 0 0 26px rgba(196, 176, 255, 0.55) !important; border-color: var(--c-legend) !important; }
.legend-ribbon { background: linear-gradient(90deg, #6c55b8, #dccfff, #6c55b8) !important; color: #1d1140 !important; }
.card--legend::before { background: linear-gradient(115deg, transparent 35%, rgba(235, 226, 255, 0.4) 50%, transparent 65%); background-size: 250% 100%; }
.card--legend .cost-dots, .cost-dots.cost-joker { background: linear-gradient(90deg, #dccfff, #b9a3ff); border-color: #f1eaff; color: #1d1140; }
.card--legend .card-power-gem { background: linear-gradient(160deg, #f1eaff 0%, #c4b0ff 40%, #8870d6 100%); }
.board-card--candidate { box-shadow: 0 0 0 2px var(--c-rank), 0 0 14px rgba(243, 217, 141, 0.55) !important; border-color: var(--c-rank) !important; }
.board-card--legend { box-shadow: 0 0 0 2px var(--c-legend), 0 0 14px rgba(196, 176, 255, 0.6) !important; border-color: var(--c-legend) !important; }
.board-card-crown { background: radial-gradient(circle, #f1eaff, #b9a3ff) !important; color: #1d1140 !important; box-shadow: 0 2px 8px #000, 0 0 12px rgba(196, 176, 255, 0.8) !important; }

/* Puissance : le même losange doré sur la carte et sur le plateau. */
.board-card .board-card-power { position: relative; isolation: isolate; display: grid; place-items: center; width: 1.8em; height: 2em; padding: 0; margin: 0; border: 0; background: none; font-family: var(--serif); font-size: 15px; font-weight: 900; line-height: 1; color: #1b1608; text-shadow: none; }
.board-card .board-card-power::before { content: ""; position: absolute; inset: 0; z-index: -1; clip-path: polygon(50% 0, 100% 18%, 100% 82%, 50% 100%, 0 82%, 0 18%); background: linear-gradient(160deg, #fff0b8 0%, #e7c46d 38%, #b8892f 100%); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.board-card .board-card-power b { font-weight: 900; }
.board-card .board-card-power small { position: absolute; right: -0.7em; bottom: -0.35em; padding: 0 0.3em; border-radius: 6px; font-size: 0.55em; font-weight: 900; background: #0b1322; border: 1px solid currentColor; }
.board-card .board-card-power small.up, .board-card .board-card-power small.mod.up { color: #5ef0b0; }
.board-card .board-card-power small.down, .board-card .board-card-power small.mod.down { color: #ff8a86; }
.board-card--legend .board-card-power::before { background: linear-gradient(160deg, #f1eaff 0%, #c4b0ff 40%, #8870d6 100%); }
@media (max-width: 700px) { .board-card .board-card-power { font-size: 11px; } }

/* Légal / interdit / bon / mauvais : mêmes couleurs partout. */
.cell--legal { box-shadow: 0 0 0 2px var(--c-legal), 0 0 14px rgba(60, 190, 120, 0.35); }
.fx-pawn--add, .fx-delta.is-good b { background: var(--c-good); }
.fx-pawn--cap, .fx-delta.is-bad b { background: var(--c-bad); }

@media (max-width: 700px) { .score-label { display: none; } }

/* =====================================================================
   Terrain de jeu sacré : le plateau, la main et les scores ne bougent jamais.
   Détails, journal et règles glissent par-dessus (tiroir à droite, feuille en bas sur téléphone).
   ===================================================================== */
#info-btn { display: inline-flex; align-items: center; gap: 4px; }
.sheet-close { display: block; width: 100%; margin: 0 0 4px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(255, 255, 255, 0.06); color: var(--text); font-size: 13px; font-weight: 800; cursor: pointer; flex: 0 0 auto; }
.sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
body.sheet-open .sheet-backdrop { opacity: 1; pointer-events: auto; }
@media (min-width: 701px) {
  .layout { display: block; max-width: 1180px; }
  .table { margin: 0 auto; }
  .sidebar { position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: min(440px, 94vw); z-index: 90; overflow-y: auto; padding: 16px; background: #0d1526; border-left: 1px solid var(--line-strong); box-shadow: -18px 0 50px rgba(0, 0, 0, 0.6); transform: translateX(105%); visibility: hidden; pointer-events: none; transition: transform 0.25s ease, visibility 0s 0.25s; max-height: none; display: flex; flex-direction: column; gap: 14px; }
  body.sheet-open .sidebar { transform: translateX(0); visibility: visible; pointer-events: auto; transition: transform 0.25s ease; }
  .sidebar > * { flex: 0 0 auto; }
  #detail { min-height: 0; height: auto; }
  .sidebar .log { max-height: none; }
}

/* Résumé de la carte choisie : toujours là, hauteur fixe, pour que rien ne saute. */
.card-brief, .card-brief.is-on { display: block; min-height: 48px; max-height: 48px; overflow: hidden; margin: 2px 0 6px; padding: 6px 10px; border-radius: 10px; background: rgba(5, 9, 16, 0.7); border: 1px solid rgba(92, 200, 255, 0.4); font-size: 12px; line-height: 1.3; }
.card-brief.is-idle { border-color: var(--line); color: var(--muted); font-style: italic; display: flex; align-items: center; }
.card-brief b { color: #fff; }
.card-brief .brief-plus { color: #9fe3b4; }
.card-brief .brief-minus { display: block; color: #ffb0b0; }
.card-brief button { float: right; margin-left: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #fff; font-size: 11px; cursor: pointer; }
@media (max-width: 700px) { .card-brief, .card-brief.is-on { min-height: 44px; max-height: 44px; font-size: 10px; padding: 4px 8px; } }

/* Main sur téléphone : les 5 cartes tiennent côte à côte, sans défilement. */
@media (max-width: 700px) {
  .hand { overflow: visible; justify-content: center; gap: 2px; scroll-snap-type: none; padding: 6px 0 4px; }
  .card--hand { zoom: 0.52; }
}
@media (max-width: 370px) { .card--hand { zoom: 0.47; } }

/* ---- Écran plein écran de la main de départ ---- */
.btn-big { padding: 16px 28px; font-size: 18px; font-weight: 900; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 10px 30px rgba(79, 134, 255, 0.45); animation: cta-pulse 1.6s ease-in-out infinite; }
@keyframes cta-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.mulligan-screen { position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column; align-items: center; background: radial-gradient(900px 600px at 50% 0%, rgba(40, 92, 200, 0.4), transparent 70%), #070c16; overflow-y: auto; padding: env(safe-area-inset-top) 14px 0; }
.mulligan-inner { flex: 1 0 auto; width: 100%; max-width: 920px; text-align: center; padding: 28px 0 12px; }
.mulligan-inner h2 { font-family: var(--serif); font-size: clamp(28px, 5vw, 44px); margin: 4px 0 8px; }
.mulligan-inner p { color: var(--muted); max-width: 56ch; margin: 0 auto 16px; font-size: 15px; line-height: 1.5; }
.mulligan-inner .mulligan-count { color: var(--text); font-size: 16px; margin-top: 18px; }
.mulligan-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding: 14px 0; }
.mulligan-hand .card--hand { zoom: 1.2; cursor: pointer; }
.mulligan-cta { position: sticky; bottom: 0; width: 100%; display: flex; justify-content: center; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, #070c16 65%, transparent); }
@media (max-width: 700px) {
  .mulligan-hand { gap: 8px; }
  .mulligan-hand .card--hand { zoom: 0.8; }
  .mulligan-inner { padding-top: 16px; }
  .mulligan-inner p { font-size: 13px; }
  .btn-big { font-size: 16px; padding: 14px 18px; }
}
body.is-mulligan-screen { overflow: hidden; }
body.is-mulligan-screen #phase-ribbon { display: none; }

/* ---- Fin de partie : les deux présidentiables face à face ---- */
.duel { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin: 14px 0 6px; }
.duel-side { display: grid; justify-items: center; gap: 4px; position: relative; font-size: 12px; text-align: center; max-width: 150px; }
.duel-side b { font-family: var(--serif); font-size: 14px; }
.duel-side i { color: var(--muted); font-style: normal; font-size: 11px; }
.duel-card { pointer-events: none; }
.duel-side.is-winner .duel-card { filter: drop-shadow(0 0 18px rgba(243, 217, 141, 0.8)); transform: scale(1.06); }
.duel-side.is-loser .duel-card { filter: grayscale(0.7) brightness(0.75); transform: scale(0.94) rotate(-2deg); }
.duel-crown { position: absolute; top: -18px; left: 50%; translate: -50% 0; z-index: 5; font-size: 28px; color: #ffe08a; text-shadow: 0 2px 8px #000, 0 0 16px rgba(255, 224, 138, 0.9); }
.duel-crown--lost { color: #ff6b6b; font-size: 24px; text-shadow: 0 2px 8px #000; }
.duel-vs { font-family: var(--serif); font-weight: 900; font-size: 26px; color: var(--gold); margin-bottom: 70px; }
.duel-line { text-align: center; font-style: italic; color: var(--muted); margin: 4px 0 12px; }
@media (max-width: 700px) { .duel { gap: 6px; } .duel-side .card--preview { zoom: 0.75; } .duel-vs { font-size: 20px; margin-bottom: 50px; } }

/* Tout le terrain tient dans la fenêtre : la taille des cases et de la main suit la hauteur disponible. */
@media (min-width: 701px) {
  :root { --hand-zoom: 1; }
  .board { --cell: clamp(80px, 9.5vh, 130px); }
  .card--hand { height: var(--card-h); width: var(--card-w); }
}
@media (min-width: 701px) and (max-height: 960px) { :root { --hand-zoom: 0.8; } .board { --cell: clamp(64px, 8vh, 110px); } }
@media (min-width: 701px) and (max-height: 800px) { :root { --hand-zoom: 0.66; } .board { --cell: clamp(56px, 7vh, 90px); } }

.card-brief, .card-brief.is-on { position: relative; padding-right: 86px; }
.card-brief button { position: absolute; right: 8px; top: 50%; translate: 0 -50%; float: none; margin: 0; }
@media (min-width: 701px) { .hand { justify-content: center; } }

/* ---- Comment jouer : parcours pas à pas ---- */
.tuto-card-wrap { max-width: 640px; text-align: center; display: flex; flex-direction: column; }
.tuto { display: grid; justify-items: center; gap: 8px; padding: 6px 4px; }
.tuto-icon { font-size: 54px; line-height: 1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); }
.tuto h2 { margin: 0; font-family: var(--serif); font-size: clamp(24px, 4.5vw, 34px); }
.tuto-body { text-align: left; max-width: 52ch; font-size: 15px; line-height: 1.55; color: #cdd8ee; }
.tuto-body p { margin: 0 0 10px; }
.tuto-body b { color: #fff; }
.tuto-small { color: var(--muted); font-size: 12px; }
.tuto-card { display: flex; justify-content: center; margin: 4px 0 10px; pointer-events: none; }
.tuto-body:has(.tuto-card) { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; max-width: 100%; }
.tuto-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tuto-legend li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; font-size: 13.5px; }
.tuto-legend li > b[class^="tl-"] { display: grid; place-items: center; height: 36px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line-strong); font-size: 14px; }
.tl-cost { color: var(--gold); letter-spacing: -1px; }
.tl-gem { color: #1b1608 !important; background: linear-gradient(160deg, #fff0b8, #e7c46d 40%, #b8892f) !important; font-weight: 900; }
.tl-grid { color: var(--c-good); }
.tl-power { color: #ffe08a; }
.tl-star { color: #3a2b05 !important; background: var(--c-rank) !important; }
.tl-crown { color: #1d1140 !important; background: var(--c-legend) !important; }
.tuto-legend--big li { font-size: 14.5px; }
.tuto-dots { display: flex; gap: 6px; margin-top: 8px; }
.tuto-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.tuto-dots span.is-on { background: var(--c-select); width: 22px; border-radius: 6px; }
.tuto-actions { justify-content: space-between; margin-top: 14px; }
.btn-big-inline { padding: 12px 24px; font-size: 16px; font-weight: 900; border-radius: 14px; background: linear-gradient(180deg, #5a95ff, #3c6fe0); color: #fff; border: 0; cursor: pointer; box-shadow: 0 8px 22px rgba(79, 134, 255, 0.45); }
@media (max-width: 700px) {
  .tuto-body:has(.tuto-card) { grid-template-columns: 1fr; }
  .tuto-card .card--preview { zoom: 0.8; }
  .tuto-body { font-size: 14px; }
  .tuto-icon { font-size: 42px; }
}

/* Boutons du bas des écrans modaux : toujours au-dessus des cartes, fond plein. */
@media (max-width: 700px) {
  .modal-actions { z-index: 40; background: #0d1526 !important; border-top: 1px solid var(--line-strong); margin: 10px -12px -16px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
}

/* ---- Écran de résultat : une seule page, sans défilement. Les détails s'ouvrent à la demande. ---- */
.result-modal { max-width: 560px; overflow: hidden; max-height: none; text-align: center; }
.result-modal .result-details { display: none; text-align: left; }
.result-modal.is-details { overflow-y: auto; max-height: 92dvh; }
.result-modal.is-details .result-details { display: block; }
.result-modal.is-details .victory-card, .result-modal.is-details .duel, .result-modal.is-details .duel-line { display: none; }
.result-actions { justify-content: center; flex-wrap: wrap; gap: 8px; position: static !important; background: none !important; border: 0 !important; margin: 10px 0 0 !important; padding: 0 !important; }
@media (max-width: 700px) {
  .result-modal { padding: 12px; }
  .result-modal .victory-card { width: 170px; min-height: 0; padding: 12px 10px; margin: 0 auto; }
  .result-modal .victory-card h2 { font-size: 24px; }
  .result-modal .result-score { font-size: 30px; }
  .result-modal .victory-sub { font-size: 11px; }
  .result-modal .duel { margin: 8px 0 2px; }
  .result-actions .btn { flex: 1 1 30%; font-size: 12px; padding: 10px 6px; }
}
@media (max-height: 760px) { .result-modal .duel-side .card--preview { zoom: 0.62; } .result-modal .victory-card { min-height: 0; } }

.duel-side i { margin-top: 8px; }
