/* =====================================================================
   Schach – chess.css
   Ergänzt memory.css; nutzt dieselben CSS-Variablen wie der Rest
   der Seite.
   ===================================================================== */

/* ---- Lobby-Karte für Memory-Hub ---------------------------------- */
.mem-card--chess::before            { background: #1a1a2e; }
.mem-card--chess .mem-card__badge   { color: #1a1a2e; }
.mem-card--chess .mem-card__play    { color: #1a1a2e; }

/* ---- Lobby -------------------------------------------------------- */
.chess-lobby__head h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.8rem, 3vw + 1rem, 2.8rem);
  color: #1a1a2e;
  margin-bottom: .25rem;
}

.chess-mode-card {
  background: #fff;
  border: 1px solid #e0ddd5;
  border-radius: 14px;
  padding: 1.4rem 1.4rem 1.6rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  height: 100%;
}
.chess-mode-card h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #1a1a2e;
  margin-bottom: 1rem;
}
.chess-mode-card--ai   { border-top: 4px solid #1a1a2e; }
.chess-mode-card--friend { border-top: 4px solid var(--brown, #8b6343); }

/* ---- Einladungen (dynamisch) ------------------------------------- */
.chess-invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .9rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
  margin-bottom: .5rem;
}
.chess-invite-item__name { font-weight: 700; }
.chess-invite-item__actions { display: flex; gap: .4rem; }

/* ---- Aktive Partien ---------------------------------------------- */
.chess-game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem .9rem;
  background: #f0f4ff;
  border: 1px solid #b8c9f5;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  margin-bottom: .5rem;
  transition: background .15s;
}
.chess-game-item:hover { background: #e3eaff; color: inherit; text-decoration: none; }
.chess-game-item__players { font-weight: 700; font-size: .95rem; }
.chess-game-item__badge {
  font-size: .75rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: #1a1a2e;
  color: #fff;
  white-space: nowrap;
}

/* ---- Schachbrett-Wrapper ----------------------------------------- */
.chess-game-wrap {
  max-width: 520px;
  margin: 0 auto;
}

/* ---- Spieler-Info-Balken ----------------------------------------- */
.chess-player-bar {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .75rem;
  background: #fff;
  border: 1px solid #e0ddd5;
  border-radius: 10px;
  margin: .45rem 0;
}
.chess-player-bar--active {
  border-color: #ffbf47;
  box-shadow: 0 0 0 2px rgba(255,191,71,.4);
}
.chess-player-bar__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1a1a2e;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.chess-player-bar__avatar--white { background: #f5f0e8; color: #1a1a2e; border: 2px solid #1a1a2e; }
.chess-player-bar__avatar--black { background: #1a1a2e; color: #fff; }
.chess-player-bar__name { font-weight: 700; font-size: .97rem; }
.chess-player-bar__sub  { font-size: .78rem; color: var(--muted, #666); }

/* ---- Status-Anzeige ---------------------------------------------- */
.chess-status {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .4rem .75rem;
  border-radius: 8px;
  margin: .5rem 0;
  background: #f8f5ef;
  border: 1px solid #e8e0cc;
  transition: background .3s, color .3s;
}
.chess-status--check     { background: #fff3cd; border-color: #ffc107; color: #856404; }
.chess-status--win       { background: #d4edda; border-color: #28a745; color: #155724; }
.chess-status--lose      { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.chess-status--draw      { background: #e2e3e5; border-color: #aaa;    color: #383d41; }
.chess-status--thinking  { background: #e8f4f8; border-color: #17a2b8; color: #0c5460; }

/* ---- Steuer-Buttons ---------------------------------------------- */
.chess-controls {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: .75rem 0 .5rem;
  justify-content: center;
}
.chess-controls .btn { min-width: 130px; }

/* ---- Highscore-Tabelle ------------------------------------------- */
.chess-hsc {
  background: #fff;
  border: 1px solid #e0ddd5;
  border-radius: 12px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.chess-hsc h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.3rem;
  color: #1a1a2e;
  margin-bottom: 1rem;
}
.chess-hsc-table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: #666; }
.chess-hsc-table td { font-variant-numeric: tabular-nums; }
.chess-hsc-table tr:first-child td { font-weight: 700; }

/* ---- Diff-Badge -------------------------------------------------- */
.chess-diff-badge {
  display: inline-block;
  font-size: .78rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-weight: 700;
}
.chess-diff-badge--easy { background: #d4edda; color: #155724; }
.chess-diff-badge--med  { background: #fff3cd; color: #856404; }
.chess-diff-badge--hard { background: #f8d7da; color: #721c24; }

/* ---- Board-Container --------------------------------------------- */
#chess-board {
  width: 100% !important;
  margin: .35rem 0;
  -webkit-touch-callout: none;
  touch-action: none;
}
/* chessboard.js erzeugt eigene inline-width; wir überschreiben. */
.board-b72b1 {
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
}
/* Kein Kontextmenü / Callout auf dem Brett (mobil) */
#chess-board img,
#chess-board .piece-417db {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- Suchfeld Ergebnisse ----------------------------------------- */
.chess-user-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .5rem .75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0ece3;
  transition: background .12s;
}
.chess-user-result:last-child { border-bottom: 0; }
.chess-user-result:hover { background: #faf7f0; }
.chess-user-result__name { font-weight: 600; }
.chess-user-result__nick { color: var(--muted, #666); font-size: .85rem; }

/* ---- Mobile ------------------------------------------------------ */
@media (max-width: 575.98px) {
  .chess-mode-card { padding: 1rem 1rem 1.25rem; }
  .chess-game-wrap { max-width: 100%; }
  .chess-hsc { padding: .9rem .85rem 1.1rem; border-radius: 10px; }
  .chess-hsc-table th, .chess-hsc-table td { font-size: .8rem; padding: .3rem .4rem; }
  .chess-controls .btn { min-width: 110px; font-size: .92rem; }
}
