:root {
  --ink: #1b1d1f;
  --muted: #667085;
  --line: #d8dee8;
  --paper: #f7f3e8;
  --panel: #fffdf7;
  --gold: #f0b429;
  --green: #2d8a58;
  --red: #b4443f;
  --blue: #2f62b3;
  --shadow: 0 14px 34px rgba(24, 31, 42, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #e7ecf1;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, select, input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.hidden { display: none !important; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,.12);
  background: #fffdf7;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-text, .primary-action, .actions button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-action {
  width: 100%;
  color: #191201;
  background: var(--gold);
  border-color: #b98509;
}

.help-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #8f6506;
  background: var(--gold);
  color: #1d1604;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.reset-game-dialog {
  width: min(430px, calc(100vw - 28px));
  padding: 20px;
  border: 2px solid #9b7a34;
  border-radius: 5px;
  color: #172033;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .36);
}

.reset-game-dialog::backdrop { background: rgba(9, 16, 27, .58); }
.reset-game-dialog .confirmation-ornament {
  height: 5px;
  margin: -11px -11px 16px;
  background: linear-gradient(90deg, transparent, #d8a827 18%, #0b4b82 50%, #d8a827 82%, transparent);
}
.reset-game-dialog h2 {
  margin: 0 0 10px;
  color: var(--navy-deep);
  text-align: center;
}
.reset-game-dialog p { margin: 0 0 20px; color: #596476; line-height: 1.45; }
.reset-game-dialog .choice-actions { display: flex; justify-content: flex-end; gap: 9px; }
.reset-game-dialog .choice-actions button { min-height: 42px; padding-inline: 16px; }
.reset-game-dialog [data-reset-cancel] {
  border: 1px solid #9f8b61;
  border-radius: 4px;
  color: var(--navy-deep);
  background: rgba(255, 252, 242, .82);
  font-family: "Conquetes Cinzel", Georgia, serif;
  font-weight: 700;
}

.home-view {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(231,236,241,.72), rgba(231,236,241,.88)),
    url("../../img/map-front.png") center / cover;
}

.setup-panel {
  width: min(780px, 100%);
  padding: 18px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  background: rgba(255,253,247,.95);
  box-shadow: var(--shadow);
}

.setup-panel h2, .side-panel h2, .hand-panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select, input[type="text"] {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.custom-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.custom-select {
  position: relative;
  width: 100%;
  color: var(--navy-deep);
  font-weight: 600;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid #bca873;
  border-radius: 5px;
  color: var(--navy-deep);
  background: linear-gradient(rgba(255,254,249,.98), rgba(244,235,214,.98));
  box-shadow: inset 0 1px rgba(255,255,255,.92), 0 2px 5px rgba(23,48,74,.12);
  text-align: left;
}

.custom-select.open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  border-color: #0b568d;
  outline: 3px solid rgba(11, 86, 141, .18);
}

.custom-select-chevron {
  width: 9px;
  height: 9px;
  margin: -4px 3px 0 12px;
  border-right: 2px solid #174f78;
  border-bottom: 2px solid #174f78;
  transform: rotate(45deg);
  transition: transform .16s ease, margin .16s ease;
}

.custom-select.open .custom-select-chevron {
  margin-top: 4px;
  transform: rotate(225deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 2200;
  display: none;
  width: 100%;
  padding: 5px;
  border: 2px solid #9b7a34;
  border-radius: 7px;
  background:
    linear-gradient(rgba(255,250,239,.97), rgba(245,234,210,.98)),
    url("../assets/conquetes-marble.jpg") center / 520px auto;
  box-shadow: 0 12px 28px rgba(5, 31, 60, .3), inset 0 0 0 2px rgba(255,255,255,.55);
}

.custom-select.open .custom-select-menu { display: grid; gap: 3px; }

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px 8px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #173650;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  border-color: #bca873;
  outline: none;
  background: rgba(255,255,255,.72);
}

.custom-select-option.selected {
  border-color: #d2a42b;
  color: #073f72;
  background: linear-gradient(90deg, #fff3c3, #fffaf0);
  font-weight: 800;
}

.custom-select-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #0b5d91;
  box-shadow: 0 1px 5px rgba(0,0,0,.3);
  opacity: 0;
}

.custom-select-option.selected .custom-select-check { opacity: 1; }

.player-setup {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.player-row {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 8px;
}

.game-view {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 210px;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  min-height: 0;
}

.side-panel, .hand-panel, .board-toolbar {
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  background: var(--panel);
}

.side-panel {
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.player-card {
  width: 100%;
  min-width: 0;
  display: block;
  text-align: left;
  overflow: hidden;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 8px;
}

.player-card.viewed {
  outline: 3px solid rgba(47, 98, 179, .32);
  outline-offset: 1px;
  box-shadow: 0 5px 12px rgba(24, 31, 42, .12);
}

.player-card.active {
  border-color: #af7b06;
  background: #fff5cf;
}

.player-card strong {
  display: block;
  font-size: 14px;
}

.player-card span {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.score-line {
  color: var(--ink) !important;
  font-weight: 800;
}

.board-wrap {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
}

.world-map {
  width: 132px;
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 7px;
  padding: 5px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel);
}

.world-map img {
  display: block;
  width: 54px;
  height: 38px;
  object-fit: cover;
  border-radius: 5px;
}

.world-map span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.territory-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.territory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.territory-head h2 {
  margin: 1px 0 0;
  font-size: 17px;
}

.territory-head span {
  color: var(--muted);
  font-size: 12px;
}

.board-head-tools {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;
}

.board-zoom {
  display: flex;
  gap: 4px;
}

.board-zoom button {
  min-width: 32px;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  background: #fff;
  font-weight: 800;
}

.attack-guide {
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #dca829;
  background: #fff6d5;
  color: #49380d;
  font-size: 13px;
  font-weight: 700;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
}

.pile-row, .actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.pile {
  width: 72px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: #f9fafb;
}

.pile img {
  width: 34px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}

.pile span, .pile strong {
  position: absolute;
  right: 6px;
  bottom: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  font-size: 12px;
}

.discard span {
  position: static;
  background: transparent;
  font-size: 11px;
  color: var(--muted);
}

.discard strong {
  font-size: 15px;
}

.actions button[data-action="draw2"] { border-color: #5c8ac7; }
.actions button[data-action="attack"] { border-color: #c55a54; }

.board {
  isolation: isolate;
  position: relative;
  min-height: 420px;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 8px;
  overflow: auto;
  background-color: #f1ead8;
  background-image:
    linear-gradient(rgba(87, 74, 47, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 74, 47, .08) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, rgba(240,180,41,.12), transparent 58%);
  background-size: 10% 10%, 10% 10%, auto;
}

.board-cards {
  position: relative;
  min-width: 100%;
  padding: 10px;
}

.player-board-canvas {
  position: relative;
  isolation: isolate;
  min-width: 100%;
  min-height: 400px;
  margin: 0 auto;
}

.empty-territories {
  margin: 0;
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

.board-card {
  position: absolute;
  width: clamp(42px, 5.4vw, 74px);
  aspect-ratio: 848 / 1261;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  padding: 0;
  filter: drop-shadow(0 5px 5px rgba(0,0,0,.32));
  transition: transform .18s ease, filter .18s ease;
  animation: cardIn .22s ease both;
}

.board-card:hover, .board-card.selected {
  transform: translate(-50%, -50%) scale(1.22);
  z-index: 500 !important;
  filter: drop-shadow(0 8px 9px rgba(0,0,0,.45));
}

.board-card img, .hand-card img, .sample-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 5px;
}

.owner-dot {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
}

.log-panel {
  align-self: start;
  width: 100%;
  max-height: clamp(300px, 52dvh, 510px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

.log-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.log-item {
  padding: 7px;
  border-left: 3px solid var(--gold);
  background: #fff;
  border-radius: 0 6px 6px 0;
}

.hand-panel {
  grid-column: 1 / -1;
  padding: 8px;
  min-width: 0;
}

.hand-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.hand-head span {
  color: var(--muted);
  font-size: 13px;
}

.hand {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 126px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.hand-card {
  flex: 0 0 clamp(64px, 8vw, 92px);
  aspect-ratio: 848 / 1261;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 6px;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.26));
  touch-action: pan-x;
  user-select: none;
}

.hand-card.dragging { opacity: .35; }

.hand-card.draw-target-slot {
  visibility: hidden;
  pointer-events: none;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  width: 76px;
  aspect-ratio: 848 / 1261;
  padding: 0;
  border: 0;
  pointer-events: none;
  transform: translate(-50%, -58%) rotate(2deg);
  filter: drop-shadow(0 12px 14px rgba(0,0,0,.45));
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.player-board.drop-target {
  outline: 4px solid var(--green);
  outline-offset: -5px;
  background-color: #e6f3e8;
}

.hand-card.selected {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

dialog {
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(14, 19, 27, .55);
}

.rules-dialog {
  width: min(880px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  box-sizing: border-box;
  padding: 0;
  background: var(--panel);
  overflow: hidden;
}

.rules-dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
}

.dialog-kicker {
  display: block;
  margin-bottom: 2px;
  color: #8d6814;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.close-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 900;
}

.rules-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.rules-intro {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  color: #26364b;
  background: rgba(255, 247, 215, .82);
  font-size: 14px;
  line-height: 1.45;
}

.rules-body section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.rules-body h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.rules-body p {
  margin: 0 0 8px;
  color: #384250;
  font-size: 14px;
  line-height: 1.42;
}

.rules-body p:last-child { margin-bottom: 0; }

.rules-body ul {
  margin: 7px 0 10px;
  padding-left: 20px;
  color: #384250;
  font-size: 14px;
  line-height: 1.45;
}

.rules-body li + li { margin-top: 4px; }

.rules-card-reading { position: relative; }

.sample-card {
  width: 96px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.choice-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 14px;
}

.choice-dialog.support-browser {
  position: fixed;
  inset: auto 12px 12px auto;
  z-index: 2500;
  isolation: isolate;
  width: min(620px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 24px));
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid #c18c12;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 35px rgba(0, 0, 0, .38);
}

.support-browser-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.support-browser-head h2 {
  margin: 0;
}

.support-browser-head button {
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 7px;
  border-color: #b98509;
  background: #fff4c6;
  font-weight: 800;
}

.choice-dialog.support-browser.collapsed {
  width: min(420px, calc(100vw - 24px));
  padding: 8px 10px;
}

.support-browser.collapsed > :not(.support-browser-head) {
  display: none;
}

.support-browser.collapsed .support-browser-head h2 {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-browser .choice-grid {
  flex: 1 1 auto;
  min-height: 110px;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.support-browser > .choice-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex: 0 0 auto;
  margin: 8px -4px -4px;
  padding: 8px 4px 4px;
  border-top: 1px solid rgba(154, 124, 56, .35);
  background: linear-gradient(rgba(247, 238, 218, .9), #f7eeda 38%);
}

.support-browser-help {
  margin: 6px 0;
  padding: 7px 9px;
  border-radius: 7px;
  background: #eef4ff;
  color: #30445f;
  font-size: 12px;
}

.support-selection-count {
  margin: 5px 0;
  font-size: 12px;
}

.choice-dialog h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  max-height: 56vh;
  overflow: auto;
  padding: 4px;
}

.choice-card {
  position: relative;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 8px;
  background: transparent;
  transition: opacity .16s ease, filter .16s ease, transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.choice-grid.has-selection .choice-card:not(.selected),
.hand-limit-cards [data-limit-card]:not(.selected) {
  opacity: 1;
  filter: none;
}

.choice-card.selected {
  z-index: 2;
  border-color: #073f72;
  background: #fff6cc;
  box-shadow: 0 0 0 4px #ffd33d, 0 7px 18px rgba(5, 45, 80, .42);
  transform: translateY(-2px);
}

.choice-card-select-label {
  display: block;
  padding: 5px 2px 3px;
  color: #075b5d;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: .7rem;
  font-weight: 800;
}

.selection-card-shell {
  position: relative;
  min-width: 0;
}

.selection-card-shell > .choice-card,
.selection-card-shell > [data-limit-card] {
  width: 100%;
  height: 100%;
}

.selection-card-preview,
.selection-card-preview-inline {
  z-index: 6;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid #fff8d8;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #0b8b84, #045562);
  box-shadow: 0 3px 8px rgba(2,36,51,.38);
  font-size: 17px;
  line-height: 1;
}

.selection-card-preview {
  position: absolute;
  top: 6px;
  right: 6px;
}

.selection-card-preview-inline {
  position: absolute;
  top: 10px;
  right: 10px;
  pointer-events: auto;
}

.choice-card.selected::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #0b5d91;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.choice-card img {
  width: 100%;
  display: block;
  border-radius: 6px;
}

.choice-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.combat-dialog {
  width: min(780px, calc(100vw - 20px));
  background: var(--panel);
}

.duplicate-region-dialog {
  width: min(520px, calc(100vw - 24px));
}

.dialog-kicker {
  margin: 0 0 4px;
  color: #9b6810;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.duplicate-region-alert {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid #c7a34a;
  background: #fff7d8;
}

.duplicate-region-alert img {
  width: 88px;
  border-radius: 5px;
  box-shadow: var(--shadow);
}

.duplicate-region-alert p {
  margin: 4px 0 9px;
}

.bot-combat-summary-dialog {
  width: min(860px, calc(100vw - 20px));
}

.bot-combat-intro {
  text-align: center;
}

.bot-combat-outcome {
  margin: 12px 0 !important;
  padding: 13px;
  border: 2px solid;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.bot-combat-outcome.is-conquest {
  border-color: #a92f28;
  color: #771d18;
  background: #ffe1d6;
}

.bot-combat-outcome.is-defense {
  border-color: #23734e;
  color: #155139;
  background: #ddf3e5;
}

.bot-combat-summary-dialog .attack-announcement-cards img {
  width: min(130px, 25vw);
  max-height: 30vh;
}

.bot-combat-supports .combat-cards {
  min-height: 86px;
}

@media (max-width: 560px) {
  .duplicate-region-alert {
    grid-template-columns: 68px minmax(0, 1fr);
  }
  .duplicate-region-alert img { width: 68px; }
  .bot-combat-summary-dialog { padding: 10px; }
  .bot-combat-outcome { font-size: 15px; }
  .bot-combat-summary-dialog .combat-sides { grid-template-columns: 1fr; }
  .bot-combat-summary-dialog .combat-cards { min-height: 68px; }
}

.combat-content > p {
  margin: 8px 0 12px;
}

.combat-notice {
  padding: 10px;
  border-left: 4px solid var(--gold);
  border-radius: 0 7px 7px 0;
  background: #fff4c6;
}

.attack-announcement-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.attack-announcement-cards figure {
  margin: 0;
  text-align: center;
}

.attack-announcement-cards figure > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.attack-announcement-cards img {
  width: min(190px, 32vw);
  max-height: 48vh;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.attack-announcement-cards figcaption {
  margin-top: 7px;
  font-size: 16px;
  font-weight: 900;
}

.attack-versus {
  color: #a22f2a;
  font-size: 13px;
}

.combat-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.combat-sides section {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.combat-sides h3,
.combat-sides p {
  margin: 0 0 8px;
}

.combat-cards {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  min-height: 110px;
  overflow-x: auto;
  padding: 4px 2px 7px;
}

.combat-cards img {
  flex: 0 0 auto;
  width: clamp(58px, 10vw, 82px);
  border-radius: 5px;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.24));
}

.combat-card {
  flex: 0 0 clamp(64px, 11vw, 88px);
  margin: 0;
}

.combat-card img {
  width: 100%;
}

.combat-card figcaption {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.1;
}

.combat-card figcaption strong {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: #26384f;
  font-size: 13px;
}

.combat-card figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.hidden-support img {
  width: clamp(48px, 8vw, 66px);
}

.no-support {
  min-height: 74px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.combat-total {
  margin: 6px 0 0 !important;
  padding: 7px;
  border-radius: 6px;
  color: #fff;
  background: #26384f;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.combat-formula {
  margin: 5px 0 !important;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.combat-winner {
  padding: 14px;
  border: 2px solid #b98509;
  border-radius: 8px;
  background: #fff4c6;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.combat-summary {
  display: grid;
  gap: 7px;
  margin: 0;
}

.combat-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.combat-summary dt { color: var(--muted); }
.combat-summary dd { margin: 0; font-weight: 900; }

.combat-rule-note {
  margin: 12px 0 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: #e8eef7;
  color: #30445f;
  font-size: 13px;
  line-height: 1.35;
}

.end-game-dialog {
  width: min(980px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  padding: 0;
  overflow: hidden;
  background: var(--panel);
}

.end-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.end-game-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.end-game-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.end-game-intro {
  margin: 12px 14px;
  padding: 12px;
  border: 2px solid #b98509;
  border-radius: 8px;
  background: #fff4c6;
  font-size: 17px;
  text-align: center;
}

.score-ranking {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 0 14px 12px;
}

.score-player {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.score-player.winner {
  border: 2px solid #b98509;
  background: #fffdf3;
}

.score-player > header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
}

.score-player h3,
.score-player h4 {
  margin: 0;
}

.score-player h3 { font-size: 17px; }
.score-player h4 { margin-top: 12px; font-size: 13px; }
.score-player small { color: var(--muted); }
.score-player > header > strong { font-size: 20px; }

.score-rank {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: #26384f;
  font-weight: 900;
}

.score-cards {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 7px 2px;
}

.score-cards figure {
  flex: 0 0 66px;
  margin: 0;
}

.score-cards img {
  display: block;
  width: 100%;
  border-radius: 5px;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.22));
}

.score-cards figcaption {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duplicate-cards img { outline: 3px solid var(--gold); outline-offset: -3px; }
.score-empty { margin: 6px 0; color: var(--muted); font-size: 13px; }

.score-equation,
.tie-break,
.continent-score {
  margin: 7px 0 0;
  font-size: 13px;
}

.score-equation {
  padding: 7px;
  border-radius: 6px;
  background: #edf2f7;
}

.tie-break { color: var(--muted); }
.continent-score { color: var(--green); font-weight: 800; }

.end-game-dialog > .choice-actions {
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.zoom-dialog {
  padding: 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.zoom-dialog img {
  max-width: min(92vw, 520px);
  max-height: 88vh;
  display: block;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.zoom-dialog.map-zoom img {
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  object-fit: contain;
}

.zoom-dialog.map-zoom {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 8px;
  display: grid;
  place-items: center;
  background: #111827;
}

.zoom-dialog .close-button {
  position: fixed;
  right: 14px;
  top: 14px;
  background: var(--gold);
}

@media (max-width: 920px) {
  .game-view {
    grid-template-columns: 150px minmax(0, 1fr);
  }
  .log-panel {
    display: none;
  }
}

@media (max-width: 680px) {
  .topbar { padding: 8px; }
  .topbar h1 { font-size: 19px; }
  .topbar p { font-size: 12px; }
  .icon-text { padding: 0 8px; font-size: 14px; }
  .help-button { width: 40px; height: 40px; }
  .setup-grid, .player-row, .game-view {
    grid-template-columns: 1fr;
  }
  .game-view {
    grid-template-rows: auto auto auto auto;
    padding: 8px;
  }
  .players-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .player-card {
    margin: 0;
  }
  .board {
    min-height: 360px;
  }
  .board-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .actions button {
    flex: 1 1 44%;
  }
  .rules-body {
    grid-template-columns: 1fr;
  }
  .combat-sides {
    grid-template-columns: 1fr;
  }
  .attack-announcement-cards {
    gap: 7px;
  }
  .attack-announcement-cards figcaption {
    font-size: 13px;
  }
  .attack-versus {
    font-size: 10px;
  }
  .choice-dialog.support-browser {
    inset: auto 6px 6px 6px;
    width: auto;
    max-height: calc(100dvh - 12px);
  }
  .choice-dialog.support-browser.collapsed {
    width: auto;
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.72);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.turn-draw-overlay {
  --draw-target-x: 50vw;
  --draw-target-y: calc(100vh - 90px);
  --draw-duration: 1800ms;
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
  background: rgba(13, 20, 32, .34);
  animation: turnDrawBackdrop var(--draw-duration) linear forwards;
  will-change: opacity;
}

.bot-notification {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 18, 30, .38);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}

.bot-notification.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.bot-notification-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(440px, 100%);
  padding: 18px;
  border: 2px solid #e4ad25;
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .32);
  transform: translateY(12px) scale(.97);
  transition: transform .18s ease;
}

.bot-notification.visible .bot-notification-card {
  transform: translateY(0) scale(1);
}

.bot-notification-image {
  width: 76px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
}

.bot-notification-image[hidden] { display: none; }

.bot-notification-copy > span {
  display: block;
  margin-bottom: 5px;
  color: #687284;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.bot-notification-copy > strong {
  display: block;
  color: #182337;
  font-size: 1.12rem;
  line-height: 1.35;
}

.bot-notification-card [data-bot-notification-continue] {
  min-height: 36px;
  margin-top: 12px;
  padding: 0 14px;
  border-color: #9b6c0c;
  border-radius: 4px;
  font-family: "Conquetes Cinzel", Georgia, serif;
  font-weight: 700;
}

.attack-wizard-dialog {
  width: min(760px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  padding: 16px;
  overflow: auto;
}

.attack-wizard-progress {
  color: #9a6a08;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.attack-wizard-dialog > h2 { margin: 4px 0 6px; }
.attack-wizard-dialog > p { margin: 0 0 12px; color: var(--muted); }

.attack-wizard-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 9px;
  max-height: 56vh;
  overflow: auto;
  padding: 4px;
}

.attack-wizard-choice {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 7px;
  border: 2px solid #bbaa81;
  border-radius: 5px;
  background: rgba(255,253,247,.86);
}

.attack-wizard-choice img {
  width: min(112px, 100%);
  aspect-ratio: 848 / 1261;
  object-fit: cover;
  border-radius: 5px;
}

.attack-wizard-choice strong { line-height: 1.15; text-align: center; }
.attack-wizard-choice.selected { border-color: #d69c14; background: #fff1b9; box-shadow: 0 0 0 2px rgba(214,156,20,.2); }
.attack-wizard-player { width: 100%; display: grid; gap: 3px; padding: 12px; border-left: 6px solid; text-align: left; }
.attack-wizard-player small { color: var(--muted); }
.attack-wizard-timer, .combat-auto-note { margin: 8px 0 0 !important; color: var(--muted); font-size: 11px; text-align: center; }

.support-attack-context {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 48px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin: 8px 0;
  padding: 8px;
  border: 1px solid #bca76d;
  border-radius: 4px;
  background: rgba(255,248,225,.86);
}

.support-attack-context img { width: 48px; border-radius: 4px; }
.support-attack-context small, .support-attack-context strong { display: block; }
.support-attack-context small { color: var(--muted); font-size: 10px; }
.support-attack-context > span { color: #a33d32; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.support-bot-count, .combat-support-count { margin: 7px 0; padding: 8px; border-radius: 4px; background: #fff0b9; text-align: center; }

.hand-limit-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: min(90vh, 820px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  color: #172033;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .38);
}

.hand-limit-dialog::backdrop { background: rgba(9, 16, 27, .62); }

.hand-limit-form {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 820px);
}

.hand-limit-form > header { padding: 20px 20px 10px; }
.hand-limit-form > header span { color: #a56c00; font-size: .82rem; font-weight: 800; text-transform: uppercase; }
.hand-limit-form h2 { margin: 3px 0 6px; }
.hand-limit-form p { margin: 0; color: #596476; }

.hand-limit-count {
  margin: 4px 20px 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #fff3c9;
  color: #724d00;
}

.hand-limit-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 9px;
  min-height: 130px;
  padding: 3px 20px 15px;
  overflow-y: auto;
}

.hand-limit-cards [data-limit-card] {
  position: relative;
  padding: 4px;
  border: 3px solid transparent;
  border-radius: 10px;
  background: #eef1f5;
  color: #263247;
}

.hand-limit-cards [data-limit-card].selected {
  border-color: #e0a817;
  background: #fff3c9;
  box-shadow: 0 0 0 2px rgba(224, 168, 23, .22);
}

.hand-limit-cards [data-limit-card].selected::after {
  content: "✓";
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: #0b5d91;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.hand-limit-cards [data-limit-card] img { display: block; width: 100%; border-radius: 6px; }
.hand-limit-cards [data-limit-card] span { display: block; padding: 5px 2px 2px; font-size: .76rem; line-height: 1.2; }

.hand-limit-targets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0 20px 14px;
  padding: 10px;
  border: 1px solid #d7dce4;
  border-radius: 10px;
}

.hand-limit-targets legend { padding: 0 6px; font-weight: 800; }
.hand-limit-targets label { display: flex; align-items: center; gap: 8px; padding: 9px; border-radius: 8px; background: #f3f5f8; }
.hand-limit-targets span, .hand-limit-targets small { display: block; }
.hand-limit-targets small { margin-top: 2px; color: #697385; }

.hand-limit-actions {
  padding: 12px 20px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid #dde1e7;
  background: #fff;
}

.hand-limit-actions button { width: 100%; min-height: 46px; }

@media (max-width: 560px) {
  .bot-notification-card { padding: 14px; gap: 12px; }
  .bot-notification-image { width: 62px; height: 92px; }
  .bot-notification-card strong { font-size: 1rem; }
  .hand-limit-dialog, .hand-limit-form { max-height: 94vh; }
  .hand-limit-form > header { padding: 15px 14px 8px; }
  .hand-limit-count { margin: 3px 14px 8px; }
  .hand-limit-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 3px 14px 12px; }
  .hand-limit-targets { margin: 0 14px 10px; grid-template-columns: 1fr; }
  .hand-limit-actions { padding-inline: 14px; }
  .attack-wizard-dialog { padding: 12px; }
  .attack-wizard-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 52vh; }
  .support-attack-context { grid-template-columns: 40px minmax(0, 1fr) auto 40px minmax(0, 1fr); gap: 5px; }
  .support-attack-context img { width: 40px; }
  .support-attack-context strong { font-size: 11px; }
}

.manual-draw-animation,
.manual-draw-animation .turn-draw-moving,
.manual-draw-animation .turn-draw-card,
.manual-draw-animation .turn-draw-name,
.manual-draw-animation .turn-draw-label {
  animation: none !important;
}

.turn-draw-moving {
  position: fixed;
  left: 50vw;
  top: 50vh;
  width: clamp(118px, 31vw, 180px);
  aspect-ratio: 848 / 1261;
  perspective: 1000px;
  animation: turnDrawTravel var(--draw-duration) cubic-bezier(.32, .75, .3, 1) forwards;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
}

.turn-draw-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max-content;
  padding: 5px 10px;
  border-radius: 999px;
  color: #201806;
  background: var(--gold);
  font-size: 13px;
  font-weight: 900;
  transform: translateX(-50%);
  animation: turnDrawLabel var(--draw-duration) linear forwards;
}

.turn-draw-card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  animation: turnDrawFlip var(--draw-duration) ease-in-out forwards;
  will-change: transform;
}

.turn-draw-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  object-fit: cover;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 16px 35px rgba(0, 0, 0, .48);
}

.turn-draw-front {
  transform: rotateY(180deg);
  -webkit-transform: rotateY(180deg);
}

.turn-draw-name {
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  width: max-content;
  max-width: 220px;
  padding: 5px 9px;
  border-radius: 999px;
  opacity: 0;
  color: #17120a;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  font-size: 13px;
  text-align: center;
  transform: translateX(-50%);
  animation: turnDrawName var(--draw-duration) linear forwards;
}

@keyframes turnDrawTravel {
  0%, 22% { left: 50vw; top: 50vh; opacity: 1; transform: translate(-50%, -50%) scale(1); }
  88% { opacity: 1; }
  100% { left: var(--draw-target-x); top: var(--draw-target-y); opacity: 0; transform: translate(-50%, -50%) scale(.48); }
}

@keyframes turnDrawFlip {
  0%, 48% { transform: rotateY(0); }
  66%, 100% { transform: rotateY(180deg); }
}

@keyframes turnDrawName {
  0%, 58% { opacity: 0; }
  68%, 88% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes turnDrawBackdrop {
  0%, 82% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes turnDrawLabel {
  0%, 54% { opacity: 1; }
  64%, 100% { opacity: 0; }
}

/* Charte Conquetes — adaptee des fichiers d'impression officiels */
@font-face {
  font-family: "Conquetes Cinzel";
  src: url("../assets/fonts/Cinzel-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Conquetes Cinzel";
  src: url("../assets/fonts/Cinzel-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Conquetes Kabel";
  src: url("../assets/fonts/Kabel-Black.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  --ink: #17243d;
  --muted: #657184;
  --line: #c8b689;
  --paper: #f3ead5;
  --panel: #fffaf0;
  --gold: #e5aa19;
  --gold-dark: #8a5c08;
  --navy: #07396c;
  --navy-deep: #06284d;
  --ivory: #fffaf0;
  --shadow: 0 12px 28px rgba(12, 35, 63, .22);
}

body {
  color: var(--ink);
  background:
    linear-gradient(rgba(232, 222, 199, .74), rgba(232, 222, 199, .74)),
    url("../assets/conquetes-marble.jpg") center top / 720px auto fixed;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

button, select, input { font-family: inherit; }

button {
  border-color: #bca873;
  color: var(--ink);
  background: linear-gradient(#fffdf7, #f0e6d0);
  box-shadow: inset 0 1px rgba(255,255,255,.85), 0 2px 4px rgba(22,42,66,.12);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease, filter .12s ease;
}

button:not(:disabled):active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid rgba(229,170,25,.44); outline-offset: 2px; }

.topbar {
  min-height: 68px;
  padding: 9px 16px;
  border-bottom: 3px double #9d7d38;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(5,44,83,.97), rgba(8,73,125,.94)),
    url("../assets/conquetes-marble.jpg") center / 700px auto;
  box-shadow: 0 5px 16px rgba(5,31,60,.26);
}

.topbar h1,
.setup-panel h2,
.side-panel h2,
.hand-panel h2,
.territory-head h2,
.dialog-head h2,
.choice-dialog h2,
.reset-game-dialog h2,
.end-game-head h2,
.score-player h3 {
  font-family: "Conquetes Cinzel", Georgia, serif;
  letter-spacing: .015em;
}

.topbar h1 {
  color: #f7c943;
  font-family: "Conquetes Kabel", "Conquetes Cinzel", Georgia, serif;
  font-size: 27px;
  letter-spacing: .035em;
  text-shadow: 0 2px 0 #6d4200, 0 3px 7px rgba(0,0,0,.45);
}

.topbar p { color: #e6edf5; }

.brand-logo {
  width: clamp(142px, 18vw, 190px);
  height: 48px;
  display: flex;
  align-items: center;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.42));
}

.brand-logo span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top-actions button { border-color: #d7bc70; }
.icon-text {
  color: #f7edd2;
  background: rgba(4,35,67,.72);
}

.icon-text:hover,
.icon-text:focus-visible {
  color: #fff7d7;
  border-color: #f2c44b;
  background: rgba(11,66,110,.96);
}

.help-button {
  border: 2px solid #fff0aa;
  color: #332006;
  background: radial-gradient(circle at 35% 28%, #ffd85d, #d79608 72%);
  box-shadow: 0 0 0 2px #80510a, 0 3px 8px rgba(0,0,0,.32);
}

.home-view {
  padding: 30px 18px;
  background:
    linear-gradient(rgba(5,38,72,.32), rgba(6,35,67,.62)),
    url("../../img/map-front.png") center / cover;
}

.setup-panel,
.side-panel,
.hand-panel,
.board-toolbar,
.territory-panel,
dialog,
.bot-notification-card {
  border: 1px solid #a98c4d;
  background:
    linear-gradient(rgba(255,250,240,.91), rgba(247,238,218,.94)),
    url("../assets/conquetes-marble.jpg") center / 620px auto;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.52), var(--shadow);
}

.setup-panel {
  position: relative;
  max-width: 620px;
  padding: 25px;
  border: 2px solid #9b7a34;
  border-radius: 4px;
}

.setup-panel::before,
.territory-panel::before,
.hand-panel::before {
  content: "";
  display: block;
  height: 4px;
  margin: -1px -1px 10px;
  background: linear-gradient(90deg, transparent, #d8a827 18%, #0b4b82 50%, #d8a827 82%, transparent);
  opacity: .92;
}

.setup-panel::before { margin: -16px -16px 16px; }
.setup-panel h2 { color: var(--navy-deep); font-size: 22px; text-align: center; }

label { color: #536078; }
select, input[type="text"] {
  height: 42px;
  border-color: #c2af7c;
  border-radius: 4px;
  background: rgba(255,253,247,.92);
  box-shadow: inset 0 1px 3px rgba(52,41,19,.08);
}

.primary-action,
.actions button {
  min-height: 42px;
  border-radius: 4px;
  font-family: "Conquetes Cinzel", Georgia, serif;
  font-weight: 700;
}

.primary-action {
  border: 2px solid #8d5e05;
  color: #fff9e4;
  background: linear-gradient(#efbb32, #c98608);
  box-shadow: inset 0 1px rgba(255,255,255,.55), 0 3px 0 #744907, 0 5px 9px rgba(67,44,5,.2);
  text-shadow: 0 1px 1px #664000;
}

.game-view { gap: 12px; }

.player-card {
  border-color: #b9aa85;
  border-radius: 4px;
  background: rgba(255,253,247,.86);
  box-shadow: inset 4px 0 var(--player-color, #c79720);
}

.player-card.viewed {
  outline: 2px solid #0f5b98;
  box-shadow: inset 4px 0 var(--player-color, #c79720), 0 5px 12px rgba(10,54,89,.18);
}

.player-card.active {
  border-color: #a87910;
  background: linear-gradient(90deg, #fff2bf, #fff9df);
}

.board-toolbar { border-radius: 4px; }
.pile { border-radius: 4px; background: rgba(255,253,247,.88); }
.discard { border-style: dashed; }

.actions button[data-action="draw2"] {
  border-color: #1b6398;
  color: #fff;
  background: linear-gradient(#2879af, #0a4a7c);
}

.actions button[data-action="attack"] {
  border-color: #983832;
  color: #fff;
  background: linear-gradient(#c95447, #8e2925);
}

.world-map {
  border: 1px solid #9e7d36;
  border-radius: 4px;
  background: linear-gradient(#fffaf0, #eadcbb);
}
.world-map img { border: 1px solid #80662f; border-radius: 2px; }
.world-map span { color: var(--navy-deep); font-family: "Conquetes Cinzel", Georgia, serif; }

.territory-panel { position: relative; border-radius: 4px; }
.territory-panel::before { margin: 0; }
.territory-head { border-bottom: 1px solid #baa775; }
.territory-head > div:first-child > span { color: #8b6a22; text-transform: uppercase; letter-spacing: .08em; }
.board-zoom button { border-radius: 3px; }

.board {
  border-color: #a98e52;
  border-radius: 2px;
  background-color: #eadfc5;
  background-image:
    linear-gradient(rgba(72, 58, 32, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 58, 32, .075) 1px, transparent 1px),
    linear-gradient(rgba(255,250,237,.69), rgba(234,220,190,.68)),
    url("../assets/conquetes-marble.jpg");
  background-size: 10% 10%, 10% 10%, auto, 620px auto;
}

.hand-panel { position: relative; border-radius: 4px; }
.hand-panel::before { margin: -8px -8px 8px; }
.hand { scrollbar-color: #b58c2c #e9dcc0; }

.attack-guide,
.combat-notice,
.combat-winner,
.hand-limit-count {
  border-color: #c28d13;
  background: linear-gradient(90deg, #fff2bd, #fff9df);
}

.log-item {
  border-left-color: #d29b1a;
  background: rgba(255,253,247,.78);
}

.choice-dialog.support-browser {
  border-color: #a87910;
  border-radius: 5px;
  background:
    linear-gradient(rgba(255,250,240,.95), rgba(247,238,218,.96)),
    url("../assets/conquetes-marble.jpg") center / 620px auto;
}

.combat-sides section,
.rules-body section,
.score-player {
  border-color: #bbaa81;
  border-radius: 4px;
  background: rgba(255,253,247,.82);
}

.combat-total,
.score-rank {
  background: linear-gradient(#0c507f, #062f59);
}

.bot-notification-card {
  border: 2px solid #b7891d;
  border-radius: 5px;
}

@media (hover: hover) {
  button:not(:disabled):hover { filter: brightness(1.045); box-shadow: inset 0 1px rgba(255,255,255,.9), 0 4px 9px rgba(16,41,68,.2); }
}

@media (max-width: 680px) {
  .rules-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }
  .rules-body {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .topbar { min-height: 60px; padding: 7px 9px; }
  .topbar h1 { font-size: 21px; }
  .topbar p { max-width: 124px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { gap: 6px; }
  .icon-text { font-size: 12px; }
  .help-button { width: 37px; height: 37px; font-size: 21px; }
  .home-view { padding: 20px 14px; }
  .setup-panel { padding: 20px 17px; }
  .setup-panel::before { margin: -11px -8px 14px; }
  .setup-panel h2 { font-size: 19px; }
  .game-view { gap: 9px; }
}

@media (max-width: 430px) {
  .topbar { gap: 5px; }
  .topbar > div:first-child { min-width: 0; }
  .topbar h1 { font-size: 18px; }
  .brand-logo { width: 132px; height: 40px; }
  .brand-logo img { max-height: 40px; }
  .topbar p { display: none; }
  .top-actions { flex: 0 0 auto; gap: 4px; }
  .icon-text { min-height: 35px; padding: 0 7px; font-size: 10px; }
  .help-button { width: 34px; height: 34px; }
  .help-button { font-size: 19px; }
  .home-view, .setup-panel, .setup-grid, .player-row,
  .setup-grid > label, .player-row > * { min-width: 0; }
  .home-view { width: 100%; overflow-x: hidden; }
  .setup-panel { width: 100%; max-width: 100%; }
  select, input[type="text"] { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}

/* Personnages des joueurs */
.player-row {
  grid-template-columns: 64px minmax(0, 1fr) 150px;
  align-items: stretch;
}

.setup-avatar-button {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid #078b86;
  border-radius: 12px;
  background: #087f7c;
  box-shadow: 0 3px 8px rgba(4,65,72,.23);
}

.setup-avatar-button img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 54px;
  object-fit: cover;
}

.setup-avatar-button span {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  padding: 2px 3px;
  border-radius: 7px;
  color: #fffbe8;
  background: rgba(3,61,69,.84);
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 9px;
  line-height: 1.1;
  text-align: center;
}

.avatar-picker-dialog {
  width: min(720px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  overflow: auto;
}

.avatar-picker-dialog > p {
  text-align: center;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 15px 0;
}

.avatar-picker-option {
  min-width: 0;
  padding: 6px;
  border: 2px solid #b8a56f;
  border-radius: 13px;
  color: #123a51;
  background: rgba(255,253,238,.9);
  box-shadow: 0 3px 8px rgba(14,54,71,.14);
}

.avatar-picker-option.selected {
  border-color: #e4a61a;
  outline: 3px solid rgba(7,143,136,.3);
  background: #fff3bd;
}

.avatar-picker-option img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 9px;
}

.avatar-picker-option strong,
.avatar-picker-option span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-picker-option strong {
  margin-top: 6px;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 13px;
}

.avatar-picker-option span {
  margin-top: 2px;
  color: #6b7580;
  font-size: 10px;
}

.player-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.player-card-avatar,
.player-avatar-inline,
.combat-heading-avatar,
.support-player-avatar,
.score-player-avatar,
[data-bot-notification-avatar] {
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid #f2c247;
  border-radius: 50%;
  background: #087f7c;
  box-shadow: 0 2px 6px rgba(3,51,67,.28);
}

.player-card-avatar {
  width: 44px;
}

.player-card-copy {
  display: block !important;
  min-width: 0;
  margin: 0 !important;
}

.player-card-copy > strong,
.player-card-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-hand-stat {
  color: #075b5d;
  font-weight: 900;
}

.player-best-line {
  overflow: visible !important;
  color: #586779 !important;
  line-height: 1.05 !important;
  white-space: normal !important;
}

.bot-notification-actor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 7px;
}

[data-bot-notification-avatar] {
  width: 42px;
}

.bot-notification-actor > span {
  color: #075b5d;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 1rem;
  font-weight: 800;
}

.combat-participants {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 4px auto 13px;
}

.combat-participants > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.combat-participants .player-avatar-inline {
  width: 58px;
  flex: 0 0 auto;
}

.combat-participants span,
.combat-participants small,
.combat-participants strong {
  display: block;
}

.combat-participants small {
  color: #6d7580;
  font-size: 10px;
  text-transform: uppercase;
}

.combat-participants b {
  color: #a86f08;
  font-size: 11px;
  text-transform: uppercase;
}

.combat-participants.compact .player-avatar-inline {
  width: 44px;
}

.support-player-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.support-player-copy > span,
.support-player-copy small,
.support-player-copy strong {
  display: block;
}

.support-player-avatar,
.combat-heading-avatar {
  width: 34px;
  flex: 0 0 auto;
}

.combat-player-heading {
  display: flex;
  align-items: center;
  gap: 7px;
}

.score-player-avatar {
  width: 42px;
  flex: 0 0 auto;
}

@media (max-width: 620px) {
  .player-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .player-row .custom-select {
    grid-column: 2;
  }

  .setup-avatar-button {
    grid-row: span 2;
  }

  .avatar-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .players-track .player-card {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 6px;
  }

  .players-track .player-card-avatar {
    width: 38px;
  }

  .combat-participants {
    gap: 7px;
  }

  .combat-participants .player-avatar-inline {
    width: 44px;
  }

  .combat-participants > div {
    gap: 5px;
  }
}

/* Impera 2026 — habillage inspiré des frises des nouvelles cartes. */
:root {
  --impera-teal: #087f7c;
  --impera-teal-deep: #03585d;
  --impera-mint: #dff4df;
  --impera-cream: #fff4d7;
  --impera-gold: #f2ad18;
  --impera-coral: #dc3759;
  --impera-ocean: #075d9b;
  --impera-ink: #083f43;
  --panel: #fff8e8;
  --ink: var(--impera-ink);
  --line: #8fc9b5;
  --gold: var(--impera-gold);
  --navy: var(--impera-ocean);
  --navy-deep: #053c69;
  --shadow: 0 14px 30px rgba(1, 54, 69, .22);
}

body {
  color: var(--impera-ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(49, 202, 181, .25), transparent 32%),
    linear-gradient(145deg, #087e9d, #064a81 58%, #05335f);
}

button, select, input[type="text"] {
  border-color: #71b7a8;
  border-radius: 12px;
}

button {
  background: linear-gradient(180deg, #fffdf3, #e6f3dc);
  box-shadow: inset 0 2px rgba(255,255,255,.8), 0 3px 0 rgba(3,89,86,.24), 0 5px 10px rgba(2,65,73,.13);
}

.topbar {
  position: relative;
  min-height: 76px;
  overflow: hidden;
  border: 0;
  border-bottom: 5px solid var(--impera-gold);
  background:
    radial-gradient(circle at 72% -40%, rgba(77,224,190,.42), transparent 48%),
    linear-gradient(100deg, #034f5a, #078b83 48%, #056c82);
  box-shadow: 0 6px 0 #fff2ca, 0 11px 22px rgba(2,36,58,.28);
}

.topbar::after {
  content: "";
  position: absolute;
  right: 18%;
  bottom: 9px;
  width: 27%;
  height: 16px;
  border-top: 3px dashed rgba(255,246,211,.68);
  border-radius: 50%;
  transform: rotate(-3deg);
  pointer-events: none;
}

.brand-logo {
  width: clamp(170px, 21vw, 235px);
  height: 57px;
  position: relative;
  z-index: 1;
}

.brand-logo img { max-height: 57px; }
.topbar > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar p {
  max-width: none;
  overflow: visible;
  color: #e6fff5;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.top-actions {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.icon-text {
  border-color: #f8d571;
  color: #fff9e8;
  background: linear-gradient(180deg, rgba(18,154,143,.96), rgba(3,92,101,.96));
}

.icon-text:hover,
.icon-text:focus-visible {
  border-color: #fff0b6;
  background: linear-gradient(180deg, #1bb8a4, #06717b);
}

.help-button {
  border-color: #fff4ca;
  color: #075159;
  background: radial-gradient(circle at 35% 28%, #fff4b6, #f2ac17 70%);
  box-shadow: 0 0 0 3px #057675, 0 4px 9px rgba(0,0,0,.25);
}

.home-view {
  min-height: calc(100dvh - 82px);
  align-items: center;
  background:
    linear-gradient(90deg, rgba(2,48,75,.50), rgba(5,75,91,.16) 52%, rgba(2,42,71,.42)),
    url("../assets/impera-cover-v2.jpg") center / cover no-repeat;
}

.setup-panel,
.side-panel,
.hand-panel,
.board-toolbar,
.territory-panel,
dialog,
.bot-notification-card {
  border: 2px solid #087f7c;
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 4%, rgba(110,209,163,.18), transparent 27%),
    linear-gradient(155deg, rgba(255,250,232,.97), rgba(225,245,220,.96));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.68), 0 0 0 2px rgba(242,173,24,.74), var(--shadow);
}

.setup-panel {
  max-width: 600px;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255,249,224,.95), rgba(220,246,222,.94));
  backdrop-filter: blur(8px);
}

.setup-panel::before,
.territory-panel::before,
.hand-panel::before {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #0aa09a 14%, #f1b329 48%, #0aa09a 84%, transparent);
}

.setup-panel h2,
.side-panel h2,
.hand-panel h2,
.territory-head h2,
.dialog-head h2 { color: #075b5d; }

.custom-select-trigger,
select,
input[type="text"] {
  border-color: #6eb5a4;
  background: rgba(255,255,241,.94);
}

.primary-action,
.actions button {
  border-radius: 14px;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  letter-spacing: .035em;
}

.primary-action {
  border-color: #056b6c;
  color: #fffdf0;
  background: linear-gradient(180deg, #11a993, #057174);
  box-shadow: inset 0 2px rgba(255,255,255,.35), 0 4px 0 #034c55, 0 7px 13px rgba(3,69,72,.24);
  text-shadow: 0 1px 1px #034a4e;
}

.game-view { padding-top: 7px; }
.player-card { border-radius: 13px; background: rgba(255,253,236,.9); }
.player-card.active { background: linear-gradient(90deg, #fff0b8, #ecf8d9); }
.player-card.viewed { outline-color: #07908c; }

.board-toolbar,
.territory-panel,
.hand-panel { border-radius: 17px; }

.actions button[data-action="draw2"] {
  border: 2px solid #f7d77c;
  color: #fffdf0;
  background: linear-gradient(180deg, #28c9ae 0%, #078c85 58%, #055e67 100%);
  box-shadow: inset 0 2px rgba(255,255,255,.38), 0 4px 0 #034b54, 0 7px 13px rgba(3,69,72,.24);
  text-shadow: 0 1px 1px #034a4e;
}

.actions button[data-action="attack"] {
  border: 2px solid #fff0b2;
  color: #07585b;
  background: linear-gradient(180deg, #fff1a9 0%, #f2bc35 55%, #d88a0d 100%);
  box-shadow: inset 0 2px rgba(255,255,255,.48), 0 4px 0 #9a6209, 0 7px 13px rgba(75,53,6,.22);
  text-shadow: 0 1px rgba(255,255,255,.68);
}

.world-map {
  border: 2px solid #07817f;
  border-radius: 13px;
  background: linear-gradient(180deg, #f9ffe9, #d9f0d4);
}

.world-map img { border-color: #f0b52d; border-radius: 8px; }
.world-map span { color: #07585b; }

.setup-panel h2,
.side-panel h2,
.hand-panel h2,
.territory-head h2,
.dialog-head h2,
.choice-dialog h2,
.reset-game-dialog h2,
.end-game-head h2,
.score-player h3,
.world-map span,
.dialog-kicker,
.territory-head > div:first-child > span {
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  letter-spacing: .035em;
}

.board {
  border: 2px solid #097e81;
  border-radius: 13px;
  background-color: #ccebdc;
  background-image:
    radial-gradient(circle at 16% 20%, rgba(255,255,255,.54) 0 2px, transparent 3px),
    linear-gradient(rgba(233,250,226,.85), rgba(190,230,215,.88)),
    repeating-linear-gradient(12deg, transparent 0 42px, rgba(5,111,121,.06) 43px 45px);
  background-size: 44px 44px, auto, auto;
}

.attack-guide,
.combat-notice,
.combat-winner,
.hand-limit-count {
  border-color: #e0a31a;
  background: linear-gradient(90deg, #fff0ba, #e9f7d9);
}

.choice-dialog.support-browser {
  border-color: #087f7c;
  border-radius: 18px;
  background: linear-gradient(155deg, #fff8e5, #e1f4db);
}

.combat-total,
.score-rank { background: linear-gradient(180deg, #0b8b84, #045562); }

@media (max-width: 680px) {
  .topbar { min-height: 67px; }
  .brand-logo { width: 158px; height: 49px; }
  .brand-logo img { max-height: 49px; }
  .topbar p {
    display: block;
    max-width: none;
    overflow: visible;
    font-size: 10px;
    line-height: 1.1;
    text-overflow: clip;
    white-space: normal;
  }
  .home-view {
    min-height: calc(100dvh - 72px);
    background-position: 54% center;
  }
  .setup-panel { border-radius: 19px; }
}

@media (max-width: 430px) {
  .brand-logo { width: 138px; height: 43px; }
  .brand-logo img { max-height: 43px; }
  .topbar p { display: block; }
}

/* Barre de jeu : piles à gauche, aide planisphère à droite */
.board-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 8px;
}

.toolbar-main-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-main-row .pile-row { flex: 0 0 auto; }
.toolbar-main-row .world-map { flex: 0 0 auto; margin-left: auto; }

.board-toolbar .actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.board-toolbar .actions button[data-action="results"] {
  grid-column: 1 / -1;
}

@media (min-width: 681px) {
  .board-toolbar {
    grid-template-columns: minmax(250px, auto) minmax(320px, 1fr);
    align-items: center;
  }
}

@media (max-width: 390px) {
  .toolbar-main-row { gap: 7px; }
  .toolbar-main-row .world-map { width: 118px; grid-template-columns: 48px 1fr; }
  .toolbar-main-row .world-map img { width: 48px; height: 34px; }
}

@media (max-width: 680px) {
  .game-view { gap: 8px; align-content: start; }
  .board-toolbar { gap: 6px; padding: 6px; }
  .board-toolbar .actions { gap: 6px; }
  .board-toolbar .actions button { min-height: 38px; }
  .board { min-height: 348px; }
  .player-board-canvas { min-height: 348px; }
}

/* Sur téléphone, la main reste accessible pendant que le plateau conserve sa
   surface complète. Le dégagement inférieur permet de faire défiler tout le
   plateau sans que sa dernière rangée reste masquée sous la main. */
@media (max-width: 680px) {
  .game-view:not(.hidden) {
    padding-bottom: calc(142px + env(safe-area-inset-bottom));
  }

  .game-view:not(.hidden) .hand-panel {
    position: fixed;
    z-index: 900;
    right: 7px;
    bottom: max(6px, env(safe-area-inset-bottom));
    left: 7px;
    max-height: 136px;
    padding: 5px 6px 6px;
    overflow: hidden;
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.68),
      0 0 0 2px rgba(242,173,24,.74),
      0 -8px 24px rgba(3,69,72,.24);
  }

  .game-view:not(.hidden) .hand-panel::before {
    height: 4px;
    margin: -5px -5px 3px;
  }

  .hand-head {
    min-height: 21px;
    align-items: center;
    gap: 6px;
  }

  .hand-head h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1;
    white-space: nowrap;
  }

  .hand-head span {
    min-width: 0;
    font-size: 10px;
    line-height: 1.05;
    text-align: right;
  }

  .hand {
    min-height: 0;
    align-items: flex-start;
    gap: 5px;
    padding: 2px 0 0;
  }

  .hand-card {
    flex-basis: 68px;
  }
}

/* Typographie des actions dans les fenêtres de jeu — identique aux cartes. */
dialog .choice-actions button,
dialog .primary-action,
.bot-notification-card [data-bot-notification-continue],
.reset-game-dialog [data-reset-cancel],
.reset-game-dialog [data-reset-confirm],
.attack-wizard-dialog [data-wizard-continue] {
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-weight: 800;
  letter-spacing: .025em;
}

/* Le conteneur intermédiaire permet une liste verticale classique sur grand
   écran et un carrousel tactile compact sur téléphone. */
.players-track {
  display: contents;
}

.player-scroll-arrow {
  display: none;
}

.hand-scroll-wrap {
  display: contents;
}

.hand-scroll-arrow {
  display: none;
}

@media (max-width: 680px) {
  .hand-scroll-wrap {
    position: relative;
    display: block;
  }

  .hand-scroll-wrap.has-overflow .hand {
    margin-right: 27px;
    margin-left: 27px;
  }

  .hand-scroll-arrow {
    position: absolute;
    z-index: 6;
    top: 50%;
    width: 26px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0 0 3px;
    transform: translateY(-50%);
    border: 2px solid #f4c447;
    border-radius: 999px;
    color: #fffbea;
    background: linear-gradient(180deg, #13a99d, #056b72);
    font-family: system-ui, sans-serif;
    font-size: 27px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 3px 8px rgba(2,62,67,.3);
  }

  .hand-scroll-arrow[hidden] {
    display: none;
  }

  .hand-scroll-previous { left: 0; }
  .hand-scroll-next { right: 0; }

  .players-panel {
    position: relative;
    display: block;
    height: 112px;
    min-height: 112px;
    padding: 7px 25px;
    overflow: hidden;
  }

  .players-track {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    touch-action: pan-x;
  }

  .players-track::-webkit-scrollbar {
    display: none;
  }

  .players-track .player-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 5px;
    flex: 0 0 calc((100% - 7px) / 2);
    height: 100%;
    margin: 0;
    padding: 4px 7px;
    scroll-snap-align: start;
  }

  .players-track .player-card strong {
    font-size: 15px;
    line-height: 1.08;
  }

  .players-track .player-card-avatar {
    width: 34px;
  }

  .players-track .player-card span {
    display: block;
    margin-top: 1px;
    font-size: 12.5px;
    line-height: 1.08;
  }

  .players-track .player-best-line {
    font-size: 11px;
  }

  .players-track .player-hand-line,
  .players-track .player-region-line {
    overflow: visible;
    font-size: 11.5px;
    white-space: nowrap;
  }

  .player-scroll-arrow {
    position: absolute;
    z-index: 4;
    top: 50%;
    width: 27px;
    height: 50px;
    display: grid;
    place-items: center;
    padding: 0 0 3px;
    transform: translateY(-50%);
    border: 2px solid #f4c447;
    border-radius: 999px;
    color: #fffbea;
    background: linear-gradient(180deg, #13a99d, #056b72);
    font-family: system-ui, sans-serif;
    font-size: 27px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 3px 8px rgba(2,62,67,.3);
  }

  .player-scroll-arrow[hidden] {
    display: none;
  }

  .player-scroll-previous { left: 3px; }
  .player-scroll-next { right: 3px; }

  .board-toolbar .actions button {
    min-height: 42px;
    font-size: 18px;
  }

  .toolbar-main-row .pile-row {
    flex: 1 1 auto;
    flex-wrap: nowrap;
  }

  .toolbar-main-row .pile {
    flex: 1 1 0;
    width: auto;
    min-width: 70px;
    height: 56px;
  }

  .toolbar-main-row .world-map {
    flex: 0 0 137px;
    width: 137px;
    min-height: 56px;
  }

  .pile span,
  .pile strong,
  .discard span {
    font-size: 12.5px;
  }

  .world-map span {
    font-size: 13px;
  }

  .territory-head {
    padding: 10px 11px;
  }

  .territory-head h2 {
    font-size: 19px;
    line-height: 1.12;
  }

  .territory-head span,
  .board-head-tools > span {
    font-size: 13px;
  }

  .board-zoom button {
    min-width: 35px;
    min-height: 34px;
    font-size: 16px;
  }

  .board,
  .player-board-canvas {
    min-height: 390px;
  }

  .empty-territories {
    font-size: 15px;
  }

  .game-view:not(.hidden) {
    padding-bottom: calc(153px + env(safe-area-inset-bottom));
  }

  .game-view:not(.hidden) .hand-panel {
    max-height: 147px;
  }

  .hand-head {
    min-height: 24px;
  }

  .hand-head h2 {
    font-size: 17px;
  }

  .hand-head span {
    font-size: 12.5px;
  }

  .hand-card {
    flex-basis: 72px;
  }
}

.setup-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 13px;
  padding: 10px 12px;
  border: 1px solid rgba(8,127,124,.35);
  border-radius: 13px;
  background: rgba(255,253,236,.72);
  cursor: pointer;
}

.setup-check input {
  width: 21px;
  height: 21px;
  margin: 1px 0 0;
  accent-color: #078b86;
}

.setup-check span,
.setup-check strong,
.setup-check small {
  display: block;
}

.setup-check strong {
  color: #075b5d;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 15px;
}

.setup-check small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.guided-help-dialog {
  width: min(440px, calc(100vw - 24px));
  padding: 25px 24px 21px;
  text-align: center;
}

.guided-help-dialog::backdrop {
  background: rgba(2,42,59,.62);
  backdrop-filter: blur(3px);
}

.guided-help-dialog .guided-help-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: -5px auto 10px;
  border: 3px solid #087f7c;
  border-radius: 50%;
  color: #07585b;
  background: radial-gradient(circle at 35% 28%, #fff4b6, #f2ac17 70%);
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 27px;
  box-shadow: 0 3px 0 #9a6209;
}

.guided-help-dialog h2 {
  margin: 3px 0 10px;
  color: #075b5d;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 24px;
}

.guided-help-dialog > p:not(.dialog-kicker) {
  margin: 0;
  color: #31494d;
  font-size: 16px;
  line-height: 1.45;
}

.guided-help-dialog .choice-actions {
  justify-content: center;
  margin-top: 18px;
}

.guided-help-dialog .primary-action {
  min-width: 150px;
}

@media (max-width: 680px) {
  .setup-check {
    margin-top: 10px;
    padding: 9px 10px;
  }

  .guided-help-dialog {
    padding: 22px 18px 18px;
  }

  .guided-help-dialog h2 {
    font-size: 22px;
  }

  .guided-help-dialog > p:not(.dialog-kicker) {
    font-size: 15px;
  }
}

/* Notifications visuelles des tours adverses */
.bot-notification-visual:empty {
  display: none;
}

.bot-notification.is-draw .bot-notification-card,
.bot-notification.is-play .bot-notification-card,
.bot-notification.is-transfer .bot-notification-card {
  width: min(680px, 100%);
  max-height: calc(100dvh - 24px);
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 12px;
  overflow: auto;
}

.bot-notification-copy {
  min-width: 0;
}

.bot-notification.is-draw .bot-notification-copy,
.bot-notification.is-play .bot-notification-copy,
.bot-notification.is-transfer .bot-notification-copy {
  text-align: center;
}

.bot-notification.is-transfer .bot-notification-actor {
  display: none;
}

.bot-notification.is-draw .bot-notification-copy > strong,
.bot-notification.is-play .bot-notification-copy > strong,
.bot-notification.is-transfer .bot-notification-copy > strong {
  color: #075b5d;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 1.28rem;
}

.hand-transfer-stage {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(190px, 1.45fr) minmax(100px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 225px;
  padding: 20px;
  border: 2px solid #087f7c;
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.94), transparent 34%),
    repeating-linear-gradient(12deg, transparent 0 42px, rgba(5,111,121,.06) 43px 45px),
    linear-gradient(155deg, #e9f7dc, #bfe7d8);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.64);
}

.hand-transfer-person {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  color: #075b5d;
  text-align: center;
}

.hand-transfer-person img {
  width: 82px;
  aspect-ratio: 1;
  border: 3px solid #f2c247;
  border-radius: 50%;
  object-fit: cover;
  background: #087f7c;
  box-shadow: 0 5px 12px rgba(3,51,67,.28);
}

.hand-transfer-person strong {
  max-width: 100%;
  overflow: hidden;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hand-transfer-person span {
  color: #64756d;
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hand-transfer-motion {
  position: relative;
  display: grid;
  justify-items: center;
  min-height: 155px;
}

.hand-transfer-cards {
  position: relative;
  width: 145px;
  height: 112px;
}

.hand-transfer-cards img {
  position: absolute;
  left: calc(50% + var(--transfer-x));
  top: 50%;
  width: 62px;
  height: 92px;
  border: 2px solid #f2c247;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 5px 10px rgba(3,51,67,.25);
  transform: translate(-50%, -50%) rotate(var(--transfer-rotation));
  animation: handTransferCard .75s cubic-bezier(.18,.74,.18,1) both;
  animation-delay: calc(var(--transfer-index) * 45ms);
}

.hand-transfer-count {
  position: absolute;
  z-index: 20;
  right: 5px;
  top: 3px;
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 54px;
  padding: 5px;
  border: 3px solid #fff8db;
  border-radius: 50%;
  color: white;
  background: linear-gradient(180deg, #f2ad18, #c57408);
  box-shadow: 0 4px 10px rgba(82,47,3,.3);
  line-height: .9;
}

.hand-transfer-count strong { font-size: 1.45rem; }
.hand-transfer-count span { font-size: .61rem; font-weight: 900; text-transform: uppercase; }

.hand-transfer-arrow {
  color: #087f7c;
  font-size: 2.5rem;
  line-height: .8;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.9));
}

@keyframes handTransferCard {
  from { opacity: 0; transform: translate(-135px, -50%) rotate(-13deg) scale(.82); }
}

.bot-draw-stage {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  border: 2px solid #087f7c;
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.9), transparent 35%),
    repeating-linear-gradient(12deg, transparent 0 42px, rgba(5,111,121,.06) 43px 45px),
    linear-gradient(155deg, #e9f7dc, #bfe7d8);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.64);
}

.bot-draw-deck {
  position: absolute;
  left: 9%;
  top: 50%;
  width: 82px;
  height: 122px;
  transform: translateY(-50%);
}

.bot-draw-deck span,
.bot-draw-deck img {
  position: absolute;
  inset: 0;
  width: 82px;
  height: 122px;
  border: 2px solid #f2c44a;
  border-radius: 8px;
  background: #075b72;
  object-fit: cover;
  box-shadow: 0 5px 12px rgba(3,58,66,.28);
}

.bot-draw-deck span:nth-child(1) { transform: translate(-7px, 6px) rotate(-3deg); }
.bot-draw-deck span:nth-child(2) { transform: translate(-3px, 3px) rotate(-1deg); }

.bot-draw-destination {
  position: absolute;
  right: 7%;
  bottom: 23px;
  width: 205px;
  height: 114px;
  border: 2px dashed rgba(7,91,93,.48);
  border-radius: 16px;
  background: rgba(255,253,236,.72);
}

.bot-draw-destination > span {
  position: absolute;
  right: 0;
  bottom: -22px;
  left: 0;
  color: #075b5d;
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 12px;
  text-align: center;
}

.bot-draw-hand-cards {
  position: absolute;
  inset: 17px 18px 8px;
}

.bot-draw-hand-cards i {
  position: absolute;
  left: calc(var(--slot, 0) * 42px);
  bottom: 0;
  width: 52px;
  height: 78px;
  border: 2px solid rgba(242,196,74,.8);
  border-radius: 6px;
  background: #0a6780 url("../../img/card-back.png?v=20260911-01") center / cover;
  box-shadow: 0 3px 8px rgba(3,58,66,.22);
}

.bot-draw-hand-cards i:nth-child(1) { --slot: 0; transform: rotate(-7deg); }
.bot-draw-hand-cards i:nth-child(2) { --slot: 1; transform: rotate(0deg); }
.bot-draw-hand-cards i:nth-child(3) { --slot: 2; transform: rotate(7deg); }

.bot-draw-card {
  --end-x: 68%;
  --end-rotation: -7deg;
  position: absolute;
  z-index: 12;
  left: 10%;
  top: 50%;
  width: 76px;
  height: 113px;
  border: 2px solid #f6cd57;
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 9px 18px rgba(3,58,66,.34);
  transform: translateY(-50%);
  animation: botCardDraw 1.35s cubic-bezier(.2,.72,.2,1) both;
}

.bot-draw-card-1 { animation-delay: .15s; }
.bot-draw-card-2 { --end-x: 76%; --end-rotation: 7deg; animation-delay: .68s; }

@keyframes botCardDraw {
  0% { left: 10%; top: 50%; opacity: .25; transform: translateY(-50%) rotate(0deg) scale(.92); }
  18% { opacity: 1; transform: translateY(-62%) rotate(-3deg) scale(1.08); }
  100% { left: var(--end-x); top: 57%; opacity: 1; transform: translateY(-50%) rotate(var(--end-rotation)) scale(.78); }
}

.bot-mini-board {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 36 / 25;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid #087f7c;
  border-radius: 15px;
  background:
    radial-gradient(circle at 16% 20%, rgba(255,255,255,.54) 0 2px, transparent 3px),
    linear-gradient(rgba(233,250,226,.88), rgba(190,230,215,.9));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.64);
}

.bot-mini-board-label {
  position: absolute;
  z-index: 100;
  top: 8px;
  left: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #075b5d;
  background: rgba(255,253,236,.88);
  font-family: "Conquetes Kabel", "Arial Black", sans-serif;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(3,58,66,.16);
}

.bot-mini-board-card {
  position: absolute;
  z-index: var(--mini-z);
  left: var(--mini-x);
  top: var(--mini-y);
  width: var(--mini-width);
  height: auto;
  aspect-ratio: 848 / 1261;
  border-radius: 5px;
  object-fit: cover;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 5px 6px rgba(0,0,0,.34));
}

.bot-mini-board-card.is-arriving {
  z-index: 90;
  animation: botCardPlacement 1.35s cubic-bezier(.18,.74,.18,1) .18s both;
}

@keyframes botCardPlacement {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(190px, -125px) rotate(12deg) scale(1.28);
    filter: drop-shadow(0 14px 13px rgba(0,0,0,.42));
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) translate(-5px, 4px) rotate(-1deg) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 5px 6px rgba(0,0,0,.34)) drop-shadow(0 0 8px rgba(242,173,24,.82));
  }
}

@media (max-width: 560px) {
  .bot-notification {
    padding: 8px;
  }

  .bot-notification.is-draw .bot-notification-card,
  .bot-notification.is-play .bot-notification-card,
  .bot-notification.is-transfer .bot-notification-card {
    padding: 10px;
    gap: 8px;
  }

  .bot-draw-stage {
    height: 178px;
  }

  .bot-draw-deck {
    left: 8%;
    width: 62px;
    height: 92px;
  }

  .bot-draw-deck span,
  .bot-draw-deck img {
    width: 62px;
    height: 92px;
  }

  .bot-draw-destination {
    right: 5%;
    bottom: 22px;
    width: 165px;
    height: 91px;
  }

  .bot-draw-hand-cards {
    inset: 12px 13px 6px;
  }

  .bot-draw-hand-cards i {
    left: calc(var(--slot, 0) * 34px);
    width: 44px;
    height: 66px;
  }

  .bot-draw-card {
    width: 60px;
    height: 90px;
  }

  .bot-notification.is-draw .bot-notification-copy > strong,
  .bot-notification.is-play .bot-notification-copy > strong,
  .bot-notification.is-transfer .bot-notification-copy > strong {
    font-size: 1.08rem;
  }

  .hand-transfer-stage {
    grid-template-columns: minmax(70px, 1fr) minmax(130px, 1.25fr) minmax(70px, 1fr);
    gap: 5px;
    min-height: 174px;
    padding: 10px 6px;
  }

  .hand-transfer-person img { width: 62px; }
  .hand-transfer-person strong { font-size: .88rem; }
  .hand-transfer-person span { font-size: .65rem; }
  .hand-transfer-motion { min-height: 125px; }
  .hand-transfer-cards { width: 112px; height: 92px; }
  .hand-transfer-cards img { width: 48px; height: 72px; }
  .hand-transfer-count { right: 0; min-width: 46px; min-height: 46px; }
  .hand-transfer-count strong { font-size: 1.22rem; }
  .hand-transfer-arrow { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bot-draw-card,
  .bot-mini-board-card.is-arriving,
  .hand-transfer-cards img {
    animation-duration: .45s;
    animation-delay: .05s;
  }
}
