/* Game screen. Colours and buttons come from style.css. */
:root { --p0: #9c3f2e; --p1: #2f5f8a; --mil: #4f8a4a; --pre: #d9d4c4; --gue: #c98a3a; --mag: #3f72b5; --vol: #b2413a; }
:root[data-theme="dark"] { --p0: #d0705b; --p1: #6d9fd0; }

body.play { min-height: 100vh; }
.play-bar { display: flex; align-items: center; gap: 20px; padding: 12px 24px; background: var(--side); color: var(--side-ink); position: sticky; top: 0; z-index: 31; flex-wrap: wrap; }
.play-bar .brand small { color: var(--side-muted); }
.play-status { flex: 1; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.play-status strong { color: var(--gold-soft); font-weight: 600; }
.play-links { display: flex; gap: 16px; align-items: center; }
.play-links a { text-decoration: none; }

/* ------------------------------------------------------------------ home */
.home { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
.home h1 { font: 600 34px var(--serif); margin: 0 0 6px; }
.home .lead { color: var(--muted); margin: 0 0 24px; }
/* New game: the mode as a choice, then the common options and the button on one line. */
.new-game { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: grid; gap: 12px; }
.new-game h1 { font-size: 26px; margin: 0; }
.mode-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-option { position: relative; cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option span { display: inline-block; padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 14px; background: var(--bg); }
.mode-option input:checked + span { border-color: var(--accent); background: var(--accent); color: #fff; }
.mode-option input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.mode-option small { font-weight: 400; font-size: 11px; }
/* A mode closed for now (see CLOSED_MODES in jouer.js). */
.mode-option.mode-closed { cursor: not-allowed; opacity: .5; }
.mode-text { margin: 0; color: var(--muted); font-size: 14px; }
.new-game-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.new-game-fields label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; flex: 1 1 180px; }
.new-game-fields label[hidden] { display: none; }
.new-game-fields select { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: var(--bg); font-weight: 400; }
.new-game-fields .primary { flex: 0 0 auto; padding: 8px 22px; }
.tuto-line { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.tuto-line .link { font-size: 14px; font-weight: 600; }
.tuto-line span { color: var(--muted); }
/* The rename of the bar only makes sense on the home. */
body:has(#home[hidden]) #rename { display: none; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.mode-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 10px; align-content: start; }
.mode-card h2 { font: 600 21px var(--serif); margin: 0; }
.mode-card p { margin: 0; color: var(--muted); font-size: 14px; }
.mode-card label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.mode-card select, .mode-card input, .action-panel select, .action-panel input[type="text"], .action-panel input[type="number"] { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: var(--bg); font-weight: 400; }
.saved { margin-top: 26px; }
/* The games to resume, at the top of the home (before the tutorial); empty: no space. */
.saved-top { margin: 0 0 18px; display: grid; gap: 10px; }
.saved-top h2 { margin: 0 0 6px; }
.saved h2 { font: 600 20px var(--serif); }
.saved-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.saved-list li { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.saved-list .grow { flex: 1; }
.invite { font: 12px var(--mono); word-break: break-all; background: var(--bg); padding: 6px 8px; border-radius: 6px; }

/* ------------------------------------------------------------------ layout */
.game { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 16px 80px; max-width: 1800px; margin: 0 auto; }
.game-main { display: grid; gap: 16px; align-content: start; }
.panel h2, .board h2 { font: 600 18px var(--serif); margin: 0 0 8px; }
.board { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.board.opponent { opacity: .95; }
.seat-0 { --seat: var(--p0); } .seat-1 { --seat: var(--p1); }
.seat-name { color: var(--seat); font-weight: 700; }

/* ------------------------------------------------------------------ dungeons */
.dungeons { display: grid; gap: 10px; }
.dungeon-row { display: grid; grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 12px; display: grid; gap: 4px; position: relative; min-height: 132px; }
.tile.locked { opacity: .55; }
.tile.cleaned { background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 8px, var(--row-hover) 8px, var(--row-hover) 16px); }
.tile.fighting { outline: 2px solid var(--gold); }
.tile h3 { font: 600 14px var(--serif); margin: 0; padding-right: 26px; }
.tile .level { position: absolute; top: 8px; right: 8px; font: 500 11px var(--mono); background: var(--side); color: var(--side-ink); border-radius: 99px; padding: 1px 7px; }
.stats { display: flex; gap: 8px; font-family: var(--mono); font-size: 12px; flex-wrap: wrap; }
.stats span b { font-weight: 600; }
.creature { color: var(--muted); }
.effect { font-style: italic; color: var(--muted); }
.skull { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; vertical-align: -1px; }
.skull.red { background: #b2413a; } .skull.black { background: #2b2419; }
:root[data-theme="dark"] .skull.black { background: #d9cfba; }
.floors { display: flex; gap: 3px; align-items: center; }
.floor { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.floor.s0 { background: var(--p0); border-color: var(--p0); } .floor.s1 { background: var(--p1); border-color: var(--p1); }
.spots { display: flex; gap: 6px; margin-top: auto; font-size: 11px; }
.spot { flex: 1; border: 1px dashed var(--line); border-radius: 6px; padding: 3px 5px; text-align: center; color: var(--muted); }
.spot.taken { border-style: solid; color: var(--side-ink); background: var(--seat); }

/* ------------------------------------------------------------------ player board */
.board-head { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; margin-bottom: 10px; }
.resources { display: flex; flex-wrap: wrap; gap: 6px; }
.res { background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: 13px; }
.res b { font-family: var(--mono); }
.units { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.unit { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.cube { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); }
.cube.mil { background: var(--mil); } .cube.pre { background: var(--pre); } .cube.gue { background: var(--gue); } .cube.mag { background: var(--mag); } .cube.vol { background: var(--vol); }
.buildings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.group { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 12px; }
.group.locked { opacity: .5; }
.line { display: flex; gap: 3px; align-items: center; min-height: 18px; }
.cards { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12px; max-width: 230px; background: var(--bg); }
.card b { display: block; font-size: 12px; }
.card.maison { border-color: var(--gold); }
.card.hidden { color: var(--muted); font-style: italic; }
.small { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ action panel */
.action-panel { border-color: var(--gold); }
.action-panel h2 { color: var(--accent); }
.action-panel p { font-size: 14px; margin: 0 0 10px; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 8px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-size: 13px; }
.choice .grow { flex: 1; }
.choice.col { display: grid; justify-content: stretch; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { padding: 2px 9px; }
.stepper output { min-width: 18px; text-align: center; font-family: var(--mono); }
.compose { display: grid; grid-template-columns: auto repeat(5, 1fr); gap: 4px 6px; align-items: center; font-size: 12px; }
.compose input { width: 100%; }
.dice { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.die { border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; font-size: 12px; background: var(--bg); }
.die.dead { border-color: var(--accent); color: var(--accent); }
.die.removed { text-decoration: line-through; opacity: .5; }
.events { list-style: none; margin: 6px 0; padding: 0; font-size: 13px; display: grid; gap: 3px; }
.events .cancelled { text-decoration: line-through; color: var(--muted); }
.versus { font: 600 20px var(--mono); margin: 6px 0; }
.waiting { color: var(--muted); font-style: italic; }

.log-panel { max-height: calc(var(--app-h, 100vh) * .45); overflow: auto; }
.log { list-style: none; margin: 0; padding: 0; font-size: 12px; display: grid; gap: 3px; }
.log li.title { font-weight: 700; margin-top: 6px; }
.log li.good { color: var(--good); }
.log li.bad { color: var(--accent); }

.results { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.results td, .results th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.results td.number, .results th.number { text-align: right; }

@media (max-width: 1100px) {
  .game { grid-template-columns: 1fr; }
  .dungeon-row { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 640px) {
  .buildings, .groups { grid-template-columns: 1fr; }
  .play-bar { padding: 10px 14px; }
}

/* ------------------------------------------------------------------ resources banner */
.play-resources { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.play-resources:empty { display: none; }
/* « Quitter et sauvegarder » : au centre du bandeau, sur la ligne des ressources ; en fin de ligne sur un écran étroit. */
.play-resources { position: relative; align-items: center; }
.quit-save { margin-left: auto; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--gold-soft, #e3c98f); background: transparent; color: var(--side-ink); font-weight: 600; cursor: pointer; white-space: nowrap; }
.quit-save:hover { background: var(--side-hover); }
@media (min-width: 1200px) { .quit-save { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; } }
.play-bar .res { background: var(--side-hover); border-color: transparent; color: var(--side-ink); }
.play-bar .res b { color: var(--gold-soft); }
.units-res { display: inline-flex; gap: 8px; align-items: center; }
.units-res .unit { gap: 3px; }

/* ------------------------------------------------------------------ building cards (type bands as on the printed tiles) */
.type-base { --type: #d9782d; --type-ink: #fff; }
.type-troupes { --type: #9aa0a6; --type-ink: #fff; }
.type-support { --type: #6fb26f; --type-ink: #fff; }
.type-commerce { --type: #e2b84a; --type-ink: #3a2c0c; }
.type-ressources { --type: #5aa3dc; --type-ink: #fff; }
.type-magie { --type: #2f6fbf; --type-ink: #fff; }
.type-avance { --type: #c8382c; --type-ink: #fff; }
.type-autre { --type: #7d7462; --type-ink: #fff; }
.bcard { border: 1px solid var(--line); border-radius: 9px; background: var(--paper); overflow: hidden; display: grid; align-content: start; font-size: 12px; }
.bcard .bband { background: var(--type); color: var(--type-ink); display: flex; justify-content: space-between; align-items: center; padding: 3px 9px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.bcard .bpips { letter-spacing: .1em; }
.bcard .bhead { display: flex; align-items: center; gap: 8px; padding: 8px 9px 4px; }
.bcard .bhead h4 { margin: 0; font: 600 15px var(--serif); flex: 1; }
.bcard .bicon { color: var(--type); flex: none; }
.bcard .bcost { font: 600 12px var(--mono); color: var(--muted); white-space: nowrap; }
.bcard .beffects { list-style: none; margin: 0; padding: 0 9px 8px; display: grid; gap: 3px; }
.bcard .beffects li { color: var(--muted); }
.bcard .beffects li > b { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--line); color: var(--ink); font-size: 10px; margin-right: 3px; }
.bcard .beffects li.on { color: var(--ink); }
.bcard .beffects li.on > b { background: var(--type); color: var(--type-ink); }
.bcard .brule { margin: 0 9px 8px; color: var(--accent); font-size: 11px; }
.bcard .tokens { margin: 0 9px 6px; font-weight: 700; color: var(--accent); }
.bcard > button { margin: 0 9px 9px; padding: 3px 8px; font-size: 12px; justify-self: start; }
.bcard.compact .bhead h4 { font-size: 14px; }
.bcard.dim { opacity: .45; }
.bcard .bnote { margin: 0 9px 8px; font-size: 11px; color: var(--muted); font-style: italic; }
.bcard .bnote.house { color: var(--gold); font-style: normal; font-weight: 600; }
.buildings .bcard { background: var(--bg); }

/* ------------------------------------------------------------------ full-screen layout */
.overlay { position: fixed; inset: 0; z-index: 32; background: var(--bg); overflow: auto; }
.overlay-inner { max-width: 1700px; margin: 0 auto; padding: 18px 20px 40px; }
.overlay-head { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-start; position: sticky; top: 0; background: var(--bg); padding: 6px 0 12px; z-index: 2; border-bottom: 1px solid var(--line); }
.overlay-head h2 { font: 600 26px var(--serif); margin: 0 0 4px; }
.overlay-head p { margin: 0 0 4px; color: var(--muted); max-width: 760px; font-size: 14px; }
.overlay-head .lproblems { color: var(--accent); font-weight: 600; }
.overlay-head .lready { color: var(--good); font-weight: 600; }
.layout-body { display: grid; grid-template-columns: minmax(520px, 0.9fr) minmax(0, 1.1fr); gap: 20px; margin-top: 16px; align-items: start; }
.layout-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; position: sticky; top: 130px; }
.lcolumn h3 { font: 600 15px var(--serif); margin: 0; }
.lcolumn > .small { margin: 2px 0 8px; min-height: 30px; }
.lslot { border: 2px dashed var(--line); border-radius: 10px; padding: 6px; margin-bottom: 8px; min-height: 120px; cursor: pointer; display: grid; gap: 4px; align-content: start; }
.lslot.filled { border-style: solid; }
.lslot.selected { border-color: var(--accent); background: var(--row-hover); }
.lslot-label { font: 500 11px var(--mono); color: var(--muted); text-transform: uppercase; }
.lslot-empty { color: var(--muted); font-size: 13px; align-self: center; text-align: center; padding: 20px 0; }
.lslot .bcard .link { margin: 0 9px 8px; justify-self: start; }
.type-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.type-filter button { border-left: 6px solid var(--type, var(--line)); }
.type-filter button.active { background: var(--side); color: var(--side-ink); }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.catalog-grid .bcard { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.catalog-grid .bcard:hover, .catalog-grid .bcard:focus { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .12); outline: none; }
.catalog-grid .bcard.dim:hover { transform: none; box-shadow: none; }
@media (max-width: 1100px) {
  .layout-body { grid-template-columns: 1fr; }
  .layout-board { position: static; }
}
@media (max-width: 640px) {
  .layout-board { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ detached boards */
.board-head .popout { margin-left: auto; padding: 4px 10px; font-size: 12px; }
.detached-placeholder { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.detached-main { padding: 16px; max-width: 1700px; margin: 0 auto; }
body.detached .play-status { font-size: 13px; }

/* ------------------------------------------------------------------ icons */
.ico-wrap { display: inline-grid; place-items: center; vertical-align: -3px; }
.res { display: inline-flex; align-items: center; gap: 5px; cursor: default; }
.play-bar .res .ico-wrap { color: var(--gold-soft); }
.play-bar .res b { color: var(--side-ink); }
.tile-head { display: flex; align-items: center; gap: 8px; padding-right: 22px; }
.tile-head h3 { padding-right: 0; }
.tile .dungeon-ico { flex: none; color: var(--ink); }
.tile.level-4 .dungeon-ico { color: var(--accent); }
.tile.level-4 { border-color: var(--accent); }
.stats .stat { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.stats .stat b { color: var(--ink); font-size: 13px; }
.creature-line { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.skull-ico.red { color: #b2413a; } .skull-ico.black { color: #2b2419; }
:root[data-theme="dark"] .skull-ico.black { color: #d9cfba; }
.creature { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; }
.spot { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.combat-title { display: flex; align-items: center; gap: 8px; }
/* The banner is always dark: a light gold that stays readable in both themes. */
.play-bar .res .ico-wrap, .play-status strong { color: #e3c98f; }

/* ------------------------------------------------------------------ departure equipment, placement */
.equip-choice { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); font-weight: 400; }
.equip-choice input { margin-top: 3px; }
.equip-effect { font-size: 12.5px; color: var(--muted); }
.choice.dim { opacity: .55; }
.bad { color: var(--accent); }
.muted { color: var(--muted); }

/* ------------------------------------------------------------------ boards behind bookmarks */
.boards { display: grid; gap: 0; }
.board-tabs { display: flex; align-items: flex-end; gap: 4px; flex-wrap: wrap; padding: 0 4px; }
.board-tab { border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--bg); padding: 9px 16px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; position: relative; top: 1px; }
.board-tab .tab-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--seat); }
.board-tab.active { background: var(--paper); color: var(--ink); box-shadow: inset 0 3px 0 var(--seat); }
.board-tab:hover { color: var(--ink); }
.tab-badge { font: 600 11px var(--mono); background: var(--seat); color: #fff; border-radius: 99px; padding: 1px 7px; }
.tabs-spacer { flex: 1; }
.board-tabs .popout { margin-bottom: 6px; }
.boards > .board { border-top-left-radius: 0; }
.detached-main .boards { padding: 16px; }

/* ------------------------------------------------------------------ supervisors and workers on the buildings */
.bcard { position: relative; }
.bcard[data-tokens] { box-shadow: 0 0 0 2px var(--seat, var(--gold)); }
.bcard[data-placeable] { cursor: copy; }
.bcard[data-placeable]:hover { box-shadow: 0 0 0 2px var(--gold); }
.btokens { display: flex; gap: 3px; flex-wrap: wrap; margin: 0 9px 7px; }
.btokens .token { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--seat); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); animation: token-drop .25s ease-out; }
.btokens .token.spent { opacity: .35; }
.btokens.planned .token { background: transparent; color: var(--seat); border: 2px dashed var(--seat); box-shadow: none; cursor: pointer; }
.btokens.planned .token:hover { border-style: solid; }
@keyframes token-drop { from { transform: translateY(-10px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.bworkers { display: flex; gap: 3px; margin: 0 9px 7px; }
.donjon-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px dashed var(--line); border-radius: 99px; font-size: 13px; }
.donjon-chip.placing { cursor: copy; border-color: var(--gold); }
.donjon-chip .btokens { margin: 0; }

/* ------------------------------------------------------------------ combat scene */
.stage.live { position: sticky; top: 72px; z-index: 6; }
.stage-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; box-shadow: 0 14px 40px rgba(0, 0, 0, .18); display: grid; gap: 14px; animation: stage-in .3s ease-out; }
.stage-card.level-4 { border-color: var(--accent); }
@keyframes stage-in { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.stage-head { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; }
.stage-emblem { width: 110px; height: 110px; border-radius: 18px; display: grid; place-items: center; background: var(--row-hover); color: var(--ink); }
.stage-card.level-4 .stage-emblem { color: var(--accent); }
.stage-title h2 { font: 600 30px var(--serif); margin: 0 0 6px; }
.stage-title .kicker { margin: 0 0 4px; }
.stage-stats { display: flex; gap: 16px; align-items: center; font: 16px var(--mono); color: var(--muted); }
.stage-stats b { color: var(--ink); }
.stage-stats .floor { width: 15px; height: 15px; }
.stage-effect { margin: 8px 0 0; font-style: italic; color: var(--muted); }
.stage-actions { display: grid; gap: 6px; }
.stage-events { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.stage-events li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--row-hover); font-size: 13px; animation: stage-in .3s ease-out both; }
.stage-events li.ev-rencontre { color: #b2413a; }
.stage-events li.ev-piege { color: var(--gold); }
.stage-events li.cancelled { text-decoration: line-through; opacity: .6; }
.stage-sides { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.stage-vs { align-self: center; font: italic 500 18px var(--serif); color: var(--muted); }
.sside { flex: 1 1 260px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; align-content: start; background: var(--bg); }
.sside.sres { flex: 0 1 220px; }
.sside-head { font-weight: 700; }
.slines { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.slines .cube { width: 16px; height: 16px; }
.sdice { display: flex; flex-wrap: wrap; gap: 10px; min-height: 58px; align-items: center; }
.sdie { width: 54px; height: 54px; border-radius: 11px; background: var(--u); color: #fff; display: grid; place-items: center; position: relative; font: 700 24px var(--mono); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), 0 3px 8px rgba(0, 0, 0, .2); }
.sdie.u-mil { --u: var(--mil); } .sdie.u-gue { --u: var(--gue); } .sdie.u-mag { --u: var(--mag); } .sdie.u-vol { --u: var(--vol); }
.sdie.u-pre { --u: var(--pre); color: #2b2419; }
.sdie.crit { outline: 4px solid #17140f; outline-offset: -4px; }
:root[data-theme="dark"] .sdie.crit { outline-color: #f4f1e8; }
.sdie i { position: absolute; font-style: normal; font-size: 15px; line-height: 1; }
.sdie .m-death { color: #fff; top: 3px; right: 3px; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .6)); display: grid; }
.sdie .m-heal { bottom: 4px; right: 6px; font-weight: 800; }
.sdie .m-disarm { color: #8fe07f; bottom: 4px; left: 5px; }
.sdie b:only-child { font-size: 26px; }
.sdie:not(:has(b)) .m-death { position: static; font-size: 26px; }
.sdie.removed { opacity: .3; filter: grayscale(1); }
.sdie.rolling { animation: die-roll .7s cubic-bezier(.2, .8, .3, 1.2) both; animation-delay: calc(var(--i) * 110ms); }
@keyframes die-roll {
  0% { transform: translate(-60px, -40px) rotate(-200deg) scale(.5); opacity: 0; }
  60% { transform: translate(4px, 3px) rotate(14deg) scale(1.05); opacity: 1; }
  80% { transform: translate(-2px, 0) rotate(-5deg); }
  100% { transform: none; }
}
.sscore { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sscore b { font: 700 32px var(--mono); }
.sresult { font: 600 20px var(--serif); padding: 10px 14px; border-radius: 10px; background: var(--row-hover); animation: stage-in .4s ease-out .5s both; }
.sresult.good { color: var(--good); }
.sresult.bad { color: var(--accent); }
.stage-hint { margin: 0; }
@media (max-width: 640px) { .stage-head { grid-template-columns: 1fr; } .stage-emblem { width: 72px; height: 72px; } .stage-title h2 { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .sdie.rolling, .stage-card, .btokens .token, .sresult, .stage-events li { animation: none; } }

/* ------------------------------------------------------------------ supervisors counter */
.sup-counter { display: inline-flex; align-items: center; gap: 3px; padding: 2px 10px 2px 6px; border-radius: 99px; background: var(--row-hover); align-self: center; }
.sup-counter .sup { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--seat); color: #fff; transition: opacity .3s, transform .3s; }
.sup-counter .sup.spent { opacity: .2; transform: scale(.8); }
.sup-counter b { font: 600 14px var(--mono); margin-left: 4px; }

/* ------------------------------------------------------------------ departure: groups, dungeons, formation */
.dep-section { display: grid; gap: 6px; margin: 10px 0; }
.dep-label { font-weight: 700; font-size: 13px; }
.gcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gcard { display: grid; gap: 3px; justify-items: center; padding: 8px 4px; border-radius: 10px; text-align: center; }
.gcard.active { box-shadow: 0 0 0 2px var(--accent); background: var(--row-hover); }
.gcard:disabled { cursor: not-allowed; }
.gcard .small { font-size: 11px; }
.gshape { display: grid; gap: 3px; margin: 3px 0; }
.gshape > span { display: flex; gap: 3px; justify-content: center; min-height: 10px; }
.gshape i { width: 10px; height: 10px; border-radius: 3px; background: var(--muted); opacity: .7; }
.gshape > span + span i { background: transparent; border: 1.5px solid var(--muted); }
.gshape em { font-size: 10px; color: var(--muted); line-height: 10px; }
.dpicks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.dpick { position: relative; display: grid; gap: 7px; align-content: start; text-align: left; padding: 12px 12px 10px; border-radius: 12px; }
.dpick-head { display: flex; align-items: center; gap: 8px; padding-right: 22px; }
.dpick-head strong { font: 600 15px var(--serif); line-height: 1.2; }
.dpick-level { position: absolute; top: 8px; right: 9px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--row-hover); border: 1px solid var(--line); font: 700 12px var(--mono); }
.dpick.active .dpick-level { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.dpick.level-4 .dpick-level { background: var(--accent); color: var(--accent-ink, #fff); }
.dpick-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.dstat { display: inline-flex; align-items: center; gap: 4px; }
.dstat b { font: 700 14px var(--mono); }
.dpick-creature { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; font-size: 12px; color: var(--muted); }
.dpick-effect { font-size: 12px; font-style: italic; color: var(--muted); line-height: 1.35; }
.dpick-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dpick-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); }
.dpick-tag.warn { border-color: var(--accent); color: var(--accent); }
.dpick.active { box-shadow: 0 0 0 2px var(--accent); background: var(--row-hover); }
.dpick.level-4 .dungeon-ico { color: var(--accent); }
.dep-teleport { font-size: 13px; }
/* Entrée / Casque: two discs, apart from the dungeon cards, their text beside them. */
.place-toggle { display: flex; justify-content: center; gap: 40px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.place-toggle button { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; box-shadow: none; color: var(--ink); text-align: left; }
.pt-disc { flex: none; width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 1px; border: 2px solid var(--line); background: var(--paper); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.pt-disc b { font-size: 12px; }
.place-toggle button:hover .pt-disc { transform: scale(1.05); border-color: var(--gold); }
.place-toggle button.active .pt-disc { border-color: var(--accent); background: var(--row-hover); box-shadow: 0 0 0 4px rgba(200, 100, 80, .25); }
.place-toggle button .small { font-weight: 400; font-size: 12px; color: var(--muted); max-width: 130px; }
.formation { gap: 8px; }
.fboard { display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: var(--row-hover); border: 1px solid var(--line); }
.frow, .tray { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-radius: 9px; padding: 3px; transition: background .15s; }
.frow.over, .tray.over, .fslot.empty.over { background: var(--gold-soft); }
.frow-label { width: 62px; font-weight: 700; font-size: 12px; display: grid; }
.frow-label .small { font-weight: 400; font-size: 10px; }
.fslot { width: 52px; height: 60px; border-radius: 9px; display: grid; place-items: center; align-content: center; gap: 2px; padding: 0; font-size: 10px; position: relative; }
.fslot.empty { border: 2px dashed var(--line); color: var(--muted); background: var(--paper); }
.fslot.none { width: auto; padding: 0 8px; border: 1px dashed var(--line); color: var(--muted); height: 34px; }
.fslot.filled { border: 0; background: var(--u); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); cursor: grab; animation: token-drop .2s ease-out; }
.fslot.filled.u-pre { color: #2b2419; }
.fslot.filled:hover { filter: brightness(1.1); }
.fslot.blocked { filter: grayscale(.8); }
.fwarn { position: absolute; top: 2px; right: 4px; font-size: 12px; }
.fcube { width: 18px; height: 18px; border-radius: 4px; background: rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 3px var(--u); }
.flabel { font-weight: 600; }
.u-mil { --u: var(--mil); } .u-gue { --u: var(--gue); } .u-mag { --u: var(--mag); } .u-vol { --u: var(--vol); } .u-pre { --u: #cfc8b4; }
.tray { background: var(--bg); border: 1px dashed var(--line); padding: 6px; }
.tray-unit { width: 56px; display: grid; justify-items: center; gap: 1px; padding: 5px 2px; border-radius: 9px; border-color: var(--u); }
.tray-unit .fcube { background: var(--u); box-shadow: none; width: 22px; height: 22px; }
.tray-unit b { font: 600 13px var(--mono); }
.tray-unit .tname { font-size: 10px; font-weight: 600; }
.tray-unit .tstat { font-size: 9px; color: var(--muted); white-space: nowrap; }
.tray-unit:disabled { opacity: .35; cursor: default; }
.tray-unit:not(:disabled):hover { background: var(--row-hover); transform: translateY(-2px); }
.dep-meter { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.dep-meter p { margin: 0; }
.chance { display: flex; align-items: baseline; gap: 8px; }
.chance b { font: 700 28px var(--mono); }
.chance.good b { color: var(--good); } .chance.mid b { color: var(--gold); } .chance.bad b { color: var(--accent); }
.gauge { position: relative; height: 12px; border-radius: 99px; background: var(--line); }
.gfill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--p0); transition: width .3s; }
.gmark { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--ink); border-radius: 2px; transition: left .3s; }
.ecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.ecard { display: grid; gap: 2px; text-align: left; padding: 8px 10px; border-radius: 9px; }
.ecard .eeffect { font-size: 12px; color: var(--muted); }
.ecard.active { box-shadow: 0 0 0 2px var(--accent); background: var(--row-hover); }

/* ------------------------------------------------------------------ treasures */
.tpiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.tpile { position: relative; display: grid; justify-items: center; gap: 3px; padding: 12px 8px 10px; border-radius: 12px; text-align: center; background: var(--paper); transition: transform .15s, box-shadow .15s; }
.tpile:not(:disabled):hover { transform: translateY(-3px); }
.tpile.active { transform: translateY(-5px); box-shadow: 0 0 0 3px var(--pile), 0 10px 20px rgba(0, 0, 0, .15); }
.tpile:disabled { opacity: .4; cursor: not-allowed; }
.p-gloire { --pile: #b8862f; } .p-richesse { --pile: #c9772f; } .p-prisonniers { --pile: #4f8a4a; } .p-objets { --pile: #3f72b5; }
.tstack { position: relative; width: 64px; height: 80px; margin-bottom: 4px; }
.tstack::before, .tstack::after { content: ""; position: absolute; inset: 0; border-radius: 8px; background: var(--pile); opacity: .35; transform: rotate(-7deg); }
.tstack::after { opacity: .6; transform: rotate(5deg); }
.tcard { position: absolute; inset: 0; z-index: 1; border-radius: 8px; background: var(--pile); color: #fff; display: grid; place-items: center; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35); }
.tpile strong { font: 600 16px var(--serif); }
.tdesc { font-size: 12px; color: var(--muted); }
.tleft { font: 11px var(--mono); color: var(--muted); }
.tcheck { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--pile); color: #fff; display: none; place-items: center; font-weight: 700; }
.tpile.active .tcheck { display: grid; }
.small-pile .tstack { width: 44px; height: 54px; }
@keyframes card-flip { 0% { transform: rotateY(180deg) translateY(40px) scale(.7); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .rcard, .fslot.filled { animation: none; } }

/* ------------------------------------------------------------------ score track */
.score-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--side-hover); background: var(--side-hover); color: var(--side-ink); border-radius: 99px; padding: 4px 12px; font-size: 13px; }
.score-btn:hover { border-color: var(--gold); }
.score-btn svg { color: var(--gold-soft); }
.st-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(23, 20, 15, .5); display: grid; place-items: start center; overflow: auto; padding: 28px 16px; }
.st-panel { width: min(1180px, 100%); background: var(--bg); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); padding: 20px 26px 26px; display: grid; gap: 18px; animation: stage-in .25s ease-out; }
.st-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.st-head h2 { font: 600 28px var(--serif); margin: 0; }
.st-head .kicker { margin: 0; }
.st-legend { display: flex; gap: 16px; flex: 1; justify-content: flex-end; font-weight: 600; }
.st-legend span { display: inline-flex; align-items: center; gap: 6px; }
.st-close { font-size: 22px; line-height: 1; padding: 4px 12px; }
.st-panel h3 { font: 600 18px var(--serif); margin: 0 0 8px; }
.st-panel section > .small, .st-panel .small { color: var(--muted); }
.st-pawn { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--seat); color: #fff; font: 700 12px var(--mono); box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.st-glory-wrap { overflow-x: auto; padding-bottom: 4px; }
.st-panel > *, .st-two > * { min-width: 0; }
.st-glory { display: grid; grid-template-columns: repeat(var(--cells), minmax(28px, 1fr)); gap: 3px; min-width: calc(var(--cells) * 31px); }
.st-cell { position: relative; height: 78px; border-radius: 7px; background: var(--paper); border: 1px solid var(--line); border-bottom: 5px solid var(--rank); display: grid; grid-template-rows: auto 22px 1fr; align-content: start; justify-items: center; padding-top: 6px; }
.st-mark { display: grid; place-items: center; }
.st-cell.occupied { background: var(--row-hover); }
.st-cell.finish { outline: 2px solid var(--accent); outline-offset: -2px; }
.st-num { font: 600 13px var(--mono); color: var(--muted); }
.st-shield { width: 17px; height: 19px; background: var(--gold); color: #fff; font: 700 10px var(--mono); display: grid; place-items: center; clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }
.st-flag { position: absolute; top: 1px; left: 4px; color: var(--accent); font-size: 13px; }
.st-rank { position: absolute; bottom: -20px; left: 0; font-size: 10px; font-weight: 700; color: var(--rank); white-space: nowrap; }
.st-pawns { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; }
.st-pawns .st-pawn { width: 18px; height: 18px; font-size: 10px; }
.st-glory { padding-bottom: 20px; }
.rank-0 { --rank: #a39782; } .rank-1 { --rank: #8a9a5b; } .rank-2 { --rank: #4f8a4a; } .rank-3 { --rank: #3f72b5; }
.rank-4 { --rank: #6b4fa0; } .rank-5 { --rank: #b2413a; } .rank-6 { --rank: #c9772f; } .rank-7 { --rank: #b8862f; }
.st-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.st-points { display: grid; gap: 10px; }
.st-player { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--paper); display: grid; gap: 6px; }
.st-player-head { display: flex; align-items: baseline; gap: 10px; }
.st-total { margin-left: auto; font: 700 22px var(--mono); color: var(--seat); }
.st-bar { display: flex; width: var(--width); min-width: 4px; height: 18px; border-radius: 99px; overflow: hidden; background: var(--line); transition: width .4s; }
.st-seg { display: grid; place-items: center; color: #fff; font: 700 10px var(--mono); min-width: 14px; background: var(--seat); }
.st-seg.seg-1 { filter: brightness(1.25); } .st-seg.seg-2 { filter: brightness(.8); } .st-seg.seg-3 { filter: saturate(.5); } .st-seg.seg-4 { filter: brightness(1.45); }
.st-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; font-size: 12.5px; }
.st-lines li { display: flex; justify-content: space-between; }
.st-lines li.zero { color: var(--muted); }
.st-chart { width: 100%; height: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.st-gridline { stroke: var(--line); stroke-width: 1; }
.st-endline { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; }
.st-axis { fill: var(--muted); font: 11px var(--mono); }
.st-line { fill: none; stroke: var(--seat); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.st-dot { fill: var(--seat); stroke: var(--paper); stroke-width: 2; }
.st-ends { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.st-end { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--paper); display: grid; gap: 6px; }
.st-cond { display: grid; grid-template-columns: 20px 110px 1fr auto; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.st-cond.done { color: var(--good); font-weight: 600; }
.st-cond > b { font: 600 12px var(--mono); }
.st-progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.st-progress i { display: block; height: 100%; background: var(--seat); }
.st-guilds { display: flex; gap: 3px; }
.st-guilds i { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font: 600 10px var(--mono); font-style: normal; border: 1px dashed var(--line); color: var(--muted); }
.st-guilds i.owned { background: var(--seat); border: 0; color: #fff; }
.st-turns { display: flex; flex-wrap: wrap; gap: 4px; }
.st-turn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--mono); border: 1px solid var(--line); background: var(--paper); color: var(--muted); }
.st-turn.past { background: var(--row-hover); color: var(--ink); }
.st-turn.now { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.12); }
.st-turn.end { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 860px) { .st-two { grid-template-columns: 1fr; } .st-cond { grid-template-columns: 20px 90px 1fr auto; } }

/* ------------------------------------------------------------------ disarm choice */
.disarm-choice { display: grid; gap: 6px; padding: 10px 12px; margin: 8px 0; border-radius: 10px; border: 1px solid var(--gold); background: var(--row-hover); }
.disarm-choice .choice { margin: 0; }

/* ------------------------------------------------------------------ groups prepared at the placement */
.plan-section { border-top: 1px solid var(--line); padding-top: 10px; }
.plan-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.plan-tab { padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.plan-tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.plan-tabs .link { margin-left: auto; }
.group .planned { color: var(--gold); font-size: 12px; }
.group .planned .cube { opacity: .8; outline: 1px dashed var(--gold); outline-offset: 1px; }

/* ------------------------------------------------------------------ preparation on the board */
.place-submit { margin-left: auto; padding: 6px 14px; }
.group.preparable { cursor: pointer; }
.group.preparable:hover { border-color: var(--gold); }
.group.preparing { box-shadow: 0 0 0 2px var(--gold); }
.board-plan { margin-top: 10px; padding: 12px; border: 1px solid var(--gold); border-radius: 12px; background: var(--bg); display: grid; gap: 8px; }
.board-plan-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.board-plan .fboard, .board-plan .tray { max-width: 760px; }

/* ------------------------------------------------------------------ animated cards (played, drawn, treasures) */
.fx-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; cursor: pointer; }
.fx-overlay.sticky { background: rgba(10, 8, 5, .72); animation: stage-in .2s ease-out; }
.fx-overlay.passing { background: rgba(10, 8, 5, .62); animation: stage-in .15s ease-out; }
.fx-inner { display: grid; justify-items: center; gap: 12px; }
.fx-inner > .kicker { color: #f4f1e8; background: rgba(23, 20, 15, .75); padding: 4px 12px; border-radius: 99px; margin: 0; }
.fx-inner > .small { color: #f4f1e8; margin: 0; }
.fx-overlay.passing .fx-inner > .small { background: rgba(23, 20, 15, .6); padding: 2px 10px; border-radius: 99px; }
.fx-cards { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; perspective: 1000px; }
.fxcard { --band: #8a7f69; width: 200px; min-height: 270px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 22px 44px rgba(0, 0, 0, .35); overflow: hidden; display: grid; grid-template-rows: auto 1fr; color: var(--ink); }
.fxcard-band { background: var(--band); color: #fff; font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 7px 12px; }
.fxcard-body { display: grid; justify-items: center; align-content: center; gap: 10px; padding: 16px 14px; text-align: center; }
.fxcard-body svg { color: var(--band); }
.fxcard-body strong { font: 600 19px var(--serif); }
.fxcard-body span { font-size: 13px; color: var(--muted); }
.fxcard.deck-base { --band: #8a7f69; }
.fxcard.deck-avancee { --band: #b8862f; }
.fxcard.deck-maison { --band: #6b4fa0; }
.fxcard.p-gloire { --band: #b8862f; } .fxcard.p-richesse { --band: #c9772f; } .fxcard.p-prisonniers { --band: #4f8a4a; } .fxcard.p-objets { --band: #3f72b5; }
.fxcard.play { animation: card-play .55s cubic-bezier(.2, .8, .3, 1.1) both; }
.fxcard.draw { animation: card-draw .7s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i) * 260ms); }
.fxcard.turnover { animation: card-flip .7s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i) * 220ms); }
@keyframes card-play { 0% { transform: translateY(55vh) scale(.45) rotate(-10deg); opacity: 0; } 70% { transform: translateY(-8px) scale(1.04) rotate(1deg); opacity: 1; } 100% { transform: none; } }
@keyframes card-draw { 0% { transform: translate(40vw, -45vh) rotateY(180deg) scale(.4); opacity: 0; } 55% { opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .fxcard.play, .fxcard.draw, .fxcard.turnover { animation: none; } }
.fx-toasts { position: fixed; left: 16px; bottom: 16px; z-index: 39; display: grid; gap: 10px; }
.fx-toast { cursor: pointer; display: grid; gap: 4px; justify-items: start; transition: opacity .4s, transform .4s; }
.fx-toast .kicker { margin: 0; color: #f4f1e8; background: rgba(23, 20, 15, .75); padding: 2px 10px; border-radius: 99px; }
.fx-toast .fxcard { width: 150px; min-height: 0; transform-origin: bottom left; }
.fx-toast .fxcard-body { padding: 10px; gap: 5px; }
.fx-toast .fxcard-body strong { font-size: 15px; }
.fx-toast .fxcard-body span { font-size: 11.5px; }
.fx-toast .fxcard-body svg { width: 22px; height: 22px; }
.fx-toast.leaving { opacity: 0; transform: translateX(-20px); }
.fxcard.toast-in { animation: stage-in .35s ease-out both; }

/* ------------------------------------------------------------------ leaderboard */
.lb-home { margin-top: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.lb-home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lb-home-head h2 { font: 600 20px var(--serif); margin: 0 0 8px; }
.lb-home-head a { color: var(--accent); font-size: 14px; }
.lb-page { max-width: 1500px; }
.lb-visitor { font-size: 11px; font-weight: 400; color: var(--muted, #777); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; margin-left: 4px; white-space: nowrap; }
.lb-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 12px; }
.lb-filters label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; }
.lb-filters input, .lb-filters select { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: var(--paper); font-weight: 400; min-width: 130px; }
.lb-count { margin-left: auto; align-self: center; }
.lb-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.lb-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lb-table th { text-align: left; background: var(--row-hover); border-bottom: 1px solid var(--line); padding: 0; white-space: nowrap; }
.lb-table th button { width: 100%; border: 0; border-radius: 0; background: none; padding: 8px 10px; text-align: left; font-weight: 600; display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.lb-table th button.sorted { color: var(--accent); }
.lb-arrow { font-size: 10px; color: var(--muted); }
.lb-table th button.sorted .lb-arrow { color: var(--accent); }
.lb-table td { padding: 7px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.lb-table tbody tr:hover { background: var(--row-hover); }
.lb-table tr.lb-new { background: var(--gold-soft); }
.lb-pos { width: 36px; text-align: center; font: 600 13px var(--mono); }
.lb-score { font: 700 15px var(--mono); }
.lb-type { font: 600 11px var(--mono); padding: 2px 8px; border-radius: 99px; background: var(--row-hover); }
.lb-type.t-Solo { color: var(--gold); } .lb-type.t-IA { color: var(--p1); } .lb-type.t-Multi { color: var(--p0); }
.lb-rank { font-weight: 600; }
.lb-rank.r-5, .lb-rank.r-6, .lb-rank.r-7 { color: var(--gold); }
.lb-result.win { color: var(--good); font-weight: 600; } .lb-result.loss { color: var(--muted); }
.lb-version { font: 12px var(--mono); color: var(--muted); }
.lb-delete { font-size: 16px; text-decoration: none; color: var(--muted); }
.lb-delete:hover { color: var(--accent); }
.button-link { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; background: var(--paper); }
.button-link:hover { border-color: var(--gold); }

/* ------------------------------------------------------------------ accounts */
.account { color: var(--side-muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.account .side-action { padding: 0; }
.mode-card input[readonly] { background: var(--row-hover); color: var(--muted); }
.home p a { color: var(--accent); }
.identity-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 0 0 16px; padding: 14px 18px; border: 1px solid var(--gold); border-radius: 12px; background: var(--paper); }
.identity-form label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; flex: 1 1 320px; }
.identity-form input { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--bg); font-weight: 400; max-width: 360px; }
.mode-card input, .mode-card select { width: 100%; min-width: 0; box-sizing: border-box; }

/* ------------------------------------------------------------------ guilds */
.guilds-btn { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 99px; font-size: 13px; }
.guilds-btn b { font: 600 12px var(--mono); }
.gd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.gd-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.gd-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.gd-name { font: 600 16px var(--serif); }
.gd-vp { font: 600 13px var(--mono); color: var(--gold); white-space: nowrap; }
.gd-cell { display: grid; gap: 4px; min-width: 150px; }
.gd-cell .st-progress { height: 8px; }
.gd-state { font-size: 12px; color: var(--muted); }
.gd-state.owned { color: var(--good); font-weight: 700; }
.gd-state.ready { color: var(--accent); font-weight: 700; }
.gd-how { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ------------------------------------------------------------------ markers stored, exploration cards */
.bmarkers { display: flex; align-items: center; gap: 8px; margin: 0 9px 7px; font-size: 12px; color: var(--muted); }
.bmarkers b { color: var(--ink); }
.bmarkers-dots { display: flex; flex-wrap: wrap; gap: 3px; max-width: 120px; }
.bmarkers-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--seat); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); }
.fxcard.deck-exploration { --band: #5b6b4f; }
.fxcard.deck-rencontre { --band: #b2413a; }
.fxcard.deck-piege { --band: #2b2419; }

/* ------------------------------------------------------------------ access lines between the rows of dungeons */
.access-line { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 2px 0; padding: 0 4px; }
.access-line::before, .access-line::after { content: ""; flex: 1 1 20px; height: 2px; background: var(--line); }
.access { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 12px; border-radius: 99px; border: 1px dashed var(--line); color: var(--muted); background: var(--paper); }
.access.open { border-style: solid; border-color: var(--good); color: var(--ink); }
.access.open strong { color: var(--good); }
.access.closed strong { color: var(--muted); }
.access.just-open { animation: access-open 1.6s ease-out; }
@keyframes access-open { 0% { transform: scale(.9); box-shadow: 0 0 0 0 var(--gold); background: var(--gold-soft); } 40% { transform: scale(1.06); box-shadow: 0 0 0 8px transparent; } 100% { transform: none; } }

/* ------------------------------------------------------------------ what is new */
.whats-new { border: 1px solid var(--gold-soft); background: transparent; color: var(--gold-soft); border-radius: 99px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.whats-new:hover { background: var(--side-hover); color: var(--side-ink); border-color: var(--gold); }

/* ------------------------------------------------------------------ critical hit on the dice of the scene */
.sdie .crit-tag { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); padding: 1px 7px; border-radius: 99px; background: linear-gradient(135deg, #f4d58a, #b8862f); color: #2b2419; font: 800 11px var(--mono); letter-spacing: .04em; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); pointer-events: none; }
.sdie .crit-tag.burst { animation: crit-burst 1.1s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--i) * 110ms + .6s); }
.sdie .crit-ring { position: absolute; inset: -6px; border-radius: 15px; pointer-events: none; box-shadow: 0 0 0 2px #e8c36a, 0 0 14px 2px rgba(232, 195, 106, .7); opacity: .85; }
.sdie .crit-ring.burst { animation: crit-ring 1.2s ease-out both; animation-delay: calc(var(--i) * 110ms + .6s); }
@keyframes crit-burst {
  0% { transform: translateX(-50%) translateY(10px) scale(.2); opacity: 0; }
  35% { transform: translateX(-50%) translateY(-8px) scale(1.7); opacity: 1; }
  60% { transform: translateX(-50%) translateY(-2px) scale(1.15) rotate(-4deg); }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
@keyframes crit-ring {
  0% { inset: 6px; opacity: 0; box-shadow: 0 0 0 2px #e8c36a, 0 0 0 0 rgba(232, 195, 106, .9); }
  30% { opacity: 1; box-shadow: 0 0 0 3px #f4d58a, 0 0 30px 12px rgba(232, 195, 106, .8); }
  100% { inset: -6px; opacity: .85; box-shadow: 0 0 0 2px #e8c36a, 0 0 14px 2px rgba(232, 195, 106, .7); }
}
.sdie { overflow: visible; }
.sdice { padding-top: 22px; }
@media (prefers-reduced-motion: reduce) { .sdie .crit-tag.burst, .sdie .crit-ring.burst { animation: none; } }

/* Deaths to come, and those the heals avoid, under the score of the combat. */
.sfate { margin-top: 6px; color: var(--muted); }
.sfate b { color: var(--accent); font-weight: 600; }
.sfate .saved { color: var(--good); }

/* A heal: white tag, black text, above the die (like the critical hit). */
.sdie .heal-tag { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); padding: 1px 8px; border-radius: 99px; background: #fff; color: #111; font: 800 11px var(--mono); letter-spacing: .04em; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); pointer-events: none; }
.sdie .heal-tag.second { top: -42px; }
.sdie .heal-tag.burst { animation: crit-burst 1.1s cubic-bezier(.2, 1.4, .4, 1) both; animation-delay: calc(var(--i) * 110ms + .6s); }
@media (prefers-reduced-motion: reduce) { .sdie .heal-tag.burst { animation: none; } }

/* « Objets » window: one row per special object, its cost to identify it and the button. */
.objects-btn .obj-badge { margin-left: 6px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink, #fff); font-size: 11px; font-weight: 700; }
.obj-panel { max-width: 760px; }
.obj-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.obj-row.known .obj-icon { opacity: .6; }
.obj-text { display: grid; gap: 3px; }
.obj-effect { font-size: 14px; }
.obj-effect.unknown { font-style: italic; color: var(--muted); }
.obj-action { display: grid; gap: 6px; justify-items: end; text-align: right; }
.obj-cost { font-size: 13px; color: var(--muted); }
.obj-cost b { font: 700 22px var(--mono); color: var(--gold); }
.obj-why { max-width: 200px; }
.obj-action input { border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: var(--bg); color: var(--ink); }
@media (max-width: 640px) { .obj-row { grid-template-columns: 1fr; } .obj-icon { display: none; } .obj-action { justify-items: start; text-align: left; } }

/* ------------------------------------------------------------------ decision window, in the middle of the screen */
.decision-overlay { position: fixed; inset: 0; z-index: 30; background: rgba(10, 8, 5, .72); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 80px 16px 10px; overflow: auto; animation: decision-in .18s ease-out; }
@keyframes decision-in { from { opacity: 0; } to { opacity: 1; } }
.decision-box { width: min(640px, 100%); display: grid; gap: 16px; align-items: start; }
.decision-companion:not(:has(> :not([hidden]))) { display: none; }
.decision-overlay:has(.decision-companion > :not([hidden])) .decision-box { width: min(1560px, 100%); grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
.decision-box > .action-panel { box-shadow: 0 24px 60px rgba(0, 0, 0, .45); max-height: calc(var(--app-h, 100vh) - var(--decision-top, 80px) - 58px); overflow: auto; }
.decision-companion { display: grid; gap: 16px; max-height: calc(var(--app-h, 100vh) - var(--decision-top, 80px) - 58px); overflow: auto; border-radius: 12px; }
.decision-companion .boards { background: var(--bg); border-radius: 12px; padding: 12px; }
.decision-companion .stage.live { position: static; }
.decision-hide { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 6px 16px; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.decision-hide:hover { border-color: var(--gold); }
.decision-show { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 29; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 10px 20px; border-radius: 99px; border: 2px solid var(--gold); background: var(--accent); color: var(--accent-ink, #fff); font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.decision-show .ds-title { font-weight: 400; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.decision-show.waiting { background: var(--paper); color: var(--ink); border-color: var(--line); }
.decision-show:not(.waiting) { animation: decision-pulse 2.2s ease-in-out infinite; }
@keyframes decision-pulse { 50% { box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 6px rgba(232, 195, 106, .35); } }
@media (max-width: 1000px) { .decision-overlay:has(.decision-companion > :not([hidden])) .decision-box { grid-template-columns: 1fr; } .decision-box > .action-panel, .decision-companion { max-height: none; overflow: visible; } }
@media (prefers-reduced-motion: reduce) { .decision-overlay, .decision-show { animation: none; } }
body.detached .decision-overlay, body.detached .decision-show { display: none; }

/* ------------------------------------------------------------------ Métropole: the hand as cards */
.metro-hand { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin: 6px 0 14px; }
.metro-card { display: grid; gap: 8px; justify-items: center; }
.metro-card .fxcard { width: 180px; min-height: 240px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); transition: transform .15s ease, box-shadow .15s ease; }
.metro-card:hover .fxcard { transform: translateY(-6px) rotate(-1deg); box-shadow: 0 18px 34px rgba(0, 0, 0, .35); }
.metro-card [data-play] { width: 180px; }
.metro-units { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 180px; }
.decision-box:has(.metro-hand) { width: min(980px, 100%); }

/* ------------------------------------------------------------------ Placement: compact panel */
.steppers-hidden { display: none; }
.place-how { font-size: 14px; }
.place-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 14px; }
.place-left b { font: 700 18px var(--mono); }
.pl-pawns { display: inline-flex; gap: 3px; }
.pl-pawns .sup { color: var(--gold); display: grid; }
.pl-pawns .sup.spent { opacity: .25; }
.place-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.place-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--gold); background: var(--row-hover); color: var(--ink); font-size: 13px; }
.place-chip.donjon { border-style: dashed; }
button.place-chip:hover { border-color: var(--accent); }
.place-donjon { margin-bottom: 8px; }

/* ------------------------------------------------------------------ departures: a wide window, in two columns */
.decision-box:has(.dep-wide) { width: min(1500px, 100%); }
.dep-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.dep-top p { margin: 0; }
.dep-wide { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.dep-col { display: grid; gap: 12px; align-content: start; }
@media (max-width: 1000px) { .dep-wide { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ city: the foot of a building card, one line */
.bcard .bfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 0 9px 8px; }
.bcard .bfoot > * { margin: 0; }
.bcard .bfoot > button { padding: 3px 8px; font-size: 12px; margin-left: auto; }

/* The city beside a decision: denser, so that it fits in Full HD without scrolling (the page keeps the full board). */
.decision-companion .board { padding: 10px 12px; }
.decision-companion .board-tabs { margin-bottom: 0; }
.decision-companion .board-head { margin-bottom: 6px; }
.decision-companion .board-head h2 { font-size: 18px; }
.decision-companion .buildings { gap: 6px; }
.decision-companion .bcard { font-size: 11.5px; line-height: 1.3; }
.decision-companion .bcard .bband { padding: 2px 8px; font-size: 10px; }
.decision-companion .bcard .bhead { padding: 5px 8px 2px; gap: 6px; }
.decision-companion .bcard .bhead h4 { font-size: 14px; }
.decision-companion .bcard .bhead svg { width: 18px; height: 18px; }
.decision-companion .bcard .beffects { padding: 0 8px 6px; gap: 1px; }
.decision-companion .bcard .beffects li > b { width: 14px; height: 14px; font-size: 9px; }
.decision-companion .bcard .brule { margin: 0 8px 6px; font-size: 10.5px; line-height: 1.25; }
.decision-companion .bcard .bfoot { padding: 0 8px 6px; }
.decision-companion .groups { margin-top: 6px; gap: 6px; }
.decision-companion .group { padding: 5px 8px; }
.decision-companion .board > h2.small, .decision-companion .board > .cards { display: none; }

/* Resolution: each effect on one line, its button on the right (the panel fits without scrolling). */
.choice.col[data-activate] { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px; }
.choice.col[data-activate] > span:first-child { flex: 1 1 160px; }
.choice.col[data-activate] .row-actions { margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.choice.col[data-activate] select { max-width: 260px; }

/* The buttons that end a decision stay in view at the bottom of the window, however long the panel. */
.decision-box > .action-panel > .row-actions:last-child,
.decision-box > .action-panel .dep-col > .row-actions:last-child {
  position: sticky; bottom: -18px; z-index: 2; margin: 10px -20px -18px; padding: 10px 20px 12px;
  background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -8px 16px rgba(0, 0, 0, .12);
}
.decision-box > .action-panel .dep-col > .row-actions:last-child { margin: 6px 0 -18px; padding: 10px 0 12px; }

/* ------------------------------------------------------------------ bar: settings (volume, size) under an icon */
.settings-wrap { position: relative; display: inline-flex; }
.settings-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; }
.settings-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; display: grid; gap: 12px; width: 300px; padding: 14px 16px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.setting { display: grid; grid-template-columns: 56px 1fr 52px; align-items: center; gap: 10px; font-size: 13px; }
.setting-name { font-weight: 600; }
.setting input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.setting output { font: 600 12px var(--mono); text-align: right; }
.setting.muted output { color: var(--accent); }
.setting-fit { justify-self: start; padding: 4px 12px; font-size: 12px; border-radius: 99px; }
.setting-sounds summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.sound-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sound-list button { padding: 3px 10px; font-size: 12px; }
.setting-fit.active { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------------ illustrations (public/images)
   The text stays readable: the picture sits on the right (or at the top of a card) and fades into the
   background of the card through a mask; the text keeps a plain background and a halo of that background. */
.has-art { position: relative; isolation: isolate; }
.has-art::before { content: ""; position: absolute; z-index: -1; pointer-events: none; background: var(--art) center / cover no-repeat; }
/* Buildings (colour): the right of the card, whole height under the band; the text sits on semi-opaque bands. */
.bcard.bart { position: relative; isolation: isolate; --band: color-mix(in srgb, var(--paper) 80%, transparent); }
.buildings .bcard.bart { --band: color-mix(in srgb, var(--bg) 80%, transparent); }
.bcard.bart::before { content: ""; position: absolute; z-index: -1; pointer-events: none; top: 22px; right: 0; bottom: 0; width: 70%;
  background: var(--art) center / cover no-repeat; opacity: .95;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%); mask-image: linear-gradient(90deg, transparent, #000 30%); }
.bcard.bart .bhead h4, .bcard.bart .beffects .glyphs, .bcard.bart .brule, .bcard.bart .bmarkers > span:last-child {
  background: var(--band); border-radius: 5px; padding: 1px 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.bcard.bart .bhead h4 { flex: 0 1 auto; margin-right: auto; }
.bcard.bart .beffects li { line-height: 1.55; }
.bcard.bart .brule { display: table; }
.bcard.bart .bfoot > button { background: var(--paper); }
/* Dungeons (black and white): the right of the tile, the lines of text on semi-opaque bands. */
.tile.has-art, .dpick.has-art { --band: color-mix(in srgb, var(--paper) 80%, transparent); }
.tile.has-art::before, .dpick.has-art::before { inset: 0 0 0 30%; border-radius: inherit; -webkit-mask-image: linear-gradient(90deg, transparent, #000 35%); mask-image: linear-gradient(90deg, transparent, #000 35%); opacity: .9; filter: grayscale(1) contrast(1.05); }
:root[data-theme="dark"] .tile.has-art::before, :root[data-theme="dark"] .dpick.has-art::before { opacity: .85; filter: grayscale(1) brightness(1.2); }
.tile.has-art > .tile-head, .tile.has-art > .stats, .tile.has-art > .creature-line, .tile.has-art > .effect, .tile.has-art > .floors,
.dpick.has-art > .dpick-head, .dpick.has-art > .dpick-stats, .dpick.has-art > .dpick-creature, .dpick.has-art > .dpick-effect {
  background: var(--band); border-radius: 6px; padding: 1px 6px; width: fit-content; max-width: 100%; }
.tile.has-art > .spots .spot { background: var(--band); }
/* The great combat scene: the picture replaces the emblem. */
.stage-emblem.has-art { background: var(--art) center / cover no-repeat; box-shadow: inset 0 0 0 1px var(--line); filter: grayscale(1) contrast(1.1); }
.stage-emblem.has-art::before { display: none; }
/* Cards: the picture replaces the icon, at the top, fading into the card before the text. */
.fxcard-body .fxart { display: block; justify-self: stretch; width: calc(100% + 28px); height: 118px; margin: -16px -14px 0; background: var(--art) center / cover no-repeat; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.fx-toast .fxcard-body .fxart { width: calc(100% + 20px); height: 70px; margin: -10px -10px 0; }
.fxcard-body:has(.fxart) { align-content: start; }

/* ------------------------------------------------------------------ building effects written with icons */
.glyphs { display: inline; }
.glyphs .gly { display: inline-flex; vertical-align: -3px; margin: 0 1px; }
.glyphs .gly svg { width: 14px; height: 14px; }
.glyphs .cube { width: 11px; height: 11px; vertical-align: -1px; margin: 0 1px 0 2px; }
.glyphs b.gain, .glyphs b.cost { font: 700 12.5px var(--mono); }
.glyphs b.cost { color: var(--accent); }
.glyphs .arrow { color: var(--muted); font-weight: 700; }
.glyphs small { font-size: 10.5px; color: var(--muted); }
.glyphs small.per { padding: 0 4px; border: 1px solid var(--line); border-radius: 99px; white-space: nowrap; }
.bcard .bcost { display: inline-flex; align-items: center; gap: 2px; }
.upgrade-btn { display: inline-flex; align-items: center; gap: 3px; } .upgrade-btn b { font: 700 12px var(--mono); }

/* ------------------------------------------------------------------ popup of a building: its three levels in words */
.building-tip { position: fixed; z-index: 60; width: 360px; max-width: calc(100vw - 16px); pointer-events: none; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px rgba(0, 0, 0, .35); overflow: hidden; font-size: 13px; line-height: 1.4; }
.building-tip header { display: flex; justify-content: space-between; gap: 8px; background: var(--type); color: var(--type-ink); padding: 4px 12px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.building-tip h3 { margin: 10px 12px 6px; font: 600 18px var(--serif); display: flex; align-items: center; gap: 8px; }
.building-tip h3 .bicon { color: var(--type); }
.building-tip h3 small { font: 500 12px var(--mono); color: var(--muted); margin-left: auto; }
.building-tip ol { list-style: none; margin: 0; padding: 0 12px 8px; display: grid; gap: 6px; }
.building-tip li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; color: var(--muted); }
.building-tip li b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--ink); font-size: 11px; }
.building-tip li.on { color: var(--ink); }
.building-tip li.on b { background: var(--type); color: var(--type-ink); }
.building-tip li.current span { font-weight: 600; }
.building-tip .tip-rule { margin: 0 12px 8px; color: var(--accent); font-size: 12px; }
.building-tip .tip-legend { margin: 0; padding: 6px 12px 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
@media (hover: none) { .building-tip { display: none; } }

/* ------------------------------------------------------------------ placement panel: groups and hand */
.hand-cards { display: flex; flex-wrap: wrap; gap: 10px; }
.hand-card { display: grid; gap: 6px; justify-items: center; }
.hand-card .fxcard { width: 118px; min-height: 0; box-shadow: 0 6px 14px rgba(0, 0, 0, .2); }
.hand-card .fxcard-band { font-size: 9px; padding: 4px 8px; }
.hand-card .fxcard-body { padding: 8px 8px 10px; gap: 5px; }
.hand-card .fxcard-body svg { width: 22px; height: 22px; }
.hand-card .fxcard-body strong { font-size: 13px; line-height: 1.2; }
.hand-card .fxcard-body span { font-size: 11px; line-height: 1.3; }
.hand-card .fxcard-body .fxart { width: calc(100% + 16px); height: 64px; margin: -8px -8px 0; }
.hand-card [data-maison] { padding: 3px 14px; font-size: 12px; }
.plan-section .formation { margin-top: 6px; }
/* During the placement the panel is wider (groups and hand), the formation more compact. */
.decision-overlay:has(.decision-companion > :not([hidden])):has(#panel .hand-section) .decision-box { grid-template-columns: minmax(0, 1fr) minmax(380px, 540px); }
.plan-section .fboard { padding: 8px 10px; gap: 6px; }
.plan-section .fslot { width: 52px; height: 50px; }
.plan-section .tray { padding: 8px 10px; }
.plan-section .tray-unit { min-width: 54px; padding: 4px 4px; }
.place-how { margin-bottom: 6px; }
.decision-companion .board-head [data-place-submit] { display: none; }

/* Leaderboard: the summary of the home page has narrow date, player and faction columns. */
.lb-compact .lb-table td.c-finished_at { width: 1%; color: var(--muted); font-size: 12px; }
.lb-compact .lb-table td.c-player, .lb-compact .lb-table td.c-house { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.lb-compact .lb-table td.c-house { max-width: 150px; color: var(--muted); font-size: 12.5px; }
.lb-clear { margin-left: 4px; }
.lb-clear.armed { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lb-home-head .lb-home-version { font: 600 12px var(--mono); color: var(--muted); margin-left: 8px; }

/* ------------------------------------------------------------------ buying the advanced cards */
.decision-box:has(.buy-grid) { width: min(1100px, 100%); }
.buy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 8px 0 12px; }
.buy-card { position: relative; padding: 0; border: 0; background: none; box-shadow: none; display: grid; justify-items: center; cursor: pointer; transition: transform .15s ease; }
.buy-card .fxcard { width: 100%; min-height: 200px; box-shadow: 0 6px 16px rgba(0, 0, 0, .22); transition: box-shadow .15s ease, outline-color .15s ease; outline: 3px solid transparent; outline-offset: 2px; }
.buy-card:hover { transform: translateY(-4px); }
.buy-card[aria-pressed="true"] { transform: translateY(-6px); }
.buy-card[aria-pressed="true"] .fxcard { outline-color: var(--accent); box-shadow: 0 14px 28px rgba(0, 0, 0, .3); }
.buy-card.too-dear { opacity: .45; }
.buy-price { position: absolute; top: 34px; right: 8px; display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); font: 700 14px var(--mono); color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.buy-check { position: absolute; top: -8px; left: -8px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.buy-card[aria-pressed="true"] .buy-check { display: grid; }
.buy-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--row-hover); font-size: 14px; }
.buy-bar span { display: inline-flex; align-items: center; gap: 4px; }
.buy-bar .over { color: var(--accent); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .buy-card, .buy-card .fxcard { transition: none; } }

/* Card faces: the effect with icons; the popup of a card. */
.fxcard-body .glyphs .gly svg { width: 15px; height: 15px; }
.fxcard-body .glyphs .cube { width: 12px; height: 12px; }
.fxcard-body .glyphs b.gain { font-size: 14px; }
.building-tip.card-tip header { background: var(--gold); color: #fff; }
.building-tip.card-tip h3 { margin-bottom: 4px; }
.building-tip .tip-text { margin: 0 12px 12px; font-size: 14px; }

/* Tutoriel (public/tutorial.js) : la carte de l'accueil, la bulle au-dessus de la fenêtre de décision, les éléments qui clignotent. */
.tuto { position: fixed; top: 76px; right: 16px; z-index: 44; width: 360px; max-width: calc(100vw - 32px); max-height: calc(100vh - 100px); overflow: auto; padding: 12px 16px 14px; background: var(--paper); color: var(--ink); border: 2px solid var(--gold, #c9a227); border-radius: 12px; box-shadow: 0 18px 44px rgba(0, 0, 0, .4); font-size: 14px; line-height: 1.45; }
.tuto h3 { font: 600 18px var(--serif); margin: 2px 0 6px; }
.tuto p { margin: 0 0 8px; }
.tuto-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tuto-kicker { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tuto-min { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; }
.tuto-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
@keyframes tuto-blink { 0%, 100% { outline-color: var(--gold, #c9a227); } 50% { outline-color: transparent; } }
@media (max-width: 700px) { .tuto { top: auto; bottom: 72px; right: 8px; left: 8px; width: auto; max-height: 45vh; } }
.tuto-list { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 4px; }

/* Langue : deux drapeaux dans le bandeau (public/i18n.js). */
.lang-flags { display: inline-flex; gap: 4px; align-items: center; }
.lang-flag { display: inline-grid; place-items: center; padding: 3px; border: 1px solid transparent; border-radius: 5px; background: none; cursor: pointer; opacity: .55; line-height: 0; }
.lang-flag svg { display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.lang-flag:hover { opacity: .9; }
.lang-flag.active { opacity: 1; border-color: var(--gold, #c9a227); cursor: default; }
/* Tutoriel : le tableau des dés (cube, six faces). */
.tuto-dice { border-collapse: collapse; width: 100%; margin: 0 0 8px; font-size: 13px; }
.tuto-dice td { padding: 4px 4px 4px 0; vertical-align: middle; border-top: 1px solid var(--line); }
.tuto-dice .cube { vertical-align: -2px; }
.tuto-faces { white-space: nowrap; }
.tuto-face { display: inline-grid; place-items: center; grid-auto-flow: column; gap: 1px; min-width: 22px; height: 22px; margin: 1px; padding: 0 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); font-weight: 600; font-size: 12px; }
.tuto-crit { display: inline-grid; place-items: center; min-width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%; font-size: 10px; line-height: 1; }

/* ------------------------------------------------------------------ compact cities (2026-10-09)
   The building cards without their band: the type colours the left edge, the level sits beside the name,
   the special rule hides behind a ✦ (whole in the tooltip). The groups hold on one line each. */
.bcard.compact { border-left: 4px solid var(--type); }
.bcard.compact .bhead { padding: 5px 8px 3px; gap: 6px; }
.bcard.compact .bhead svg { width: 18px; height: 18px; }
.bcard.compact .bpips { flex: none; padding: 1px 7px; border-radius: 99px; background: var(--type); color: var(--type-ink); font: 700 13px/1.3 var(--mono); letter-spacing: .12em; white-space: nowrap; }
.bcard.compact .brule-mark { color: var(--accent); font-size: 12px; cursor: help; }
.bcard.compact .beffects { padding: 0 8px 5px; gap: 1px; }
.bcard.compact .bfoot { padding: 0 8px 5px; gap: 4px 8px; }
.bcard.compact .bmarkers { gap: 4px; margin: 0; }
.bcard.compact .bmarkers-dots i { width: 9px; height: 9px; }
.bcard.compact .bfoot > button { padding: 2px 7px; font-size: 11.5px; }
.bcard.bart.compact::before { top: 0; }
.group { padding: 5px 8px; }
.group-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.group-units { display: inline-flex; align-items: center; gap: 2px; }
.group-sep { color: var(--muted); margin: 0 4px; }
.group-state { margin-left: auto; }
.group-equip { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.groups { margin-top: 8px; }

/* ------------------------------------------------------------------ compact bar during a game (2026-10-09)
   What only matters on the home (version, novelties, leaderboard, Atelier, account, language) leaves the bar;
   the resources come up on the same line when there is room. */
body.in-game .play-bar { padding: 6px 16px; gap: 6px 14px; }
body.in-game .play-bar .brand { font-size: 15px; gap: 8px; }
body.in-game .play-bar .brand small,
body.in-game #whats-new,
body.in-game .play-links a[href="classement.html"],
body.in-game #atelier-link,
body.in-game #account,
body.in-game .lang-flags { display: none; }
body.in-game .play-bar .brand-mark { width: 28px; height: 28px; font-size: 17px; border-radius: 8px; }
body.in-game .play-status { flex: 0 1 auto; font-size: 13px; gap: 4px 14px; }
body.in-game .play-links { order: 3; gap: 12px; margin-left: auto; }
body.in-game .play-resources { flex: 1 1 auto; flex-basis: auto; order: 2; gap: 4px; }
body.in-game .play-bar .res { padding: 2px 8px; font-size: 12.5px; }
body.in-game .quit-save { position: static; transform: none; margin-left: auto; padding: 3px 12px; font-size: 13px; }
body.in-game .score-btn { padding: 3px 8px; }
.initiative-mark { color: var(--gold-soft); margin-right: 4px; }

/* ------------------------------------------------------------------ compact departure (2026-10-09)
   The groups on one line, the dungeon cards tighter (values and creature together, effect on two lines,
   whole in the tooltip), Entrée / Casque as two pills, smaller places, the estimate on one line. */
.dep-top:not(:has(*)) { display: none; }
.dep-section { margin: 4px 0; gap: 4px; }
.dep-col { gap: 8px; }
.gcard { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 8px; padding: 5px 6px; }
.gcard .gshape { margin: 0; gap: 2px; }
.gshape i { width: 8px; height: 8px; }
.gshape > span { min-height: 8px; }
.dpicks { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.dpick { gap: 4px; padding: 7px 9px 7px; border-radius: 10px; }
.dpick-head { gap: 6px; }
.dpick-head strong { font-size: 14px; }
.dpick-level { top: 6px; right: 7px; width: 20px; height: 20px; font-size: 11px; }
.dpick-stats { gap: 2px 9px; align-items: center; }
.dstat b { font-size: 13px; }
.dpick-effect { font-size: 11.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dpick.has-art > .dpick-effect { display: -webkit-box; }
.dpick .floor { width: 10px; height: 10px; }
.place-toggle { gap: 12px; margin-top: 8px; padding-top: 8px; justify-content: flex-start; flex-wrap: wrap; }
.place-toggle button { gap: 10px; padding: 5px 16px 5px 5px; border: 1px solid var(--line); border-radius: 99px; }
.place-toggle button.active { border-color: var(--accent); background: var(--row-hover); }
.place-toggle .pt-disc { width: 48px; height: 48px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; background: var(--paper); }
.place-toggle button:hover .pt-disc { transform: scale(1.05); border-color: var(--gold); }
.place-toggle button.active .pt-disc { border-color: var(--accent); background: var(--row-hover); box-shadow: 0 0 0 3px rgba(200, 100, 80, .25); }
.place-toggle .pt-text { display: grid; gap: 1px; text-align: left; }
.place-toggle .pt-text b { font-size: 15px; }
.place-toggle .pt-text .small { font-size: 12.5px; max-width: none; }
#dep-formation .fboard { padding: 6px 8px; gap: 4px; }
#dep-formation .frow, #dep-formation .tray { gap: 4px; padding: 2px; }
#dep-formation .tray { padding: 4px 6px; }
#dep-formation .frow-label { width: 54px; }
#dep-formation .fslot { width: 44px; height: 42px; font-size: 9.5px; }
#dep-formation .fslot .fcube { width: 14px; height: 14px; }
#dep-formation .tray-unit { width: 50px; padding: 3px 2px; }
#dep-formation .tray-unit .fcube { width: 16px; height: 16px; }
#dep-formation .tray-unit .tstat { display: none; }
#dep-formation .row-actions { margin: 0; }
.dep-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 6px 10px; }
.dep-meter .chance b { font-size: 20px; }
.dep-meter .gauge { flex: 1 1 140px; height: 10px; }
.dep-meter p { flex-basis: 100%; }
.ecard { padding: 5px 8px; }
.ecard .eeffect { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Hovering a dungeon of the departure: the card larger, under its illustration (black and white, like the tiles). */
.dungeon-tip { width: 340px; }
.dungeon-tip .dtip-art { height: 210px; background: var(--art) center / cover no-repeat; filter: grayscale(1) contrast(1.05); border-bottom: 1px solid var(--line); }
:root[data-theme="dark"] .dungeon-tip .dtip-art { filter: grayscale(1) brightness(1.2); }
.dungeon-tip .dtip-body { position: relative; display: grid; gap: 6px; padding: 10px 12px 12px; }
.dungeon-tip .dpick-head { gap: 8px; }
.dungeon-tip .dpick-head strong { font: 600 18px var(--serif); }
.dungeon-tip .dpick-level { top: 10px; right: 10px; }
.dungeon-tip .dpick-stats { gap: 4px 12px; }
.dungeon-tip .dstat b { font-size: 15px; }
.dungeon-tip .dpick-effect { display: block; -webkit-line-clamp: unset; overflow: visible; font-size: 13px; }
.dungeon-tip .floor { width: 12px; height: 12px; }
