/* Keep the board, both clocks and the useful game controls in a laptop viewport. */
.academy.bot-game-page {
  --game-board-size: min(640px, calc(100dvh - 255px), calc(100vw - 520px));
}

.bot-game-page .academy-header {
  min-height: 56px;
  padding: 7px 3%;
}

.bot-game-page .academy-brand {
  font-size: 19px;
  line-height: 1.2;
}

.bot-game-page .academy-brand small { font-size: 10px; }
.bot-game-page .academy-navigation a { padding: 7px 10px; }
.bot-game-page .academy-main { max-width: none; padding: 8px 18px 12px; }

.bot-game-page .game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: calc(var(--game-board-size) + 416px);
  min-height: 48px;
  margin: 0 auto 10px;
}

.bot-game-page .game-toolbar-context { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.bot-game-page .game-toolbar-context a { color: #356383; font-size: 13px; font-weight: 600; white-space: nowrap; }
.bot-game-page .game-toolbar h1 { margin: 0; color: #073b70; font-size: 19px; font-weight: 700; white-space: nowrap; }
.bot-game-page .game-actions { gap: 7px; margin-left: 0; flex: 0 0 auto; }
.bot-game-page .game-actions button { padding: 7px 10px; font-size: 13px; line-height: 1.3; }

.bot-game-page .game-layout {
  grid-template-columns: minmax(0, calc(var(--game-board-size) + 38px)) minmax(280px, 360px);
  justify-content: center;
  align-items: start;
  gap: 18px;
  max-width: none;
  padding-bottom: 0;
}

.bot-game-page .board-wrap { padding: 8px; border-radius: 13px; }
.bot-game-page .bot-board-frame { width: calc(var(--game-board-size) + 18px); max-width: 100%; padding-left: 18px; }
.bot-game-page .chessboard { max-width: none; }
.bot-game-page .side-strip { min-height: 43px; }
.bot-game-page .opponent-strip { padding-bottom: 4px; }
.bot-game-page .player-strip { padding-top: 4px; }
.bot-game-page .side-strip .material-row { min-height: 14px; }
.bot-game-page .side-strip .side-identity,
.bot-game-page .side-strip .player-identity { gap: 7px; }
.bot-game-page .side-name small { margin-left: 4px; color: #7b91a3; font-size: 11px; font-weight: 500; }
.bot-game-page .side-strip.is-turn .side-name,
.bot-game-page .side-strip.is-turn .player-name { color: #064577; font-weight: 750; }
.bot-game-page .turn-indicator { flex: 0 0 auto; padding: 2px 6px; border-radius: 5px; background: #e2f1e9; color: #246044; font-size: 11px; line-height: 1.35; font-weight: 700; }
.bot-game-page .turn-indicator.is-thinking { background: #eaf2fa; color: #07518b; }
.bot-game-page .turn-indicator.is-result-win { background: #e0f1e5; color: #1c6741; }
.bot-game-page .turn-indicator.is-result-loss { background: #fbe9e7; color: #a54239; }
.bot-game-page .turn-indicator.is-result-draw { background: #edf1f5; color: #526b7d; }
.bot-game-page .game-clock.is-active { background: #cce4f5; color: #073f73; box-shadow: inset 0 0 0 1px #8cb9d8; }
.bot-game-page .game-clock.is-low { background: #fce6e2; color: #a33028; box-shadow: inset 0 0 0 1px #e9aea7; }

.bot-game-page .game-aside { display: block; min-height: 0; padding: 16px; border-radius: 13px; }
.bot-game-page .game-aside .game-status { min-height: 20px; margin: 0 0 12px; padding: 0; background: transparent; color: #536d82; font-size: 13px; line-height: 1.45; }
.bot-game-page .game-aside .game-status.is-result { padding: 10px 12px; border-radius: 8px; background: #eff6fb; color: #17496f; font-weight: 650; }
.bot-game-page .game-aside .game-status.is-result[data-outcome="win"] { background: #eaf6ee; color: #1c6441; }
.bot-game-page .game-aside .game-status.is-result[data-outcome="loss"] { background: #fff0ed; color: #963e38; }
.bot-game-page .game-aside .game-status.is-result[data-outcome="draw"] { background: #f0f4f7; color: #435c70; }
.bot-game-page .game-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 16px; }
.bot-game-page .game-result-score { font: 700 15px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
.bot-game-page .game-result-reason { margin: 3px 0 0; font-size: 12px; line-height: 1.4; font-weight: 500; }
.bot-game-page .square.king-result-checkmate { box-shadow: inset 0 0 0 3px #ce4d4d; }
.bot-game-page .king-result-badge {
  position: absolute;
  z-index: 5;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: clamp(18px, 2vw, 24px);
  height: clamp(18px, 2vw, 24px);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 5px #173e5d55;
  color: #fff;
  font: 800 14px/1 system-ui, sans-serif;
  text-shadow: none;
  pointer-events: none;
}
.bot-game-page .king-result-badge.is-win { background: #24734a; }
.bot-game-page .king-result-badge.is-loss { background: #c64545; }
.bot-game-page .king-result-badge.is-draw { background: #586e7c; }
.bot-game-page .game-aside .move-history { display: block; margin-top: 0; }
.bot-game-page .move-history-heading { align-items: center; margin-bottom: 7px; }
.bot-game-page .move-history-heading h2 { margin: 0; color: #17466c; font-size: 14px; line-height: 1.4; }
.bot-game-page .game-aside .move-list { flex: none; min-height: 0; max-height: min(44dvh, 340px); }
.bot-game-page .move-history-empty { padding: 12px; }
.bot-game-page .history-controls { height: 38px; }

@media (max-width: 900px) {
  .academy.bot-game-page { --game-board-size: min(640px, calc(100vw - 134px)); }
  .bot-game-page .game-layout { grid-template-columns: minmax(0, calc(var(--game-board-size) + 38px)); gap: 12px; }
  .bot-game-page .game-toolbar { max-width: calc(var(--game-board-size) + 38px); flex-wrap: wrap; }
  .bot-game-page .game-actions { margin-left: auto; }
  .bot-game-page .game-aside .move-list { max-height: 260px; }
}

@media (max-width: 768px) {
  .bot-game-page .academy-header { padding: 7px 14px; }
  .bot-game-page .academy-main { padding: 10px 10px 72px; }
  .academy.bot-game-page { --game-board-size: min(640px, calc(100vw - 52px)); }
  .bot-game-page .game-toolbar { gap: 8px; }
  .bot-game-page .game-toolbar-context { width: 100%; justify-content: space-between; gap: 8px; }
  .bot-game-page .game-toolbar h1 { font-size: 16px; }
  .bot-game-page .game-actions { width: 100%; justify-content: space-between; }
  .bot-game-page .game-actions button { flex: 1; }
  .bot-game-page .game-layout { grid-template-columns: minmax(0, calc(var(--game-board-size) + 28px)); }
  .bot-game-page .board-wrap { padding: 6px; }
  .bot-game-page .bot-board-frame { width: calc(var(--game-board-size) + 14px); padding-left: 14px; }
  .bot-game-page .game-aside { padding: 14px; }
}

@media (max-width: 420px) {
  .bot-game-page .side-name small { display: block; margin-left: 0; line-height: 1.2; }
  .bot-game-page .player-name { max-width: calc(100vw - 235px); }
  .bot-game-page .turn-indicator { font-size: 10px; }
  .bot-game-page .game-actions button { padding: 8px 5px; font-size: 12px; }
  .bot-game-page .move-history-heading span { display: none; }
}
