:root {
      --bg: #121418;
      --panel: #1b1e26;
      --ink: #f7f3ea;
      --muted: #d0cbbf;
      --line: #2c313c;
      --accent: #c9a45c;
      --accent-2: #8d6b2f;
      --good: #7dbe74;
      --food: #d35a3a;
      --wood: #3f8f5a;
      --gold: #d4b04c;
      --stone: #8d9198;
      --scroll: var(--accent);
      --scroll-hover: color-mix(in srgb, var(--accent) 70%, white);
      --scroll-track: var(--bg);
    }
    * { box-sizing: border-box; }
    html {
      color-scheme: dark;
      scrollbar-gutter: stable;
      scrollbar-width: thin;
      scrollbar-color: var(--scroll) var(--scroll-track);
    }
    ::-webkit-scrollbar { width: 12px; height: 12px; }
    ::-webkit-scrollbar-track { background: var(--scroll-track); }
    ::-webkit-scrollbar-thumb {
      background: var(--scroll);
      border-radius: 8px;
      border: 3px solid var(--scroll-track);
    }
    ::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
    html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: "Source Sans 3", sans-serif; font-size: 17px; line-height: 1.55; }
    body {
      min-height: 100vh;
      min-height: 100dvh;
      background:
        radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
        radial-gradient(900px 400px at 100% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 55%),
        var(--pattern),
        var(--bg);
      background-attachment: fixed;
      transition: background-color .35s ease;
    }
    .wrap {
      max-width: 1180px;
      margin: 0 auto;
      padding: 24px 18px 48px;
      padding-left: max(18px, env(safe-area-inset-left));
      padding-right: max(18px, env(safe-area-inset-right));
      padding-bottom: max(48px, env(safe-area-inset-bottom));
      position: relative;
      z-index: 1;
    }
    .civ-relic { display: flex; justify-content: center; margin: 2px 0 16px; --relic-opacity: .1; }
    .civ-relic svg { display: block; opacity: var(--relic-opacity); fill: var(--accent); stroke: var(--accent); transform-origin: center; }
    body[data-civ="hre"] {
      --panel: #24180f;
      --line: #4a3420;
      --scroll: #c9a45c;
      --scroll-hover: #e0c078;
      --scroll-track: #140e0a;
    }
    body[data-civ="rus"] {
      --panel: #1a1416;
      --line: #4a2a2c;
      --scroll: #8a3a3a;
      --scroll-hover: #c06060;
      --scroll-track: #0c1014;
    }
    body[data-civ="kt"] {
      --panel: #14100f;
      --line: #413331;
      --scroll: #c4a060;
      --scroll-hover: #e4d2a0;
      --scroll-track: #140c0a;
    }
    body[data-civ="mac"] {
      --panel: #221010;
      --line: #4a3d22;
      --scroll: #c4a84a;
      --scroll-hover: #e0c36a;
      --scroll-track: #12100c;
    }
    body[data-civ="byz"] {
      --panel: #181422;
      --line: #3e3458;
      --scroll: #8a6ab8;
      --scroll-hover: #b090d4;
      --scroll-track: #0c0a14;
    }
    body[data-civ="hol"] {
      --panel: #12111a;
      --line: #2a4058;
      --ink: #e8eef4;
      --muted: #9aacbc;
      --scroll: #3e5e82;
      --scroll-hover: #5a7aa4;
      --scroll-track: #070b12;
    }
    body[data-civ="hol"] .mark { color: #d44a58; }
    .panel {
      position: relative;
      overflow: visible;
    }
    body[data-civ="gh"] {
      --panel: #141313;
      --line: #4a3c2a;
      --scroll: #865e21;
      --scroll-hover: #664612;
      --scroll-track: #07120f;
    }
    body[data-civ="gh"] .mark { color: var(--accent); }
    body[data-civ="ootd"] {
      --panel: #1a1210;
      --line: #4a3020;
      --scroll: #a87830;
      --scroll-hover: #d4a85a;
      --scroll-track: #100a0a;
    }
    body[data-civ="ootd"] .mark { color: var(--accent); }
    body[data-civ="sco"] {
      --panel: #0f1420;
      --line: #2a3e5c;
      --ink: #eaf0f8;
      --scroll: #3f68a8;
      --scroll-hover: #6c9ce0;
      --scroll-track: #070b14;
    }
    body[data-civ="sco"] .mark { color: var(--accent); }

    aside.panel { overflow: auto; }
    .panel::before {
      content: "";
      position: absolute; inset: 0 auto auto 0; width: 100%; height: 3px;
      background: linear-gradient(90deg, transparent, var(--accent), transparent);
      opacity: .7;
    }
    .crest {
      width: 26px; height: 26px; display: inline-flex; vertical-align: -5px; margin-right: 8px;
      color: var(--accent);
    }
    .crest img { width: 32px; height: 32px; object-fit: contain; }
    .mark { font-size: 13px; letter-spacing: .04em; color: var(--accent); margin: 0 0 8px; font-weight: 700; }
    header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 16px;
      margin-bottom: 22px;
    }
    h1 { font-family: Cinzel, serif; font-size: 28px; margin: 0 0 4px; letter-spacing: .04em; }
    .sub { color: var(--muted); margin: 0; }
    .civs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; padding-top: 4px; }
    .header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }
    .header-btn {
      width: 40px; height: 40px; padding: 0;
      display: inline-flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .header-btn svg { width: 20px; height: 20px; fill: currentColor; }
    .civ-picker-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }
    .civ-picker-compact {
      max-height: min(38vh, 280px);
      overflow: auto;
      gap: 4px;
      padding-right: 2px;
    }
    .civ-picker-item {
      display: flex; align-items: center; gap: 10px;
      padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
      background: #15181f; cursor: pointer; user-select: none;
    }
    .civ-picker-compact .civ-picker-item {
      padding: 5px 8px;
      gap: 8px;
      border-radius: 8px;
    }
    .civ-picker-item .drag-handle { flex-shrink: 0; }
    .civ-picker-item.dragging { opacity: .28; pointer-events: none; }
    .civ-picker-item:hover {
      border-color: color-mix(in srgb, var(--line) 82%, var(--accent));
      background: color-mix(in srgb, var(--accent) 2.5%, #15181f);
    }
    .sort-ghost,
    .civ-picker-ghost,
    .civ-ghost,
    .build-ghost,
    .build-item.build-ghost,
    .edit-ghost,
    .edit-row.edit-ghost {
      position: fixed;
      z-index: 80;
      pointer-events: none;
      margin: 0;
      box-shadow: 0 16px 32px rgba(0,0,0,.45);
      opacity: .96;
    }
    .civ-ghost { cursor: grabbing; }
    .civ-ghost .civ-face {
      top: 0;
      border-color: var(--accent);
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 10px 24px rgba(0,0,0,.35);
    }
    .build-ghost .build-btn {
      border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
      background: color-mix(in srgb, var(--accent) 8%, #15181f);
    }
    .edit-row.edit-ghost {
      border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
      background: color-mix(in srgb, var(--accent) 8%, #15181f);
    }
    body.is-sorting { cursor: grabbing; user-select: none; }
    body.is-sorting * { cursor: grabbing !important; }
    .civs,
    .builds,
    .civ-picker-list,
    #edSteps { touch-action: pan-y; }
    .drag-handle { touch-action: none; }
    body.is-sorting,
    body.is-sorting * { touch-action: none; }
    .civ-picker-item input { width: 18px; height: 18px; padding: 0; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
    .civ-picker-item input:disabled { opacity: .4; }
    .civ-picker-item.disabled { opacity: .55; cursor: not-allowed; }
    .civ-picker-item img {
      width: 34px; height: 34px; object-fit: contain; flex-shrink: 0;
      pointer-events: none;
      -webkit-user-drag: none;
    }
    .civ-picker-compact .civ-picker-item img { width: 26px; height: 26px; }
    .civ-picker-item .civ-picker-name { font-weight: 700; font-size: 15px; }
    .civ-picker-compact .civ-picker-item .civ-picker-name { font-size: 14px; }
    .civ-picker-item .civ-picker-short { color: var(--muted); font-size: 13px; margin-left: auto; }
    .civ-picker-compact .civ-picker-item .civ-picker-short { font-size: 12px; }
    .civ {
      display: block;
      width: 100%;
      background: none;
      border: none;
      padding: 0;
      cursor: default;
      text-align: center;
      color: var(--ink);
      font: inherit;
      line-height: 1.2;
      user-select: none;
      -webkit-user-select: none;
    }
    .civ-face {
      display: block;
      position: relative;
      top: 0;
      background: color-mix(in srgb, var(--panel) 88%, black);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 12px 8px;
      transition: top .15s ease, border-color .15s ease, box-shadow .15s ease;
    }
    .civ:hover .civ-face { top: -2px; }
    .civ.dragging { opacity: .28; pointer-events: none; }
    .civ.dragging .civ-face { top: 0; }
    .civ.active .civ-face {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent), 0 10px 24px rgba(0,0,0,.25);
      background: color-mix(in srgb, var(--accent) 12%, var(--panel));
    }
    .civ img {
      width: 56px; height: 56px; object-fit: contain;
      filter: drop-shadow(0 4px 8px rgba(0,0,0,.35));
      pointer-events: none;
      -webkit-user-drag: none;
      display: block;
      margin: 0 auto;
    }
    .civ-name {
      display: block;
      margin-top: 8px;
      font-weight: 700;
      font-size: 13px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; }
    .panel { background: color-mix(in srgb, var(--panel) 92%, black); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
    .civ-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
    .civ-head img { width: 64px; height: 64px; }
    .civ-head h2 { font-family: Cinzel, serif; margin: 0; font-size: 22px; }
    .tag { display: inline-block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
    .identity { color: var(--ink); opacity: .88; font-size: 15px; line-height: 1.55; margin: 0 0 16px; }
    .builds { display: flex; flex-direction: column; gap: 8px; }
    .build-item { position: relative; }
    .build-btn {
      text-align: left; background: #15181f; color: var(--ink); border: 1px solid var(--line);
      border-radius: 10px; padding: 12px 14px; cursor: pointer; font-size: 16px; line-height: 1.35;
       display: grid; grid-template-columns: 1.6em 1fr; gap: 8px; align-items: center;
       width: 100%;
    }
    .build-btn:hover {
      border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
      background: color-mix(in srgb, var(--accent) 6%, #15181f);
    }

    .build-item { cursor: grab; }
    .build-item.dragging { opacity: .28; pointer-events: none; }
    .build-btn .bo-emo { font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; height: 100%; }
    .build-btn.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #15181f); }
    .build-btn small { display: block; color: var(--muted); margin-top: 4px; font-size: 13px; }
    .build-delete {
      width: 36px; height: 36px; padding: 0;
      display: inline-flex; align-items: center; justify-content: center;
      color: color-mix(in srgb, #e08a7a 82%, var(--muted));
      border-color: color-mix(in srgb, var(--line) 72%, #e08a7a);
    }
    .build-delete svg {
      width: 17px; height: 17px;
      display: block;
      flex-shrink: 0;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.75;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    button.ctrl.build-delete:hover {
      color: #f2a494;
      border-color: color-mix(in srgb, #e08a7a 58%, var(--line));
      background: color-mix(in srgb, #e08a7a 14%, #15181f);
    }
    button.ctrl.build-delete:disabled,
    button.ctrl.build-delete:disabled:hover {
      opacity: .45;
      cursor: not-allowed;
      color: var(--muted);
      border-color: var(--line);
      background: #15181f;
    }
    .build-add {
      align-self: flex-start;
      width: 42px;
      min-height: 34px;
      border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
      border-radius: 8px;
      background: transparent;
      color: color-mix(in srgb, var(--accent) 70%, var(--muted));
      cursor: pointer;
      font: 600 20px/1 Cinzel, serif;
    }
    .build-add:hover {
      border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
      background: color-mix(in srgb, var(--accent) 6%, #15181f);
      color: var(--accent);
    }
    .emo-pick { display: flex; flex-wrap: wrap; gap: 6px; }
    .emo-pick button {
      width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line);
      background: #15181f; cursor: pointer; font-size: 18px;
    }
    .emo-pick button:hover {
      border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
      background: color-mix(in srgb, var(--accent) 6%, #15181f);
    }
    .emo-pick button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, #15181f); }
    .toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
    button.ctrl {
      background: #15181f; color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
      padding: 10px 12px; cursor: pointer; font-weight: 700; font-size: 14px;
      transition: background .22s ease, border-color .22s ease, color .22s ease, opacity .22s ease;
    }
    button.ctrl:hover {
      border-color: color-mix(in srgb, var(--line) 82%, var(--accent));
      background: color-mix(in srgb, var(--accent) 2.5%, #15181f);
    }
    button.ctrl:disabled,
    button.ctrl:disabled:hover {
      opacity: .45;
      cursor: not-allowed;
      background: #15181f;
      border-color: var(--line);
      color: var(--muted);
    }
    button.ctrl.primary { background: var(--accent); color: #1a1408; border-color: transparent; }
    button.ctrl.primary,
    button.ctrl.game-launch { transition: background .15s ease; }
    button.ctrl.primary:hover,
    button.ctrl.game-launch:hover {
      background: color-mix(in srgb, var(--accent) 100%, white 22%);
      border-color: transparent;
    }
    ol.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
    .step {
      display: grid; grid-template-columns: 28px max-content 1fr; gap: 8px; align-items: start;
      background: #15181f; border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px;
      font-size: 16px; line-height: 1.4;
    }
    .step.done { opacity: .72; }
    .step.current { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 8%, #15181f); }
    .age-sep {
      display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
      margin: 6px 0 2px; padding: 8px 4px 8px 0;
      background: transparent; border: none; box-shadow: none;
    }
    .age-sep .sep-line { height: 1px; background: linear-gradient(90deg, var(--accent), transparent); opacity: .7; }
    .age-sep .sep-label {
      font-family: Cinzel, serif; font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
      color: var(--accent); font-weight: 700; white-space: nowrap;
    }
    .age-sep .sep-num {
      font-family: Cinzel, serif; font-size: 15px; color: var(--accent); font-weight: 700;
      min-width: 1.6em;
      display: inline-flex; align-items: center;
    }
    .age-sep .sep-num .res-ico {
      width: 1.35em; height: 1.35em; margin: 0; vertical-align: 0;
    }
    .edit-row.sep-row { grid-template-columns: 22px 1fr 40px; background: color-mix(in srgb, var(--accent) 8%, #15181f); }
    .drag-handle {
      cursor: grab; color: var(--muted); font-size: 14px; letter-spacing: -2px;
      user-select: none; text-align: center; opacity: .55;
      min-width: 28px; min-height: 36px;
      display: inline-flex; align-items: center; justify-content: center;
    }
    .drag-handle:active { cursor: grabbing; }
    .edit-row.dragging { opacity: .28; pointer-events: none; }
    .time { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
    .step input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
    .note { color: var(--muted); font-size: 13px; margin-top: 4px; }
    .res-ico {
      display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em;
      margin: 0 2px; object-fit: contain;
    }
    .tips {
      margin-top: 18px;
      color: var(--ink);
      font-size: 16px;
      line-height: 1.55;
      white-space: pre-line;
      opacity: .92;
      border: 1px solid var(--line);
      border-left: 3px solid var(--accent);
      border-right: 3px solid var(--accent);
      border-radius: 12px;
      padding: 12px 16px;
      background: color-mix(in srgb, var(--accent) 7%, #15181f);
    }
    .tips strong {
      display: block;
      font-size: 11px;
      letter-spacing: .08em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 2px;
    }
    .tips strong + br { display: none; }
    .tips textarea {
      display: block;
      min-height: 76px;
      margin: 0;
    }
    .editor .tips { margin-bottom: 10px; }
    /* footer styles defined below with layout */
    .side-actions { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 0; }
    .side-actions .row,
    .side-actions .row-quiet { display: flex; flex-direction: column; gap: 8px; }
    .side-actions .ctrl,
    .side-actions .quiet {
      width: 100%;
      text-align: center;
      font-size: 15px;
      padding: 11px 12px;
      letter-spacing: 0;
      text-transform: none;
    }
    .side-actions .quiet {
      background: #15181f;
      border: 1px solid var(--line);
      border-radius: 10px;
      color: var(--ink);
      font-weight: 700;
    }
    .side-actions .quiet:hover { border-color: var(--accent); color: var(--ink); }
    .side-actions .quiet.danger { color: #e0a090; }
    .toolbar {
      display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
      gap: 10px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
    }
    /* Toolbar stable Build order (Modifier + trait) + lecture ↔ édition */
    #tab-builds > .toolbar {
      flex-wrap: nowrap;
      align-items: center;
      min-height: 49px;
      box-sizing: border-box;
    }
    #tab-builds > .toolbar .tool-group:first-child {
      flex: 1 1 auto;
      min-width: 0;
      flex-wrap: nowrap;
    }
    #tab-builds > .toolbar .tool-group:last-child {
      flex: 0 0 auto;
      margin-left: auto;
    }
    #tab-builds > .toolbar #gameMode {
      flex-shrink: 0;
      white-space: nowrap;
    }
    /* Emplacement fixe « Modifier » / « Terminer » */
    #tab-builds > .toolbar #toggleEdit {
      box-sizing: border-box;
      width: 88px;
      height: 36px;
      padding: 0 12px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      white-space: nowrap;
    }
    .conseil-strategie {
      flex: 0 0 auto;
    }
    .strategie-block-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin: 0 0 8px;
    }
    .strategie-block-head h3 {
      font-family: Cinzel, serif;
      font-size: 18px;
      margin: 0;
      letter-spacing: .03em;
    }
    .conseil-strategie .toolbar {
      flex-wrap: nowrap;
      align-items: center;
      min-height: 36px;
      margin: 0;
      padding: 0;
      border: none;
    }
    .conseil-strategie #editPlan {
      box-sizing: border-box;
      width: 88px;
      height: 36px;
      padding: 0 12px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      white-space: nowrap;
    }
    .tool-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
    .toolbar .ctrl { font-size: 14px; padding: 8px 12px; }
    footer {
      display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
      margin-top: 18px; color: var(--muted); font-size: 13px;
    }
    footer .foot-note { margin-left: 0; }
    .sync-status {
      font-size: 13px; color: var(--muted); min-height: 1.35em; margin: 0 0 10px;
    }
    .sync-status[data-kind="ok"] { color: color-mix(in srgb, var(--accent) 55%, #8fdf9a); }
    .sync-status[data-kind="err"] { color: #e0a090; }
    .sync-status[data-kind="busy"] { color: var(--muted); }
    .app-toast {
      position: fixed;
      left: 50%;
      bottom: 24px;
      transform: translateX(-50%) translateY(120%);
      z-index: 10050;
      max-width: min(92vw, 420px);
      padding: 12px 16px;
      border-radius: 10px;
      background: color-mix(in srgb, var(--panel) 92%, #000);
      border: 1px solid var(--line);
      color: var(--ink);
      font-size: 14px;
      line-height: 1.45;
      box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
      opacity: 0;
      pointer-events: none;
      transition: transform 0.22s ease, opacity 0.22s ease;
    }
    .app-toast.show {
      transform: translateX(-50%) translateY(0);
      opacity: 1;
    }
    .app-toast[data-kind="ok"] {
      border-color: color-mix(in srgb, var(--good) 45%, var(--line));
    }
    .app-toast[data-kind="err"] {
      border-color: color-mix(in srgb, #e08a7a 50%, var(--line));
    }
    .notes-corrupt-bar {
      margin: 0 0 12px;
      padding: 12px 14px;
      border: 1px solid color-mix(in srgb, #e08a7a 45%, var(--line));
      border-radius: 10px;
      background: color-mix(in srgb, #e08a7a 12%, var(--panel));
    }
    .notes-corrupt-bar p {
      margin: 0 0 10px;
      color: var(--ink);
      font-size: 14px;
      line-height: 1.45;
    }
    .sync-code {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 1.15rem; letter-spacing: .08em; text-align: center;
      padding: 12px 10px; margin: 12px 0; border: 1px solid var(--line);
      background: color-mix(in srgb, var(--bg) 88%, black); user-select: all;
    }
    .sync-confirm {
      display: flex; align-items: flex-start; gap: 8px; margin-top: 12px;
      font-size: 14px; color: var(--ink); cursor: pointer;
    }
    .sync-confirm input { margin-top: 3px; }
    .data-actions {
      display: flex; flex-wrap: wrap; gap: 8px;
    }
    .data-actions .ctrl { min-width: 0; }
    .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
    .field label { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
    input, textarea, select {
      background: #10131a !important;
      color: var(--ink) !important;
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 8px 10px;
      font: inherit;
      width: 100%;
      color-scheme: dark;
      caret-color: var(--ink);
    }
    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus {
      -webkit-text-fill-color: var(--ink);
      transition: background-color 9999s ease-in-out 0s;
      box-shadow: 0 0 0 1000px #10131a inset;
    }
    textarea { min-height: 64px; resize: vertical; }
    .edit-row {
      display: grid;
      grid-template-columns: 22px 90px 78px minmax(0, 1fr) 40px;
      gap: 6px;
      align-items: center;
      margin-bottom: 8px;
      background: #15181f;
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 8px;
    }
    .edit-row input { padding: 7px 8px; min-width: 0; }
    .edit-row label.age-flag {
      display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 600;
    }
    .edit-row label.age-flag input { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
    .edit-head {
      display: grid;
      grid-template-columns: 22px 90px 78px minmax(0, 1fr) 40px;
      gap: 6px;
      font-size: 11px;
      color: var(--muted);
      padding: 0 8px 6px;
      font-weight: 700;
      letter-spacing: .04em;
      text-transform: uppercase;
    }
    .age-badge { font-size: 15px; font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 2px; }
    .tabs {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0;
      margin: -4px -16px 16px;
      padding: 0 8px;
      border-bottom: 1px solid var(--line);
    }
    .tabs button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      background: transparent;
      border: none;
      border-bottom: 2px solid transparent;
      border-radius: 0;
      color: var(--muted);
      font-family: Cinzel, serif;
      font-size: 13px;
      font-weight: 700;
      letter-spacing: .06em;
      text-transform: uppercase;
      padding: 12px 6px 10px;
      cursor: pointer;
      line-height: 1.25;
      white-space: normal;
    }
    .tabs button .tab-icon {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
      background-color: currentColor;
      -webkit-mask: url("../assets/tab-salle.png") center / contain no-repeat;
      mask: url("../assets/tab-salle.png") center / contain no-repeat;
    }
    .tabs button:hover { color: var(--ink); }
    .tabs button.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
      background: transparent;
    }
    .book h3 { font-family: Cinzel, serif; font-size: 18px; margin: 18px 0 8px; }
    .book p, .book li { color: var(--ink); line-height: 1.6; font-size: 16px; }
    .book ul { margin: 0 0 8px; padding-left: 18px; }
    .book .chip {
      display: inline-block; margin: 0 6px 6px 0; padding: 4px 8px; border: 1px solid var(--line);
      border-radius: 999px; font-size: 12px; color: var(--ink);
    }
    #notesBox { min-height: 180px; }

    /* Salle de conseil */
    .conseil {
      display: flex;
      flex-direction: column;
      gap: 0;
    }
    .conseil-chamber {
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 14px;
      flex: 1;
    }
    .conseil-stage {
      /* Places autour de la table */
      --table-top: 46%;
      --table-width: 50%;
      --table-height: 23%;
      --c0-x: 20%;
      --c0-y: 13%;
      --c1-x: 32%;
      --c1-y: 8%;
      --c2-y: 6%;
      --c3-x: 32%;
      --c3-y: 8%;
      --c4-x: 20%;
      --c4-y: 13%;
      --player-bottom: 12%;
      --presenter-top: 10%;
      --presenter-gap: 10px;
      position: relative;
      flex: 0 0 auto;
      width: 100%;
      height: 420px;
      min-height: 420px;
      max-height: 420px;
      border: 1px solid color-mix(in srgb, var(--line) 85%, var(--accent));
      border-radius: 14px;
      overflow: hidden;
      background:
        radial-gradient(ellipse 80% 55% at 50% 42%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        linear-gradient(180deg,
          color-mix(in srgb, var(--panel) 70%, #0a0c10) 0%,
          color-mix(in srgb, var(--bg) 55%, #151820) 55%,
          color-mix(in srgb, var(--panel) 80%, #0d1016) 100%);
      box-shadow: inset 0 0 60px color-mix(in srgb, #000 35%, transparent);
    }
    .conseil-stage-glow {
      position: absolute;
      inset: 0;
      background:
        radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 40%),
        radial-gradient(circle at 80% 15%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 45%);
      pointer-events: none;
    }
    .conseil-table {
      position: absolute;
      left: 50%;
      top: var(--table-top);
      width: min(var(--table-width), 400px);
      height: var(--table-height);
      transform: translate(-50%, -50%) scale(.96);
      border-radius: 50%;
      background:
        radial-gradient(ellipse at 50% 40%,
          color-mix(in srgb, var(--accent-2) 55%, #3a2a18) 0%,
          color-mix(in srgb, var(--accent-2) 30%, #24180f) 55%,
          #1a120c 100%);
      border: 2px solid color-mix(in srgb, var(--accent) 45%, #2a2010);
      box-shadow:
        0 10px 24px color-mix(in srgb, #000 45%, transparent),
        inset 0 2px 8px color-mix(in srgb, var(--accent) 18%, transparent);
      opacity: 0;
      transition: opacity .65s ease, transform .65s cubic-bezier(.2, .8, .2, 1);
      pointer-events: none;
    }
    .conseil-stage.is-seated .conseil-table {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1.02);
    }
    .conseil-table-emblem {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: min(48%, 72px);
      height: min(64%, 58px);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity .55s ease .15s;
      pointer-events: none;
    }
    .conseil-stage.is-seated .conseil-table-emblem {
      opacity: .7;
    }
    .conseil-table-emblem::before {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 70%;
      height: 70%;
      transform: translate(-50%, -50%);
      border-radius: 50%;
      background: radial-gradient(circle,
        color-mix(in srgb, #000 35%, transparent) 0%,
        transparent 70%);
      pointer-events: none;
    }
    .conseil-table-emblem svg {
      position: relative;
      display: block;
      width: 100%;
      height: 100%;
      max-width: 64px;
      max-height: 54px;
      fill: color-mix(in srgb, var(--accent) 75%, #f0e6c8);
      stroke: color-mix(in srgb, var(--accent) 75%, #f0e6c8);
      filter: drop-shadow(0 1px 3px color-mix(in srgb, #000 55%, transparent));
    }

    .conseil-seat {
      --seat-move: left 1.2s cubic-bezier(.22, .82, .25, 1), right 1.2s cubic-bezier(.22, .82, .25, 1), top 1.2s cubic-bezier(.22, .82, .25, 1), bottom 1.2s cubic-bezier(.22, .82, .25, 1), transform 1.2s cubic-bezier(.22, .82, .25, 1), width .6s ease, opacity .4s ease;
      position: absolute;
      display: flex;
      /* Libellé au-dessus de la tête (comme sur le croquis) */
      flex-direction: column-reverse;
      align-items: center;
      gap: 8px;
      width: 84px;
      opacity: 0;
      transform: translateY(12px) scale(.92);
      pointer-events: none;
      z-index: 2;
      transition: var(--seat-move);
    }
    .conseil-stage.is-seated .conseil-seat[data-seat^="c"] {
      pointer-events: auto;
      cursor: pointer;
    }
    .conseil-stage.is-seated .conseil-seat[data-seat^="c"]:hover .conseil-figure:not(.is-speak-pop) {
      transform: scale(1.05);
    }
    .conseil-stage.is-seated .conseil-seat[data-seat^="c"]:hover .conseil-figure::before {
      opacity: .55;
      transform: scale(.92);
    }
    .conseil-stage.is-seated .conseil-seat[data-seat^="c"]:hover .conseil-seat-label {
      color: var(--accent);
      opacity: 1;
    }
    .conseil-stage.is-seated .conseil-seat[data-seat^="c"]:hover .conseil-seat-label .seat-given {
      color: var(--accent);
    }
    .conseil-stage.is-seated .conseil-seat[data-seat^="c"]:focus-visible {
      outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
      outline-offset: 4px;
    }
    .conseil-stage.is-seated .conseil-seat {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    /* Départ hors scène → marche jusqu’au siège (transform relatif à la place finale) */
    .conseil-stage.is-seated .seat-c0.is-entering {
      transform: translate(-200%, 40%) scale(.9);
    }
    .conseil-stage.is-seated .seat-c1.is-entering {
      transform: translate(-120%, -160%) scale(.9);
    }
    .conseil-stage.is-seated .seat-c2.is-entering {
      transform: translate(-50%, -180%) scale(.9);
    }
    .conseil-stage.is-seated .seat-c3.is-entering {
      transform: translate(120%, -160%) scale(.9);
    }
    .conseil-stage.is-seated .seat-c4.is-entering {
      transform: translate(200%, 40%) scale(.9);
    }
    .conseil-stage.is-seated .seat-player.is-entering {
      transform: translate(-50%, 160%) scale(.9);
    }
    /* Décalage d’arrivée : ils ne partent pas tous en même temps */
    .conseil-stage.is-gathering .seat-c0 { transition-delay: 0s; }
    .conseil-stage.is-gathering .seat-c4 { transition-delay: .1s; }
    .conseil-stage.is-gathering .seat-c1 { transition-delay: .18s; }
    .conseil-stage.is-gathering .seat-c3 { transition-delay: .26s; }
    .conseil-stage.is-gathering .seat-c2 { transition-delay: .12s; }
    .conseil-stage.is-gathering .seat-player { transition-delay: .4s; }
    .conseil-stage.is-gathering .conseil-seat-label {
      opacity: 0 !important;
      transition: opacity .35s ease .75s;
    }
    .conseil-stage.is-seated.is-gathering .conseil-seat-label {
      opacity: .9 !important;
    }

    /* Vue présentation : un seul conseiller face caméra, sans table */
    .conseil-stage.is-presenting .conseil-table {
      opacity: 0;
      transform: translate(-50%, -50%) scale(.9);
    }
    .conseil-stage.is-presenting .conseil-seat {
      opacity: 0;
      pointer-events: none;
      animation: none;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter {
      left: 50% !important;
      right: auto !important;
      top: var(--presenter-top) !important;
      bottom: auto !important;
      width: 120px;
      opacity: 1;
      transform: translateX(-50%) scale(1);
      animation: conseil-presenter-in .6s cubic-bezier(.2, .8, .2, 1) both;
      z-index: 3;
      pointer-events: auto;
      cursor: pointer;
      gap: var(--presenter-gap);
    }
    /* Pas de scale « speaking » en présentation : il mange le titre/nom */
    .conseil-stage.is-presenting .conseil-seat.is-presenter.speaking .conseil-figure {
      transform: none;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .conseil-figure {
      width: 72px;
      height: 112px;
      flex-shrink: 0;
      overflow: visible;
      box-sizing: border-box;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .figure-hat {
      width: 38px;
      height: 22px;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .figure-head {
      width: 30px;
      height: 30px;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .figure-body {
      width: 54px;
      height: 56px;
      margin-top: 4px;
      border-radius: 24px 24px 12px 12px;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .conseil-figure::before {
      width: 96px;
      height: 96px;
      margin-left: -48px;
      margin-top: -48px;
      top: 38%;
      opacity: .55;
      transform: scale(1);
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .conseil-seat-label {
      opacity: 1;
      max-width: 140px;
      font-size: 11px;
      margin: 0;
      position: relative;
      z-index: 2;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .conseil-seat-label .seat-title {
      font-size: 10px;
    }
    .conseil-stage.is-presenting .conseil-seat.is-presenter .conseil-seat-label .seat-given {
      font-size: 14px;
    }
    @keyframes conseil-presenter-in {
      from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.88); }
      to { opacity: 1; transform: translateX(-50%) scale(1); }
    }

    /* Croquis : 5 serrés derrière la table ronde, face au joueur (sud) */
    .seat-c0 { left: var(--c0-x); top: var(--c0-y); }
    .seat-c1 { left: var(--c1-x); top: var(--c1-y); }
    .seat-c2 { left: 50%; top: var(--c2-y); transform: translateX(-50%) translateY(12px) scale(.92); }
    .seat-c3 { right: var(--c3-x); left: auto; top: var(--c3-y); }
    .seat-c4 { right: var(--c4-x); left: auto; top: var(--c4-y); }
    .seat-player { left: 50%; bottom: var(--player-bottom); top: auto; transform: translateX(-50%) translateY(12px) scale(.92); }
    .conseil-stage.is-seated .seat-c2 {
      transform: translateX(-50%) translateY(0) scale(1);
    }
    .conseil-stage.is-seated .seat-player {
      transform: translateX(-50%) translateY(0) scale(1);
    }
    /* Le présentateur glisse de sa place centrale vers son siège à table */
    .conseil-stage.is-seated .conseil-seat.is-presenter {
      opacity: 1;
      transition: var(--seat-move);
      transition-delay: .05s;
    }
    .conseil-stage.is-seated .seat-c2.is-presenter {
      transform: translateX(-50%) translateY(0) scale(1);
    }
    .conseil-seat.speaking {
      z-index: 4;
    }
    .conseil-seat.speaking .conseil-figure {
      transform: scale(1.07);
    }
    .conseil-seat.speaking .conseil-figure::before {
      opacity: .9;
      transform: scale(1);
    }
    /* Petit sursaut dès qu’il prend la parole (un seul bond, discret) */
    .conseil-figure.is-speak-pop {
      animation: conseil-speak-pop .38s cubic-bezier(.25, .8, .35, 1) both !important;
    }
    /* Pas de sursaut pendant la marche jusqu’à la table */
    .conseil-stage.is-gathering .conseil-figure.is-speak-pop {
      animation: none !important;
    }
    /* En présentation, le pop finit en scale et recouvre le libellé */
    .conseil-stage.is-presenting .conseil-figure.is-speak-pop {
      animation: none !important;
    }
    @keyframes conseil-speak-pop {
      0% { transform: scale(1) translateY(0); }
      40% { transform: scale(1.08) translateY(-7px); }
      100% { transform: scale(1.07) translateY(0); }
    }
    .conseil-seat.thinking .conseil-figure::after {
      content: "";
      position: absolute;
      top: -6px;
      right: -4px;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent);
      animation: conseil-think 1s ease-in-out infinite;
    }
    @keyframes conseil-think {
      0%, 100% { opacity: .35; transform: scale(.85); }
      50% { opacity: 1; transform: scale(1.15); }
    }

    /* Concertation : petit cercle asymétrique, juste au-dessus de la table */
    .conseil-stage.is-huddling.is-seated .conseil-seat[data-seat^="c"] {
      gap: 0;
    }
    /* Cercle irrégulier autour du centre (pas un alignement) */
    .conseil-stage.is-huddling.is-seated .seat-c0 {
      left: 39%;
      top: 17%;
      transform: translateY(0) scale(1);
      transition: var(--seat-move);
      transition-duration: .65s;
    }
    .conseil-stage.is-huddling.is-seated .seat-c1 {
      left: 43%;
      top: 11%;
      transform: translate(2px, 0) scale(1);
      transition: var(--seat-move);
      transition-duration: .65s;
    }
    .conseil-stage.is-huddling.is-seated .seat-c2 {
      left: 52%;
      top: 9%;
      transform: translateX(-50%) translateY(3px) scale(1);
      transition: var(--seat-move);
      transition-duration: .65s;
    }
    .conseil-stage.is-huddling.is-seated .seat-c3 {
      right: 38%;
      left: auto;
      top: 12%;
      transform: translate(-2px, 5px) scale(1);
      transition: var(--seat-move);
      transition-duration: .65s;
    }
    .conseil-stage.is-huddling.is-seated .seat-c4 {
      right: 40%;
      left: auto;
      top: 18%;
      transform: translate(4px, -2px) scale(1);
      transition: var(--seat-move);
      transition-duration: .65s;
    }
    /* Titres/noms : disparition totale (plus d’espace réservé non plus) */
    .conseil-stage.is-huddling .conseil-seat[data-seat^="c"] .conseil-seat-label {
      opacity: 0 !important;
      visibility: hidden;
      height: 0 !important;
      max-height: 0 !important;
      overflow: hidden;
      margin: 0 !important;
      padding: 0 !important;
      line-height: 0;
      gap: 0;
      pointer-events: none;
      transition: opacity .2s ease;
    }
    /* Micro-mouvement aléatoire (via --fidget-x/y en JS), sans dérive ni éparpillement */
    .conseil-stage.is-huddling .conseil-seat[data-seat^="c"] .conseil-figure {
      transform: translate(var(--fidget-x, 0px), var(--fidget-y, 0px));
      transition: transform 1.35s ease-in-out;
    }
    .conseil-stage.is-huddling .conseil-seat[data-seat^="c"] .conseil-figure::before {
      opacity: .55;
      transform: scale(.95);
    }
    .conseil-stage.is-huddling .conseil-flavor {
      font-size: 12px;
      color: color-mix(in srgb, var(--accent) 70%, var(--ink));
      opacity: 0;
      animation: conseil-flavor-float 1.8s ease-out forwards;
      z-index: 6;
    }

    .conseil-figure {
      position: relative;
      width: 44px;
      height: 64px;
      display: flex;
      flex-direction: column;
      align-items: center;
      transform: scale(1);
      transition: transform .45s cubic-bezier(.22, 1, .36, 1), width .45s ease, height .45s ease;
    }
    .conseil-figure::before {
      content: "";
      position: absolute;
      left: 50%;
      top: 42%;
      width: 64px;
      height: 64px;
      margin-left: -32px;
      margin-top: -32px;
      border-radius: 50%;
      background: radial-gradient(circle,
        color-mix(in srgb, var(--accent) 55%, transparent) 0%,
        color-mix(in srgb, var(--accent) 18%, transparent) 45%,
        transparent 70%);
      opacity: 0;
      transform: scale(.7);
      transition: opacity .45s ease, transform .45s cubic-bezier(.22, 1, .36, 1);
      pointer-events: none;
      z-index: -1;
    }
    /* Chapeau conseiller : bord large + dôme (clip-path, comme la couronne) */
    .figure-hat {
      display: block;
      width: 26px;
      height: 13px;
      margin-bottom: -5px;
      background: color-mix(in srgb, var(--ink) 40%, #3a3428);
      clip-path: polygon(
        0% 100%,
        0% 82%,
        10% 74%,
        16% 48%,
        24% 30%,
        36% 18%,
        50% 12%,
        64% 18%,
        76% 30%,
        84% 48%,
        90% 74%,
        100% 82%,
        100% 100%
      );
      filter: drop-shadow(0 1px 2px color-mix(in srgb, #000 40%, transparent));
      opacity: .95;
      position: relative;
      transition: width .45s ease, height .45s ease;
    }
    .figure-crown {
      display: block;
      width: 22px;
      height: 12px;
      margin-bottom: -2px;
      background: var(--accent);
      clip-path: polygon(0% 100%, 0% 40%, 18% 70%, 35% 15%, 50% 55%, 65% 15%, 82% 70%, 100% 40%, 100% 100%);
      filter: drop-shadow(0 1px 2px color-mix(in srgb, #000 40%, transparent));
    }
    .figure-head {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: color-mix(in srgb, var(--ink) 18%, #1a1c22);
      border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
      box-shadow: inset 0 -2px 4px color-mix(in srgb, #000 35%, transparent);
      transition: width .45s ease, height .45s ease;
    }
    .figure-body {
      width: 34px;
      height: 36px;
      margin-top: 2px;
      border-radius: 16px 16px 8px 8px;
      background: linear-gradient(180deg,
        color-mix(in srgb, var(--ink) 22%, #22262e),
        color-mix(in srgb, #121418 80%, var(--accent-2)));
      border: 1px solid color-mix(in srgb, var(--line) 70%, var(--accent));
      transition: width .45s ease, height .45s ease, margin-top .45s ease, border-radius .45s ease;
    }
    /* Icône de spécialité : épaule visuelle gauche du sprite (côté left) */
    .figure-specialty {
      position: absolute;
      top: 26px;
      left: -7px;
      right: auto;
      width: 30px;
      height: 30px;
      object-fit: contain;
      pointer-events: none;
      z-index: 2;
      opacity: 0;
      visibility: hidden;
      transition: opacity .35s ease, visibility .35s ease, width .45s ease, height .45s ease, top .45s ease, left .45s ease;
      filter: drop-shadow(0 1px 2px color-mix(in srgb, #000 55%, transparent));
    }
    /* Visible uniquement à table, hors concertation (pas en vue présentateur) */
    .conseil-stage.is-seated:not(.is-huddling) .conseil-seat[data-seat^="c"] .figure-specialty:not([hidden]) {
      opacity: 1;
      visibility: visible;
    }
    .conseil-stage.is-huddling .conseil-seat[data-seat^="c"] .figure-specialty {
      opacity: 0;
      visibility: hidden;
    }
    .conseil-stage.is-presenting .figure-specialty {
      opacity: 0 !important;
      visibility: hidden !important;
    }
    .conseil-figure.ruler .figure-head {
      background: color-mix(in srgb, var(--accent) 28%, #2a2418);
      border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    }
    .conseil-figure.ruler .figure-body {
      background: linear-gradient(180deg,
        color-mix(in srgb, var(--accent) 35%, #2a2418),
        color-mix(in srgb, var(--accent-2) 40%, #15120e));
      border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
    }
    .conseil-seat-label {
      font-family: Cinzel, serif;
      font-size: 9px;
      letter-spacing: .04em;
      text-transform: uppercase;
      color: var(--muted);
      text-align: center;
      max-width: 84px;
      line-height: 1.15;
      opacity: 0;
      transition: opacity .35s ease .2s, color .2s ease;
      display: flex;
      flex-direction: column;
      gap: 1px;
    }
    .conseil-seat-label .seat-title {
      font-size: 8px;
      letter-spacing: .06em;
      opacity: .85;
    }
    .conseil-seat-label .seat-given {
      font-size: 10px;
      letter-spacing: .03em;
      color: var(--ink);
      text-transform: none;
      font-family: "Source Sans 3", sans-serif;
      font-weight: 600;
    }
    .conseil-stage.is-seated .conseil-seat-label { opacity: .9; }
    .conseil-seat.speaking .conseil-seat-label {
      color: var(--accent);
      opacity: 1;
      transition: color .45s ease, opacity .45s ease;
    }
    .conseil-seat.speaking .conseil-seat-label .seat-given {
      color: var(--accent);
      transition: color .45s ease;
    }

    .conseil-bubble {
      position: absolute;
      z-index: 5;
      width: min(260px, 70%);
      max-width: 280px;
      padding: 10px 12px 12px;
      border-radius: 12px;
      border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
      background: color-mix(in srgb, var(--panel) 92%, #0a0c10);
      box-shadow: 0 8px 22px color-mix(in srgb, #000 40%, transparent);
      opacity: 0;
      transition: opacity .28s ease;
      pointer-events: auto;
      --arrow-x: 50%;
    }
    .conseil-bubble.is-visible {
      opacity: 1;
    }
    .conseil-bubble::after {
      content: "";
      position: absolute;
      left: var(--arrow-x);
      width: 0;
      height: 0;
      margin-left: -8px;
      border-left: 8px solid transparent;
      border-right: 8px solid transparent;
      bottom: -10px;
      border-top: 10px solid color-mix(in srgb, var(--accent) 40%, var(--line));
      background: transparent;
      transform: none;
    }
    .conseil-bubble::before {
      content: "";
      position: absolute;
      left: var(--arrow-x);
      width: 0;
      height: 0;
      margin-left: -7px;
      border-left: 7px solid transparent;
      border-right: 7px solid transparent;
      bottom: -8px;
      border-top: 8px solid color-mix(in srgb, var(--panel) 92%, #0a0c10);
      z-index: 1;
    }
    .conseil-bubble[data-side="below"]::after {
      top: -10px;
      bottom: auto;
      border-top: none;
      border-bottom: 10px solid color-mix(in srgb, var(--accent) 40%, var(--line));
    }
    .conseil-bubble[data-side="below"]::before {
      top: -8px;
      bottom: auto;
      border-top: none;
      border-bottom: 8px solid color-mix(in srgb, var(--panel) 92%, #0a0c10);
    }
    /* Didascalies d’ambiance pendant l’entretien (sous les bulles) */
    .conseil-flavor {
      position: absolute;
      z-index: 4;
      transform: translate(-50%, 6px);
      font-family: "Source Sans 3", sans-serif;
      font-style: italic;
      font-size: 12px;
      font-weight: 400;
      letter-spacing: .02em;
      color: color-mix(in srgb, var(--muted) 75%, var(--accent));
      white-space: nowrap;
      pointer-events: none;
      text-shadow: 0 1px 2px color-mix(in srgb, #000 45%, transparent);
      opacity: 0;
      animation: conseil-flavor-float 2.2s ease-out forwards;
    }
    @keyframes conseil-flavor-float {
      0% { opacity: 0; transform: translate(-50%, 8px); }
      18% { opacity: .88; transform: translate(-50%, 0); }
      65% { opacity: .7; transform: translate(-50%, -16px); }
      100% { opacity: 0; transform: translate(-50%, -30px); }
    }

    .conseil-bubble-who {
      display: block;
      font-family: Cinzel, serif;
      font-size: 10px;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 2px;
    }
    .conseil-bubble-spec {
      display: block;
      font-family: Cinzel, serif;
      font-size: 9px;
      letter-spacing: .04em;
      color: var(--muted);
      margin-bottom: 6px;
      opacity: .85;
    }
    .conseil-bubble-spec.hidden { display: none !important; }
    .conseil-bubble-text {
      margin: 0;
      font-size: 14px;
      line-height: 1.45;
      color: var(--ink);
      white-space: pre-wrap;
    }
    .conseil-bubble-text .res-ico {
      display: inline-block;
      width: 1.25em;
      height: 1.25em;
      vertical-align: -0.28em;
      margin: 0 2px;
      object-fit: contain;
    }
    .conseil-bubble-footer {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin-top: 10px;
      flex-wrap: wrap;
    }
    .conseil-bubble-footer.hidden { display: none !important; }
    .conseil-bubble-page {
      font-family: Cinzel, serif;
      font-size: 11px;
      letter-spacing: .06em;
      color: var(--muted);
      min-width: 2.5em;
      text-align: center;
    }
    .conseil-bubble-page.hidden { display: none !important; }
    .conseil-bubble-ok {
      display: block;
      margin: 0;
      min-width: 72px;
      padding: 5px 16px;
      font-size: 13px;
    }
    .conseil-bubble-ok.hidden { display: none !important; }

    .conseil-lobby {
      position: absolute;
      inset: 0;
      z-index: 6;
      background: radial-gradient(ellipse at center, color-mix(in srgb, var(--bg) 25%, transparent), color-mix(in srgb, #000 35%, transparent));
      transition: opacity .35s ease;
      pointer-events: none;
    }
    .conseil-lobby .game-launch {
      position: absolute;
      left: 50%;
      top: 46%;
      transform: translate(-50%, -50%);
      min-width: 220px;
      padding: 14px 26px;
      font-size: 16px;
      animation: conseil-lobby-pulse 2.4s ease-in-out infinite;
      pointer-events: auto;
      margin: 0;
    }
    @keyframes conseil-lobby-pulse {
      0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
      50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 12%, transparent); }
    }

    .conseil-controls {
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-height: 160px;
    }
    .conseil-cta {
      display: flex;
      justify-content: center;
      padding: 4px 0 8px;
    }
    .conseil-cta .game-launch {
      min-width: 200px;
      padding: 12px 22px;
      font-size: 15px;
    }
    .conseil-interview {
      display: flex;
      flex-direction: column;
    }
    .conseil-interview-inner {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .conseil-interview-progress {
      display: flex;
      align-items: center;
      gap: 12px;
      font-size: 12px;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--muted);
      font-family: Cinzel, serif;
    }
    .conseil-progress-track {
      flex: 1;
      height: 4px;
      border-radius: 999px;
      background: color-mix(in srgb, var(--line) 80%, transparent);
      overflow: hidden;
    }
    .conseil-progress-bar {
      height: 100%;
      background: var(--accent);
      border-radius: 999px;
      transition: width .2s ease;
    }
    .conseil-answer {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .conseil-answer-text {
      width: 100%;
      min-height: 48px;
    }
    textarea.conseil-answer-text {
      min-height: 88px;
      resize: vertical;
    }
    .conseil-opts {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .conseil-opt {
      background: transparent;
      border: 1px solid var(--line);
      border-radius: 8px;
      color: var(--muted);
      font-family: "Source Sans 3", sans-serif;
      font-size: 13px;
      padding: 7px 12px;
      cursor: pointer;
      transition: border-color .15s, color .15s, background .15s;
    }
    .conseil-opt:hover {
      color: var(--ink);
      border-color: color-mix(in srgb, var(--line) 50%, var(--accent));
    }
    .conseil-opt.on {
      color: var(--ink);
      border-color: var(--accent);
      background: color-mix(in srgb, var(--accent) 14%, transparent);
    }
    .conseil-interview-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      justify-content: space-between;
      align-items: center;
      padding-top: 8px;
      border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    }
    .conseil-interview-actions .game-launch {
      margin-left: auto;
    }
    .conseil-chat {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .conseil-chat-bar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-end;
      gap: 10px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--line);
    }
    .conseil-chat-actions {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 6px;
    }
    .conseil-rp-pop {
      position: fixed;
      z-index: 80;
      width: min(240px, calc(100vw - 24px));
      padding: 10px 28px 10px 12px;
      border-radius: 10px;
      border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
      background: color-mix(in srgb, var(--panel) 94%, #0a0c10);
      box-shadow: 0 8px 20px color-mix(in srgb, #000 35%, transparent);
      pointer-events: auto;
    }
    .conseil-rp-pop h3 {
      font-family: Cinzel, serif;
      font-size: 14px;
      letter-spacing: .03em;
      margin: 0 0 4px;
      color: var(--ink);
    }
    .conseil-rp-role {
      margin: 0 0 6px;
      font-family: Cinzel, serif;
      font-size: 11px;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--accent);
    }
    .conseil-rp-text {
      margin: 0;
      font-size: 13px;
      line-height: 1.4;
      color: var(--muted);
    }
    .conseil-rp-x {
      position: absolute;
      top: 4px;
      right: 6px;
      width: 44px;
      height: 44px;
      border: none;
      background: transparent;
      color: var(--muted);
      font-size: 22px;
      line-height: 1;
      cursor: pointer;
      padding: 0;
    }
    .conseil-rp-x:hover { color: var(--ink); }

    /* Journal des entretiens Conseil — FAB bas-droite de la fenêtre scène.
       Spécificité button.ctrl.* requise : sinon le padding de button.ctrl (10×12)
       gagne et l’icône 42px déborde, puis est coupée par .conseil-stage { overflow:hidden }. */
    button.ctrl.conseil-journal-fab {
      --conseil-journal-inset: 10px;
      position: absolute;
      right: var(--conseil-journal-inset);
      bottom: var(--conseil-journal-inset);
      z-index: 8;
      width: 48px;
      height: 48px;
      padding: 3px;
      border-radius: 12px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 8px 22px color-mix(in srgb, #000 40%, transparent);
    }
    button.ctrl.conseil-journal-fab img {
      width: 40px;
      height: 40px;
      object-fit: contain;
      pointer-events: none;
    }
    button.ctrl.conseil-journal-fab:hover {
      border-color: color-mix(in srgb, var(--line) 45%, var(--accent));
      background: color-mix(in srgb, var(--accent) 10%, #15181f);
    }
    .conseil-journal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 55;
      display: flex;
      justify-content: flex-end;
      align-items: stretch;
      padding: 0;
      background: rgba(8, 9, 12, .62);
      backdrop-filter: blur(2px);
      -webkit-backdrop-filter: blur(2px);
    }
    .conseil-journal-backdrop.hidden { display: none; }
    .conseil-journal-panel {
      position: relative;
      width: min(420px, 100vw);
      height: 100%;
      max-height: 100dvh;
      margin: 0;
      border-radius: 16px 0 0 16px;
      border-right: none;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      box-shadow: -12px 0 40px rgba(0, 0, 0, .45);
      animation: conseil-journal-in .18s ease-out;
    }
    @keyframes conseil-journal-in {
      from { opacity: 0; transform: translateX(18px); }
      to { opacity: 1; transform: none; }
    }
    .conseil-journal-head {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding-right: 36px;
      margin-bottom: 12px;
      flex-shrink: 0;
    }
    .conseil-journal-head h3 {
      font-family: Cinzel, serif;
      font-size: 18px;
      letter-spacing: .03em;
      margin: 0;
    }
    .conseil-journal-head .conseil-rp-x {
      top: 8px;
      right: 8px;
    }
    .conseil-journal-body {
      flex: 1;
      min-height: 0;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding-right: 2px;
      outline: none;
    }
    .conseil-journal-empty {
      margin: 24px 4px;
      color: var(--muted);
      font-size: 15px;
      line-height: 1.55;
    }
    .conseil-journal-day {
      margin: 0 0 18px;
    }
    .conseil-journal-day-title {
      font-family: Cinzel, serif;
      font-size: 13px;
      letter-spacing: .06em;
      text-transform: uppercase;
      color: var(--accent);
      margin: 0 0 10px;
      padding-bottom: 6px;
      border-bottom: 1px solid var(--line);
    }
    .conseil-journal-entry {
      margin: 0 0 12px;
      padding: 10px 12px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: color-mix(in srgb, var(--panel) 70%, #0a0c10);
    }
    .conseil-journal-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 6px 12px;
      margin: 0 0 8px;
      font-size: 12px;
      color: var(--muted);
    }
    .conseil-journal-q,
    .conseil-journal-a {
      margin: 0 0 8px;
      font-size: 14px;
      line-height: 1.5;
    }
    .conseil-journal-a { margin-bottom: 0; color: var(--muted); }
    .conseil-journal-q > strong,
    .conseil-journal-a > strong {
      display: block;
      font-family: Cinzel, serif;
      font-size: 11px;
      letter-spacing: .05em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 6px;
      font-weight: 600;
    }
    .conseil-journal-rich {
      color: inherit;
    }
    .conseil-journal-rich > p {
      margin: 0 0 0.55em;
    }
    .conseil-journal-rich > p:last-child {
      margin-bottom: 0;
    }
    .conseil-journal-spec {
      margin: 0 0 10px;
      padding: 8px 0 0;
      border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    }
    .conseil-journal-rich > .conseil-journal-spec:first-child {
      margin-top: 0;
      padding-top: 0;
      border-top: 0;
    }
    .conseil-journal-spec:last-child {
      margin-bottom: 0;
    }
    .conseil-journal-spec-head {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 0 0 6px;
      min-width: 0;
    }
    .conseil-journal-spec-ico {
      width: 22px;
      height: 22px;
      object-fit: contain;
      flex: 0 0 auto;
      border-radius: 4px;
    }
    .conseil-journal-spec-label {
      font-family: Cinzel, serif;
      font-size: 12px;
      letter-spacing: .04em;
      color: var(--text);
      font-weight: 600;
      min-width: 0;
    }
    .conseil-journal-spec-who {
      margin-left: auto;
      font-size: 12px;
      color: var(--muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 45%;
    }
    .conseil-journal-spec-body > p {
      margin: 0 0 0.55em;
    }
    .conseil-journal-spec-body > p:last-child {
      margin-bottom: 0;
    }
    .conseil-journal-list {
      margin: 0.25em 0 0.55em;
      padding-left: 1.2em;
    }
    .conseil-journal-list:last-child {
      margin-bottom: 0;
    }
    .conseil-journal-list li {
      margin: 0.2em 0;
    }
    .conseil-journal-em {
      display: inline;
      font-family: inherit;
      font-size: inherit;
      letter-spacing: inherit;
      text-transform: none;
      color: var(--text);
      font-weight: 600;
      margin: 0;
    }
    .conseil-compose {
      display: flex;
      gap: 8px;
      align-items: center;
    }
    .conseil-compose input {
      flex: 1;
      min-width: 0;
    }
    @media (max-width: 720px) {
      .tabs {
        grid-template-columns: repeat(2, 1fr);
        position: sticky;
        top: 0;
        z-index: 8;
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 4px;
        background: color-mix(in srgb, var(--panel) 94%, black);
      }
      .tabs button {
        font-size: 12px;
        padding: 12px 6px;
        letter-spacing: .03em;
        min-height: 44px;
      }
      .conseil-stage {
        height: min(360px, 58vh);
        min-height: 280px;
        max-height: 360px;
      }
      .conseil-seat { width: 64px; }
      .conseil-figure { width: 36px; height: 54px; }
      .figure-head { width: 15px; height: 15px; }
      .figure-body { width: 28px; height: 30px; }
      .figure-crown { width: 18px; height: 10px; }
      .figure-hat { width: 20px; height: 12px; }
      .figure-specialty {
        width: 24px;
        height: 24px;
        top: 20px;
        left: -6px;
        right: auto;
      }
      .conseil-seat-label { max-width: 72px; }
      .conseil-seat-label .seat-title { font-size: 9px; }
      .conseil-seat-label .seat-given { font-size: 11px; }
      .conseil-bubble { width: min(240px, 82%); }
      .conseil-bubble-text { font-size: 14px; }
      .conseil-bubble-ok { min-width: 72px; min-height: 40px; }
      .seat-c0 { left: 27%; top: 18%; }
      .seat-c1 { left: 35%; top: 10%; }
      .seat-c2 { top: 5%; }
      .seat-c3 { right: 35%; top: 10%; }
      .seat-c4 { right: 27%; left: auto; top: 18%; }
      .seat-player { bottom: 3%; }
      .conseil-stage.is-huddling.is-seated .seat-c0 {
        left: 36%;
        top: 18%;
        transform: translateY(0) scale(1);
      }
      .conseil-stage.is-huddling.is-seated .seat-c1 {
        left: 41%;
        top: 12%;
        transform: translate(2px, 0) scale(1);
      }
      .conseil-stage.is-huddling.is-seated .seat-c2 {
        left: 52%;
        top: 10%;
        transform: translateX(-50%) translateY(3px) scale(1);
      }
      .conseil-stage.is-huddling.is-seated .seat-c3 {
        right: 36%;
        left: auto;
        top: 13%;
        transform: translate(-2px, 4px) scale(1);
      }
      .conseil-stage.is-huddling.is-seated .seat-c4 {
        right: 38%;
        left: auto;
        top: 19%;
        transform: translate(3px, -2px) scale(1);
      }
      .conseil-stage.is-presenting .conseil-seat.is-presenter {
        width: 96px;
        gap: 12px;
      }
      .conseil-stage.is-presenting .conseil-seat.is-presenter .conseil-figure {
        width: 56px;
        height: 82px;
      }
      .conseil-stage.is-presenting .conseil-seat.is-presenter .figure-head {
        width: 24px;
        height: 24px;
      }
      .conseil-stage.is-presenting .conseil-seat.is-presenter .figure-body {
        width: 42px;
        height: 44px;
      }
      .conseil-compose {
        position: sticky;
        bottom: 0;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--panel) 94%, black);
      }
      .conseil-compose input,
      .conseil-compose .ctrl { min-height: 44px; }
    }

    .hidden { display: none !important; }
    .danger { color: #e08a7a !important; }
    .build-stage { margin-top: 8px; }
    .editor { display: none; margin-top: 0; }
    body.editing .editor { display: block; }
    body.editing #playView { display: none; }
    .editor-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
    .editor-fab {
      display: none;
      position: sticky;
      bottom: 12px;
      z-index: 5;
      justify-content: center;
      gap: 10px;
      margin: 16px auto 0;
      padding: 12px 16px;
      width: fit-content;
      max-width: 100%;
      border: 1px solid var(--line);
      border-left: 3px solid var(--accent);
      border-right: 3px solid var(--accent);
      border-radius: 12px;
      background: color-mix(in srgb, var(--accent) 7%, #15181f);
      box-shadow: 0 0 40px 22px rgba(0,0,0,.65), 0 8px 24px rgba(0,0,0,.45);
    }
    body.editing .editor-fab { display: flex; }
    .editor-fab .ctrl:hover {
      border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
      background: color-mix(in srgb, var(--accent) 6%, #15181f);
    }
    body.editing .build-add { display: none; }
    .modal-backdrop {
      position: fixed; inset: 0; z-index: 50;
      display: flex; align-items: center; justify-content: center; padding: 20px;
      background: rgba(8, 9, 12, .72);
      backdrop-filter: blur(2px);
    }
    .modal {
      width: min(420px, 100%);
      box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
      animation: modal-in .16s ease-out;
    }
    .settings-modal,
    .data-modal { width: min(460px, 100%); }
    @keyframes modal-in {
      from { opacity: 0; transform: translateY(10px) scale(.98); }
      to { opacity: 1; transform: none; }
    }
    .modal h3 { font-family: Cinzel, serif; font-size: 19px; letter-spacing: .03em; margin: 0 0 10px; }
    .modal h4 {
      font-family: Cinzel, serif; font-size: 14px; letter-spacing: .04em;
      margin: 0 0 6px; color: var(--ink); font-weight: 700;
    }
    .modal p,
    .modal-copy { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.6; }
    .modal p strong,
    .modal-copy strong { color: var(--ink); }
    .settings-section {
      margin: 0 0 16px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--line);
    }
    .settings-section:last-of-type { border-bottom: none; padding-bottom: 0; }
    .settings-hint {
      margin: 0 0 10px !important;
      font-size: 13px !important;
      line-height: 1.45 !important;
    }
    .settings-danger .ctrl.danger { margin-top: 2px; }
    .modal-backdrop-top { z-index: 60; }
    .reset-options {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin: 12px 0 14px;
      text-align: left;
    }
    .reset-option {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      color: var(--ink);
      font-size: 14px;
      line-height: 1.4;
      cursor: pointer;
    }
    .reset-option input {
      width: 16px;
      height: 16px;
      margin: 2px 0 0;
      accent-color: var(--accent);
      flex-shrink: 0;
    }
    .modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
    .modal-actions .ctrl { min-width: 108px; }
    .modal-actions .ctrl.danger { border-color: color-mix(in srgb, #e08a7a 45%, var(--line)); }
    body.game-open { overflow: hidden; }
    button.ctrl.game-launch {
      background: color-mix(in srgb, var(--accent) 86%, #1a1408);
      color: #16110a;
      border-color: transparent;
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 6px 16px color-mix(in srgb, var(--accent) 18%, transparent);
      transition: background .15s ease, opacity .22s ease;
    }
    button.ctrl.game-launch:hover {
      background: color-mix(in srgb, var(--accent) 100%, white 22%);
    }
    button.ctrl.game-launch:disabled,
    button.ctrl.game-launch:disabled:hover {
      opacity: .45;
      cursor: not-allowed;
      color: #16110a;
      background: color-mix(in srgb, var(--accent) 50%, #1a1408);
      /* Garde l’ombre pour que le bouton ne « rétrécisse » pas visuellement */
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 6px 16px color-mix(in srgb, var(--accent) 18%, transparent);
    }
    .game-backdrop {
      position: fixed; inset: 0; z-index: 40;
      display: flex; align-items: center; justify-content: center;
      padding: 22px;
      background: color-mix(in srgb, var(--bg) 55%, rgba(0,0,0,.55));
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
    .game-sheet {
      position: relative;
      width: min(1520px, calc(100vw - 36px));
      height: min(920px, calc(100vh - 36px));
      height: min(920px, calc(100dvh - 36px));
      display: flex; flex-direction: column;
      background: color-mix(in srgb, var(--panel) 94%, black);
      border: 1px solid var(--line);
      border-radius: 20px;
      box-shadow: 0 28px 80px rgba(0,0,0,.55);
      overflow: hidden;
      animation: modal-in .16s ease-out;
    }
    .game-relic {
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      color: var(--accent);
      --relic-opacity: .2;
    }
    .game-relic svg {
      width: 72px; height: auto;
      max-height: 72px;
      opacity: var(--relic-opacity);
      fill: var(--accent);
      stroke: var(--accent);
      transform-origin: center;
    }
    .crest { --relic-opacity: 1; }
    #crest, #relics, #gameRelic {
      user-select: none;
      -webkit-user-select: none;
    }
    .relic-animate.relic-hre svg { animation: relic-hre .75s ease-out; }
    .relic-animate.relic-rus svg { animation: relic-rus .9s cubic-bezier(.2,.75,.3,1); }
    .relic-animate.relic-kt svg { animation: relic-kt .58s cubic-bezier(.65,0,.35,1) both; }
    .relic-animate.relic-mac svg { animation: relic-mac .85s cubic-bezier(.2,.7,.25,1); }
    .relic-animate.relic-byz svg { animation: relic-byz .8s ease-in-out; }
    .relic-animate.relic-hol svg { animation: relic-hol .95s ease-in-out; transform-origin: 50% 100%; }
    .relic-animate.relic-gh svg { animation: relic-gh .95s ease-in-out; transform-origin: 50% 100%; }
    .relic-animate.relic-ootd svg { animation: relic-ootd .9s ease-in-out; transform-origin: 50% 55%; }
    .relic-animate.relic-sco svg { animation: relic-sco .85s cubic-bezier(.45,0,.25,1); }

    @keyframes relic-hre {
      0%, 100% { transform: scale(1); opacity: var(--relic-opacity); }
      42% { transform: scale(1.28); opacity: .7; filter: drop-shadow(0 0 8px var(--accent)); }
    }
    @keyframes relic-rus {
      0%, 100% { transform: translateY(0) scale(1); opacity: var(--relic-opacity); }
      35% { transform: translateY(-12px) scale(1.12); opacity: .62; }
      60% { transform: translateY(-4px) scale(.96); opacity: .45; }
    }
    @keyframes relic-kt {
      0% { transform: rotate(0); opacity: var(--relic-opacity); }
      55% { opacity: .65; filter: drop-shadow(0 0 7px var(--accent)); }
      100% { transform: rotate(360deg); opacity: var(--relic-opacity); filter: none; }
    }
    @keyframes relic-mac {
      0%, 100% { transform: scale(1); opacity: var(--relic-opacity); }
      32% { transform: scale(1.34, .72); opacity: .7; filter: drop-shadow(0 0 10px var(--accent)); }
      58% { transform: scale(.78, 1.22); opacity: .58; }
    }
    @keyframes relic-byz {
      0%, 100% { transform: translateX(0) scaleX(1); opacity: var(--relic-opacity); }
      25% { transform: translateX(-7px) scaleX(1.04); opacity: .48; }
      55% { transform: translateX(7px) scaleX(1.04); opacity: .58; }
    }
    @keyframes relic-hol {
      0%, 100% { transform: rotate(0); opacity: var(--relic-opacity); }
      25% { transform: rotate(-10deg); opacity: .55; }
      55% { transform: rotate(8deg); opacity: .6; }
      75% { transform: rotate(-4deg); opacity: .38; }
    }
    @keyframes relic-gh {
      0%, 100% { transform: rotate(0) skewX(0); opacity: var(--relic-opacity); }
      30% { transform: rotate(-7deg) skewX(-7deg); opacity: .62; filter: drop-shadow(0 0 8px var(--accent)); }
      60% { transform: rotate(5deg) skewX(5deg); opacity: .5; }
      80% { transform: rotate(-2deg) skewX(-2deg); }
    }
    @keyframes relic-ootd {
      0%, 100% { transform: scale(1) rotate(0); opacity: var(--relic-opacity); }
      35% { transform: scale(1.18) rotate(-6deg); opacity: .58; filter: drop-shadow(0 0 9px var(--accent)); }
      65% { transform: scale(.94) rotate(5deg); opacity: .48; }
    }
    @keyframes relic-sco {
      0% { transform: scale(1) rotate(0); opacity: var(--relic-opacity); }
      45% { transform: scale(1.22) rotate(45deg); opacity: .6; filter: drop-shadow(0 0 8px var(--accent)); }
      100% { transform: scale(1) rotate(90deg); opacity: var(--relic-opacity); filter: none; }
    }
    @media (prefers-reduced-motion: reduce) {
      .relic-animate svg { animation: none; }
      .conseil-stage.is-huddling .conseil-figure {
        animation: none !important;
        transition: none !important;
        --fidget-x: 0px !important;
        --fidget-y: 0px !important;
        transform: none !important;
      }
      .conseil-journal-panel { animation: none; }
    }
    .game-head, .game-ages, .game-foot, .game-bo-view, .game-late-view { position: relative; z-index: 1; }
    .game-sheet::before {
      content: "";
      position: absolute; inset: 0 auto auto 0; width: 100%; height: 3px;
      background: linear-gradient(90deg, transparent, var(--accent), transparent);
      opacity: .7;
    }
    .game-head {
      display: flex; align-items: center; justify-content: space-between;
      gap: 16px; padding: 14px 18px 12px;
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
    }
    .game-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
    .game-brand img { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }
    .game-brand h2 {
      font-family: Cinzel, serif; font-size: 20px; margin: 0;
      letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .game-head-actions {
      display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    }
    .game-head-actions .ctrl {
      min-height: 36px;
      font-size: 13px;
      white-space: nowrap;
    }
    .game-opponent-chip {
      display: inline-flex; align-items: center; gap: 6px;
      margin: 0; padding: 4px 10px 4px 6px;
      border: 1px solid var(--line);
      border-radius: 999px;
      background: color-mix(in srgb, var(--panel) 80%, black);
      color: var(--ink);
      font-size: 12px;
      cursor: pointer;
      flex-shrink: 0;
    }
    .game-opponent-chip img {
      width: 22px; height: 22px; object-fit: contain;
      background: transparent;
    }
    .game-opponent-chip:hover {
      border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    }
    .game-bo-view {
      flex: 1; min-height: 0;
      display: flex; flex-direction: column;
    }
    .game-late-view {
      flex: 1; min-height: 0;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding: 8px 18px 12px;
    }
    .game-late-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
      gap: 16px;
      align-items: start;
    }
    .game-late-strategy h3,
    .game-late-advice h3 {
      margin: 0 0 10px;
      font-family: Cinzel, serif;
      font-size: 16px;
      letter-spacing: .03em;
    }
    .game-late-advice-head {
      display: flex; align-items: center; justify-content: space-between;
      gap: 10px; margin-bottom: 10px;
    }
    .game-late-advice-head h3 { margin: 0; }
    .game-late-advice-status {
      margin-bottom: 10px;
      color: var(--muted);
      font-size: 14px;
    }
    .game-late-loading { margin: 0; }
    .game-late-advice-body {
      display: flex; flex-direction: column; gap: 10px;
    }
    .game-late-advice-card {
      padding: 12px 14px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: color-mix(in srgb, var(--accent) 6%, #15181f);
      font-size: 14px;
      line-height: 1.5;
    }
    .game-late-advice-card p { margin: 0; white-space: pre-wrap; }
    .game-late-empty { margin: 0; color: var(--muted); }
    .game-opponent-backdrop { z-index: 55; }
    .game-opponent-modal { width: min(640px, 100%); }
    .game-opponent-modal #gameOpponentTitle {
      text-transform: uppercase;
      letter-spacing: .06em;
      font-size: 22px;
    }
    .game-opponent-modal #gameOpponentHint {
      margin-top: -4px;
      margin-bottom: 14px;
      color: color-mix(in srgb, var(--ink) 70%, var(--muted));
    }
    .game-opp-search-label {
      position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
    .game-opp-search-wrap {
      position: relative;
      margin: 0 0 14px;
    }
    .game-opp-search-icon {
      position: absolute; left: 12px; top: 50%;
      transform: translateY(-50%);
      color: color-mix(in srgb, var(--ink) 45%, var(--muted));
      font-size: 16px; line-height: 1;
      pointer-events: none;
    }
    .game-opp-search {
      display: block; width: 100%;
      margin: 0;
      padding: 10px 14px 10px 34px;
      border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--line));
      border-radius: 10px;
      background: color-mix(in srgb, var(--panel) 55%, #0a0c10);
      color: var(--ink);
      font: inherit; font-size: 14px;
    }
    .game-opp-search::placeholder { color: color-mix(in srgb, var(--ink) 42%, var(--muted)); }
    .game-opp-search:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
    }
    .game-opp-cols-head {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
      gap: 0 6px;
      align-items: end;
      margin: 0 0 8px;
      padding: 0 2px;
    }
    .game-opp-cols-head.hidden { display: none; }
    .game-opp-col-label {
      font-size: 12px; font-weight: 600;
      letter-spacing: .02em;
      color: color-mix(in srgb, var(--ink) 55%, var(--muted));
    }
    .game-opp-col-label-vars { grid-column: 3; }
    .game-opp-scroll {
      /* Hauteur fixe : la box ne rétrécit pas pendant la recherche */
      position: relative;
      height: min(400px, 50vh);
      margin: 0 0 4px;
      border: none;
      background: transparent;
      overflow: hidden;
    }
    .game-opp-scroll::after {
      content: "";
      position: absolute; left: 0; right: 0; bottom: 0;
      height: 36px;
      pointer-events: none;
      background: linear-gradient(to top, var(--panel), transparent);
      z-index: 1;
    }
    .game-opp-grid {
      display: flex;
      flex-direction: column;
      gap: 8px;
      height: 100%;
      overflow: auto;
      padding: 2px 2px 28px;
      scrollbar-gutter: stable;
      scrollbar-width: thin;
      scrollbar-color: color-mix(in srgb, var(--accent) 65%, var(--ink)) transparent;
      -webkit-overflow-scrolling: touch;
    }
    .game-opp-grid::-webkit-scrollbar { width: 10px; }
    .game-opp-grid::-webkit-scrollbar-track { background: transparent; }
    .game-opp-grid::-webkit-scrollbar-thumb {
      background: color-mix(in srgb, var(--accent) 65%, var(--ink));
      border-radius: 8px;
      border: 2px solid transparent;
      background-clip: padding-box;
    }
    /* Rangée 2 colonnes fixes : base | › | variantes empilées */
    .game-opp-grid.is-grouped .game-opp-group {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
      gap: 0 6px;
      align-items: start;
      min-width: 0;
    }
    .game-opp-cell {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .game-opp-cell-base { align-self: start; }
    .game-opp-cell-vars { align-self: start; }
    .game-opp-link {
      display: flex;
      align-items: flex-start;
      justify-content: center;
      padding-top: 14px;
      color: color-mix(in srgb, var(--accent) 55%, var(--muted));
      font-size: 16px; line-height: 1;
      font-weight: 600;
      user-select: none;
    }
    .game-opp-link.is-empty { visibility: hidden; }
    .game-opp-grid.is-flat {
      gap: 6px;
    }
    .game-opp-empty {
      margin: 16px 8px;
      color: color-mix(in srgb, var(--ink) 70%, var(--muted));
      font-size: 14px;
      text-align: left;
    }
    .game-opp-item {
      position: relative;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: flex-start;
      gap: 10px;
      width: 100%;
      min-width: 0;
      min-height: 44px;
      padding: 7px 10px;
      border: 1px solid color-mix(in srgb, var(--ink) 18%, var(--line));
      border-radius: 10px;
      background: color-mix(in srgb, var(--panel) 70%, #0e1016);
      color: var(--ink);
      cursor: pointer;
      text-align: left;
    }
    .game-opp-item.is-variant {
      padding: 6px 8px;
      gap: 8px;
      border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
      background: color-mix(in srgb, var(--accent) 7%, color-mix(in srgb, var(--panel) 72%, #0e1016));
    }
    .game-opp-item:hover {
      border-color: var(--accent);
      background: color-mix(in srgb, var(--accent) 12%, #15181f);
    }
    .game-opp-item.is-selected {
      border-color: var(--accent);
      border-width: 2px;
      padding: 6px 9px;
      background: color-mix(in srgb, var(--accent) 16%, #15181f);
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
    }
    .game-opp-item.is-variant.is-selected { padding: 5px 7px; }
    .game-opp-item.is-selected .game-opp-name { color: #fff8e8; font-weight: 700; }
    .game-opp-item img {
      width: 100%; height: 100%;
      object-fit: cover; object-position: center;
      display: block;
      background: transparent;
    }
    /* Même cadre 16:9 pour parent et variante (cover, sans stretch) */
    .game-opp-flag {
      display: block; overflow: hidden; flex-shrink: 0;
      width: 48px; height: 27px;
      border-radius: 4px;
      background: color-mix(in srgb, var(--ink) 8%, #0a0c10);
    }
    .game-opp-name {
      flex: 1 1 auto;
      min-width: 0;
      font-weight: 700; font-size: 14px; line-height: 1.25;
      text-align: left;
      white-space: normal;
      overflow: visible;
      color: var(--ink);
      text-wrap: balance;
    }
    .game-opp-item.is-variant .game-opp-name {
      font-size: 12.5px;
      font-weight: 600;
    }
    .game-opp-self-mark {
      position: absolute; top: 4px; right: 6px;
      z-index: 2;
      font-size: 10px; line-height: 1;
      color: var(--accent);
      text-shadow: 0 0 4px color-mix(in srgb, var(--accent) 55%, transparent);
      pointer-events: none;
    }
    .game-opp-short { display: none; }
    .game-opp-actions {
      justify-content: space-between;
      margin-top: 10px;
      padding-top: 12px;
      border-top: 1px solid color-mix(in srgb, var(--ink) 12%, var(--line));
    }
    .game-opp-none-btn.is-selected,
    button.ctrl.game-opp-none-btn.is-selected {
      border-color: var(--accent);
      color: #fff8e8;
      background: color-mix(in srgb, var(--accent) 14%, #15181f);
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
    }
    @media (max-width: 560px) {
      .game-opp-scroll { height: min(360px, 48vh); }
      .game-opp-name { font-size: 13px; }
    }
    .game-close {
      width: 40px; height: 40px; border-radius: 10px;
      border: 1px solid var(--line); background: #15181f; color: var(--ink);
      font-size: 22px; line-height: 1; cursor: pointer; flex-shrink: 0;
    }
    .game-close:hover {
      border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
      background: color-mix(in srgb, var(--accent) 6%, #15181f);
    }
    .game-ages {
      flex: 1; min-height: 0;
      display: flex; justify-content: center; align-items: stretch;
      gap: 14px; padding: 16px 18px 8px;
      --game-fs: 16px;
    }
    .game-age {
      flex: 1 1 0;
      max-width: 380px;
      min-width: 0;
      display: flex; flex-direction: column;
      background: color-mix(in srgb, var(--panel) 70%, #10131a);
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 10px 10px 8px;
    }
    .game-age.wide { max-width: 560px; flex-grow: 1.35; }
    .game-age.wider { max-width: 720px; flex-grow: 1.7; }
    .game-age-title {
      display: flex; justify-content: center; align-items: center;
      margin: 0 0 10px; padding: 4px 0 10px;
      border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
      flex-shrink: 0;
    }
    .game-age-title img {
      width: 52px; height: 52px; object-fit: contain;
      filter: drop-shadow(0 4px 8px rgba(0,0,0,.35));
    }
    .game-age-grid {
      flex: 1; min-height: 0;
      display: grid; gap: 10px 14px; align-content: start;
    }
    .game-subcol {
      list-style: none; margin: 0; padding: 0;
      display: flex; flex-direction: column; gap: 8px;
      min-width: 0;
    }
    .game-subcol.can-scroll {
      overflow-y: auto;
      padding-right: 4px;
      mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 14px), transparent 100%);
    }
    .game-step {
      display: grid; grid-template-columns: 1.6em minmax(0, 1fr); gap: 8px;
      align-items: start; min-width: 0;
      background: color-mix(in srgb, var(--panel) 55%, #10131a);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 8px 10px;
    }
    .game-subcol:nth-child(2) .game-step {
      background: color-mix(in srgb, black 32%, color-mix(in srgb, var(--panel) 55%, #10131a));
    }
    .game-subcol:nth-child(3) .game-step {
      background: color-mix(in srgb, black 82%, color-mix(in srgb, var(--panel) 55%, #10131a));
    }
    .game-subcol:nth-child(n+4) .game-step {
      background: color-mix(in srgb, black 92%, color-mix(in srgb, var(--panel) 55%, #10131a));
    }
    .game-num {
      font-variant-numeric: tabular-nums; font-weight: 700;
      color: var(--accent); font-size: calc(var(--game-fs) * .9);
      line-height: 1.4; text-align: center;
      background: color-mix(in srgb, var(--accent) 14%, transparent);
      border-radius: 999px;
      min-width: 1.5em;
      padding: 1px 0;
    }
    .game-step-body { min-width: 0; font-size: var(--game-fs); line-height: 1.4; }
    .game-time {
      display: block; font-variant-numeric: tabular-nums; font-weight: 700;
      color: var(--accent); margin-bottom: 2px; letter-spacing: .02em;
    }
    .game-empty {
      color: var(--muted); align-self: center; margin: auto; font-size: 16px;
    }
    .game-tips {
      flex-shrink: 0;
      width: min(720px, calc(100% - 36px));
      margin: 12px auto 0;
      padding: 10px 16px;
      border: 1px solid var(--line);
      white-space: pre-line;
      border-left: 3px solid var(--accent);
      border-right: 3px solid var(--accent);
      border-radius: 12px;
      background: color-mix(in srgb, var(--accent) 7%, #15181f);
      font-size: 14px; line-height: 1.45;
    }
    .game-foot {
      flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      padding: 4px 18px 14px;
    }
    .game-tips strong {
      display: block; font-size: 11px; letter-spacing: .08em;
      text-transform: uppercase; color: var(--accent); margin-bottom: 4px;
    }
    .game-ages.tight { --game-fs: 13px; }
    .game-ages.tighter { --game-fs: 12px; }
    .game-ages.tighter .game-step-body { line-height: 1.28; }
    @media (max-width: 900px) {
      body {
        /* fixed + motifs répétés = jank au scroll (surtout iOS) */
        background-attachment: scroll;
      }
      .modal-backdrop,
      .game-backdrop,
      .conseil-journal-backdrop {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
      }
      .wrap { padding-top: 16px; padding-bottom: max(32px, env(safe-area-inset-bottom)); }
      h1 { font-size: 22px; }
      .civs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
      .layout { grid-template-columns: 1fr; }
      .panel { padding: 14px 12px; }
      .step {
        grid-template-columns: 24px max-content minmax(0, 1fr);
      }
      .step > :last-child { min-width: 0; }
      .toolbar .ctrl { min-height: 40px; }
      .build-delete { width: 40px; height: 40px; }
      .edit-head { display: none; }
      .edit-row {
        grid-template-columns: 36px minmax(0, 1fr) 40px;
        grid-template-areas:
          "handle flag del"
          "handle timing del"
          "handle action del";
        align-items: stretch;
      }
      .edit-row .drag-handle { grid-area: handle; align-self: center; }
      .edit-row .age-flag { grid-area: flag; }
      .edit-row .ed-t { grid-area: timing; }
      .edit-row .ed-text { grid-area: action; }
      .edit-row .ed-del { grid-area: del; align-self: center; }
      .edit-row.sep-row {
        grid-template-columns: 36px 1fr 40px;
        grid-template-areas: "handle mark del";
      }
      .edit-row.sep-row .ed-mark { grid-area: mark; }
      .game-backdrop {
        padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        align-items: stretch;
      }
      .game-sheet {
        height: auto;
        max-height: calc(100dvh - 16px);
        width: 100%;
        border-radius: 14px;
      }
      .game-ages {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        gap: 10px;
        padding: 12px;
      }
      .game-age, .game-age.wide, .game-age.wider {
        max-width: none;
        flex: 0 0 auto;
        width: 100%;
      }
      .game-brand h2 { white-space: normal; font-size: 17px; }
      .game-head {
        flex-wrap: wrap;
        gap: 10px;
      }
      .game-head-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
      }
      .game-late-grid {
        grid-template-columns: 1fr;
      }
      .game-opp-scroll { height: min(340px, 46vh); }
      .game-opp-name { font-size: 13px; }
      .game-opp-actions { flex-wrap: wrap; gap: 8px; }
    }

.step-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
  color: var(--accent);
  text-align: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 999px;
  min-width: 1.5em;
  padding: 1px 0;
  margin-top: 2px;
}
