/* Analysis board (analysis.html): the live classroom's board. As large as the screen allows,
   the plain chessboard frame, and the move buttons on a labelled rail beside the board
   (a row under it on small screens). */

.xt-anboard { width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }

#board-wrapper { position: relative; width: 100%; }
#board { width: 100%; }
/* The canvas sits on the squares: inside chessboard.js's 2px frame. */
#arrow-canvas { position: absolute; top: 2px; left: 2px; pointer-events: none; z-index: 10; }
#board .board-b72b1 { border: 2px solid #404040; border-radius: 2px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); }

#eval-bar-container { border-radius: 4px; background: #2b2d38 !important; }

/* Rail buttons: the classroom's soft square buttons. */
.xt-anrail { display: flex; align-items: center; justify-content: center; gap: 0.35rem; flex-wrap: wrap; }
.xt-anrail__nav, .xt-anrail__tools { display: flex; gap: 0.35rem; align-items: center; }
.xt-anrail__tools { padding-left: 0.6rem; margin-left: 0.25rem; border-left: 1px solid rgba(255, 255, 255, 0.1); }
.xt-anrail .control-btn {
  width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.05);
  color: #e8e9f0; font-size: 0.95rem; cursor: pointer; flex: 0 0 auto;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.xt-anrail .control-btn:hover { background: rgba(240, 126, 19, 0.14); border-color: rgba(240, 126, 19, 0.45); color: #fff; }
.xt-anrail .control-btn:focus-visible { outline: 2px solid #ff9d42; outline-offset: 2px; }
.xt-anrail__tool span { display: none; font-size: 0.66rem; font-weight: 600; line-height: 1; }

/* Wide screens: board and rail side by side, the board sized by the column width and
   the window height (top bar, title and the two name bars above and below it). */
@media (min-width: 901px) {
  .xt-anboard {
    container-type: inline-size;
    display: grid; grid-template-columns: auto 84px; justify-content: center; align-items: start; gap: 6px 12px;
  }
  .xt-anboard > #player-top, .xt-anboard > .xt-board-row, .xt-anboard > #player-bottom { grid-column: 1; }
  .xt-anboard > #player-top { grid-row: 1; }
  .xt-anboard > .xt-board-row { grid-row: 2; width: min(calc(100cqw - 96px), calc(100dvh - 205px + 30px)); min-width: 300px; }
  .xt-anboard > #player-bottom { grid-row: 3; }
  .xt-anboard > .xt-anrail { grid-column: 2; grid-row: 2; flex-direction: column; flex-wrap: nowrap; width: 84px; gap: 0.3rem; }
  .xt-anboard > .xt-anboard__rep { grid-column: 1 / -1; grid-row: 4; margin-top: 0.2rem; }
  .xt-anrail__nav { flex-direction: column; width: 100%; }
  .xt-anrail__nav .control-btn { width: 72px; }
  .xt-anrail__tools {
    flex-direction: column; width: 100%; gap: 0.3rem;
    margin: 0.35rem 0 0; padding: 0.45rem 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .xt-anrail__tool.control-btn { width: 72px; height: 50px; flex-direction: column; }
  .xt-anrail__tool span { display: block; }

  /* The board column takes the room the old 480px cap left empty. */
  .analysis-grid.analysis-grid--eval { max-width: none; }
}

@media (max-width: 900px) {
  .xt-anboard { max-width: min(560px, 100%); }
  .xt-anrail { margin-top: 0.2rem; }
}
