/* ═══════════════════════════════════════════════════════════════
   LAYOUT — grille principale, en-tête, boutons, pied de page
   ═══════════════════════════════════════════════════════════════ */

/* ── App Grid — 3 colonnes : gauche | échiquier | droite ─────── */

#app {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header  header  header"
    "left    game    right"
    "footer  footer  footer";
  min-height: 100dvh;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 0 12px;
}

/* ── Header ───────────────────────────────────────────────────── */

.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-math {
  font-family: 'Times New Roman', 'Georgia', serif;
  font-size: 1.5rem;
  font-style: italic;
  color: var(--color-primary);
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.logo-math sup {
  font-size: 0.65em;
  vertical-align: super;
  line-height: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.logo-accent {
  color: var(--color-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-username {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  margin-right: 4px;
}

/* ── Buttons ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); }

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-border); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  padding: 8px 10px;
}
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface); }

.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: var(--radius-md); }

.btn-label { display: inline; }

/* ── Game Area (centre) ───────────────────────────────────────── */

.game-area {
  grid-area: game;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  gap: 10px;
  /* Hauteur contrainte = hauteur de la grille — empêche l'échiquier de bouger */
  min-height: 0;
}

/* Quand l'échiquier est retourné, inverser les barres joueurs */
.game-area.board-flipped .player-bar.player-white { order: -1; }
.game-area.board-flipped .player-bar.player-black { order: 1; }

/* ── Footer ───────────────────────────────────────────────────── */

.footer {
  grid-area: footer;
  padding: 14px 0;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.footer a {
  color: var(--color-text-faint);
  text-decoration: none;
  font-size: 12px;
  transition: color var(--transition-fast);
}

.footer a:hover { color: var(--color-text-muted); }
