/* ==========================================================================
   Monopolix — feuille de style complete
   Theme sombre premium : « casino feutre + table de jeu moderne ».
   Aucune police distante, aucune image externe, aucun @import.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Jetons de design
   -------------------------------------------------------------------------- */

:root {
  /* Fonds et surfaces */
  --bg: #070b14;
  --bg-2: #0c1220;
  --panel: rgba(20, 28, 45, 0.72);
  --panel-2: rgba(30, 41, 64, 0.62);

  /* Texte */
  --ink: #eef2f9;
  --muted: #8e9ab4;
  --line: rgba(148, 168, 208, 0.16);

  /* Accents */
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --good: #22c55e;
  --bad: #e5484d;
  --warn: #f59e0b;
  --gold: #f2c14e;

  /* Formes */
  --radius: 18px;
  --radius-sm: 10px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  /* Ombres */
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 26px 60px -18px rgba(0, 0, 0, 0.78), 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* Couleurs des 8 joueurs */
  --p-red: #e5484d;
  --p-blue: #3b82f6;
  --p-green: #22c55e;
  --p-yellow: #eab308;
  --p-purple: #a855f7;
  --p-orange: #f97316;
  --p-cyan: #06b6d4;
  --p-pink: #ec4899;

  /* Divers */
  --font: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-num: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, 'Roboto Mono', monospace;
  --t-fast: 120ms;
  --t: 150ms;
  --t-slow: 180ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --topbar-h: 60px;
  --pc: var(--accent);
}

/* Correspondance id de couleur -> variable, utilisable par le JS
   via class="color-red" ou data-color="red" */
.color-red,
[data-color='red'] { --pc: var(--p-red); }
.color-blue,
[data-color='blue'] { --pc: var(--p-blue); }
.color-green,
[data-color='green'] { --pc: var(--p-green); }
.color-yellow,
[data-color='yellow'] { --pc: var(--p-yellow); }
.color-purple,
[data-color='purple'] { --pc: var(--p-purple); }
.color-orange,
[data-color='orange'] { --pc: var(--p-orange); }
.color-cyan,
[data-color='cyan'] { --pc: var(--p-cyan); }
.color-pink,
[data-color='pink'] { --pc: var(--p-pink); }

/* --------------------------------------------------------------------------
   2. Reset moderne
   -------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Fond decoratif global : degrades radiaux, aucune image */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 12% -8%, rgba(79, 140, 255, 0.18), transparent 62%),
    radial-gradient(760px 560px at 92% 4%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(1100px 780px at 50% 118%, rgba(34, 197, 94, 0.09), transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg) 100%);
}

/* Trame feutree tres discrete */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 4px);
}

img,
picture,
video,
canvas,
svg { display: block; max-width: 100%; }

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; cursor: pointer; }

p,
h1,
h2,
h3,
h4,
h5,
h6 { overflow-wrap: break-word; }

h1, h2, h3, h4, h5 { line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.28rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.94rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: color-mix(in srgb, var(--accent) 70%, white); }

ul, ol { list-style: none; padding: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

table { border-collapse: collapse; }

::selection {
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  color: #fff;
}

/* Focus visible accessible */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   3. Barres de defilement discretes
   -------------------------------------------------------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 168, 208, 0.28) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 168, 208, 0.22);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 168, 208, 0.42); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* --------------------------------------------------------------------------
   4. Utilitaires
   -------------------------------------------------------------------------- */

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

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.row--wrap { flex-wrap: wrap; }
.row--top { align-items: flex-start; }
.row--between { justify-content: space-between; }
.row--center { justify-content: center; }
.row--end { justify-content: flex-end; }

.col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.col--tight { gap: 6px; }
.col--loose { gap: 18px; }

.spacer { flex: 1 1 auto; min-width: 0; min-height: 0; }

.muted,
.hint,
.action-prompt {
  color: var(--muted);
  font-size: 0.86rem;
}
.hint:empty,
.action-prompt:empty { display: none; }

/* Messages de formulaire portes par index.html (.form-error / .form-ok). */
.form-error { color: var(--bad); font-size: 0.84rem; line-height: 1.4; }
.form-ok { color: var(--good); font-size: 0.84rem; line-height: 1.4; }

/* Conteneurs simples d'index.html sans equivalent thematique. */
.trade-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.tile-table { display: block; min-width: 0; }
.board-list { display: block; min-width: 0; }
.field--narrow { max-width: 140px; }

/* Message affiche uniquement quand JavaScript est desactive. */
.noscript {
  max-width: 46ch;
  margin: 60px auto;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-align: center;
  line-height: 1.5;
}

.tiny { font-size: 0.76rem; }
.strong { font-weight: 650; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.hidden { display: none !important; }
/* L'attribut `hidden` d'index.html doit primer sur tout `display` d'auteur. */
[hidden] { display: none !important; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
  border-radius: 1px;
}

.kbd {
  font-family: var(--font-num);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

/* Argent */
.money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: var(--gold);
  white-space: nowrap;
}
.money--pos,
.money.is-positive { color: var(--good); }
.money--neg,
.money.is-negative { color: var(--bad); }
.money--big { font-size: 1.25rem; }
.money--muted { color: var(--muted); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 620;
  line-height: 1.5;
  letter-spacing: 0.01em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  white-space: nowrap;
}
.badge--accent {
  color: color-mix(in srgb, var(--accent) 78%, white);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.badge--good {
  color: color-mix(in srgb, var(--good) 76%, white);
  border-color: color-mix(in srgb, var(--good) 38%, transparent);
  background: color-mix(in srgb, var(--good) 14%, transparent);
}
.badge--bad {
  color: color-mix(in srgb, var(--bad) 80%, white);
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
  background: color-mix(in srgb, var(--bad) 16%, transparent);
}
.badge--warn {
  color: color-mix(in srgb, var(--warn) 80%, white);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 15%, transparent);
}
.badge--gold {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 40%, transparent);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
}

/* Avatars */
.avatar {
  --size: 38px;
  width: var(--size);
  height: var(--size);
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: calc(var(--size) * 0.42);
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-transform: uppercase;
  background:
    linear-gradient(150deg,
      color-mix(in srgb, var(--pc) 78%, #10182b),
      color-mix(in srgb, var(--pc) 30%, #10182b));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow), var(--shadow-inset);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { --size: 24px; }
.avatar--sm { --size: 30px; }
.avatar--lg { --size: 64px; }
.avatar--xl { --size: 96px; }
.avatar--ring { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--pc), var(--shadow); }

/* Pastille de couleur */
.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--pc);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 10px -1px var(--pc);
}
.dot--lg { width: 14px; height: 14px; }

/* --------------------------------------------------------------------------
   5. Cartes / panneaux en verre depoli
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)),
    var(--panel);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: var(--shadow), var(--shadow-inset);
}
.card--flat { box-shadow: none; background: var(--panel-2); }
.card--tight { padding: 12px; }
.card--pad-lg { padding: 26px; }
.card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.card__title .spacer { margin: 0; }

.card--action {
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition:
    transform var(--t) var(--ease),
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}
.card--action:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 44%, transparent);
  box-shadow: var(--shadow-lg);
}
.card--action:active { transform: translateY(-1px); }

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.008)),
    var(--panel);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: var(--shadow), var(--shadow-inset);
  overflow: hidden;
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  flex: 0 0 auto;
}
.panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel__foot {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

/* Sous-elements portes par index.html a l'interieur des panneaux. */
.panel__title {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  margin: 0;
}
.panel__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.panel__section--danger { margin-top: auto; }

/* Etat vide */
.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.014);
}
.empty__icon { font-size: 2rem; opacity: 0.7; }

/* --------------------------------------------------------------------------
   6. Boutons
   -------------------------------------------------------------------------- */

.btn {
  --btn-bg: rgba(255, 255, 255, 0.055);
  --btn-bd: var(--line);
  --btn-fg: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-inset);
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease);
}
.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(148, 168, 208, 0.32);
}
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[disabled],
.btn.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  filter: saturate(0.5);
}
.btn:disabled:hover { background: var(--btn-bg); border-color: var(--btn-bd); }

.btn--primary {
  --btn-fg: #fff;
  --btn-bd: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:
    0 10px 24px -10px color-mix(in srgb, var(--accent) 85%, transparent),
    var(--shadow-inset);
}
.btn--primary:hover {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 84%, white),
    color-mix(in srgb, var(--accent-2) 84%, white));
  border-color: transparent;
  box-shadow:
    0 14px 30px -10px color-mix(in srgb, var(--accent) 95%, transparent),
    var(--shadow-inset);
}

.btn--gold {
  --btn-fg: #2a1e05;
  --btn-bd: transparent;
  background: linear-gradient(135deg, #ffd977, var(--gold));
  font-weight: 700;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--gold) 90%, transparent), var(--shadow-inset);
}
.btn--gold:hover {
  background: linear-gradient(135deg, #ffe49b, color-mix(in srgb, var(--gold) 80%, white));
  border-color: transparent;
}

.btn--good {
  --btn-fg: #fff;
  --btn-bd: color-mix(in srgb, var(--good) 45%, transparent);
  --btn-bg: color-mix(in srgb, var(--good) 22%, transparent);
}
.btn--good:hover {
  background: color-mix(in srgb, var(--good) 34%, transparent);
  border-color: color-mix(in srgb, var(--good) 62%, transparent);
}

.btn--danger {
  --btn-fg: color-mix(in srgb, var(--bad) 30%, white);
  --btn-bd: color-mix(in srgb, var(--bad) 42%, transparent);
  --btn-bg: color-mix(in srgb, var(--bad) 16%, transparent);
}
.btn--danger:hover {
  background: color-mix(in srgb, var(--bad) 30%, transparent);
  border-color: color-mix(in srgb, var(--bad) 66%, transparent);
  color: #fff;
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-bd: transparent;
  --btn-fg: var(--muted);
}
.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: transparent;
  color: var(--ink);
}

.btn--outline {
  --btn-bg: transparent;
  --btn-bd: var(--line);
}
.btn--outline:hover { background: rgba(255, 255, 255, 0.06); }

.btn--sm {
  padding: 6px 11px;
  min-height: 30px;
  font-size: 0.8rem;
  border-radius: 8px;
  gap: 6px;
}
.btn--lg {
  padding: 14px 26px;
  min-height: 52px;
  font-size: 1rem;
  border-radius: 14px;
}
.btn--block { width: 100%; }
.btn--icon {
  padding: 0;
  width: 38px;
  min-height: 38px;
  border-radius: 50%;
}
.btn--icon.btn--sm { width: 30px; min-height: 30px; }
.btn--pill { border-radius: var(--radius-pill); }

.btn__hint {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.7;
}

.btn-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   7. Champs de formulaire
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > label,
.field__label {
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.field__hint { font-size: 0.76rem; color: var(--muted); }
.field__error {
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--bad) 35%, white);
}

.input,
.field input[type='text'],
.field input[type='password'],
.field input[type='number'],
.field input[type='email'],
.field input[type='search'],
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  min-height: 40px;
  color: var(--ink);
  background: rgba(6, 10, 20, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  transition:
    border-color var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease);
}
.input::placeholder,
.field input::placeholder,
.field textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

.input:hover,
.field input:hover,
.field textarea:hover,
.field select:hover { border-color: rgba(148, 168, 208, 0.3); }

.input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  background: rgba(6, 10, 20, 0.75);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.input:focus-visible,
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.field textarea { min-height: 90px; resize: vertical; line-height: 1.45; }

.field select,
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.field select option,
select.input option { background: #101828; color: var(--ink); }

.input--invalid,
.field input.is-invalid,
.field.is-invalid input {
  border-color: color-mix(in srgb, var(--bad) 65%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent);
}

.input-money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

input[type='color'] {
  width: 42px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 10, 20, 0.55);
  cursor: pointer;
}
input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
input[type='color']::-webkit-color-swatch { border: 0; border-radius: 6px; }
input[type='color']::-moz-color-swatch { border: 0; border-radius: 6px; }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0a0f1c;
  box-shadow: var(--shadow);
}
input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0a0f1c;
}

/* Interrupteur CSS pur */
.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  cursor: pointer;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.switch__track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
  transition:
    background-color var(--t) var(--ease),
    border-color var(--t) var(--ease);
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f4f7ff, #c3ccdf);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: transform var(--t-slow) var(--ease), background-color var(--t) var(--ease);
}
.switch input:checked + .switch__track {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
.switch input:checked + .switch__track::after {
  transform: translateX(20px);
  background: linear-gradient(180deg, #ffffff, #e6ecff);
}
.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch input:disabled + .switch__track { opacity: 0.4; cursor: not-allowed; }
.switch input:disabled { cursor: not-allowed; }

/* Cases a cocher stylisees */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.checkbox input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 20, 0.55);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.checkbox input[type='checkbox']::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0.4);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.checkbox input[type='checkbox']:checked {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}
.checkbox input[type='checkbox']:checked::after { opacity: 1; transform: rotate(-45deg) scale(1); }

/* Groupe de boutons radio (regles de type "choice") */
.choice-group,
.radio-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(6, 10, 20, 0.5);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}
.choice,
.radio-group label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease);
}
.choice input,
.radio-group label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.choice:hover,
.radio-group label:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.choice:has(input:checked),
.radio-group label:has(input:checked) {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 90%, transparent);
}
.choice:has(input:focus-visible),
.radio-group label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.choice.is-selected,
.choice--active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.choice-group--disabled { opacity: 0.45; pointer-events: none; }

/* --------------------------------------------------------------------------
   8. Structure : #app, #topbar, ecrans
   -------------------------------------------------------------------------- */

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  isolation: isolate;
}

#topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 22, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 6px 24px -18px #000;
}
#topbar .spacer { flex: 1 1 auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 750;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background-color var(--t-fast) var(--ease);
}
.brand:hover { background: rgba(255, 255, 255, 0.05); }
.brand__mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--gold), #e08a2c);
  color: #241703;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--gold) 90%, transparent);
}
.brand__name span { color: var(--gold); }

.topbar__room {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  color: var(--muted);
}
.topbar__code {
  font-family: var(--font-num);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.topbar__user {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.topbar__user:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(148, 168, 208, 0.3);
}
.topbar__user .avatar { --size: 28px; }
.topbar__nick { font-weight: 600; font-size: 0.86rem; }

/* Groupes de la barre superieure portes par index.html. */
.topbar__nav,
.topbar__account {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.topbar__logo { font-size: 1.1rem; line-height: 1; }
.topbar__wordmark { white-space: nowrap; }
.topbar__avatar { display: inline-flex; }
.topbar__nickname { font-weight: 600; font-size: 0.86rem; white-space: nowrap; }
.topbar__room-name { max-width: 220px; }

/* Ecrans */
.screen {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
}
.screen--active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: screen-in 220ms var(--ease) both;
}

.screen__inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.screen__inner--wide { max-width: 1520px; }
.screen__inner--narrow { max-width: 760px; }

.screen-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.screen-head h1 { font-size: 1.6rem; }
.screen-head p { color: var(--muted); }

/* `.panel__subtitle` est le nom porte par index.html. */
.section-title,
.panel__subtitle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::after,
.panel__subtitle::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

/* --------------------------------------------------------------------------
   9. Toasts
   -------------------------------------------------------------------------- */

#toast-host {
  position: fixed;
  top: calc(var(--topbar-h) + 14px);
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  --toast-tone: var(--accent);
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(16, 23, 38, 0.9);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: toast-in 220ms var(--ease) both;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--toast-tone);
  box-shadow: 0 0 14px -1px var(--toast-tone);
}
.toast--good { --toast-tone: var(--good); }
.toast--bad { --toast-tone: var(--bad); }
.toast--warn { --toast-tone: var(--warn); }
.toast--info { --toast-tone: var(--accent); }
.toast.is-leaving { animation: toast-out 180ms var(--ease) both; }
.toast__icon { font-size: 1.05rem; line-height: 1.3; flex: 0 0 auto; }
.toast__body { flex: 1 1 auto; min-width: 0; }
.toast__title { font-weight: 650; font-size: 0.9rem; }
.toast__text { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.toast__close {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.toast__close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }

/* --------------------------------------------------------------------------
   10. Modales
   -------------------------------------------------------------------------- */

#modal-host {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#modal-host:not(:empty),
#modal-host.is-open { display: flex; }

.modal-backdrop,
#modal-host::before {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 14, 0.66);
  backdrop-filter: blur(7px) saturate(120%);
  -webkit-backdrop-filter: blur(7px) saturate(120%);
  animation: fade-in 160ms var(--ease) both;
}
#modal-host::before { content: ''; }
.modal-backdrop { z-index: 0; }
/* Si le JS fournit son propre voile, on masque celui du conteneur */
#modal-host:has(.modal-backdrop)::before { display: none; }

.modal {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(86dvh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 168, 208, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    rgba(15, 21, 36, 0.94);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in 200ms var(--ease) both;
}
.modal--wide { width: min(880px, 100%); }
.modal--narrow { width: min(420px, 100%); }
.modal__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal__title { font-size: 1.08rem; font-weight: 680; }
.modal__close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.modal__close:hover { background: rgba(255, 255, 255, 0.09); color: var(--ink); }
.modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

/* --------------------------------------------------------------------------
   11. Ecran d'authentification
   -------------------------------------------------------------------------- */

#screen-auth.screen--active {
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  position: relative;
  overflow: hidden;
}

/* Halos decoratifs propres a l'ecran d'auth */
#screen-auth::before,
#screen-auth::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
  z-index: 0;
}
#screen-auth::before {
  width: 620px; height: 620px;
  top: -260px; left: -200px;
  background: radial-gradient(circle at 50% 50%, rgba(79, 140, 255, 0.24), transparent 66%);
  animation: float-slow 18s ease-in-out infinite;
}
#screen-auth::after {
  width: 720px; height: 720px;
  bottom: -320px; right: -220px;
  background: radial-gradient(circle at 50% 50%, rgba(242, 193, 78, 0.16), transparent 64%);
  animation: float-slow 22s ease-in-out infinite reverse;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: 30px 28px 26px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 168, 208, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    rgba(14, 20, 34, 0.82);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise-in 320ms var(--ease) both;
}
.auth-card__logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 20px;
  font-size: 1.7rem;
  background: linear-gradient(135deg, var(--gold), #dd8a24);
  color: #241703;
  box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--gold) 90%, transparent);
}
.auth-card h1 {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}
.auth-card h1 span { color: var(--gold); }
.auth-card__sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: -8px;
}

/* Bascule connexion / inscription */
.auth-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(6, 10, 20, 0.55);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}
.auth-toggle__btn {
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 620;
  color: var(--muted);
  transition:
    color var(--t-fast) var(--ease),
    background-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}
.auth-toggle__btn:hover { color: var(--ink); }
.auth-toggle__btn.is-active,
.auth-toggle__btn[aria-selected='true'] {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--accent) 90%, transparent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.auth-form .btn--primary { margin-top: 4px; }

.auth-error {
  display: none;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: color-mix(in srgb, var(--bad) 28%, white);
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  animation: shake 260ms var(--ease) both;
}
.auth-error.is-visible { display: block; }

.auth-foot {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.auth-foot button { color: var(--accent); font-weight: 600; }
.auth-foot button:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   12. Accueil
   -------------------------------------------------------------------------- */

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.action-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  min-height: 148px;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    var(--panel);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: var(--shadow), var(--shadow-inset);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform var(--t) var(--ease),
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}
.action-card::after {
  content: '';
  position: absolute;
  inset: -40% -20% auto auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--pc) 26%, transparent), transparent 68%);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
  pointer-events: none;
}
.action-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--pc) 42%, transparent);
  box-shadow: var(--shadow-lg);
}
.action-card:hover::after { opacity: 1; }
.action-card:active { transform: translateY(-1px); }
.action-card__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 14px;
  font-size: 1.35rem;
  background: color-mix(in srgb, var(--pc) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--pc) 34%, transparent);
}
.action-card__title { font-size: 1.05rem; font-weight: 660; }
.action-card__desc { font-size: 0.84rem; color: var(--muted); }
.action-card--primary { --pc: var(--gold); }
.action-card--join { --pc: var(--accent); }
.action-card--editor { --pc: var(--accent-2); }
.action-card--profile { --pc: var(--good); }

/* Carte de profil */
.profile-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
  padding: 24px 20px;
}
.profile-card__nick { font-size: 1.15rem; font-weight: 680; }
.profile-card__user { font-size: 0.82rem; color: var(--muted); }
.profile-card .avatar { --size: 84px; }

/* `.stats` est le nom porte par index.html (#game-info, #profile-stats). */
.stat-grid,
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
/* Dans la colonne etroite de l'ecran de jeu, les tuiles passent sur une seule
   colonne des que 2 x 120 px ne tiennent plus. */
#game-info { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}
.stat__value {
  font-family: var(--font-num);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}
.stat__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   13. Liste des salons (accueil + lobby)
   -------------------------------------------------------------------------- */

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.room-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
  transform: translateX(2px);
}
.room-row__code {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--gold) 26%, transparent);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.room-row__name { font-weight: 620; }
.room-row__meta { font-size: 0.8rem; color: var(--muted); }
.room-row__count {
  font-family: var(--font-num);
  font-weight: 650;
  color: var(--muted);
}
.room-row__count.is-full { color: var(--bad); }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-bar .input { max-width: 260px; }

/* --------------------------------------------------------------------------
   14. Ecran salon (attente)
   -------------------------------------------------------------------------- */

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.room-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(120deg,
      color-mix(in srgb, var(--accent) 12%, transparent),
      transparent 55%),
    var(--panel);
  box-shadow: var(--shadow), var(--shadow-inset);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.room-header__code {
  font-family: var(--font-num);
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-shadow: 0 0 26px color-mix(in srgb, var(--gold) 45%, transparent);
}

/* Liste des joueurs du salon */
/* `.player-list` est le nom porte par index.html (#room-players, #player-list). */
.seat-list,
.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.seat {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
  border-left: 3px solid var(--pc);
  transition: background-color var(--t-fast) var(--ease);
}
.seat:hover { background: rgba(255, 255, 255, 0.055); }
.seat__pawn { font-size: 1.15rem; line-height: 1; }
.seat__name { font-weight: 620; }
.seat--empty {
  border-style: dashed;
  border-left-color: var(--line);
  color: var(--muted);
  justify-items: center;
  grid-template-columns: 1fr;
  text-align: center;
  padding: 12px;
}

/* Reglages : lignes de regles */
/* `.rules` est le nom porte par index.html (#room-rules). */
.rule-sections,
.rules {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rule-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.022);
  transition:
    background-color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}
.rule-row + .rule-row { margin-top: 6px; }
.rule-row:hover {
  background: rgba(255, 255, 255, 0.052);
  border-color: var(--line);
}
.rule-row__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 10px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.rule-row__text { min-width: 0; }
.rule-row__label {
  font-weight: 620;
  font-size: 0.9rem;
  overflow-wrap: break-word;
}
.rule-row__desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 2px;
}
.rule-row__control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.rule-row.is-on { border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
.rule-row.is-on .rule-row__icon {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}
.rule-row.is-locked { opacity: 0.55; }
.rule-row.is-locked .rule-row__control { pointer-events: none; }

/* Grille de selection des pions */
.pawn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}

.pawn-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px 7px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease);
}
.pawn-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 168, 208, 0.34);
}
.pawn-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pawn-card canvas {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 118%, rgba(79, 140, 255, 0.2), transparent 62%),
    rgba(6, 10, 20, 0.5);
}
.pawn-card__name {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 1.7em;
}
.pawn-card--selected {
  border-color: var(--pc, var(--accent));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow:
    0 0 0 1px var(--pc, var(--accent)),
    0 12px 28px -14px var(--pc, var(--accent));
}
.pawn-card--selected .pawn-card__name { color: var(--ink); font-weight: 620; }
.pawn-card--selected::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 6px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  font-weight: 800;
  color: #fff;
  border-radius: 50%;
  background: var(--pc, var(--accent));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.pawn-card--taken {
  opacity: 0.32;
  cursor: not-allowed;
  filter: grayscale(0.7);
}
.pawn-card--taken:hover { transform: none; }

.pawn-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* Selecteur de couleur */
/* `.color-grid` est le nom porte par index.html (#room-colors). */
.color-dots,
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.color-dots__dot {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--pc);
  cursor: pointer;
  box-shadow: 0 4px 12px -4px var(--pc), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition:
    transform var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease),
    border-color var(--t-fast) var(--ease);
}
.color-dots__dot:hover { transform: scale(1.12); }
.color-dots__dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.color-dots__dot.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.55), 0 0 18px -2px var(--pc);
  transform: scale(1.08);
}
.color-dots__dot.is-selected::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
}
.color-dots__dot.is-taken {
  opacity: 0.28;
  cursor: not-allowed;
  transform: none;
}

/* --------------------------------------------------------------------------
   15. Ecran de jeu : mise en page 3 colonnes
   -------------------------------------------------------------------------- */

#screen-game.screen--active,
.game-layout {
  display: grid;
  grid-template-columns: minmax(200px, 250px) minmax(0, 1fr) minmax(290px, 360px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    'left board side-top'
    'left board side-bottom';
  gap: 14px;
  padding: 14px;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

#player-panel { grid-area: left; }
.board-col,
#board-wrap { grid-area: board; }
#action-panel { grid-area: side-top; }
#log-panel { grid-area: side-bottom; }

.side-col {
  grid-column: 3;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}
.side-col #action-panel { flex: 0 0 auto; }
.side-col #log-panel { flex: 1 1 auto; }

.board-col {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}

/* Conteneur du plateau */
#board-wrap {
  position: relative;
  aspect-ratio: 1;
  width: min(calc(100vh - 140px), 100%);
  max-width: 100%;
  max-height: calc(100vh - 140px);
  margin-inline: auto;
  align-self: center;
  justify-self: center;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 42%, rgba(30, 44, 74, 0.9), rgba(8, 12, 22, 0.95) 72%);
  border: 1px solid rgba(148, 168, 208, 0.2);
  box-shadow:
    var(--shadow-lg),
    inset 0 0 60px -20px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  /* Toute la typographie du plateau est indexee sur sa largeur reelle (cqw) */
  container-type: size;
  container-name: board;
}

/* Grille 11x11 */
#board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
  width: 100%;
  height: 100%;
  gap: 0;
  padding: 0;
}

/* Canvas WebGL des pions, au-dessus des cases */
#pawn-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* --------------------------------------------------------------------------
   16. Cases du plateau
   -------------------------------------------------------------------------- */

.tile {
  --band: transparent;
  --owner: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 3px;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(180deg, rgba(30, 41, 66, 0.72), rgba(20, 28, 46, 0.82));
  border: 1px solid rgba(148, 168, 208, 0.14);
  color: var(--ink);
  transition:
    background-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    filter var(--t) var(--ease);
}
.tile:hover { filter: brightness(1.22); z-index: 2; }

.tile--corner {
  background: linear-gradient(150deg, rgba(44, 58, 90, 0.9), rgba(24, 33, 55, 0.92));
  border-color: rgba(148, 168, 208, 0.24);
  gap: 2px;
}
.tile--chance,
.tile--chest {
  background: linear-gradient(180deg, rgba(37, 46, 78, 0.78), rgba(22, 29, 50, 0.86));
}
.tile--tax { background: linear-gradient(180deg, rgba(48, 34, 40, 0.75), rgba(24, 20, 30, 0.86)); }
.tile--railroad { background: linear-gradient(180deg, rgba(30, 44, 60, 0.8), rgba(18, 26, 40, 0.86)); }
.tile--utility { background: linear-gradient(180deg, rgba(28, 46, 52, 0.8), rgba(17, 27, 38, 0.86)); }

/* Bandeau de groupe : toujours du cote interieur du plateau */
.tile__band {
  position: absolute;
  background: var(--band);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  z-index: 1;
}
.tile--bottom .tile__band { top: 0; left: 0; right: 0; height: 18%; }
.tile--top .tile__band { bottom: 0; left: 0; right: 0; height: 18%; }
.tile--left .tile__band { top: 0; bottom: 0; right: 0; width: 18%; }
.tile--right .tile__band { top: 0; bottom: 0; left: 0; width: 18%; }

/* Reserve de place pour le bandeau */
.tile--bottom.tile--property { padding-top: 21%; }
.tile--top.tile--property { padding-bottom: 21%; }
.tile--left.tile--property { padding-right: 21%; }
.tile--right.tile--property { padding-left: 21%; }

/* Contenu textuel */
.tile__name {
  font-size: clamp(5px, 0.62vh, 10px);
  font-size: clamp(5px, 1.16cqw, 12px);
  font-weight: 620;
  line-height: 1.1;
  letter-spacing: -0.01em;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 100%;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.tile__price {
  font-family: var(--font-num);
  font-size: clamp(4px, 0.55vh, 9px);
  font-size: clamp(4px, 0.98cqw, 10px);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.tile__flag {
  font-size: clamp(6px, 0.85vh, 13px);
  font-size: clamp(6px, 1.5cqw, 16px);
  line-height: 1;
}
.tile__icon {
  font-size: clamp(8px, 1.25vh, 20px);
  font-size: clamp(8px, 2.2cqw, 24px);
  line-height: 1;
  opacity: 0.92;
}
.tile--corner .tile__name {
  font-size: clamp(5px, 0.7vh, 11px);
  font-size: clamp(5px, 1.32cqw, 14px);
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.tile--corner .tile__icon {
  font-size: clamp(10px, 1.7vh, 26px);
  font-size: clamp(10px, 3cqw, 32px);
}

/* Colonnes gauche et droite : texte pivote, lisible */
.tile--left .tile__name,
.tile--left .tile__price {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  max-height: 100%;
  max-width: none;
}
.tile--right .tile__name,
.tile--right .tile__price {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  max-height: 100%;
  max-width: none;
}
.tile--top .tile__name,
.tile--top .tile__price { transform: rotate(180deg); }
.tile--left,
.tile--right { flex-direction: row; }
.tile--left { flex-direction: row-reverse; }

/* Maisons et hotel */
.tile__houses {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  z-index: 2;
  pointer-events: none;
}
.tile--bottom .tile__houses { top: 1%; left: 0; right: 0; height: 18%; }
.tile--top .tile__houses { bottom: 1%; left: 0; right: 0; height: 18%; }
.tile--left .tile__houses { right: 1%; top: 0; bottom: 0; width: 18%; flex-direction: column; }
.tile--right .tile__houses { left: 1%; top: 0; bottom: 0; width: 18%; flex-direction: column; }

.tile__house {
  width: clamp(3px, 0.55vh, 7px);
  height: clamp(3px, 0.55vh, 7px);
  width: clamp(3px, 0.95cqw, 9px);
  height: clamp(3px, 0.95cqw, 9px);
  border-radius: 1.5px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.tile__hotel {
  width: clamp(6px, 1vh, 13px);
  height: clamp(3px, 0.6vh, 8px);
  width: clamp(6px, 1.7cqw, 17px);
  height: clamp(3px, 1cqw, 10px);
  border-radius: 1.5px;
  background: linear-gradient(180deg, #f87171, #dc2626);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.5);
}
.tile__skyscraper {
  width: clamp(4px, 0.7vh, 9px);
  height: clamp(7px, 1.15vh, 15px);
  width: clamp(4px, 1.1cqw, 11px);
  height: clamp(7px, 1.9cqw, 19px);
  border-radius: 1.5px;
  background: linear-gradient(180deg, #c084fc, #7c3aed);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 0 8px -2px #a855f7;
}

/* Pastille du proprietaire */
.tile__owner-dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: clamp(4px, 0.7vh, 9px);
  height: clamp(4px, 0.7vh, 9px);
  width: clamp(4px, 1.15cqw, 11px);
  height: clamp(4px, 1.15cqw, 11px);
  border-radius: 50%;
  background: var(--owner, var(--pc));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 8px -1px var(--owner, var(--pc));
  z-index: 3;
}

/* Etats */
.tile--owned {
  box-shadow:
    inset 0 0 0 2px var(--owner, var(--pc)),
    inset 0 0 18px -6px var(--owner, var(--pc));
}

.tile--mortgaged {
  filter: grayscale(0.85) brightness(0.72);
}
.tile--mortgaged::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    rgba(229, 72, 77, 0.35) 0 3px,
    transparent 3px 8px
  );
}

.tile--highlight {
  z-index: 4;
  animation: tile-halo 1.4s ease-in-out infinite;
}

.tile--current {
  box-shadow:
    inset 0 0 0 2px var(--gold),
    0 0 20px -4px color-mix(in srgb, var(--gold) 70%, transparent);
  z-index: 3;
}

.tile.is-clickable { cursor: pointer; }

/* --------------------------------------------------------------------------
   17. Centre du plateau
   -------------------------------------------------------------------------- */

/* `#board-center` est un FRERE de `#board` a l'interieur de `#board-wrap` : ce
   n'est donc pas une cellule de la grille 11 x 11 et `grid-column` / `grid-row`
   n'auraient aucun effet. On le cale explicitement sur les 9 cases interieures,
   soit un onzieme du cote sur chaque bord, au-dessus du canvas des pions
   (`#pawn-canvas`, z-index 5). */
#board-center,
.board-center {
  position: absolute;
  inset: calc(100% / 11);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2.4cqw, 22px);
  padding: clamp(8px, 3.4cqw, 34px);
  text-align: center;
  border-radius: calc(var(--radius) * 0.6);
  background:
    radial-gradient(circle at 50% 40%, rgba(48, 66, 106, 0.42), transparent 66%),
    linear-gradient(160deg, rgba(16, 23, 40, 0.55), rgba(9, 13, 24, 0.7));
  box-shadow: inset 0 0 70px -22px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}
#board-center::before {
  content: '';
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(148, 168, 208, 0.08);
  pointer-events: none;
}

.board-logo {
  font-size: clamp(14px, 3.1vh, 40px);
  font-size: clamp(14px, 5.4cqw, 52px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffe6a8, var(--gold) 45%, #d98a24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 12px 34px rgba(242, 193, 78, 0.16);
  user-select: none;
}
.board-logo__sub {
  font-size: clamp(7px, 1.5cqw, 15px);
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  margin-top: 4px;
}

/* Blocs de la zone centrale portes par index.html (#board-center-*). */
.board-center__turn {
  font-size: clamp(9px, 2.2cqw, 21px);
  font-weight: 650;
  line-height: 1.2;
  color: var(--ink);
}
.board-center__turn:empty { display: none; }
.board-center__action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 94%;
}
.board-center__action:empty { display: none; }

/* Zone des des */
.dice-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.8cqw, 16px);
  min-height: clamp(28px, 9cqw, 84px);
}

.die {
  --die-size: clamp(24px, 5.2vh, 62px);
  --die-size: clamp(24px, 8cqw, 74px);
  position: relative;
  width: var(--die-size);
  height: var(--die-size);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 12%;
  border-radius: 22%;
  background: linear-gradient(150deg, #ffffff, #d9dfeb 60%, #b9c2d4);
  box-shadow:
    0 10px 22px -8px rgba(0, 0, 0, 0.75),
    inset 0 -3px 6px rgba(0, 0, 0, 0.18),
    inset 0 2px 3px rgba(255, 255, 255, 0.9);
}
.die .pip {
  width: 68%;
  height: 68%;
  place-self: center;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #4b5568, #10141d 78%);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6);
}

/* Placement des points selon la face */
.die[data-face='1'] .pip:nth-child(1),
.die--1 .pip:nth-child(1) { grid-area: 2 / 2; }

.die[data-face='2'] .pip:nth-child(1),
.die--2 .pip:nth-child(1) { grid-area: 1 / 1; }
.die[data-face='2'] .pip:nth-child(2),
.die--2 .pip:nth-child(2) { grid-area: 3 / 3; }

.die[data-face='3'] .pip:nth-child(1),
.die--3 .pip:nth-child(1) { grid-area: 1 / 1; }
.die[data-face='3'] .pip:nth-child(2),
.die--3 .pip:nth-child(2) { grid-area: 2 / 2; }
.die[data-face='3'] .pip:nth-child(3),
.die--3 .pip:nth-child(3) { grid-area: 3 / 3; }

.die[data-face='4'] .pip:nth-child(1),
.die--4 .pip:nth-child(1) { grid-area: 1 / 1; }
.die[data-face='4'] .pip:nth-child(2),
.die--4 .pip:nth-child(2) { grid-area: 1 / 3; }
.die[data-face='4'] .pip:nth-child(3),
.die--4 .pip:nth-child(3) { grid-area: 3 / 1; }
.die[data-face='4'] .pip:nth-child(4),
.die--4 .pip:nth-child(4) { grid-area: 3 / 3; }

.die[data-face='5'] .pip:nth-child(1),
.die--5 .pip:nth-child(1) { grid-area: 1 / 1; }
.die[data-face='5'] .pip:nth-child(2),
.die--5 .pip:nth-child(2) { grid-area: 1 / 3; }
.die[data-face='5'] .pip:nth-child(3),
.die--5 .pip:nth-child(3) { grid-area: 2 / 2; }
.die[data-face='5'] .pip:nth-child(4),
.die--5 .pip:nth-child(4) { grid-area: 3 / 1; }
.die[data-face='5'] .pip:nth-child(5),
.die--5 .pip:nth-child(5) { grid-area: 3 / 3; }

.die[data-face='6'] .pip:nth-child(1),
.die--6 .pip:nth-child(1) { grid-area: 1 / 1; }
.die[data-face='6'] .pip:nth-child(2),
.die--6 .pip:nth-child(2) { grid-area: 1 / 3; }
.die[data-face='6'] .pip:nth-child(3),
.die--6 .pip:nth-child(3) { grid-area: 2 / 1; }
.die[data-face='6'] .pip:nth-child(4),
.die--6 .pip:nth-child(4) { grid-area: 2 / 3; }
.die[data-face='6'] .pip:nth-child(5),
.die--6 .pip:nth-child(5) { grid-area: 3 / 1; }
.die[data-face='6'] .pip:nth-child(6),
.die--6 .pip:nth-child(6) { grid-area: 3 / 3; }

.die.is-rolling { animation: die-roll 560ms var(--ease) both; }
.die--speed {
  background: linear-gradient(150deg, #ffe9b0, var(--gold) 60%, #cf8b21);
  color: #2a1c04;
}
.die--speed .pip { background: radial-gradient(circle at 34% 30%, #6b4c12, #241703 78%); }
.die__glyph {
  grid-area: 1 / 1 / 4 / 4;
  place-self: center;
  font-size: calc(var(--die-size) * 0.42);
  line-height: 1;
}

.dice-total {
  font-family: var(--font-num);
  font-size: clamp(9px, 1.7cqw, 17px);
  font-weight: 700;
  color: var(--muted);
}

/* Bandeau d'action en cours */
/* `.card-popup` est le nom porte par index.html (#card-popup). */
.center-banner,
.card-popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 92%;
  padding: clamp(6px, 1.7cqw, 15px) clamp(10px, 2.8cqw, 26px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(10, 15, 27, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  animation: rise-in 200ms var(--ease) both;
}
.center-banner__title,
.card-popup__title {
  font-size: clamp(9px, 2.1cqw, 20px);
  font-weight: 680;
  line-height: 1.25;
}
.center-banner__text,
.card-popup__text {
  font-size: clamp(8px, 1.65cqw, 16px);
  color: var(--muted);
  line-height: 1.35;
}
.center-banner--good { border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.center-banner--bad { border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.center-banner--gold { border-color: color-mix(in srgb, var(--gold) 40%, transparent); }

/* Bouton principal contextuel */
.center-cta {
  min-width: clamp(90px, 26cqw, 240px);
  padding: clamp(7px, 1.9cqw, 17px) clamp(14px, 3.6cqw, 34px);
  font-size: clamp(10px, 2.2cqw, 21px);
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:
    0 16px 34px -16px color-mix(in srgb, var(--accent) 92%, transparent),
    var(--shadow-inset);
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease),
    filter var(--t-fast) var(--ease);
}
.center-cta:hover { transform: translateY(-2px); filter: brightness(1.1); }
.center-cta:active { transform: translateY(0); }
.center-cta:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.6);
}
.center-cta--gold {
  color: #2a1e05;
  background: linear-gradient(135deg, #ffd977, var(--gold));
  box-shadow: 0 16px 34px -16px color-mix(in srgb, var(--gold) 92%, transparent);
}
.center-cta--pulse { animation: cta-pulse 2.2s var(--ease) infinite; }

/* Chrono de tour au centre */
/* `.board-center__timer` et `.auction__timer` sont les noms d'index.html. */
.turn-timer,
.board-center__timer {
  font-family: var(--font-num);
  font-size: clamp(9px, 1.8cqw, 18px);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}
/* Hors du plateau : taille fixe (pas de conteneur de requete disponible). */
.auction__timer {
  font-family: var(--font-num);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.turn-timer.is-urgent,
.board-center__timer.is-urgent,
.auction__timer.is-urgent { color: var(--bad); animation: blink 900ms steps(2) infinite; }

/* --------------------------------------------------------------------------
   18. Panneau des joueurs
   -------------------------------------------------------------------------- */

#player-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 10px;
  overflow-y: auto;
  padding: 2px;
}

.player-chip {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 10px 12px 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--pc) 10%, transparent), transparent 58%),
    var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-inset);
  overflow: hidden;
  transition:
    transform var(--t) var(--ease),
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    opacity var(--t) var(--ease);
}
.player-chip::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--pc);
  box-shadow: 0 0 12px -1px var(--pc);
}
.player-chip .avatar { grid-row: 1 / 3; --size: 40px; }
.player-chip__name {
  grid-column: 2;
  font-weight: 640;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.player-chip__name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-chip__money {
  grid-column: 2;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  font-size: 0.95rem;
  color: var(--gold);
}
.player-chip__meta {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 3px;
}
.player-chip__badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.player-chip--active {
  border-color: color-mix(in srgb, var(--pc) 62%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--pc) 46%, transparent),
    0 14px 32px -18px var(--pc),
    var(--shadow-inset);
  animation: chip-pulse 2.4s var(--ease) infinite;
}
.player-chip--active .player-chip__name { color: #fff; }

.player-chip--self { border-left-color: transparent; }
.player-chip--self .player-chip__name::after {
  content: 'vous';
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
}

.player-chip--bankrupt {
  opacity: 0.42;
  filter: grayscale(0.7);
}
.player-chip--bankrupt .player-chip__name span { text-decoration: line-through; }
.player-chip--disconnected { opacity: 0.6; }

/* Badges specifiques */
.badge--jail {
  color: color-mix(in srgb, var(--warn) 25%, white);
  border-color: color-mix(in srgb, var(--warn) 42%, transparent);
  background: color-mix(in srgb, var(--warn) 16%, transparent);
}
.badge--bot {
  color: color-mix(in srgb, var(--accent-2) 30%, white);
  border-color: color-mix(in srgb, var(--accent-2) 42%, transparent);
  background: color-mix(in srgb, var(--accent-2) 16%, transparent);
}
.badge--offline {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.badge--offline::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.badge--host {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 40%, transparent);
  background: color-mix(in srgb, var(--gold) 13%, transparent);
}

/* Mini-jauge de proprietes possedees */
.owned-strip {
  display: flex;
  gap: 2px;
  margin-top: 5px;
  grid-column: 2;
}
.owned-strip__seg {
  height: 4px;
  flex: 1 1 auto;
  border-radius: 2px;
  background: var(--band, rgba(255, 255, 255, 0.14));
}

/* --------------------------------------------------------------------------
   19. Panneau d'actions
   -------------------------------------------------------------------------- */

#action-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.008)),
    var(--panel);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: var(--shadow), var(--shadow-inset);
}
#action-panel > .panel__body { padding: 12px; }

/* `.actions` est le nom porte par index.html (#action-buttons). */
.action-buttons,
.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 7px;
}
.action-buttons .btn,
.actions .btn { width: 100%; }

/* Panneau d'enchere */
/* `#action-auction` est la section correspondante dans index.html. */
.auction,
#action-auction {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--gold) 12%, transparent), transparent 60%),
    rgba(12, 17, 30, 0.7);
  box-shadow: var(--shadow);
  animation: rise-in 200ms var(--ease) both;
}
.auction__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auction__tile {
  font-weight: 660;
  font-size: 0.95rem;
}
.auction__bid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
}
.auction__amount {
  font-family: var(--font-num);
  font-size: 1.7rem;
  font-weight: 750;
  color: var(--gold);
  letter-spacing: -0.02em;
  text-shadow: 0 0 26px color-mix(in srgb, var(--gold) 40%, transparent);
}
.auction__bidder { font-size: 0.78rem; color: var(--muted); }
.auction__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.auction__steps .btn { width: 100%; font-family: var(--font-num); }
.auction__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
/* Blocs de l'enchere et de la banque portes par index.html. */
.auction__info { color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.bank__form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.auction__form .field,
.bank__form .field { flex: 1 1 130px; min-width: 0; }

/* `.auction__bidders` est le nom porte par index.html (#auction-bidders). */
.auction__players,
.auction__bidders {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.auction__player {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.76rem;
}
.auction__player .avatar { --size: 18px; }
.auction__player.is-out { opacity: 0.35; text-decoration: line-through; }

/* Chrono circulaire */
.timer-ring {
  --p: 100;
  --ring-size: 54px;
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(
      var(--gold) calc(var(--p) * 1%),
      rgba(255, 255, 255, 0.08) 0
    );
  transition: background 240ms linear;
}
.timer-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #0b101c;
  border: 1px solid var(--line);
}
.timer-ring__value {
  position: relative;
  font-family: var(--font-num);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.timer-ring.is-urgent {
  background: conic-gradient(var(--bad) calc(var(--p) * 1%), rgba(255, 255, 255, 0.08) 0);
}
.timer-ring.is-urgent .timer-ring__value { color: var(--bad); }
.timer-ring--sm { --ring-size: 38px; }
.timer-ring--sm .timer-ring__value { font-size: 0.78rem; }

/* Panneau d'echange */
.trade {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.trade__cols {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: start;
}
.trade__col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.026);
  min-width: 0;
}
.trade__col--mine { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.trade__col--theirs { border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.trade__col-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.trade__swap {
  align-self: center;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.9rem;
}
.trade__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 210px;
  overflow-y: auto;
}
.trade__item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.trade__item:hover { background: rgba(255, 255, 255, 0.07); }
.trade__item.is-selected {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.trade__item-swatch {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--band, var(--line));
  flex: 0 0 auto;
}
.trade__foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.trade-offer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent-2) 32%, transparent);
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  animation: rise-in 200ms var(--ease) both;
}
.trade-offer__title { font-weight: 640; font-size: 0.88rem; }
.trade-offer__body { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }

/* Mes proprietes, groupees par couleur */
/* `.prop-list` est le nom porte par index.html (#property-list). */
.props-groups,
.prop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.props-group {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  overflow: hidden;
}
.props-group__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--band, var(--line)) 34%, transparent),
    transparent 72%);
  border-bottom: 1px solid var(--line);
}
.props-group__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--band, var(--line));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  flex: 0 0 auto;
}
.props-group--full .props-group__head { color: var(--gold); }
.props-group__list { display: flex; flex-direction: column; }

.prop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 0.83rem;
  border-top: 1px solid rgba(148, 168, 208, 0.08);
  transition: background-color var(--t-fast) var(--ease);
}
.prop-row:first-child { border-top: 0; }
.prop-row:hover { background: rgba(255, 255, 255, 0.05); }
.prop-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prop-row__level {
  display: flex;
  gap: 2px;
  align-items: center;
}
.prop-row__actions { display: flex; gap: 4px; }
.prop-row--mortgaged .prop-row__name {
  color: var(--muted);
  text-decoration: line-through;
}

/* --------------------------------------------------------------------------
   20. Journal + chat
   -------------------------------------------------------------------------- */

#log-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.008)),
    var(--panel);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: var(--shadow), var(--shadow-inset);
}

/* Onglets generiques (aussi utilises en responsive) */
.tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  flex: 0 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 620;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition:
    color var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}
.tab:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.tab--active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -9px color-mix(in srgb, var(--accent) 90%, transparent);
}
.tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  margin-left: 5px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  font-size: 0.66rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.32);
}

.tabpane {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.tabpane--active { display: flex; }

/* Liste du journal */
/* `.log` et `.chat` sont les noms portes par index.html. */
.log-list,
.chat-list,
.log,
.chat {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

.log-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: color-mix(in srgb, var(--ink) 88%, transparent);
  animation: log-in 180ms var(--ease) both;
}
.log-entry:nth-child(odd) { background: rgba(255, 255, 255, 0.018); }
.log-entry__icon { font-size: 0.9rem; line-height: 1.3; }
.log-entry__text { overflow-wrap: anywhere; }
.log-entry__text b { color: #fff; font-weight: 640; }
.log-entry--good { color: color-mix(in srgb, var(--good) 40%, var(--ink)); }
.log-entry--bad { color: color-mix(in srgb, var(--bad) 40%, var(--ink)); }
.log-entry--gold { color: color-mix(in srgb, var(--gold) 42%, var(--ink)); }

/* Chat */
.chat-msg {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  padding: 5px 6px;
  border-radius: 10px;
  animation: log-in 180ms var(--ease) both;
}
.chat-msg .avatar { --size: 24px; margin-top: 2px; }
.chat-msg__head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.chat-msg__name {
  font-size: 0.78rem;
  font-weight: 660;
  color: var(--pc);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-msg__time { font-size: 0.68rem; color: var(--muted); }
.chat-msg__text {
  font-size: 0.85rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.chat-msg--system {
  grid-template-columns: 1fr;
  text-align: center;
  font-size: 0.76rem;
  color: var(--muted);
  font-style: italic;
}

/* `.chat__form` est le nom porte par index.html (#room-chat-form, #game-chat-form). */
.chat-input,
.chat__form {
  display: flex;
  gap: 7px;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  flex: 0 0 auto;
}
.chat__form .field { flex: 1 1 auto; min-width: 0; }
.chat-input input,
.chat__form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  min-height: 36px;
  color: var(--ink);
  background: rgba(6, 10, 20, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
}
.chat-input input::placeholder,
.chat__form input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.chat-input input:focus,
.chat__form input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.chat-input input:focus-visible,
.chat__form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-input .btn,
.chat__form .btn { flex: 0 0 auto; border-radius: var(--radius-pill); }

/* --------------------------------------------------------------------------
   21. Editeur de plateau
   -------------------------------------------------------------------------- */

#screen-editor.screen--active { min-height: 0; }

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 18px;
  align-items: start;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow), var(--shadow-inset);
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
  z-index: 20;
}
.editor-toolbar .field { min-width: 150px; }

.editor-table-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow), var(--shadow-inset);
  overflow: auto;
  max-height: calc(100dvh - 220px);
}

.editor-table {
  width: 100%;
  min-width: 780px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}
.editor-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 9px 10px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: #101728;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.editor-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(148, 168, 208, 0.08);
  vertical-align: middle;
}
.editor-table tbody tr { transition: background-color var(--t-fast) var(--ease); }
.editor-table tbody tr:hover { background: rgba(255, 255, 255, 0.038); }
.editor-table tbody tr.is-invalid { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.editor-table tbody tr.is-selected {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.editor-table input,
.editor-table select {
  width: 100%;
  min-width: 0;
  padding: 5px 8px;
  min-height: 30px;
  font-size: 0.82rem;
  color: var(--ink);
  background: rgba(6, 10, 20, 0.5);
  border: 1px solid transparent;
  border-radius: 7px;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.editor-table input:hover,
.editor-table select:hover { border-color: var(--line); }
.editor-table input:focus,
.editor-table select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: rgba(6, 10, 20, 0.8);
}
.editor-table input:focus-visible,
.editor-table select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.editor-table .col-index {
  font-family: var(--font-num);
  color: var(--muted);
  text-align: right;
  width: 42px;
  padding-right: 10px;
}
.editor-table .col-num input { text-align: right; font-family: var(--font-num); }
.editor-table .col-rents input { width: 52px; }
.editor-table .cell-rents { display: flex; gap: 3px; }
.editor-table .cell-error {
  font-size: 0.72rem;
  color: color-mix(in srgb, var(--bad) 32%, white);
}

/* Palette des groupes */
/* `.group-list` est le nom porte par index.html (#editor-groups). */
.group-palette,
.group-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.group-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.026);
  border-left: 4px solid var(--band, var(--line));
}
.group-item__key {
  font-family: var(--font-num);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
}
.group-item input[type='text'] {
  padding: 5px 8px;
  min-height: 30px;
  font-size: 0.83rem;
  background: rgba(6, 10, 20, 0.5);
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
  width: 100%;
}
.group-item input[type='text']:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.group-item input[type='number'] {
  width: 72px;
  padding: 5px 8px;
  min-height: 30px;
  text-align: right;
  font-family: var(--font-num);
  font-size: 0.82rem;
  background: rgba(6, 10, 20, 0.5);
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ink);
}

/* Apercu du plateau dans l'editeur */
.editor-preview {
  position: sticky;
  top: calc(var(--topbar-h) + 78px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Apercu de plateau reutilisable : `renderBoard(board, mount)` construit
   `.board-preview > .board-grid` pour tout conteneur qui n'est pas `#board`. */
.board-preview {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 42%, rgba(30, 44, 74, 0.9), rgba(8, 12, 22, 0.95) 72%);
  overflow: hidden;
}
.editor-preview .board-preview { box-shadow: var(--shadow-lg); }
.board-preview > #board,
.board-preview > .board-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
}

.editor-errors {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
}
.editor-error {
  display: flex;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: color-mix(in srgb, var(--bad) 28%, white);
  border: 1px solid color-mix(in srgb, var(--bad) 32%, transparent);
  background: color-mix(in srgb, var(--bad) 11%, transparent);
}

/* --------------------------------------------------------------------------
   22. Ecran de profil
   -------------------------------------------------------------------------- */

.profile-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.avatar-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.avatar-editor .avatar { --size: 128px; }
.avatar-drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  padding: 18px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}
.avatar-drop:hover,
.avatar-drop.is-dragover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--ink);
}
.avatar-drop input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* Classement / resultats de fin de partie */
.podium {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.podium-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.028);
  border-left: 3px solid var(--pc);
}
.podium-row__rank {
  font-family: var(--font-num);
  font-size: 1.1rem;
  font-weight: 750;
  color: var(--muted);
  width: 26px;
  text-align: center;
}
.podium-row--first {
  border-color: color-mix(in srgb, var(--gold) 42%, transparent);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.podium-row--first .podium-row__rank { color: var(--gold); }

/* --------------------------------------------------------------------------
   23. Animations
   -------------------------------------------------------------------------- */

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.965); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(28px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateX(28px) scale(0.96); }
}

@keyframes log-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes chip-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--pc) 46%, transparent),
      0 14px 32px -18px var(--pc),
      var(--shadow-inset);
  }
  50% {
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--pc) 70%, transparent),
      0 18px 40px -16px var(--pc),
      var(--shadow-inset);
  }
}

@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 16px 34px -16px color-mix(in srgb, var(--accent) 92%, transparent); }
  50% { box-shadow: 0 18px 44px -14px color-mix(in srgb, var(--accent) 100%, transparent); }
}

@keyframes tile-halo {
  0%, 100% {
    box-shadow:
      inset 0 0 0 2px color-mix(in srgb, var(--gold) 70%, transparent),
      0 0 12px -2px color-mix(in srgb, var(--gold) 55%, transparent);
  }
  50% {
    box-shadow:
      inset 0 0 0 2px var(--gold),
      0 0 26px 1px color-mix(in srgb, var(--gold) 75%, transparent);
  }
}

@keyframes die-roll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-22deg) scale(1.16) translateY(-8%); }
  50% { transform: rotate(18deg) scale(1.1) translateY(-4%); }
  75% { transform: rotate(-8deg) scale(1.04); }
  100% { transform: rotate(0deg) scale(1); }
}

@keyframes float-slow {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(24px, 26px, 0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.1) 37%,
    rgba(255, 255, 255, 0.04) 63%);
  background-size: 400% 100%;
  animation: skeleton-shine 1.3s ease-in-out infinite;
}
@keyframes skeleton-shine {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* --------------------------------------------------------------------------
   24. Responsive
   -------------------------------------------------------------------------- */

/* Ecrans intermediaires : panneaux resserres */
@media (max-width: 1400px) {
  #screen-game.screen--active,
  .game-layout {
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(268px, 320px);
    gap: 12px;
    padding: 12px;
  }
}

@media (max-width: 1200px) {
  :root { --radius: 16px; }

  #screen-game.screen--active,
  .game-layout {
    grid-template-columns: 168px minmax(0, 1fr) 250px;
    gap: 10px;
    padding: 10px;
  }
  #board-wrap { width: min(calc(100vh - 120px), 100%); max-height: calc(100vh - 120px); }

  .player-chip { padding: 8px 10px 8px 12px; }
  .player-chip .avatar { --size: 32px; }
  .player-chip__name { font-size: 0.84rem; }
  .player-chip__money { font-size: 0.88rem; }

  .home-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .room-layout { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
  .editor-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); }
}

@media (max-width: 1024px) {
  .home-grid,
  .room-layout,
  .profile-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-preview { position: static; }
  .editor-preview .board-preview { max-width: 560px; margin-inline: auto; }
}

/* Sous 900 px : les panneaux passent en onglets sous le plateau */
@media (max-width: 900px) {
  /* La barre peut passer sur deux lignes sans que son contenu se chevauche. */
  #topbar {
    height: auto;
    min-height: var(--topbar-h);
    padding: 6px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar__room { display: none; }
  .topbar__nick { display: none; }

  #screen-game.screen--active,
  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
  }

  #board-wrap {
    width: min(calc(100vw - 20px), calc(100vh - 200px));
    max-height: none;
    margin-inline: auto;
    flex: 0 0 auto;
  }

  .side-col {
    display: contents;
  }

  /* Barre d'onglets : dans index.html, `#game-tabs` est la barre elle-meme
     (`.tabs`), pas un conteneur ; elle passe simplement avant le plateau. */
  #game-tabs {
    order: -1;
    flex: 0 0 auto;
    border-radius: var(--radius);
    border: 1px solid var(--line);
  }

  #player-panel,
  #action-panel,
  #log-panel {
    width: 100%;
    /* Borne haute : le contenu defile a l'interieur du panneau, pas la page. */
    max-height: min(72vh, 560px);
  }

  /* Les panneaux marques .tabpane sont masques quand inactifs */
  #player-panel.tabpane,
  #action-panel.tabpane,
  #log-panel.tabpane { display: none; }
  /* Le plateau occupe deja toute la hauteur disponible : le panneau actif ne
     doit pas etre comprime a zero, l'ecran defile pour l'atteindre. */
  #player-panel.tabpane--active,
  #action-panel.tabpane--active,
  #log-panel.tabpane--active {
    display: flex;
    flex: 0 0 auto;
    min-height: 320px;
  }

  #player-panel {
    max-height: 380px;
    overflow-y: auto;
  }
  #action-panel { min-height: 360px; }
  #log-panel { min-height: 340px; }

  .screen__inner { padding: 18px 14px 40px; }
  .action-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .trade__cols { grid-template-columns: minmax(0, 1fr); }
  .trade__swap { transform: rotate(90deg); justify-self: center; }
  .modal { width: 100%; }
  #toast-host { left: 12px; right: 12px; width: auto; }
}

@media (max-width: 620px) {
  :root { --radius: 14px; --radius-lg: 20px; }
  body { font-size: 13.5px; }

  #screen-game.screen--active,
  .game-layout { padding: 8px; gap: 8px; }
  #board-wrap { width: min(calc(100vw - 16px), calc(100vh - 170px)); }

  .room-row {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 8px;
  }
  .room-row__count { grid-column: 2; justify-self: end; }

  .action-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pawn-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
  .auction__steps { grid-template-columns: repeat(3, 1fr); }
  .rule-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 8px; }
  .rule-row__control { grid-column: 2; justify-content: flex-start; }
  .modal__foot { flex-wrap: wrap; }
  .modal__foot .btn { flex: 1 1 auto; }
  .editor-toolbar { position: static; }
}

/* Ecrans tres larges */
@media (min-width: 1800px) {
  #screen-game.screen--active,
  .game-layout {
    grid-template-columns: 280px minmax(0, 1fr) 400px;
    gap: 18px;
    padding: 18px;
  }
}

/* --------------------------------------------------------------------------
   24 bis. Ossature d'index.html
   Les conteneurs de premier niveau du balisage statique. Les modules d'ecran
   peuvent affiner ces blocs, mais aucune zone ne reste sans mise en forme si
   le JavaScript ne les decore pas.
   -------------------------------------------------------------------------- */

.auth {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
  align-items: start;
}
.auth__title { font-size: 1.5rem; font-weight: 740; letter-spacing: -0.02em; text-align: center; }
.auth__subtitle { color: var(--muted); text-align: center; }
.auth__form { display: flex; flex-direction: column; gap: 14px; }
.auth__submit { width: 100%; justify-content: center; }
.auth__switch { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.auth__legal { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.auth__aside-title { font-size: 1.05rem; font-weight: 680; }
.auth__features { display: flex; flex-direction: column; gap: 10px; list-style: none; margin: 0; padding: 0; }
.auth__features li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; color: var(--muted); }
.auth__feature-icon { flex: 0 0 auto; }

.home,
.lobby,
.room,
.editor,
.profile {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.editor { max-width: 1520px; }
.home__rooms,
.editor__head { padding: 18px; }

.room__grid,
.editor__grid,
.profile__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}
.room__col,
.editor__col,
.profile__col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.profile__col--wide { grid-column: 1 / -1; }
.profile__form { display: flex; flex-direction: column; gap: 12px; }
.profile__username { font-weight: 650; }
.profile__avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   25. Preferences utilisateur
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .card--action:hover,
  .action-card:hover,
  .pawn-card:hover,
  .room-row:hover,
  .center-cta:hover,
  .color-dots__dot:hover { transform: none; }

  #screen-auth::before,
  #screen-auth::after { animation: none; }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(190, 208, 240, 0.34);
    --muted: #aab6cd;
    --panel: rgba(16, 23, 38, 0.94);
  }
  .tile { border-color: rgba(190, 208, 240, 0.3); }
  .btn { border-color: rgba(190, 208, 240, 0.32); }
}

/* Impression : rendu lisible sur fond clair */
/* --------------------------------------------------------------------------
   Barre superieure : compression progressive au lieu du retour a la ligne.

   #topbar a une hauteur fixe (--topbar-h) alors que ses groupes internes
   autorisaient flex-wrap: wrap. Entre 900 px (ou la barre passe volontairement
   en mode multi-lignes) et ~1200 px, le contenu debordait donc sous la barre et
   chevauchait l'ecran. On interdit le retour a la ligne dans cette plage et on
   sacrifie progressivement les elements les moins utiles.
   -------------------------------------------------------------------------- */
@media (min-width: 901px) {
  #topbar { flex-wrap: nowrap; }
  #topbar .topbar__nav,
  #topbar .topbar__account,
  #topbar .topbar__room {
    flex-wrap: nowrap;
    min-width: 0;
  }
  #topbar .topbar__room-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #topbar .topbar__nickname {
    max-width: 140px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

@media (min-width: 901px) and (max-width: 1280px) {
  #topbar { gap: 8px; padding: 0 12px; }
  #topbar .topbar__room-name { max-width: 150px; }
}

/* En dessous de ce seuil, le nom du salon et le mot-logo ne rentrent plus :
   l'icone du logo et le code du salon suffisent a l'orientation. */
@media (min-width: 901px) and (max-width: 1150px) {
  #topbar .topbar__wordmark,
  #topbar .topbar__room-name { display: none; }
  #topbar .topbar__nickname { max-width: 96px; }
  #topbar .topbar__nav .btn,
  #topbar .topbar__account .btn,
  #topbar .topbar__room .btn { padding-inline: 9px; }
}

@media print {
  body::before,
  body::after,
  #topbar,
  #toast-host,
  #modal-host,
  #action-panel,
  #log-panel { display: none !important; }
  body { background: #fff; color: #000; }
  .card,
  .panel { box-shadow: none; border-color: #ccc; background: #fff; }
}
