/* The list takes the sidebar body's free height and scrolls the moves inside it; the alternatives listbox sits above the moves. */
chess-move-list { display: flex; flex-direction: column; min-height: 0; }
chess-move-list > .moves { flex: 1 1 auto; min-height: 6rem; overflow-y: auto; }
chess-move-list .branch-choice { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px; padding: 4px; border: 1px solid var(--panel-border); border-radius: 8px; background: #fffaf0; }
chess-move-list .branch-choice button { text-align: left; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; font-size: 1.05rem; }
chess-move-list .branch-choice button[aria-selected=true] { background: #c9762f18; box-shadow: inset 0 -2px 0 #c9762f80; color: var(--accent-dark); }
chess-move-list .branch-choice:focus { outline: none; }
chess-move-list .branch-choice:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }

/* Move tokens and the move table, shared by the PGN player and the study review. */
.moves { position: relative; overflow-y: auto; display: flex; flex-wrap: wrap; gap: .3rem; padding: .3rem; }

/* The one base size of the notation: moves, numbers and comments are all 1em of it; A− / A+ scale it. */
.moves {
  font-size: calc(1.2rem * var(--moves-text-scale, 1));
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: baseline;
  gap: .1rem .2rem;
  /* The list reaches through the panel's right padding, so the scrollbar sits at the panel edge, clear of the text. */
  margin-right: calc(-1 * var(--sidebar-padding, .75rem));
  padding: .3rem var(--sidebar-padding, .75rem) .3rem 0;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #d5c7a8 transparent;
}
.moves > span {
  font-family: "PGN Notation", Georgia, serif;
  font-size: 1em;
  color: var(--ink);
  margin-left: .35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
/* Hierarchy: main line bold upright; variation normal upright; variation of a variation italic; deeper ones italic and quieter. */
.moves .variation-number, .moves > .variation-mark { font-weight: 400; color: var(--muted); }
.moves > .variation-mark { margin: 0; }
.moves > .move-pair { display: inline-flex; align-items: baseline; white-space: nowrap; }
.moves .move-number { margin-right: -.1rem; }
.moves [data-depth="2"] { font-style: italic; }
.moves [data-depth="3"] { font-style: italic; opacity: .8; }
.moves button {
  position: relative;
  color: var(--ink);
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: .25rem .35rem;
  min-height: 40px;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background-color .15s, color .15s;
}
.moves button:hover { background: #c9762f0d; color: var(--accent-dark); }
/* Page themes restyle every notation button, so the shared tint is forced on screen (the active move keeps its own look); print keeps the sheet plain.
   The hue is laid translucent over the panel, so it stays light on a light theme and dark on a dark one. */
@media screen {
  .moves button[data-branch]:not([aria-current=true]) { background: color-mix(in srgb, hsl(var(--branch-hue) 65% 50%) 22%, transparent) !important; }
  .moves button[data-branch="0"] { --branch-hue: 205; }
  .moves button[data-branch="1"] { --branch-hue: 145; }
  .moves button[data-branch="2"] { --branch-hue: 275; }
  .moves button[data-branch="3"] { --branch-hue: 50; }
  .moves button[data-branch="4"] { --branch-hue: 175; }
  .moves button[data-branch="5"] { --branch-hue: 235; }
  .moves button[data-branch="6"] { --branch-hue: 90; }
  .moves button[data-branch="7"] { --branch-hue: 300; }
  .moves button[data-branch="8"] { --branch-hue: 115; }
  .moves button[data-branch="9"] { --branch-hue: 255; }
}
.moves button[aria-current=true] {
  background: #c9762f18;
  color: var(--accent-dark);
  box-shadow: inset 0 -2px 0 #c9762f80;
}

@font-face { font-family: "PGN Notation"; src: url("fonts/FreeSerif.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "PGN Notation"; src: url("fonts/NagSymbols.ttf") format("truetype"); unicode-range: U+E000-E00E; font-display: swap; }
/* Outline figurines with heavier strokes, for dark grounds; downloaded only when a theme picks them with --figurine-font. */
@font-face { font-family: "PGN Figurine"; src: url("fonts/ChessMeridaUnicode.ttf") format("truetype"); unicode-range: U+2654-265F; font-display: swap; }
.notation-token { display: inline-flex; align-items: baseline; white-space: nowrap; vertical-align: baseline; font-family: "PGN Notation", Georgia, serif; font-size: 1em; line-height: 1; font-weight: 400; }
.notation-san { line-height: 1; }
/* As in print, a figurine stands on the baseline and even the lowest ones (knight, rook) reach a capital letter's height; a font with larger drawings sets its own --figurine-size and --figurine-shift. */
.notation-piece { font-family: var(--figurine-font, "PGN Notation"), Georgia, serif; font-weight: 400; font-size: var(--figurine-size, 1.15em); line-height: 1; display: inline-block; margin-right: var(--figurine-gap, -.06em); translate: 0 var(--figurine-shift, 0); }
.notation-space { white-space: pre-wrap; }
.moves .notation-token { font-weight: inherit; letter-spacing: .04em; }
.moves button.variation-move { font-weight: 400; }
.moves button.variation-move:not(:hover):not([aria-current=true]) { color: color-mix(in srgb, var(--ink) 72%, transparent); }


/* Annotated view: a move's comment sits on its own line under the move. */
.moves > .move-comment { white-space: pre-line; flex: 1 1 100%; min-width: 0; margin: .1rem 0 .25rem; font-family: inherit; font-size: 1em; font-weight: 400; font-style: normal; line-height: 1.45; color: var(--muted); }

.moves .comment-move { min-height: 0; padding: 0 .15rem; font-size: inherit; font-weight: 700; color: var(--accent-dark); text-decoration: underline dotted; }
.moves .variation-first .notation-token:first-child { padding-bottom: .12em; border-bottom: 1.5px solid currentColor; }
.moves .variation-toggle {
  min-height: 0; min-width: 1.4rem; padding: 0 .3rem; margin: 0 .15rem; font-size: .9rem; font-weight: 700; line-height: 1.3; text-align: center;
  color: var(--accent-dark); background: #c9762f14; border: 1px solid #c9762f66; border-radius: 6px;
}
.moves .variation-toggle:hover { background: #c9762f2e; }

.moves > .moves-table { flex: 1 1 100%; width: 100%; border-collapse: collapse; table-layout: fixed; }
.moves-table col:first-child { width: 2.6rem; }
.moves-table .move-index { padding: 0 .2rem; font-family: "PGN Notation", Georgia, serif; font-size: 1em; font-weight: 600; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.moves-table td { padding: 0; vertical-align: baseline; }
.moves-table tbody tr:not(:has(.move-extra)):nth-child(odd) { background: #c9762f08; }
.moves-table td:not(.move-extra) > button { width: 100%; }
.moves-table .move-extra { padding: .1rem 0 .3rem; }
.moves-table .move-extra > .moves { overflow: visible; margin: 0; padding: 0; }
/* Variations flow as running text in both views; only main-line comments take their own line. */
.moves-table .move-extra > .moves, .moves:not(:has(> .moves-table)) { display: block; line-height: 1.7; }
.moves-table .move-extra > .moves > .move-comment, .moves:not(:has(> .moves-table)) > .move-comment { display: block; }
.moves-table .move-extra > .moves > .move-pair, .moves:not(:has(> .moves-table)) > .move-pair { display: inline-flex; vertical-align: baseline; }

.moves button[data-drawing]::after { content: ""; display: inline-block; width: .5em; height: .5em; margin-left: .3em; border: 2px solid #3f9a5a; border-radius: 50%; vertical-align: .1em; box-sizing: border-box; }
/* No focus ring on notation moves; the current move already has its own highlight. */
.moves button:focus, .moves button:focus-visible { outline: none; }

/* A small board square before the move marks a diagram position. */
.moves button[data-diagram]::before { content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .3em; border: 1.5px solid currentColor; border-radius: 2px; vertical-align: .05em; box-sizing: border-box; background: conic-gradient(currentColor 25%, transparent 0 50%, currentColor 0 75%, transparent 0); }

.moves .diagram-mark { display: inline-block; width: .7em; height: .7em; margin-right: .4em; border: 1.5px solid currentColor; border-radius: 2px; vertical-align: .05em; box-sizing: border-box; background: conic-gradient(currentColor 25%, transparent 0 50%, currentColor 0 75%, transparent 0); }

/* isolate: the board's pieces have z-indexes of their own and must not rise over the rows pinned around the list. */
.moves .diagram-board { isolation: isolate; display: block; width: min(15rem, 100%); aspect-ratio: 1; margin: .5rem 0 .25rem; pointer-events: none; }

/* Engine value and clock time after the move, small and quiet; shown in the annotated list and the table. */
/* The engine's rating of a move, shown beside it until it is written into the game. */
.moves .engine-mark { margin-left: .3em; font-weight: 700; font-size: .85em; }
.moves .engine-mark[data-level="inaccuracy"] { color: #a16207; }
.moves .engine-mark[data-level="mistake"] { color: #c2410c; }
.moves .engine-mark[data-level="blunder"] { color: #9f1239; }
.moves button[data-stamp]::after { content: attr(data-stamp); margin-left: .4em; font-size: .72em; font-weight: 400; opacity: .6; font-variant-numeric: tabular-nums; }
/* The move the whole-game pass is analysing right now. */
.moves button[data-analyzing]::after { content: ""; display: inline-block; box-sizing: border-box; width: .7em; height: .7em; margin-left: .4em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.05em; opacity: .6; animation: analyzing-spin .8s linear infinite; }

.moves .answer-button { display: block; margin: .35rem 0 .2rem; padding: .2rem .7rem; font: inherit; font-size: .85em; border: 1px solid currentColor; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; opacity: .85; }
.moves .answer-button:hover { opacity: 1; }

/* A comment inside a variation flows with the variation's moves. */
.moves-table .move-extra > .moves > .move-comment:not([data-depth="0"]), .moves:not(:has(> .moves-table)) > .move-comment:not([data-depth="0"]) { display: inline; margin: 0; }

/* Placeholder in the White cell of a row that opens with Black's reply. */
.moves-table .move-skipped { display: block; padding: 0 .5rem; font-family: "PGN Notation", Georgia, serif; color: var(--muted); }
