* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #050505;
  --bg-card: #0C0C0C;
  --bg-card-border: #1A1A1A;
  --bg-input: #141414;
  --accent: #F59E0B;
  --accent-light: #FBBF24;
  --accent-dim: #1AF59E0B;
  --green: #10B981;
  --red: #EF4444;
  --gold: #F59E0B;
  --text: #F1F5F9;
  --text-dim: #666666;
  --radius: 12px;

  /* === Plateau MoneyGo — Palette désaturée haut de gamme === */
  --board-bg: #0C0C0C;
  --board-space-bg: #f4f5f6;
  --board-space-border: #1A1A1A;
  --board-text: #1a1c1e;
  --board-text-muted: #626a74;
  --board-center-bg: #050505;
  --board-shadow: 0 12px 40px rgba(0,0,0,0.3);

  /* Groupes de propriétés — tons rompus élégants */
  --grp-brown: #8b6f5e;
  --grp-lightblue: #6b9bc4;
  --grp-pink: #d97d95;
  --grp-orange: #d99e6a;
  --grp-red: #c96b6b;
  --grp-yellow: #d4b55e;
  --grp-green: #5ca386;
  --grp-darkblue: #4a7ab5;
  --grp-railroad: #7a7a8a;
  --grp-utility: #8a8a9a;
}

/* Light theme */
[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --bg-card-border: #e0e0e0;
  --bg-input: #f0f0f0;
  --accent: #D97706;
  --accent-light: #F59E0B;
  --green: #059669;
  --red: #DC2626;
  --gold: #D97706;
  --text: #1a1a1a;
  --text-dim: #888888;
  --board-bg: #e8eaf2;
  --board-center-bg: #dfe2ee;
  --board-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* --- Landing --- */
header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; color: var(--accent); }
header p { color: var(--text-dim); }

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(245,158,11,0.08);
}
.card h2 { margin-bottom: 0.5rem; }
.card p { color: var(--text-dim); margin-bottom: 1rem; font-size: 0.9rem; }

/* --- Boutons --- */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-input);
  color: var(--text);
}
.btn:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-primary:hover { background: var(--accent-light); }
.btn-big { font-size: 1.1rem; padding: 0.8rem 2rem; width: 100%; margin-bottom: 0.5rem; }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.85rem; }

/* --- Inputs --- */
.input-code {
  background: var(--bg-input);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 1.3rem;
  text-align: center;
  text-transform: uppercase;
  width: 120px;
  color: var(--text);
  letter-spacing: 0.3rem;
}
.input-name, .input-text {
  background: var(--bg-input);
  border: 1px solid #1A1A1A;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-size: 1rem;
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); }

.join-row { display: flex; gap: 0.5rem; justify-content: center; align-items: center; }

/* --- Games preview --- */
.games-preview { margin-top: 2rem; }
.games-preview h2 { margin-bottom: 1rem; }
.game-list { display: flex; flex-direction: column; gap: 0.8rem; }
.game-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color 0.2s;
}
.game-item:hover { border-color: var(--accent); }
.game-icon { font-size: 2rem; }
.game-info { flex: 1; text-align: left; }
.game-info h3 { font-size: 1.1rem; color: var(--text); }
.game-info p { color: var(--text-dim); font-size: 0.85rem; }
.badge { padding: 0.3rem 0.7rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-soon { background: #1A1A1A; color: var(--text-dim); }
.badge-live { background: var(--green); color: #fff; }

/* --- Room --- */
.room-container { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.room-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.back-link { color: var(--text-dim); text-decoration: none; }
.room-code {
  background: var(--accent);
  color: #000;
  padding: 0.2rem 0.8rem;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.2rem;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}
.share-section { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.share-code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.3rem;
  color: var(--gold);
}

/* --- Lobby --- */
.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  margin: 2rem auto;
}
.login-card h2 { margin-bottom: 0.5rem; }
.login-card p { color: var(--text-dim); margin-bottom: 1.5rem; }
.login-card .input-name {
  width: 100%;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  padding: 0.7rem;
  background: var(--bg-input);
  border: 2px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  text-align: center;
}

.player-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.player-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  padding: 0.6rem 1rem;
  border-radius: 8px;
}
.player-dot { width: 12px; height: 12px; border-radius: 50%; }
.lobby-actions { display: flex; flex-direction: column; gap: 0.5rem; max-width: 300px; margin: 1rem auto; }

/* --- Lobby layout --- */
.lobby-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.lobby-section h2 { font-size: 1.1rem; margin-bottom: 0.8rem; }
.lobby-start {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}
.game-selected-info {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

/* --- Game selector --- */
.game-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.game-option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  cursor: default;
  transition: all 0.15s;
}
.game-option.selectable {
  cursor: pointer;
}
.game-option.selectable:hover {
  border-color: var(--accent-light);
  background: var(--bg-input);
}
.game-option.selected {
  border-color: var(--gold);
  background: rgba(253,203,110,0.1);
}
.game-option.disabled {
  opacity: 0.5;
}
.game-option-icon { font-size: 1.8rem; }
.game-option-info { flex: 1; }
.game-option-info strong { display: block; font-size: 0.95rem; }
.game-option-info small { color: var(--text-dim); font-size: 0.75rem; }
.game-option-badge {
  background: #1A1A1A;
  color: var(--text-dim);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}
.game-option.selected .game-option-badge { display: none; }

/* --- Game layout --- */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  align-items: start;
}

/* --- Board --- */
.board-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  width: 100%;
}
.board {
  display: grid;
  grid-template-columns: 88px repeat(9, 56px) 88px;
  grid-template-rows: 88px repeat(9, 56px) 88px;
  background: var(--board-bg);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
  box-shadow: var(--board-shadow);
  transform-origin: top center;
  transition: transform 0.2s ease;
  position: relative;
}

/* Plateau compact (30 cases, grille 9×8) */
.board.small {
  grid-template-columns: 70px repeat(7, 65px) 70px;
  grid-template-rows: 70px repeat(6, 65px) 70px;
}
.board.small .board-center {
  grid-area: 2 / 2 / 8 / 9;
}
.board.small .board-space {
  font-size: 0.55rem;
}
.board-space {
  background: var(--board-space-bg);
  border: 1px solid var(--board-space-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-size: 0.55rem;
  text-align: center;
  padding: 4px 3px;
  position: relative;
  cursor: pointer;
  color: var(--board-text);
  overflow: hidden;
}
.board-space .space-name { font-weight: 600; font-size: 0.5rem; line-height: 1.2; margin-top: 2px; }
.board-space .space-price { font-size: 0.45rem; color: var(--board-text-muted); font-weight: 500; margin-top: auto; }
.board-space .color-bar { width: 100%; height: 12px; border-radius: 2px; margin-bottom: 2px; border-bottom: 1px solid rgba(0,0,0,0.05); }
/* Tokens joueurs — couche superposée qui glisse */
.token-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}
.token-pawn {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 -2px 4px rgba(0,0,0,0.2);
  margin-left: -11px;
  margin-top: -11px;
  transition: transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.board-space .house-indicator {
  font-size: 0.5rem;
  background: rgba(0,0,0,0.06);
  color: var(--board-text);
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 1px;
}
.board-center {
  grid-area: 2 / 2 / 11 / 11;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--text);
  text-align: center;
  background: var(--board-center-bg);
  border-radius: 0;
  padding: 20px;
  gap: 12px;
}
.board-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; text-transform: uppercase; opacity: 0.9; }
.board-center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}
.mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 90%;
  max-width: 200px;
}
.mobile-btn { font-size: 1rem !important; padding: 0.7rem !important; }
.mobile-dice { margin: 0 !important; }
.turn-info {
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 600;
}
.board-space.mortgaged { opacity: 0.45; filter: grayscale(0.6); }
.board-space.corner-space {
  justify-content: center;
  background: #fcfdfe;
}
.board-space .space-icon { font-size: 1rem; line-height: 1; margin-bottom: 2px; }
.board-space.corner-space .space-icon { font-size: 1.4rem; }
.board-space.owned {
  /* Couleur de fond du propriétaire via --owner-color */
  background: var(--owner-color, var(--board-space-bg));
}
.board-space.owned .space-name { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.board-space.owned .space-price { color: rgba(255,255,255,0.85); }
.owner-marker {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 1;
  opacity: 0.8;
}
.board-space .space-name,
.board-space .space-price {
  position: relative;
  z-index: 2;
}

/* --- Connexion icons --- */
.conn-icon { font-size: 0.6rem; margin-left: -2px; }
.conn-on { color: var(--green); }
.conn-off { color: var(--red); opacity: 0.5; }

/* --- Dés 3D --- */
.dice-3d-container {
  perspective: 400px;
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: center;
  min-height: 56px;
}
.dice-3d {
  width: 48px;
  height: 48px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 0.8, 0.4, 1);
}
.dice-3d .face {
  position: absolute;
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, #fff, #e8e8e8);
  border: 1px solid #ccc;
  border-radius: 10px;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 6px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}
.dice-3d .pip {
  width: 7px;
  height: 7px;
  background: #2a2a3a;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
.pip.tl { grid-area: 1/1; }
.pip.tc { grid-area: 1/2; }
.pip.tr { grid-area: 1/3; }
.pip.ml { grid-area: 2/1; }
.pip.c  { grid-area: 2/2; }
.pip.mr { grid-area: 2/3; }
.pip.bl { grid-area: 3/1; }
.pip.bc { grid-area: 3/2; }
.pip.br { grid-area: 3/3; }

.face-1 { transform: translateZ(24px); }
.face-2 { transform: rotateY(90deg) translateZ(24px); }
.face-3 { transform: rotateX(-90deg) translateZ(24px); }
.face-4 { transform: rotateX(90deg) translateZ(24px); }
.face-5 { transform: rotateY(-90deg) translateZ(24px); }
.face-6 { transform: rotateY(180deg) translateZ(24px); }

.dice-3d.show-1 { transform: rotateX(0deg) rotateY(0deg); }
.dice-3d.show-2 { transform: rotateY(-90deg); }
.dice-3d.show-3 { transform: rotateX(90deg); }
.dice-3d.show-4 { transform: rotateX(-90deg); }
.dice-3d.show-5 { transform: rotateY(90deg); }
.dice-3d.show-6 { transform: rotateY(180deg); }

.dice-3d.rolling {
  animation: dice-tumble 0.6s linear infinite;
}
@keyframes dice-tumble {
  0%   { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  25%  { transform: rotateX(180deg) rotateY(90deg) rotateZ(45deg); }
  50%  { transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg); }
  75%  { transform: rotateX(540deg) rotateY(270deg) rotateZ(135deg); }
  100% { transform: rotateX(720deg) rotateY(360deg) rotateZ(180deg); }
}

/* Old dice fallback */
.dice-rolling { animation: dice-shake 0.15s infinite; }
@keyframes dice-shake {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(0.95); }
  75% { transform: rotate(270deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

/* --- Buy notification (non bloquante) --- */
.buy-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 1rem;
  z-index: 150;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: slide-in 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.bn-content { flex: 1; }
.bn-info { font-size: 0.9rem; margin-bottom: 0.6rem; }
.bn-info .bn-money { color: var(--text-dim); font-size: 0.75rem; display: block; margin-top: 2px; }
.bn-actions { display: flex; gap: 0.4rem; }
.bn-close {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 1rem; padding: 0; line-height: 1;
}
.bn-close:hover { color: var(--text); }

@media (max-width: 900px) {
  .buy-notification {
    bottom: 10px; right: 10px; left: 10px;
    max-width: none;
  }
}

/* --- Side panel --- */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 4px;
}
.side-panel::-webkit-scrollbar { width: 4px; }
.side-panel::-webkit-scrollbar-thumb { background: var(--bg-input); border-radius: 2px; }
.player-cards { display: flex; flex-direction: column; gap: 0.4rem; }
.player-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.2s;
}
.player-card.active {
  border: 2px solid var(--gold);
  box-shadow: 0 0 12px rgba(253,203,110,0.3);
}
.player-card.bankrupt { opacity: 0.4; }
.player-card .pc-color { width: 24px; height: 24px; border-radius: 50%; }
.player-card .pc-name { flex: 1; font-weight: 600; }
.player-card .pc-money { font-weight: 700; color: var(--green); position: relative; }
.player-card .pc-money.negative { color: var(--red); }

.board-center-log {
  max-height: 100px;
  overflow-y: auto;
  width: 90%;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 0.5rem;
}
.board-center-log .center-log-entry {
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.board-center-log .center-log-entry:last-child { border-bottom: none; color: var(--gold); }

/* Delta money animation */
.manage-hint { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.3rem; }
.btn-bankrupt {
  background: var(--red) !important;
  color: #fff !important;
  width: 100%;
  font-weight: 700;
  border: none;
  cursor: pointer;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
}
.btn-bankrupt:hover { filter: brightness(1.15); }
.btn-sell {
  background: #c0392b !important;
  color: #fff !important;
}
.btn-sell:hover { filter: brightness(1.15); }
.btn-sell:disabled { opacity: 0.4; }
.money-delta {
  position: absolute;
  right: -4px;
  top: -2px;
  font-size: 0.72rem;
  font-weight: 700;
  pointer-events: none;
  animation: delta-fade 2s ease forwards;
  white-space: nowrap;
}
.money-delta.up { color: var(--green); }
.money-delta.down { color: var(--red); }
@keyframes delta-fade {
  0%   { opacity: 0; transform: translateY(8px) scale(0.7); }
  15%  { opacity: 1; transform: translateY(0) scale(1.05); }
  25%  { transform: translateY(-2px) scale(1); }
  80%  { opacity: 1; transform: translateY(-6px) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(0.9); }
}
.player-card .pc-jail { font-size: 0.7rem; color: var(--red); }

.actions-panel {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.8rem;
}
.dice-display { display: flex; gap: 0.5rem; justify-content: center; margin: 0.5rem 0; }
.die {
  width: 40px; height: 40px;
  background: #fff; color: #333;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700;
}

.game-log {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.6rem;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.8rem;
}
.game-log .log-entry { padding: 0.15rem 0; color: var(--text-dim); }
.game-log .log-entry:nth-child(even) { color: var(--text); }

.chat-box {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  min-height: 100px;
}
.chat-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.chat-header:hover { color: var(--text); }
.chat-box.collapsed .chat-messages,
.chat-box.collapsed .chat-input-row { display: none; }
.chat-box.collapsed { min-height: auto; }
.chat-messages {
  flex: 1;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}
.chat-input-row { display: flex; gap: 0.4rem; }
.chat-input-row input { flex: 1; }

/* --- Modal --- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  text-align: center;
}
.modal-content h3 { margin-bottom: 0.5rem; }
.modal-content p { color: var(--text-dim); margin-bottom: 1rem; }
#modalActions { display: flex; gap: 0.5rem; justify-content: center; }

/* --- Utilities --- */
.hidden { display: none !important; }

/* Desktop : cacher le panneau d'actions latéral si mobile actions visible */
@media (min-width: 901px) {
  #mobileActions { display: none; }
}
@media (max-width: 900px) {
  .actions-panel { display: none; }
  .game-layout {
    grid-template-columns: 1fr;
  }
  .side-panel {
    max-height: 200px;
  }
}

/* --- Chess v2 --- */
.chess-game {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  max-width: 800px;
  margin: 0 auto;
}
@media (min-width: 901px) {
  .chess-game {
    grid-template-columns: auto 240px;
    grid-template-areas: "board sidebar";
    gap: 1.5rem;
    align-items: start;
  }
  .chess-board-wrap { grid-area: board; }
  .chess-sidebar { grid-area: sidebar; }
}

/* Barres joueur */
.chess-player-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: var(--bg-card);
  border-radius: 8px;
  font-size: 0.9rem;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  max-width: var(--board-size, 560px);
  margin: 0 auto;
}
.chess-player-bar.active { border-color: var(--green); }
.chess-player-bar.top { order: 0; }
.chess-player-bar.bottom { order: 2; }
.chess-player-dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex-shrink: 0;
}
.chess-player-name { font-weight: 600; }
.chess-host-badge { font-size: 0.8rem; }
.chess-captured {
  font-size: 1.1rem;
  letter-spacing: -2px;
  margin-left: auto;
  line-height: 1;
}
.chess-advantage {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green);
  background: rgba(245,158,11,0.15);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Plateau */
.chess-board-wrap {
  position: relative;
  order: 1;
  width: var(--board-size, min(560px, 90vw));
  margin: 0 auto;
}
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1;
  border: 3px solid #2a2a2a;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.chess-square {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
  font-size: clamp(1.8rem, 8vw, 3rem);
  transition: background 0.1s;
}
.chess-square.chess-clickable { cursor: pointer; }
.chess-square:not(.chess-clickable) { cursor: default; }
.chess-square.light { background: #f0d9b5; }
.chess-square.dark { background: #b58863; }
.chess-square.selected { background: #F59E0B !important; }
.chess-square.last-move { background: #cdd26a !important; }
.chess-square.valid-move::after {
  content: '';
  position: absolute;
  width: 32%; height: 32%;
  border-radius: 50%;
  background: rgba(245,158,11,0.45);
  z-index: 0;
}
.chess-square.valid-capture::after {
  content: '';
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 4px solid rgba(231,76,60,0.6);
  background: transparent;
  z-index: 0;
}
.chess-square.check-square {
  background: radial-gradient(circle, rgba(231,76,60,0.5) 0%, transparent 70%) !important;
}
.chess-piece {
  user-select: none;
  line-height: 1;
  z-index: 1;
  position: relative;
}
.chess-piece.white { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6), 0 0 2px #000; }
.chess-piece.black { color: #1a1a1a; text-shadow: 0 1px 2px rgba(255,255,255,0.2); }

/* Coordonnées */
.chess-coords-bottom {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  padding-top: 3px;
}
.chess-coords-left {
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: right;
  width: 12px;
}
@media (max-width: 500px) {
  .chess-coords-left { left: -14px; font-size: 0.55rem; }
}

/* Sidebar */
.chess-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.chess-status {
  font-size: 0.95rem;
  text-align: center;
  padding: 0.6rem;
  background: var(--bg-card);
  border-radius: 8px;
  color: var(--gold);
  font-weight: 600;
}
.chess-status.my-turn {
  color: var(--green);
  border: 1px solid rgba(245,158,11,0.3);
}
.chess-status.ended {
  color: #fff;
  background: var(--accent);
}
.check-badge {
  color: var(--red);
  font-weight: 700;
  animation: pulse 1s ease infinite alternate;
}
@keyframes pulse { from { opacity: 0.7; } to { opacity: 1; } }

/* Historique */
.chess-history-panel {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.6rem;
  max-height: 300px;
  display: flex;
  flex-direction: column;
}
.chess-history-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}
.chess-history-list {
  overflow-y: auto;
  flex: 1;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
}
.chess-history-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 0.3rem;
  padding: 2px 4px;
  border-radius: 4px;
}
.chess-history-row:nth-child(odd) { background: rgba(255,255,255,0.03); }
.mh-num { color: var(--text-dim); font-size: 0.75rem; }
.mh-white { color: #f0f0f0; }
.mh-black { color: #aab; }

/* Modale promotion */
.chess-promo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chess-promo-modal {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.chess-promo-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.chess-promo-choices {
  display: flex;
  gap: 0.8rem;
}
.chess-promo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chess-promo-btn:hover {
  border-color: var(--gold);
  background: rgba(253,203,110,0.1);
}
.chess-promo-btn .chess-piece { font-size: 2.5rem; }
.chess-promo-btn small {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.chess-promo-wait {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 2rem;
  color: var(--text-dim);
}

/* --- DiceMaster --- */
.dice-game { display: flex; flex-direction: column; gap: 1rem; max-width: 700px; margin: 0 auto; }
.dice-area {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.dice-row { display: flex; justify-content: center; gap: 0.8rem; flex-wrap: wrap; }
.die-large {
  width: 70px; height: 70px;
  background: #fff; color: #333;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  position: relative;
  border: 3px solid #ddd;
  transition: all 0.15s;
}
.die-large.kept { border-color: var(--green); background: #e8fff5; }
.die-large.clickable { cursor: pointer; }
.die-large.clickable:hover { transform: scale(1.1); }
.kept-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--green); color: #fff;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
}
.dice-controls { margin-top: 1rem; }
.rolls-info { color: var(--gold); font-weight: 600; margin-bottom: 0.5rem; }
.keep-hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.5rem; }

.scorecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 0.8rem; }
.scorecard {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.8rem;
}
.scorecard.active { border: 2px solid var(--gold); }
.scorecard.me { border-left: 3px solid var(--accent); }
.scorecard-header {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.5rem; font-size: 0.9rem;
}
.scorecard-header .total-score { margin-left: auto; font-weight: 700; color: var(--green); }
.scorecard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; }
.score-cell {
  display: flex; justify-content: space-between;
  padding: 0.3rem 0.5rem;
  background: var(--bg-input);
  border-radius: 4px;
  font-size: 0.75rem;
}
.score-cell.filled { opacity: 0.5; }
.score-cell.clickable { cursor: pointer; border: 1px solid var(--accent); }
.score-cell.clickable:hover { background: var(--accent); }
.sc-name { color: var(--text-dim); }
.sc-value { font-weight: 700; }
.game-over-screen {
  text-align: center; font-size: 1.3rem; padding: 1rem; color: var(--gold); font-weight: 700;
}

/* --- Manage panel --- */
.manage-panel {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 0.8rem;
  max-height: 250px;
  overflow-y: auto;
}
.manage-section { margin-bottom: 0.6rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--bg-input); }
.manage-section:last-child { border-bottom: none; }
.manage-section strong { display: block; margin-bottom: 0.3rem; font-size: 0.85rem; }
.manage-list { display: flex; flex-direction: column; gap: 0.25rem; }
.manage-item { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.manage-item span { font-size: 0.75rem; color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .manage-panel { max-height: 180px; font-size: 0.7rem; }
}

/* --- Auction --- */
.auction-panel {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  z-index: 150;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  text-align: center;
}
.auction-header { font-size: 1rem; font-weight: 700; color: var(--gold); margin-bottom: 0.5rem; }
.auction-bid { font-size: 0.9rem; margin-bottom: 0.6rem; }
.auction-actions { display: flex; gap: 0.4rem; justify-content: center; align-items: center; }
.auction-waiting { color: var(--text-dim); font-size: 0.85rem; padding: 0.5rem; }

@media (max-width: 500px) {
  .auction-panel { bottom: 10px; left: 10px; right: 10px; transform: none; max-width: none; }
}

/* --- Responsive : scale au lieu de casser la grille --- */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .game-layout { grid-template-columns: 1fr; }
  .lobby-layout { grid-template-columns: 1fr; }
  .room-container { padding: 0.5rem; }
  .room-header { font-size: 0.85rem; gap: 0.5rem; }
  .room-header h1 { font-size: 1rem; }
  .share-code { font-size: 1.1rem; }
  .board-space { font-size: 0.45rem; padding: 2px; }
  .board-space .space-name { font-size: 0.42rem; }
  .board-space .space-price { font-size: 0.38rem; }
  .board-space .color-bar { height: 8px; }
  .board-space .space-icon { font-size: 0.8rem; }
  .board-space.corner-space .space-icon { font-size: 1.1rem; }
  .board-title { font-size: 1rem; }
  .side-panel { 
    gap: 0.4rem;
    max-height: none;
    overflow-y: visible;
  }
  .player-card { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  .player-card .pc-name { font-size: 0.75rem; }
  .player-card .pc-money { font-size: 0.8rem; }
  .game-log { max-height: 60px; font-size: 0.7rem; }
  .chat-box { min-height: 70px; }
  .chat-messages { max-height: 60px; font-size: 0.7rem; }
  .actions-panel { padding: 0.5rem; }
  .btn-big { font-size: 0.9rem; padding: 0.6rem; }
}

@media (max-width: 500px) {
  .board-space { font-size: 0.38rem; }
  .board-space .space-name { font-size: 0.35rem; }
  .board-title { font-size: 0.75rem; }
}

/* --- Plein écran --- */
.btn-fullscreen {
  font-size: 1.1rem;
  padding: 0.3rem 0.6rem;
  line-height: 1;
}

/* Bouton flottant de sortie */
.btn-exit-fullscreen {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 500;
  background: rgba(231,76,60,0.9);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  transition: all 0.15s;
}
.btn-exit-fullscreen:hover { filter: brightness(1.15); }

/* Classe body en plein écran */
body.fullscreen-mode {
  overflow: hidden;
}
body.fullscreen-mode .room-header,
body.fullscreen-mode #loginView,
body.fullscreen-mode #lobbyView {
  display: none !important;
}
body.fullscreen-mode .room-container {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.fullscreen-mode #gameView:not(.hidden) {
  width: 100%;
  height: 100vh;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

/* MoneyGo plein écran : layout côte à côte qui remplit l'écran */
body.fullscreen-mode .game-layout {
  width: 100%;
  height: 100%;
  max-width: 1400px;
  align-items: center;
  gap: 1.5rem;
}
body.fullscreen-mode .board-wrapper {
  flex: 1;
  height: 100%;
  align-items: center;
}
body.fullscreen-mode .side-panel {
  flex-shrink: 0;
  width: 320px;
  max-height: 100vh;
  height: 100%;
  padding: 0.5rem;
  justify-content: center;
}

/* ChessBattle plein écran */
body.fullscreen-mode #chessContainer,
body.fullscreen-mode #checkersContainer,
body.fullscreen-mode #goContainer {
  width: 100%;
  height: 100vh;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
body.fullscreen-mode .chess-game,
body.fullscreen-mode .checkers-game,
body.fullscreen-mode .go-game {
  max-width: 1200px;
  width: 100%;
}

/* DiceMaster plein écran */
body.fullscreen-mode #diceContainer {
  width: 100%;
  height: 100vh;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
body.fullscreen-mode .dice-game {
  max-width: 900px;
  width: 100%;
}

/* --- Settings panel (lobby) --- */
.settings-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.settings-header {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--text);
}
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-input);
  border-radius: 8px;
  transition: background 0.15s;
}
.setting-row:hover { background: #1A1A1A; }
.setting-info {
  flex: 1;
  text-align: left;
}
.setting-info span {
  font-size: 0.85rem;
  font-weight: 600;
  display: block;
}
.setting-info small {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: #1A1A1A;
  transition: background 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.toggle[aria-checked="true"] {
  background: var(--accent);
}
.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.3, 0.8, 0.4, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle[aria-checked="true"] .toggle-knob {
  transform: translateX(20px);
}
.toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.setting-select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid #1A1A1A;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}

/* --- Property modal --- */
.property-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pm-fade-in 0.2s ease;
}
@keyframes pm-fade-in { from { opacity: 0; } to { opacity: 1; } }
.property-modal {
  background: var(--bg-card);
  border-radius: 14px;
  width: 90%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  animation: pm-slide-up 0.25s cubic-bezier(0.3, 0.8, 0.4, 1);
}
@keyframes pm-slide-up { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.pm-header {
  padding: 0.8rem 1rem;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pm-title { color: #fff; font-weight: 700; font-size: 1rem; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.pm-close { background: rgba(0,0,0,0.2); border: none; color: #fff; font-size: 1.1rem; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.pm-close:hover { background: rgba(0,0,0,0.4); }
.pm-body { padding: 0.8rem 1rem; }
.pm-row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid #1A1A1A; font-size: 0.85rem; }
.pm-row span { color: var(--text-dim); }
.pm-row strong { color: var(--text); }
.pm-free { color: var(--green); font-weight: 600; }
.pm-desc { color: var(--text-dim); font-size: 0.85rem; padding: 0.3rem 0; line-height: 1.4; }
.pm-rent-table { margin: 0.6rem 0; overflow-x: auto; }
.pm-rent-table table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.pm-rent-table th { background: var(--bg-input); color: var(--text-dim); padding: 0.3rem 0.2rem; font-weight: 600; }
.pm-rent-table td { text-align: center; padding: 0.3rem 0.2rem; color: var(--text); border-top: 1px solid #1A1A1A; }
.pm-rent-note { font-size: 0.68rem; color: var(--text-dim); margin-top: 0.3rem; font-style: italic; }
.pm-mortgaged-banner { background: rgba(231,76,60,0.15); border: 1px solid var(--red); border-radius: 6px; padding: 0.5rem; text-align: center; color: var(--red); font-size: 0.8rem; font-weight: 600; margin: 0.5rem 0; }
.pm-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid #1A1A1A; }

/* Turn timer */
.turn-timer {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  padding: 0.4rem;
  background: var(--bg-input);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.turn-timer.urgent {
  color: #fff;
  background: var(--red);
  animation: timer-pulse 0.5s ease infinite alternate;
}
@keyframes timer-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

/* === Checkers (Dames) === */
.checkers-game {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  max-width: 700px;
  margin: 0 auto;
}
@media (min-width: 901px) {
  .checkers-game {
    grid-template-columns: auto 220px;
    grid-template-areas: "board sidebar";
    gap: 1.5rem;
    align-items: start;
  }
  .checkers-board-wrap { grid-area: board; }
  .checkers-sidebar { grid-area: sidebar; }
}
.checkers-player-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: var(--bg-card);
  border-radius: 8px;
  font-size: 0.9rem;
  border: 2px solid transparent;
  max-width: var(--board-size, 500px);
  margin: 0 auto;
}
.checkers-player-bar.active { border-color: var(--green); }
.checkers-player-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.dot-red { background: var(--accent); }
.dot-black { background: #2a2a3a; border: 1px solid #555; }
.checkers-player-name { font-weight: 600; }
.checkers-captured { margin-left: auto; font-size: 0.8rem; color: var(--text-dim); }

.checkers-board-wrap {
  position: relative;
  width: var(--board-size, min(500px, 90vw));
  margin: 0 auto;
}
.checkers-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1;
  border: 3px solid var(--accent);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.checkers-square {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
  font-size: clamp(1.5rem, 7vw, 2.8rem);
}
.checkers-square.light-bg { background: #f0d9b5; }
.checkers-square.dark-bg { background: #b58863; }
.checkers-square.ck-clickable { cursor: pointer; }
.checkers-square:not(.ck-clickable) { cursor: default; }
.checkers-square.selected { background: #F59E0B !important; }
.checkers-square.last-move { background: #cdd26a !important; }
.checkers-square.valid-move::after {
  content: '';
  position: absolute;
  width: 35%; height: 35%;
  border-radius: 50%;
  background: rgba(245,158,11,0.4);
}
.checker-piece {
  width: 70%; height: 70%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.2rem, 5vw, 2rem);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 -3px 6px rgba(0,0,0,0.2);
  z-index: 1;
}
.checker-piece.piece-red {
  background: radial-gradient(circle at 35% 35%, #ff6b6b, #c0392b);
  color: rgba(0,0,0,0.3);
}
.checker-piece.piece-black {
  background: radial-gradient(circle at 35% 35%, #4a4a5a, #1a1a2a);
  color: rgba(255,255,255,0.1);
}
.checker-piece.is-king::before {
  content: '♛';
  position: absolute;
  font-size: 0.6em;
  color: var(--gold);
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
}
.checkers-coords-bottom {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  padding-top: 3px;
}
.checkers-coords-left {
  position: absolute;
  left: -16px;
  top: 0; bottom: 0;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: right;
  width: 12px;
}
.checkers-sidebar { display: flex; flex-direction: column; gap: 0.8rem; }
.checkers-status {
  font-size: 0.95rem; text-align: center; padding: 0.6rem;
  background: var(--bg-card); border-radius: 8px; color: var(--gold); font-weight: 600;
}
.checkers-status.my-turn { color: var(--green); border: 1px solid rgba(245,158,11,0.3); }
.checkers-status.ended { color: #fff; background: var(--accent); }
.checkers-history-panel {
  background: var(--bg-card); border-radius: 8px; padding: 0.6rem; max-height: 300px;
  display: flex; flex-direction: column;
}
.checkers-history-title { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); margin-bottom: 0.4rem; }
.checkers-history-list { overflow-y: auto; font-size: 0.85rem; font-family: 'Courier New', monospace; }
.checkers-history-row { padding: 2px 4px; }

/* === Go === */
.go-game {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  max-width: 700px;
  margin: 0 auto;
}
@media (min-width: 901px) {
  .go-game {
    grid-template-columns: auto 220px;
    grid-template-areas: "board sidebar";
    gap: 1.5rem;
    align-items: start;
  }
  .go-board-outer { grid-area: board; }
  .go-sidebar { grid-area: sidebar; }
}
.go-player-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: var(--bg-card);
  border-radius: 8px;
  font-size: 0.9rem;
  border: 2px solid transparent;
  max-width: var(--go-board-px, 500px);
  margin: 0 auto;
}
.go-player-bar.active { border-color: var(--green); }
.go-player-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.dot-black-stone { background: #1a1a2a; border: 1px solid #444; }
.dot-white-stone { background: #f0f0f0; border: 1px solid #aaa; }
.go-player-name { font-weight: 600; }
.go-captures { margin-left: auto; font-size: 0.8rem; color: var(--text-dim); }

.go-board-outer {
  position: relative;
  width: var(--go-board-px, min(500px, 90vw));
  margin: 0 auto;
  padding: 12px;
  background: #d4a76a; /* couleur bois traditionnel */
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.go-board {
  display: grid;
  aspect-ratio: 1;
  background: transparent;
}
.go-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: default;
  /* Lignes du plateau via background pour effet goban */
  background-image:
    linear-gradient(to right, #5a3a1a 1px, transparent 1px),
    linear-gradient(to bottom, #5a3a1a 1px, transparent 1px);
  background-size: 100% 100%;
}
.go-cell.go-clickable { cursor: pointer; }
.go-cell.go-clickable:hover { background-color: rgba(0,0,0,0.05); }
.go-cell.star-point::before {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #5a3a1a;
  opacity: 0.6;
}
.go-stone {
  width: 85%; height: 85%;
  border-radius: 50%;
  z-index: 2;
  transition: transform 0.15s;
}
.go-stone.stone-black {
  background: radial-gradient(circle at 35% 35%, #4a4a5a, #0a0a15);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.go-stone.stone-white {
  background: radial-gradient(circle at 35% 35%, #fff, #d0d0d0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.go-stone.last-stone {
  box-shadow: 0 0 0 3px var(--green), 0 2px 6px rgba(0,0,0,0.5);
}
.go-ko-mark {
  font-size: 0.7rem;
  z-index: 3;
}
.go-coords-bottom {
  display: grid;
  text-align: center;
  font-size: 0.6rem;
  color: #5a3a1a;
  padding-top: 4px;
}
.go-sidebar { display: flex; flex-direction: column; gap: 0.8rem; }
.go-status {
  font-size: 0.95rem; text-align: center; padding: 0.6rem;
  background: var(--bg-card); border-radius: 8px; color: var(--gold); font-weight: 600;
}
.go-status.my-turn { color: var(--green); border: 1px solid rgba(245,158,11,0.3); }
.go-status.ended { color: #fff; background: var(--accent); }
.go-score-detail { font-size: 0.75rem; font-weight: 400; margin-top: 0.3rem; color: var(--text-dim); }
.go-actions { display: flex; gap: 0.5rem; }
.go-actions .btn { flex: 1; }
.go-history-panel {
  background: var(--bg-card); border-radius: 8px; padding: 0.6rem; max-height: 300px;
  display: flex; flex-direction: column;
}
.go-history-title { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); margin-bottom: 0.4rem; }
.go-history-list { overflow-y: auto; font-size: 0.85rem; font-family: 'Courier New', monospace; }
.go-history-row { display: flex; gap: 0.3rem; padding: 2px 4px; }
.go-mh-num { color: var(--text-dim); font-size: 0.75rem; min-width: 28px; }
.go-mh-mark { font-size: 0.9rem; }
.go-waiting { text-align: center; padding: 3rem; color: var(--text-dim); }

/* ============ CONNECT 4 (Puissance 4) ============ */
.c4-game { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.c4-players { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.c4-player {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem; border-radius: 8px; font-weight: 600;
  background: var(--bg-card); transition: all 0.2s;
}
.c4-player.active { box-shadow: 0 0 0 2px var(--accent); }
.c4-dot {
  width: 18px; height: 18px; border-radius: 50%; display: inline-block;
}
.c4-dot.red { background: var(--accent); box-shadow: inset -3px -3px 6px rgba(0,0,0,0.3); }
.c4-dot.yellow { background: #e0e0e0; box-shadow: inset -3px -3px 6px rgba(0,0,0,0.3); }
.c4-board {
  display: grid; gap: 4px; padding: 10px;
  background: linear-gradient(135deg, #1a5fb4, #0d3a6d);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.c4-cell {
  width: 44px; height: 44px;
  background: rgba(0,0,0,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: default; transition: background 0.15s;
}
.c4-cell.c4-clickable:hover { background: rgba(255,255,255,0.1); }
.c4-cell.c4-last { box-shadow: 0 0 8px 2px rgba(255,255,255,0.5); }
.c4-cell.c4-win { animation: c4WinPulse 0.8s ease-in-out infinite alternate; }
@keyframes c4WinPulse { from { box-shadow: 0 0 8px 2px var(--accent); } to { box-shadow: 0 0 16px 4px var(--accent); } }
.c4-piece { width: 36px; height: 36px; border-radius: 50%; display: block; }
.c4-piece.red { background: radial-gradient(circle at 35% 35%, #FBBF24, #B45309); box-shadow: inset -2px -2px 6px rgba(0,0,0,0.3); }
.c4-piece.yellow { background: radial-gradient(circle at 35% 35%, #f0f0f0, #888); box-shadow: inset -2px -2px 6px rgba(0,0,0,0.3); }
.c4-cols { display: flex; gap: 4px; padding: 0 10px; }
.c4-col-btn {
  width: 44px; height: 28px; border: none; border-radius: 6px;
  background: rgba(255,255,255,0.15); color: #fff; cursor: pointer; font-size: 0.9rem;
  transition: all 0.15s;
}
.c4-col-btn:hover { background: rgba(255,255,255,0.35); transform: translateY(-2px); }
.c4-status { font-size: 1rem; font-weight: 600; text-align: center; padding: 0.5rem; }

/* ============ TIC-TAC-TOE (Morpion) ============ */
.ttt-game { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.ttt-players { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.ttt-player {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem; border-radius: 8px; font-weight: 600;
  background: var(--bg-card); transition: all 0.2s;
}
.ttt-player.active { box-shadow: 0 0 0 2px var(--accent); }
.ttt-sym {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; border-radius: 4px;
}
.ttt-sym.ttt-x { color: var(--accent); }
.ttt-sym.ttt-o { color: #e0e0e0; }
.ttt-board {
  display: grid; gap: 6px; padding: 10px;
  background: var(--bg-card); border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.ttt-cell {
  width: 60px; height: 60px;
  background: var(--bg-main);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: default; font-size: 2rem; font-weight: 800;
  transition: all 0.15s; user-select: none;
}
.ttt-cell.ttt-clickable { cursor: pointer; }
.ttt-cell.ttt-clickable:hover { background: rgba(245,158,11,0.08); }
.ttt-cell.ttt-last { box-shadow: 0 0 6px 1px var(--accent); }
.ttt-cell.ttt-win { animation: tttWin 0.6s ease-in-out infinite alternate; }
@keyframes tttWin { from { background: rgba(245,158,11,0.15); box-shadow: 0 0 8px rgba(245,158,11,0.2); } to { background: rgba(245,158,11,0.3); box-shadow: 0 0 16px rgba(245,158,11,0.4); } }
.ttt-mark { display: flex; align-items: center; justify-content: center; }
.ttt-mark.ttt-x { color: var(--accent); text-shadow: 0 0 10px rgba(245,158,11,0.3); }
.ttt-mark.ttt-o { color: #e0e0e0; text-shadow: 0 0 8px rgba(255,255,255,0.2); }
.ttt-status { font-size: 1rem; font-weight: 600; text-align: center; padding: 0.5rem; }

/* ============ MineField
.ms-game { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.ms-players { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; align-items: center; }
.ms-player {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem; border-radius: 8px; font-weight: 600;
  background: var(--bg-card); transition: all 0.2s;
}
.ms-player.active { box-shadow: 0 0 0 2px var(--accent); }
.ms-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--p-color, #e74c3c);
}
.ms-score { font-size: 0.8rem; color: var(--text-dim); }
.ms-mines { font-size: 0.85rem; font-weight: 600; }
.ms-status { font-size: 0.95rem; font-weight: 600; text-align: center; padding: 0.3rem; }
.ms-board {
  display: grid; gap: 2px; padding: 8px;
  background: var(--bg-card); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  max-width: 100%; overflow: auto;
}
.ms-cell {
  width: var(--ms-cell, 36px); height: var(--ms-cell, 36px);
  background: linear-gradient(135deg, #1A1A1A, #0C0C0C);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.95rem; font-weight: 700;
  transition: all 0.1s; user-select: none;
}
.ms-cell:hover { background: linear-gradient(135deg, #241f10, #1A1A1A); }
.ms-cell.ms-clickable { cursor: pointer; }
.ms-cell.revealed { background: rgba(255,255,255,0.06); cursor: default; }
.ms-cell:not(.ms-clickable):not(.revealed) { cursor: default; }
.ms-cell.last { box-shadow: 0 0 6px 1px var(--accent); }
.ms-flag { font-size: 1rem; }
.ms-hint { font-size: 0.8rem; color: var(--text-dim); text-align: center; }

/* ============ CHAT IN-GAME ============ */
.chat-panel {
  position: fixed; bottom: 0; right: 20px; width: 300px;
  background: var(--bg-card); border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4); z-index: 200;
  font-size: 0.85rem; transition: all 0.3s;
}
.chat-panel.hidden { display: none; }
.chat-panel.collapsed .chat-body { display: none; }
.chat-panel.collapsed .chat-toggle { transform: rotate(180deg); }
.chat-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.8rem; cursor: pointer; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1); user-select: none;
}
.chat-toggle { margin-left: auto; font-size: 0.7rem; transition: transform 0.3s; }
.chat-badge {
  background: #e74c3c; color: #fff; border-radius: 10px;
  padding: 1px 7px; font-size: 0.7rem; font-weight: 700;
}
.chat-badge.hidden { display: none; }
.chat-body { display: flex; flex-direction: column; }
.chat-messages {
  height: 180px; overflow-y: auto; padding: 0.5rem;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.chat-msg { line-height: 1.3; word-wrap: break-word; }
.chat-author { font-weight: 600; color: var(--accent); }
.chat-input-row { display: flex; padding: 0.4rem; gap: 0.3rem; }
.chat-input-row input {
  flex: 1; padding: 0.4rem 0.6rem; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; background: var(--bg-main); color: var(--text); font-size: 0.85rem;
}
.chat-input-row button {
  padding: 0.4rem 0.7rem; border: none; border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer; font-size: 0.85rem;
}
.chat-input-row button:hover { opacity: 0.85; }
@media (max-width: 600px) {
  .chat-panel { width: calc(100% - 20px); right: 10px; left: 10px; }
}

/* === Language toggle === */
.lang-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 100;
}
.lang-toggle-room {
  position: static;
  display: inline-flex;
}
.lang-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  line-height: 1;
}
.lang-btn:hover {
  background: rgba(255,255,255,0.18);
  transform: scale(1.1);
}
.lang-btn[disabled], .lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  opacity: 0.9;
}

/* === RPS === */
.rps-game { max-width: 500px; margin: 0 auto; text-align: center; }
.rps-scores { display: flex; justify-content: space-around; margin-bottom: 1rem; }
.rps-player { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; opacity: 0.7; transition: opacity 0.3s; }
.rps-player.me { font-weight: 700; }
.rps-player.chosen { opacity: 1; }
.rps-player.chosen::after { content: '🔒'; font-size: 0.8rem; }
.rps-name { font-size: 0.95rem; }
.rps-pips { font-size: 1.1rem; letter-spacing: 2px; }
.rps-round { font-size: 1rem; color: var(--text-dim); margin-bottom: 1.5rem; }
.rps-choices { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.rps-choice-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 1rem 1.2rem; cursor: pointer; transition: all 0.2s;
  color: var(--text); font-size: 0.9rem;
}
.rps-choice-btn:hover {
  border-color: var(--accent); background: rgba(245,158,11,0.12);
  transform: translateY(-2px);
}
.rps-choice-btn:active { transform: translateY(0); }
.rps-emoji-big { font-size: 2.5rem; }
.rps-waiting { font-size: 1rem; color: var(--text-dim); margin: 1rem 0; }
.rps-locked { font-size: 3rem; opacity: 0.5; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 0.8; } }
.rps-reveal { display: flex; justify-content: center; gap: 2rem; margin: 1.5rem 0; }
.rps-reveal-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1rem 1.5rem; border-radius: 12px; background: rgba(255,255,255,0.05);
  border: 2px solid transparent; transition: all 0.3s;
}
.rps-reveal-card.win {
  border-color: #2ecc71; background: rgba(46,204,113,0.1);
  box-shadow: 0 0 12px rgba(46,204,113,0.3);
}
.rps-reveal-card .rps-emoji { font-size: 3rem; }
.rps-reveal-card .rps-name { font-size: 0.85rem; color: var(--text-dim); }
.rps-history { margin-top: 1.5rem; text-align: left; max-width: 300px; margin-left: auto; margin-right: auto; }
.rps-history-title { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.4rem; font-weight: 600; }
.rps-hist-row { font-size: 1.1rem; text-align: center; padding: 0.2rem 0; }

/* === Mastermind === */
.mm-game { max-width: 500px; margin: 0 auto; text-align: center; }
.mm-players { display: flex; justify-content: space-around; margin-bottom: 0.8rem; }
.mm-player { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; opacity: 0.6; }
.mm-player.me { font-weight: 700; }
.mm-player.active { opacity: 1; }
.mm-name { font-size: 0.9rem; }
.mm-guess-count { font-size: 0.8rem; color: var(--text-dim); }
.mm-status { margin-bottom: 1rem; }
.mm-reveal { margin: 1rem 0; padding: 0.8rem; background: rgba(245,158,11,0.05); border-radius: 8px; }
.mm-reveal-row { display: flex; justify-content: center; gap: 0.5rem; align-items: center; padding: 0.3rem 0; font-size: 1.2rem; }
.mm-board { display: flex; justify-content: center; margin-bottom: 1rem; }
.mm-board-section { min-width: 280px; }
.mm-board-title { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.4rem; font-weight: 600; }
.mm-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.mm-pegs { display: flex; gap: 0.3rem; }
.mm-peg { font-size: 1.3rem; width: 28px; text-align: center; }
.mm-hints { display: flex; gap: 0.1rem; flex-wrap: wrap; max-width: 60px; min-width: 50px; }
.mm-hint { font-size: 0.8rem; }
.mm-input-area { margin-top: 1rem; }
.mm-current-guess { display: flex; justify-content: center; gap: 0.4rem; margin-bottom: 0.8rem; }
.mm-color-picker { display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.mm-color-btn { background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 0.4rem 0.6rem; cursor: pointer; font-size: 1.3rem; transition: all 0.15s; }
.mm-color-btn:hover { border-color: var(--accent); transform: scale(1.1); }
.mm-clear-btn, .mm-submit-btn { background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.9rem; color: var(--text); transition: all 0.15s; }
.mm-submit-btn { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.mm-submit-btn:hover { opacity: 0.9; }

/* === Player Stats === */
.player-stats { max-width: 700px; margin: 2rem auto; padding: 0 1rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.8rem; }
.stat-card {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(245,158,11,0.04); border: 1px solid #1A1A1A;
  border-radius: 10px; padding: 0.7rem 0.9rem;
}
.stat-icon { font-size: 1.3rem; }
.stat-name { font-size: 0.85rem; flex: 1; }
.stat-numbers { font-size: 0.9rem; color: var(--text-dim); }
.stat-numbers strong { color: #2ecc71; }
.stat-wr { font-size: 0.85rem; font-weight: 700; color: var(--accent); min-width: 40px; text-align: right; }
.game-over-stats { margin-top: 0.8rem; font-size: 0.85rem; color: var(--text-dim); }

/* Theme button */
.theme-btn { margin-left: 0.3rem; font-size: 1rem; }
