@layer structure {
/* Piece sizing */
.chess-board .square > img.chess-piece {
  position: absolute;
  inset: 8%;
  display: block;
  width: 84%;
  height: 84%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* Check and move feedback */
/* Keep all candidate squares neutral until a level-check answer is submitted. */
#assessment-board .square.target::after {
  inset: auto 5px 5px auto;
  width: 10px;
  height: 10px;
  border: 2px solid #171717;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  z-index: 3;
}

#assessment-board .square.last {
  box-shadow: inset 0 0 0 3px #171717;
}

#assessment-board .square.last::after {
  background: #171717;
}

#assessment-board .square:focus-visible,
#concept-board .square:focus-visible {
  outline: 2px dashed #171717;
  outline-offset: -5px;
  z-index: 4;
}

#site-dialog .assessment-move-status {
  min-height: 3em;
  color: #535353;
}

.board-choice-msg:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

@media (max-width: 390px) {
  #site-dialog .assessment-move-status { min-height: 0; }
}
}

.editorial-interior :where(#main-content, #site-dialog) .chess-board,
.is-editorial-home #site-dialog .chess-board {
  border: 1px solid var(--editorial-muted);
  background: var(--paper);
}

.editorial-interior :where(#main-content, #site-dialog) .square,
.is-editorial-home #site-dialog .square {
  background-color: var(--paper);
  color: var(--ink);
}

.editorial-interior :where(#main-content, #site-dialog) .square.dark,
.is-editorial-home #site-dialog .square.dark {
  background-color: var(--editorial-square);
}

.editorial-ui :is(#main-content, #site-dialog) .square.selected {
  z-index: 2;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--ink);
}

.editorial-interior :where(#main-content, #site-dialog) .square.last:not(.selected),
.is-editorial-home #site-dialog .square.last:not(.selected) {
  outline: 2px dashed var(--ink);
  outline-offset: -4px;
  box-shadow: none;
}

.editorial-ui :is(#main-content, #site-dialog) .square.target::after {
  inset: auto auto 6% 6%;
  width: clamp(6px, 1vw, 11px);
  height: clamp(6px, 1vw, 11px);
  border-radius: 50%;
  border: 1px solid var(--paper);
  background: var(--ink);
  opacity: 1;
}

.editorial-ui :is(#main-content, #site-dialog) .square:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  z-index: 3;
}

.editorial-interior :where(#main-content, #site-dialog) :is(.rank-label, .file-labels),
.is-editorial-home #site-dialog :is(.rank-label, .file-labels) {
  color: var(--editorial-copy, var(--muted));
  font: 400 .75rem/1 var(--mono);
}

.editorial-interior :where(.page) .chess-piece { filter: none; }

.editorial-ui .chess-board .square > img.white-piece {
  filter: drop-shadow(0 1px 0 #171717) drop-shadow(0 0 1px #171717);
}

@media (forced-colors: active) {
  .editorial-ui .chess-board { forced-color-adjust: none; }
  .editorial-ui .square:focus-visible { outline-color: Highlight; }
}

.chess-board .board-row { display: contents; }

/* A rank shares the same grid row as its squares, for either orientation. */
.editorial-ui :where(.page, #site-dialog) .board-shell {
  --board-rank-gutter: 18px;
  display: grid;
  grid-template-columns: var(--board-rank-gutter) minmax(0, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr)) auto;
  padding: 0;
}

.editorial-ui :where(.page, #site-dialog) .chess-board { grid-area: 1 / 2 / span 8 / 3; }
.editorial-ui :where(.page, #site-dialog) .rank-label {
  grid-area: calc(var(--i) + 1) / 1;
  align-self: center;
  justify-self: center;
  position: static;
  display: block;
  width: auto;
  transform: none;
}

.editorial-ui :where(.page, #site-dialog) .file-labels {
  grid-area: 9 / 2;
  position: static;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: center;
  min-height: 20px;
  height: auto;
  margin: 0;
  padding: 0;
  text-align: center;
}

.editorial-interior :is(.course-preview-board, .content-task-preview, .daily-play-board) .board-shell {
  --board-rank-gutter: 0px;
}

.editorial-interior :is(.course-preview-board, .content-task-preview, .daily-play-board) :is(.rank-label, .file-labels) {
  display: none;
}
