/* ============================================================
   Brain Train — Chess against the house
   ============================================================ */

.chess-page {
  max-width: 880px;
  margin: 1.4rem auto 5rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.4rem;
  align-items: start;
}
@media (max-width: 760px) {
  .chess-page { grid-template-columns: 1fr; }
}

.chess-hero h1 {
  margin: 0 0 0.3rem;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}
.chess-hero .lead {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.chess-board-wrap {
  display: flex; flex-direction: column; gap: 0.6rem;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  aspect-ratio: 1;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  user-select: none;
  background: var(--bg-card);
}

.chess-square {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background-color 80ms;
}
.chess-square.light { background: #f0d9b5; }
.chess-square.dark  { background: #b58863; }

/* Selection + legal-move indicators */
.chess-square.is-selected {
  outline: 3px solid #f5c84c;
  outline-offset: -3px;
  z-index: 2;
}
.chess-square.is-legal::after {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  background: rgba(20, 70, 30, 0.45);
  border-radius: 50%;
  pointer-events: none;
}
.chess-square.is-legal.is-capture::after {
  width: 86%; height: 86%;
  background: transparent;
  border: 3px solid rgba(180, 20, 20, 0.55);
  border-radius: 50%;
}
.chess-square.is-last-move { background: #cdd26a; }
.chess-square.is-last-move.dark { background: #aaa23a; }
.chess-square.is-check { background: #f1948a; }

.chess-piece {
  pointer-events: none;
  position: relative;
  z-index: 1;
  width: 86%;
  height: 86%;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
  user-select: none;
}

/* Rank / file coordinate hints in the board corners */
.chess-square .coord {
  position: absolute;
  font-size: 0.55rem;
  font-weight: 800;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
.chess-square .coord.file { right: 3px; bottom: 1px; }
.chess-square .coord.rank { left: 3px; top: 1px; }
.chess-square.light .coord { color: #b58863; }
.chess-square.dark  .coord { color: #f0d9b5; }

/* Side panel */
.chess-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
}

.chess-status {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.chess-status .turn-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text);
  margin-right: 0.4rem;
  vertical-align: middle;
  border: 2px solid var(--border-strong);
}
.chess-status .turn-dot.white { background: #ffffff; border-color: #94a3b8; }
.chess-status .turn-dot.black { background: #1a1a1a; border-color: #94a3b8; }
.chess-status.thinking { color: var(--text-muted); font-weight: 500; }
.chess-status.gameover { color: var(--accent); }

.chess-controls {
  display: flex; flex-direction: column; gap: 0.5rem;
}

.chess-difficulty {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem;
}
.chess-difficulty label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chess-difficulty select {
  flex: 1;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.chess-new-btn {
  width: 100%;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.chess-moves {
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-alt);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
}
.chess-moves h4 {
  margin: 0 0 0.3rem;
  font-family: var(--font);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.chess-move-row { display: flex; gap: 0.6rem; }
.chess-move-row .num { color: var(--text-soft); min-width: 1.8rem; }
.chess-move-row .ply { color: var(--text); }
.chess-moves-empty { color: var(--text-soft); }

/* ============================================================
   Brain Train hub
   ============================================================ */

.bt-shell { max-width: 760px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.bt-hero { margin-bottom: 1.6rem; }
.bt-hero h1 { margin: 0.25rem 0 0.5rem; font-size: 1.85rem; letter-spacing: -0.01em; }
.bt-hero .lead { color: var(--text-muted); font-size: 0.95rem; max-width: 540px; }
.bt-eyebrow { color: var(--accent); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }

.bt-games { display: flex; flex-direction: column; gap: 0.7rem; }
.bt-tile {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  column-gap: 1rem;
  padding: 1.05rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 120ms, background 120ms, transform 120ms;
}
.bt-tile:hover { background: var(--bg-alt); }
.bt-tile:active { transform: translateY(1px); }
.bt-tile.is-soon { opacity: 0.55; cursor: default; pointer-events: none; }
.bt-tile-glyph {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  display: grid; place-items: center;
  font-size: 1.4rem;
  line-height: 1;
}
.bt-tile h3 { margin: 0 0 0.15rem; font-size: 1.02rem; }
.bt-tile p  { margin: 0; color: var(--text-muted); font-size: 0.85rem; line-height: 1.4; }
.bt-tile-arrow { color: var(--accent); font-size: 1.2rem; font-weight: 700; }
.bt-tile.is-soon .bt-tile-arrow { color: var(--text-soft); }

@media (max-width: 600px) {
  .bt-shell { padding: 1.2rem 0.85rem 3rem; }
  .bt-hero h1 { font-size: 1.5rem; }
  .bt-tile p { display: none; }
}
