/* What every signed-in page wears (index.html, game.html,
   quick-leaderboard.html, quick-profile.html): the look's tokens, the bar
   with the admins' message over it, what the bar's dialogs show (the
   rankings, the trophies, a PGN to replay), and the pieces around a board
   that a lesson and a Quick Game share (the moves card, "Revizuire", the
   switch). The homepage's own layout is dashboard.css's and the Quick
   Game's is quick-game.css's; each page loads its own after this file.

   What the page shows is read from classes on <body>, which the scripts
   set: here `main-shown` (#main-content shown, auth.js) and
   `announcement-shown` (the admins' message, announcement-bar.js); in
   dashboard.css `lesson-shown`, `lesson-not-puzzle` and `session-active`.
   Never `body:has(... :not(...))`: a :has() holding a :not() makes the
   browser restyle the whole page for every element added or taken out
   anywhere in it (every new board, every frame of a stream), 10 to 20 ms a
   time. `body.main-shown:not(#main-content)` holds nothing out (the body is
   not #main-content): the :not() gives the rule an id's weight, as the
   `body:has(#main-content:not(.hidden))` it replaced had, so it still
   beats common.css's and app.css's rules as that one did. */

/* ===== TOKENS =====
   A light page: white surfaces on a cool grey, hairline borders rather than
   shadows, blue for what the player acts on, amber only for what is earned
   or aimed at, green for success. */
body.main-shown:not(#main-content) {
  --hp-bg: #f5f7fa;
  --hp-surface: #ffffff;
  --hp-subtle: #f8fafc;
  --hp-blue: #2563eb;
  --hp-blue-hover: #1d4ed8;
  --hp-blue-line: #bfdbfe;
  --hp-selected: #eff6ff;
  --hp-amber: #f59e0b;
  --hp-amber-ink: #b45309;
  /* The rating beside the board, a shade deeper than the accent so it holds
     its contrast as text; a training session's Terminare wears it too. */
  --hp-rating: #d97706;
  --hp-green: #16a34a;
  --hp-text: #1e293b;
  --hp-muted: #64748b;
  --hp-border: #e2e8f0;
  --hp-divider: #f1f5f9;
  --hp-radius-card: 16px;
  --hp-radius-item: 12px;
  --hp-radius-btn: 10px;
  --hp-ease: 160ms ease;
  --hp-font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hp-font-play: "Baloo 2", var(--hp-font);
  /* The bar, and over it the admins' message when there is one (below). */
  --navbar-block-size: 62px;
  --header-block-size: calc(var(--navbar-block-size) + var(--announcement-block-size, 0px));

  background: var(--hp-bg);
  color: var(--hp-text);
  font-family: var(--hp-font);
}

body.main-shown:not(#main-content) :is(button, input, select, textarea) {
  font-family: inherit;
}

/* ===== THE BAR =====
   White, over a hairline: the ratings, the bug report, the trophies and the
   account menu with the player's first name. */
/* Above the menu when the page scrolls under it (both were z-index 100). */
body.main-shown:not(#main-content) .header-bar {
  z-index: 101;
  background: var(--hp-surface);
  box-shadow: 0 1px 0 var(--hp-border);
}

body.main-shown:not(#main-content) .header-bar .section-inner {
  max-inline-size: none;
  padding-inline: 8px 18px;
}

/* ===== THE ADMINS' MESSAGE =====
   A slim strip over the bar, the page's width, while the admins have
   something to say (#announcement-bar, filled by whichever stream the page
   has open) and the viewer has not hidden it with its × (`is-hidden`,
   js/announcement-bar.js); otherwise no strip. One line, the whole text in
   its title, swiped along on a touch screen. Its height is the header's
   too: every height rule that leaves room for the header
   (--header-block-size) leaves room for it, and the toasts move down by
   it.

   Its theme is its level's (announcement_level, `data-level` on its text):
   a notification's blue, the default; a warning's yellow; an error's red;
   an event's violet. Each has its mark before the text, so a level does not
   rest on its colour alone. */
.announcement-bar {
  --announcement-surface: var(--color-info-bg);
  --announcement-ink: var(--color-info-text);
  --announcement-mark: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill-rule='evenodd' d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1ZM7 7h2v5H7V7Zm1-3.3a1.2 1.2 0 1 1 0 2.4 1.2 1.2 0 0 1 0-2.4Z'/%3e%3c/svg%3e");

  display: none;
}

.announcement-bar:has([data-level="warning"]) {
  --announcement-surface: var(--color-warning-bg);
  --announcement-ink: var(--color-warning-text);
  --announcement-mark: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill-rule='evenodd' d='M6.7 2.1a1.5 1.5 0 0 1 2.6 0l5.6 10.1a1.5 1.5 0 0 1-1.3 2.3H2.4a1.5 1.5 0 0 1-1.3-2.3L6.7 2.1Zm.5 3.4h1.6v4.2H7.2V5.5Zm0 5.4h1.6v1.6H7.2v-1.6Z'/%3e%3c/svg%3e");
}

.announcement-bar:has([data-level="error"]) {
  --announcement-surface: var(--color-danger-bg);
  --announcement-ink: var(--color-danger-text);
  --announcement-mark: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill-rule='evenodd' d='M5.1 1h5.8L15 5.1v5.8L10.9 15H5.1L1 10.9V5.1L5.1 1Zm.4 3.4L8 6.9l2.5-2.5 1.1 1.1L9.1 8l2.5 2.5-1.1 1.1L8 9.1l-2.5 2.5-1.1-1.1L6.9 8 4.4 5.5l1.1-1.1Z'/%3e%3c/svg%3e");
}

/* No token of common.css's is an event's: the accent's violet, as pale and
   as deep as the others' pairs. */
.announcement-bar:has([data-level="event"]) {
  --announcement-surface: #ede9fe;
  --announcement-ink: #5b21b6;
  --announcement-mark: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill-rule='evenodd' d='M4.5 1H6v1.5h4V1h1.5v1.5H13A1.5 1.5 0 0 1 14.5 4v9.5A1.5 1.5 0 0 1 13 15H3a1.5 1.5 0 0 1-1.5-1.5V4A1.5 1.5 0 0 1 3 2.5h1.5V1ZM3 6.5h10v7H3v-7Zm6 3h2.5V12H9V9.5Z'/%3e%3c/svg%3e");
}

body.main-shown.announcement-shown:not(#main-content):not(#announcement-bar) {
  --announcement-block-size: 26px;

  .announcement-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    block-size: var(--announcement-block-size);
    padding-inline: 32px;
    background: var(--announcement-surface);
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--announcement-ink) 15%, transparent);
    color: var(--announcement-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
  }

  .header-bar .section-inner {
    block-size: var(--navbar-block-size);
  }

  toast-notification {
    translate: 0 var(--announcement-block-size);
  }
}

.announcement-text {
  min-inline-size: 0;
  max-inline-size: 1200px;
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The level's mark, in the text's colour. */
.announcement-text::before {
  display: inline-block;
  inline-size: 1.1em;
  block-size: 1.1em;
  margin-inline-end: 0.45em;
  background: currentcolor;
  content: "";
  mask: var(--announcement-mark) center / contain no-repeat;
  vertical-align: -0.2em;
}

.announcement-hide {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  inline-size: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* No title to hover on a touch screen: a long message is swiped along. */
@media (pointer: coarse) {
  .announcement-text {
    overflow-x: auto;
    text-overflow: clip;
    scrollbar-width: none;
  }
}

@media (max-width: 575.98px) {
  body.main-shown.announcement-shown:not(#main-content):not(#announcement-bar) {
    --announcement-block-size: 22px;

    .announcement-bar {
      font-size: 12px;
    }
  }
}

body.main-shown:not(#main-content) .score-container {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-right: 0;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  color: var(--hp-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color var(--hp-ease);
}

body.main-shown:not(#main-content) .score-container:hover {
  background: var(--hp-subtle);
}

/* The best Quick Game rating: a link to its leaderboard. */
a.score-container {
  text-decoration: none;
}

.score-icon {
  display: inline-flex;
  color: var(--hp-muted);
}

.score-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.score-icon-dice svg circle {
  fill: currentColor;
  stroke: none;
}

/* A narrow bar drops what it has no room for: the training ranking's link
   under 700px, the puzzles' rating under 640px (with it the bar needs 616px:
   four-digit ratings, six-digit points and a name of twelve letters). The
   Quick Game's rating and the points stay. */
@media (max-width: 699px) {
  #training-elo-container {
    display: none !important;
  }
}

@media (max-width: 639.98px) {
  #score-container {
    display: none !important;
  }
}

/* Whatever room is still missing, the account's name gives: it is cut short
   (…), and nothing is pushed off the screen. */
body.main-shown:not(#main-content) .header-bar .logo {
  flex-shrink: 0;
}

body.main-shown:not(#main-content) .header-bar .actions {
  min-width: 0;
}

body.main-shown:not(#main-content) .header-bar .actions > * {
  flex-shrink: 0;
}

body.main-shown:not(#main-content) .header-bar .actions > #account-dropdown {
  flex-shrink: 1;
  min-width: 0;
}

body.main-shown:not(#main-content) #account-dropdown .dropdown-toggle {
  max-width: 100%;
}

body.main-shown:not(#main-content) #bug-report-btn {
  border: none;
  padding-inline: 0.2rem;
}

/* The player's trophies, beside their name: the gold cup (img/trophies). */
.nav-trophies-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.3rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-trophies-btn img {
  width: 24px;
  height: 26px;
  object-fit: contain;
}

.nav-trophies-btn:hover {
  background: var(--hp-divider);
}

.nav-trophies-btn:focus-visible {
  outline: 2px solid var(--hp-blue);
  outline-offset: 2px;
}

body.main-shown:not(#main-content) #account-dropdown .dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.65rem;
  border: none;
  border-radius: var(--hp-radius-btn);
  color: var(--hp-text);
  font-weight: 600;
}

body.main-shown:not(#main-content) #account-dropdown .dropdown-toggle:hover,
body.main-shown:not(#main-content) #account-dropdown.open .dropdown-toggle {
  background: var(--hp-divider);
}

.nav-account-name {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A chevron in place of the ▾ glyph; it turns over while the menu is open. */
body.main-shown:not(#main-content) #account-dropdown .dropdown-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2.2px solid #94a3b8;
  border-bottom: 2.2px solid #94a3b8;
  border-radius: 1px;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

body.main-shown:not(#main-content) #account-dropdown.open .dropdown-toggle::after {
  transform: translateY(2px) rotate(-135deg);
}

body.main-shown:not(#main-content) .dropdown-menu {
  border-color: var(--hp-border);
  border-radius: var(--hp-radius-item);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}

body.main-shown:not(#main-content) .dropdown-item {
  color: var(--hp-text);
  font-size: 0.92rem;
}

body.main-shown:not(#main-content) .dropdown-item:hover {
  background: var(--hp-selected);
}

/* A phone (under 480px, where the bar without the puzzles' rating no longer
   fits a long name): its items closer together, so that the account's name
   is shown whole on most; under 300px the name gives way first. */
@media (max-width: 479.98px) {
  body.main-shown:not(#main-content) .header-bar .section-inner {
    padding-inline: 4px 6px;
  }

  body.main-shown:not(#main-content) .header-bar .actions {
    gap: 2px;
  }

  body.main-shown:not(#main-content) .score-container {
    padding: 0.1rem 0.2rem;
  }

  body.main-shown:not(#main-content) #bug-report-btn,
  .nav-trophies-btn {
    padding-inline: 0.1rem;
  }

  body.main-shown:not(#main-content) #account-dropdown .dropdown-toggle {
    gap: 0.3rem;
    padding-inline: 0.3rem;
  }
}

@media (max-width: 299.98px) {
  .nav-account-name {
    max-width: 4ch;
  }

  body.main-shown:not(#main-content) #account-dropdown .dropdown-toggle::after {
    content: none;
  }

  body.main-shown:not(#main-content) .header-bar .logo {
    block-size: 68%;
  }
}

/* ===== THE BAR'S DIALOGS =====
   What the dialogs the bar opens on every page show (navbar-dialogs.js):
   the trophy case, a PGN to replay, and a ranking's tabs and table, which
   the homepage's own points ranking wears too. */
/* The trophy case (trophy_case.html) in its own window: as it was in the
   profile, its heading the window's. */
.trophies-window .trophy-case {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.trophies-window .trophy-case > h5 {
  display: none;
}

/* A game's PGN to replay (navbar-dialogs.js): what to do, the box (a file
   dragged over it outlined), why the PGN was refused, then the file's and
   the replay's buttons. */
.pgn-form-note {
  margin: 0 0 0.75rem;
  color: var(--hp-muted);
  font-size: 0.92rem;
}

.pgn-form .pgn-text {
  min-height: 11rem;
  resize: vertical;
  font-size: 1rem;
  line-height: 1.45;
}

.pgn-form .pgn-text.is-dropping {
  border-color: var(--hp-blue);
  background: var(--hp-selected);
}

.pgn-error {
  margin: 0.5rem 0 0;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 600;
}

.pgn-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

/* A ranking's window: a tab per period over its ranking (the points' four,
   the training's two), the chosen one raised in white. */
.ranking-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: var(--hp-radius-btn);
  background: var(--hp-divider);
}

.ranking-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--hp-muted);
  font: 600 0.85rem/1.2 var(--hp-font);
  cursor: pointer;
  transition:
    background var(--hp-ease),
    color var(--hp-ease);
}

.ranking-tab:hover {
  color: var(--hp-text);
}

.ranking-tab[aria-selected="true"] {
  background: var(--hp-surface);
  color: var(--hp-blue);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.ranking-tab:focus-visible {
  outline: 2px solid var(--hp-blue);
  outline-offset: 2px;
}

/* On a phone a quarter of the strip is narrower than "Săptămâna": a tab is
   never narrower than its longest word, the rest shared out equally. */
@media (max-width: 575.98px) {
  .ranking-tab {
    min-width: min-content;
    padding: 6px 4px;
    font-size: 0.8rem;
  }
}

/* What a paid place won, beside its points or rating: its ranking's prize. */
.rail-prize {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dcfce7;
  color: var(--hp-green);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Under a past period's ranking while its prizes are not given yet. */
.ranking-note {
  margin: 10px 0 0;
  color: var(--hp-muted);
  font-size: 0.8rem;
}

.rail-medal {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--hp-font-play);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--hp-divider);
  color: var(--hp-muted);
}

/* The first three hold a trophy, gold, silver or bronze (img/trophies, the
   pictures beside "Locul", smaller), with the place written over its
   cup: the picture's own number is too small to read at this size. */
:root {
  --trophy-gold: url("/img/trophies/gold.webp");
  --trophy-silver: url("/img/trophies/silver.webp");
  --trophy-bronze: url("/img/trophies/bronze.webp");
}

.rail-medal.medal-1,
.rail-medal.medal-2,
.rail-medal.medal-3 {
  width: 22px;
  height: 26px;
  align-items: flex-start;
  padding-top: 3px;
  border-radius: 0;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  background: var(--trophy) center / contain no-repeat;
  color: #fff;
  text-shadow:
    0 0 1px var(--trophy-ink),
    0 0 2px var(--trophy-ink),
    0 0 2px var(--trophy-ink),
    0 0 3px var(--trophy-ink);
}

.rail-medal.medal-1 {
  --trophy: var(--trophy-gold);
  --trophy-ink: #6b3f00;
}

.rail-medal.medal-2 {
  --trophy: var(--trophy-silver);
  --trophy-ink: #1f2937;
}

.rail-medal.medal-3 {
  --trophy: var(--trophy-bronze);
  --trophy-ink: #4a1f05;
}

/* The training and the total leaderboards, in their windows: a ranking's
   table shows ten rows and scrolls to the rest (up to fifty), its header on
   top and, once the viewer is below the ten, their own row (the tfoot) kept
   under the list, as the day rankings' lists. */
.ranking-table {
  --ranking-head-h: 2.75rem;
  --ranking-row-h: 2.5rem;
  --ranking-in-sight: 10;
  --ranking-rows-h: calc(var(--ranking-in-sight) * var(--ranking-row-h));
  max-height: min(calc(var(--ranking-head-h) + var(--ranking-rows-h) + 2px), calc(70vh - 3rem));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--hp-border) transparent;
  border: 1px solid var(--hp-border);
  border-radius: 10px;
  font-family: var(--hp-font);
}

.ranking-table.has-own {
  --ranking-rows-h: calc((var(--ranking-in-sight) + 1) * var(--ranking-row-h));
}

.ranking-table:focus-visible {
  outline: 2px solid var(--hp-blue);
  outline-offset: 2px;
}

.ranking-table .table {
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.ranking-table th,
.ranking-table td {
  height: var(--ranking-row-h);
  padding: 0 0.85rem;
  border: none;
  white-space: nowrap;
  vertical-align: middle;
  font-size: 0.9rem;
  color: var(--hp-text);
  background: #fff;
}

.ranking-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: var(--ranking-head-h);
  background: var(--color-gray);
  color: #fff;
  font-weight: 700;
}

.ranking-table tbody tr:nth-child(even) td {
  background: var(--hp-divider);
}

.ranking-table tbody tr:hover td {
  background: var(--hp-border);
}

.ranking-table tr.is-me td,
.ranking-table tbody tr.is-me:hover td {
  background: var(--hp-selected);
}

.ranking-table tr.is-me .ranking-name {
  font-weight: 800;
}

/* The stripes are nearly the highlight's colour: the viewer's row, in the
   list and kept under it, is outlined too, drawn inside its cells so that
   no row moves. */
.ranking-table tr.is-me td {
  box-shadow:
    inset 0 2px 0 var(--hp-blue),
    inset 0 -2px 0 var(--hp-blue);
}

.ranking-table tr.is-me td:first-child {
  border-radius: 8px 0 0 8px;
  box-shadow:
    inset 2px 0 0 var(--hp-blue),
    inset 0 2px 0 var(--hp-blue),
    inset 0 -2px 0 var(--hp-blue);
}

.ranking-table tr.is-me td:last-child {
  border-radius: 0 8px 8px 0;
  box-shadow:
    inset -2px 0 0 var(--hp-blue),
    inset 0 2px 0 var(--hp-blue),
    inset 0 -2px 0 var(--hp-blue);
}

.ranking-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  box-shadow: inset 0 2px 0 var(--hp-blue);
}

.ranking-table td .rail-medal {
  vertical-align: middle;
}

/* Past the trophies a place is a pill, outlined so that it shows on every
   row's colour, and wide enough for a place in the thousands. */
.ranking-table td .rail-medal:not(.medal-1, .medal-2, .medal-3) {
  width: auto;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--hp-border);
}

.ranking-name {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* A paid place's name with its prize after it: a long name gives way, the
   prize never does. */
.ranking-user {
  display: flex;
  align-items: center;
  min-width: 0;
}

.ranking-username {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-user .rail-prize {
  flex: none;
}

.ranking-table .ranking-empty {
  text-align: center;
  color: var(--hp-muted);
  white-space: normal;
}

@media (max-width: 575.98px) {
  .ranking-table th,
  .ranking-table td {
    padding: 0 0.55rem;
    font-size: 0.84rem;
  }
}

/* ===== AROUND A BOARD =====
   The pieces beside a board that a lesson's player and a Quick Game share,
   in the look of these pages: "Revizuire" over an earlier position, the
   switch (a lesson's auto-next, the lobby's rated choice) and the moves
   card. Where they sit is each page's own (dashboard.css, quick-game.css). */
/* "Revizuire" while an earlier position is shown: in the rating's column on
   a wide screen and in the side's row on a phone (both below); a lesson's
   goes over its title (dashboard.css). */
.board-review-badge {
  display: none;
  max-width: 100%;
  padding: 0.35rem 0.75rem;
  border-radius: var(--hp-radius-btn);
  background: rgba(15, 23, 42, 0.85);
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

/* The auto-next switch, at the top of the button card. */
.auto-next-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 2px 2px 4px;
  color: var(--hp-muted);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
}

.auto-next-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.auto-next-track {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background-color var(--hp-ease);
}

.auto-next-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform var(--hp-ease);
}

.auto-next-toggle input:checked + .auto-next-track {
  background: var(--hp-green);
}

.auto-next-toggle input:checked + .auto-next-track::after {
  transform: translateX(14px);
}

.auto-next-toggle input:focus-visible + .auto-next-track {
  outline: 2px solid var(--hp-blue);
  outline-offset: 2px;
}

.auto-next-toggle:hover .auto-next-label,
.auto-next-toggle input:checked ~ .auto-next-label {
  color: var(--hp-text);
}

@media (min-width: 900px) {
  .board-review-badge {
    display: block;
    grid-row: 1;
    align-self: start;
  }

  /* Mutări efectuate: one pair of moves to a row (the box's height is set
     after its own rules, below). */
  .moves-history-list .move-pair {
    display: grid;
    grid-template-columns: 2.75em 1fr 1fr;
    align-items: baseline;
    margin: 0;
  }

  .moves-history-list :is(.white-move, .black-move) {
    justify-self: start;
    margin: 0;
    padding: 0 4px;
    border-radius: 4px;
  }
}

.moves-history-list .move-pair.game-history :is(.white-move, .black-move) {
  color: var(--hp-muted);
}

.moves-history-list .move-number {
  color: var(--hp-muted);
  font-weight: 700;
}

.moves-history-list .white-move,
.moves-history-list .black-move {
  font-weight: 600;
}

.moves-history-list .clickable-move:hover {
  background: var(--hp-selected);
  color: var(--hp-blue-hover);
}

/* The move that sets a puzzle, the last of its game before it: the puzzle's
   position is the one after it. */
.moves-history-list .move-pair .clickable-move.puzzle-start {
  outline: 2px solid var(--hp-blue);
  outline-offset: 1px;
  color: var(--hp-blue-hover);
}

/* The move the board shows (the last one while live). */
.moves-history-list .move-pair .clickable-move.current-move,
.moves-history-list .move-pair .clickable-move.current-move:hover {
  background: var(--hp-blue);
  color: white;
  font-weight: 800;
}

/* Beside the board the box takes the column's height down to the button
   card. */
@media (min-width: 900px) {
  .moves-history-container {
    flex: 1 1 0;
    max-height: none;
  }
}

@media (max-width: 575.98px) {
  /* An earlier position: the board is dimmed, and says so under the moves,
     over the switch's line, rather than over its pieces. */
  .board-locked::after {
    content: none;
  }

  .board-review-badge {
    grid-area: controls;
    align-self: start;
    z-index: 11; /* over the button card's own 10 (chess-lesson-player.css) */
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(var(--ph-switch) + 4px);
    margin: calc(var(--ph-gap) + var(--ph-pad) - 2px) 6px 0;
    padding: 0 0.75rem;
    /* Opaque: the switch is under it. Its own colour over white. */
    background: #333a4a;
    font-size: 0.82rem;
  }

  .moves-history-container {
    grid-area: moves;
    height: var(--ph-moves);
    min-height: 0;
    margin: var(--ph-gap) 0 0;
  }

  .moves-history-list {
    height: 100%;
    padding: 0 8px;
    scrollbar-width: none;
  }

  .moves-history-list::-webkit-scrollbar {
    display: none;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  body.main-shown:not(#main-content) .header-bar * {
    transition: none !important;
  }
}
