#fc-root {
  --board-1: #34466a;
  --board-2: #1c263b;
  --slot: rgba(255, 255, 255, 0.07);
  --slot-border: rgba(255, 255, 255, 0.22);
  --panel: #ffffff;
  --border: #dfe3e8;
  --text: #2b2f36;
  --muted: #6b7380;
  --accent: #f5b301;
  --hint: #4fc3f7;
  --shadow: 0 8px 24px rgba(20, 30, 40, 0.14);
  --gap: 12px;
  /* Barre commune (css/games.css) aux couleurs du tapis */
  --mg-jeu-largeur: 1024px;
  --mgb-fond: radial-gradient(120% 160% at 0% 0%, rgba(245, 179, 1, 0.18), transparent 55%),
    linear-gradient(120deg, var(--board-2), var(--board-1));
  --mgb-accent: var(--accent);
  --mgb-titre: linear-gradient(100deg, #ffe08a, var(--accent) 60%, #ffffff);
  --mg-fs-fond: #f4f6f8;
  --mg-bulle-fond: var(--board-2);

  color: var(--text);
}

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

/* ---------- Barres ---------- */

#fc-root .message {
  flex: 1;
  min-width: 200px;
  font-weight: 700;
  color: var(--muted);
}
#fc-root .message {
  min-height: 1.4em;
}

/* ---------- Plateau ---------- */
#fc-root .board-wrap {
  container-type: inline-size;
}
#fc-root .board {
  /* --cw-max est calculé en JS pour que le plateau tienne dans la hauteur de l'écran */
  --cw: min(
    var(--cw-cap, 100px),
    var(--cw-max, 100px),
    calc((100cqw - 32px - 7 * var(--gap)) / 8)
  );
  --ch: calc(var(--cw) * 1.4);

  padding: 16px;
  background:
    radial-gradient(
        circle at 1px 1px,
        rgba(255, 255, 255, 0.06) 1px,
        transparent 0
      )
      0 0 / 14px 14px,
    linear-gradient(160deg, var(--board-1), var(--board-2));
  border-radius: 20px;
  box-shadow:
    var(--shadow),
    inset 0 0 50px rgba(0, 0, 0, 0.35);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#fc-root .row-top {
  display: flex;
  justify-content: center;
  gap: var(--gap);
  margin-bottom: calc(var(--gap) * 1.6);
}
#fc-root .slots {
  display: flex;
  gap: var(--gap);
}
#fc-root .slot {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  background: var(--slot);
  border: 2px dashed var(--slot-border);
  border-radius: calc(var(--cw) * 0.08);
}
#fc-root .slot.foundation::before {
  content: attr(data-symbol);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cw) * 0.5);
  color: rgba(255, 255, 255, 0.2);
}
#fc-root .slot .card {
  position: absolute;
  top: -2px;
  left: -2px;
}

#fc-root .columns {
  display: flex;
  justify-content: center;
  gap: var(--gap);
}
#fc-root .column {
  position: relative;
  width: var(--cw);
  height: calc(var(--cw) * 4.4);
}
#fc-root .column::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: var(--cw);
  height: var(--ch);
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: calc(var(--cw) * 0.08);
}
#fc-root .column .card {
  position: absolute;
  left: 0;
}

/* Zone de dépôt survolée */
#fc-root .drop-ok {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: calc(var(--cw) * 0.08);
}

/* ---------- Cartes ---------- */
#fc-root .card {
  display: block;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.07);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
#fc-root .card.selected {
  box-shadow:
    0 0 0 3px var(--accent),
    0 4px 12px rgba(0, 0, 0, 0.5);
  filter: brightness(0.95);
}
#fc-root .card.hint {
  animation: hint 0.5s ease-in-out 3 alternate;
}
@keyframes hint {
  to {
    box-shadow:
      0 0 0 4px var(--hint),
      0 0 18px var(--hint);
  }
}
#fc-root .card.dragging {
  z-index: 1000;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  cursor: grabbing;
}
#fc-root .slot.hint,
#fc-root .column.hint::before {
  animation: hint-slot 0.5s ease-in-out 3 alternate;
}
@keyframes hint-slot {
  to {
    border-color: var(--hint);
    box-shadow: 0 0 18px var(--hint);
  }
}

/* ---------- Boutons ---------- */
#fc-root .btn {
  padding: 8px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}
#fc-root .btn:hover:not(:disabled) {
  background: #f1f3f5;
}
#fc-root .btn:active:not(:disabled) {
  transform: translateY(1px);
}
#fc-root .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#fc-root .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
}
#fc-root .btn.primary:hover:not(:disabled) {
  background: #ffc933;
}

/* ---------- Modales ---------- */
#fc-root .modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(92vw, 460px);
  height: fit-content;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
#fc-root #helpModal {
  width: min(94vw, 680px);
}
#fc-root .modal[open] {
  animation: pop 0.25s ease-out;
}
#fc-root .modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}
#fc-root .modal-body {
  padding: 22px;
}
#fc-root .modal-body h2 {
  margin: 0 0 10px;
}
#fc-root .modal-body.centered {
  text-align: center;
}
#fc-root .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#fc-root .modal-head h2 {
  margin: 0;
}
#fc-root .modal-close {
  padding: 4px 8px;
  font-size: 1.2rem;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
#fc-root .modal-close:hover {
  color: var(--text);
  background: var(--border);
}
#fc-root .modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
#fc-root .modal-actions.stack .btn {
  flex: 1;
}
#fc-root .muted {
  color: var(--muted);
}
#fc-root .rules h3 {
  margin: 16px 0 6px;
  font-size: 1rem;
}
#fc-root .rules p,
#fc-root .rules ul {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}
#fc-root .rules ul {
  padding-left: 20px;
}
#fc-root .rules strong {
  color: var(--text);
}
#fc-root .rules .tip {
  margin-top: 14px;
  padding: 10px 12px;
  background: #fff8e1;
  border-radius: 10px;
}

#fc-root .deal-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
  padding: 12px;
  background: #f4f6f8;
  border: 1px solid var(--border);
  border-radius: 12px;
}
#fc-root .deal-form input {
  width: 100px;
  padding: 7px 10px;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
}

#fc-root .win-emoji {
  font-size: 3rem;
}
#fc-root .win-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
#fc-root .win-stats div {
  padding: 8px;
  background: #f4f6f8;
  border-radius: 10px;
}
#fc-root .win-stats strong {
  display: block;
  font-size: 1.2rem;
}
#fc-root .win-stats span {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Plein écran ---------- */
#fc-root.mg-fs {
  padding: 16px;
}
/* Le plateau prend toute la hauteur restante ; les cartes peuvent grandir davantage */
#fc-root.mg-fs .board-wrap {
  flex: 1 1 0;
  min-height: 0;
}
#fc-root.mg-fs .board {
  --cw-cap: 140px;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  #fc-root {
    --gap: 4px;
  }
  #fc-root .board {
    --cw: min(var(--cw-max, 100px), calc((100cqw - 12px - 7 * var(--gap)) / 8));
    padding: 6px;
    border-radius: 12px;
  }
  #fc-root .row-top {
    gap: calc(var(--gap) * 1);
  }
  #fc-root .slot {
    border-width: 1px;
  }
  
  
}
