/* Games: the tap-to-move board and the game replay (both driven by js/games.js), the Chess Coach (js/coach.js), and the
   opening and endgame pages' board (js/lesson.js). */

/* ---------- Game panel: board, facts and move list (Components/Games/GamePanel.razor) ---------- */
.game-panel {
    display: grid;
    grid-template-columns: minmax(0, 393px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.game-board {
    width: 100%;
    height: auto;
    display: block;
}

.game-facts p {
    margin: 0 0 0.5rem;
}

.game-facts .moves {
    font-family: var(--serif);
    font-size: 1.1rem;
}

@media (max-width: 760px) {
    .game-panel {
        grid-template-columns: minmax(0, 1fr);  /* may shrink below its content's widest line, as phones need */
    }
}


/* ---------- Move board: tap a piece, then its square (js/games.js) ---------- */
.tap-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1;
    border: 6px solid var(--board-frame);
    border-radius: 10px;
    overflow: hidden;   /* the corner squares follow the rounded frame */
    box-shadow: var(--shadow);
    user-select: none;
    margin: 0 0 0.75rem;
}

.tap-square {
    position: relative;
    border: none;
    padding: 0;
    margin: 0;
    aspect-ratio: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.tap-square.light { background: var(--board-light); }
.tap-square.dark { background: var(--board-dark); }
.tap-square.last.light { background: var(--board-last-light); }
.tap-square.last.dark { background: var(--board-last-dark); }

.tap-square img {
    position: absolute;
    inset: 4%;
    width: 92%;
    height: 92%;
    pointer-events: none;
}

.tap-square.selected { box-shadow: inset 0 0 0 4px var(--board-frame); }

/* A dot on empty target squares, a ring around capturable pieces. */
.tap-square.target::after {
    content: "";
    position: absolute;
    inset: 36%;
    border-radius: 50%;
    background: rgba(24, 24, 27, 0.45);
    pointer-events: none;
}

.tap-square.target:has(img)::after {
    inset: 4%;
    background: none;
    border: 4px solid rgba(24, 24, 27, 0.55);
}

.tap-square:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }

.tap-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.tap-prompt { width: 100%; margin: 0; }
/* The promotion choice (js/promotion.js): laid over the board, which it dims, with the four pieces in a column from
   the promotion square. */
.promote-overlay {
    position: absolute;
    z-index: 900;
    background: rgba(24, 24, 27, 0.45);
    border-radius: 10px;
}

.promote-choice {
    position: absolute;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--board-light);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: border-radius 0.12s, background 0.12s;
}

.promote-choice img { width: 92%; height: 92%; margin: 4%; display: block; pointer-events: none; }
.promote-choice:hover, .promote-choice:focus-visible { border-radius: 8%; background: var(--gold); outline: none; }

.move-list summary {
    cursor: pointer;
    font-family: var(--sans);
    color: var(--ink-soft);
    margin: 0.5rem 0;
}

/* ---------- Game replay (js/games.js): tap a move or step through the game ---------- */
.game-panel:not(:has(.game-board-wrap)) { grid-template-columns: minmax(0, 1fr); }

.replay-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;  /* last resort on the narrowest screens, rather than widening the page */
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.replay-controls button { min-width: 44px; min-height: 40px; }
.replay-controls button:disabled { opacity: 0.4; cursor: default; }
.replay-where { min-width: 7.5em; text-align: center; font: 0.9rem var(--sans); color: var(--ink-soft); }

/* Small phones (320–360px): the fixed label width that stops the buttons shifting doesn't fit. */
@media (max-width: 360px) {
    .replay-where { min-width: 0; }
}

.moves .move-number { color: var(--ink-soft); margin: 0 0.15rem 0 0.35rem; }
.moves .move-number:first-child { margin-left: 0; }

.replay-move {
    border: none;
    background: none;
    padding: 0.15rem 0.3rem;
    margin: 0;
    font: inherit;
    color: inherit;
    border-radius: 3px;
    cursor: default;
}

.game-panel[data-replay] .replay-move { cursor: pointer; }
.game-panel[data-replay] .replay-move:hover { background: var(--paper-deep); }
.replay-move.current { background: var(--gold-soft); color: var(--board-frame); }  /* dark text on the light gold, in dark mode too */



/* ---------- Chess Coach: a game against the bot with comments (Pages/Learn/Coach.razor, js/coach.js) ---------- */
/* The coach takes more of a wide screen than other pages, and its board is as big as fits: as tall as the window
   allows with the ribbon below it, from 360px to 760px. The comments and moves scroll in boxes about as tall. */
.site-main:has(.coach) { max-width: 1500px; }

.coach { --coach-board: clamp(360px, calc(100vh - 11rem), 760px); }

/* The title and intro, with the picture of the coach beside them (images/coach.webp: transparent, portrait). */
.coach-title { display: flex; align-items: center; gap: 0.5rem 1.5rem; margin-bottom: 1rem; }
.coach-title > div { flex: 0 1 auto; min-width: 0; }
.coach-title .lede { margin-bottom: 0; }
.coach-figure { flex-shrink: 0; width: auto; height: clamp(7rem, 16vw, 12rem); }

/* On the dark page the coach's navy sweater would vanish: he stands in a pool of light paper. */
@media (prefers-color-scheme: dark) {
    .coach-figure { background: radial-gradient(closest-side, #f1f1f2 80%, transparent); }
}

.coach-layout {
    display: grid;
    grid-template-columns: minmax(0, var(--coach-board)) minmax(18rem, 1fr);
    gap: 1.5rem 2rem;
    align-items: start;
}

.coach-board { max-width: var(--coach-board); position: relative; }

/* The move that led to an earlier position, or to a move named in a comment: an arrow over the board (js/coach.js). */
.coach-arrow {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}
.coach-arrow polygon { fill: var(--gold); fill-opacity: 0.8; }
/* A puzzle hint's arrow fades out after a few seconds (js/puzzle.js). */
.coach-arrow { transition: opacity 0.6s ease; }
.coach-arrow.fading { opacity: 0; }
.coach-board.tap-board { margin-bottom: 0.25rem; }

/* The pieces each side has taken, small, in a strip above and below the board; the strip keeps its height when
   empty so the board doesn't move. */
.coach-captured {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    max-width: var(--coach-board);
    min-height: 1.9rem;
    margin: 0 0 0.25rem;
}

.coach-captured-piece { width: 1.75rem; height: 1.75rem; }
.coach-captured-piece + .coach-captured-piece { margin-left: -0.55rem; }   /* overlapping a little, like a hand of cards */

@media (max-width: 860px) {
    .coach-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.coach-status {
    min-height: 1.6em;
    margin: 0 0 0.5rem;
    font-weight: 600;
}

/* The ribbon under the board, like a player's controls: as wide as the board, the play button larger. */
.coach-ribbon {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    max-width: var(--coach-board);
    margin: 0.25rem 0 0.75rem;
    padding: 0.35rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--paper-deep);
}

.coach-ribbon-button {
    display: inline-grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.coach-ribbon-button[hidden] { display: none; }
.coach-ribbon-button svg { width: 1.3rem; height: 1.3rem; }
.coach-ribbon-button:hover:not(:disabled) { background: var(--paper); }
.coach-ribbon-button:disabled { color: var(--mark-muted); cursor: default; }
.coach-ribbon-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.coach-ribbon-button.play { width: 2.9rem; height: 2.9rem; background: var(--gold); color: var(--on-gold); }
.coach-ribbon-button.play:hover:not(:disabled) { background: var(--gold-ink); }
.coach-ribbon-button.play:disabled { background: var(--mark-muted); color: var(--paper); }
.coach-ribbon-button.play svg { width: 1.5rem; height: 1.5rem; }
/* Turning the board around (before the start) or a new game (after) sits apart, at the left end; a spacer as wide at
   the right keeps the moves' buttons centred. */
.coach-ribbon-button.edge { margin-right: auto; }
.coach-ribbon-button.edge-right { margin-left: auto; }
.coach-ribbon-button[aria-expanded="true"] { background: var(--paper); }

/* Loading a position: a FEN to paste, under the ribbon. */
.coach-fen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
    max-width: var(--coach-board);
    margin: 0 0 0.75rem;
}

.coach-fen[hidden] { display: none; }
.coach-fen label { width: 100%; font-weight: 600; }
.coach-fen textarea { flex: 1 1 100%; min-width: 0; font: inherit; font-family: ui-monospace, monospace; font-size: 0.9rem; padding: 0.35rem 0.5rem; resize: vertical; }
/* Which side the player had in a pasted game: shown once what is pasted is a game, not a position. */
.coach-pgn-side { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.9rem; margin: 0; padding: 0; border: 0; }
.coach-pgn-side[hidden] { display: none; }
.coach-pgn-side legend { float: left; padding: 0; margin-right: 0.9rem; font-weight: 600; }
.coach-pgn-side label { width: auto; font-weight: normal; }
.coach-fen-actions { display: flex; gap: 0.4rem; }
.coach-fen-error { width: 100%; margin: 0; color: var(--danger); }
.coach-fen-error:empty { display: none; }
.coach-move-gap { padding: 0.25rem 0.5rem; color: var(--ink-soft); }

/* The panel's tabs: the coach's comments, and the moves. */
.coach-tabs {
    display: flex;
    gap: 0.25rem;
    margin: 0 0 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.coach-tab {
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    color: var(--ink-soft);
    padding: 0.35rem 0.75rem;
    font-family: var(--serif);
    font-size: 1.3rem;
    cursor: pointer;
}

.coach-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); font-weight: 600; }
.coach-tab:hover { color: var(--ink); }
.coach-tab:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }

/* The Moves tab: number, White's move, Black's move; scrolls in its own box like the comments. */
.coach-moves {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: calc(var(--coach-board) - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    font-family: var(--serif);
    font-size: 1.1rem;
}

@media (max-width: 860px) {
    .coach-moves { max-height: 50vh; }
}

.coach-moves li {
    display: grid;
    grid-template-columns: 2.5rem 1fr 1fr;
    align-items: center;
}

.coach-moves li:nth-child(odd) { background: var(--paper-deep); }
.coach-move-number { color: var(--ink-soft); padding-left: 0.5rem; }

.coach-move {
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.coach-move:hover { background: var(--paper); }
.coach-move[aria-current="true"] { background: var(--gold-soft); color: var(--board-frame); font-weight: 600; }
.coach-move:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }

/* The comments scroll in their own box, about as tall as the board, so the page itself stays put. */
.coach-comments {
    list-style: none;
    margin: 0;
    padding: 0 0.4rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: calc(var(--coach-board) - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;   /* scrolling past the end doesn't scroll the page */
}

@media (max-width: 860px) {
    .coach-comments { max-height: 50vh; }   /* under the board on phones */
}

/* A new comment below the screen (on phones, under the board): a pill at the bottom of the screen that brings it into
   view (js/coach.js). Its edge takes the comment's tone, as the cards' do. */
.coach-new-comment {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--rule);
    border-left: 4px solid var(--rule);
    border-radius: 999px;
    background: var(--paper-deep);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
    cursor: pointer;
    animation: coach-new-comment 0.25s ease-out;
}
.coach-new-comment[hidden] { display: none; }
.coach-new-comment svg { width: 1.1rem; height: 1.1rem; }
.coach-new-comment.good { border-left-color: var(--win); }
.coach-new-comment.caution { border-left-color: var(--caution); }
.coach-new-comment.blunder { border-left-color: var(--danger); background: var(--danger-bg); }
.coach-new-comment:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

@keyframes coach-new-comment {
    from { opacity: 0; transform: translate(-50%, 0.75rem); }
}

@media (prefers-reduced-motion: reduce) {
    .coach-new-comment { animation: none; }
}

.coach-comment {
    padding: 0.6rem 0.85rem;
    border-left: 4px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--paper-deep);
}

/* While the coach's comments are on their way (js/coach.js): a card with three dots rising in turn. */
.coach-typing {
    display: flex;
    gap: 0.3rem;
    padding: 0.85rem;
    border-left: 4px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--paper-deep);
}

.coach-typing span {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--ink-soft);
    animation: coach-typing 1.2s ease-in-out infinite;
}

.coach-typing span:nth-child(2) { animation-delay: 0.15s; }
.coach-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes coach-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-0.3rem); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .coach-typing span { animation: none; opacity: 0.6; }
}

.coach-comment.good { border-left-color: var(--win); }
.coach-comment.caution { border-left-color: var(--caution); }
/* A blunder (or a queen given away) stands out in red. */
.coach-comment.blunder { border-left-color: var(--danger); background: var(--danger-bg); }
.coach-blunder { color: var(--danger); }

/* The game summary at the end: accuracy first, then the labels, the phases and the key moments. */
.coach-summary .coach-accuracy strong { font-size: 1.4rem; margin-right: 0.15rem; }
.coach-summary .coach-labels, .coach-summary .coach-phases { color: var(--ink-soft); font-size: 0.9rem; }
.coach-summary .coach-moments-title { font-weight: 600; margin-top: 0.5rem; }
.coach-moments { list-style: none; margin: 0.2rem 0 0; padding: 0; }
/* After the summary: was the coach helpful (thumbs and an open note box), and keep the game (an account). */
.coach-summary-feedback, .coach-keep { margin-top: 0.85rem; padding-top: 0.7rem; border-top: 1px solid var(--rule); }
.coach-summary-feedback-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; }
.coach-summary-feedback .coach-note { margin-top: 0.4rem; }
.coach-keep p { margin: 0.3rem 0 0; }
.coach-keep-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.coach-moments li { margin-top: 0.35rem; }
.coach-moments li.caution strong { color: var(--danger); }
.coach-moments li.good strong { color: var(--win); }
.coach-moment {
    font: inherit;
    font-weight: 600;
    padding: 0 0.4rem;
    border: 1px solid var(--rule);
    border-radius: 0.3rem;
    background: var(--field);
    color: var(--ink);
    cursor: pointer;
}
.coach-moment:hover, .coach-moment:focus-visible { border-color: var(--gold-ink); }

/* A move named in a comment: pressed, the board shows it (js/coach.js). */
.coach-link {
    font: inherit;
    font-weight: 600;
    padding: 0 0.3rem;
    border: 1px solid var(--rule);
    border-radius: 0.3rem;
    background: var(--field);
    color: var(--ink);
    cursor: pointer;
}
.coach-link:hover, .coach-link:focus-visible { border-color: var(--gold-ink); }
.coach-link[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }

.coach-comment-move {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.coach-comment p { margin: 0.15rem 0 0; }

/* A book move (a known opening line), in the move list and on comments. */
.coach-book { font-size: 0.85em; margin-left: 0.15em; cursor: help; }
.coach-comment-move .coach-book { font-size: 1.4em; line-height: 1; vertical-align: -0.15em; }   /* on cards: the label is small text */

/* The verdict on a move: a tag beside its label, or a small card on its own (move and verdict on one line). */
.coach-verdict {
    display: inline-block;
    margin-left: 0.25rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--rule);
    font-weight: 600;
    color: var(--ink);
}

.coach-verdict.good { border-color: var(--win); color: var(--win); }
/* "Great move" and "Brilliant move": gold, a cut above the rest. */
.coach-verdict.special { border-color: var(--gold-ink); background: var(--gold-ink); color: var(--on-gold); }

/* A move's grade as a badge (js/coach.js): stars for good, excellent and best; the chess marks for the rest. */
.coach-grade { margin-right: 0.35rem; font-weight: 700; letter-spacing: 0.04em; color: var(--gold-ink); white-space: nowrap; }
.coach-verdict.special .coach-grade { color: inherit; }
.coach-grade.inaccuracy, .coach-grade.mistake { color: var(--caution); }
.coach-grade.blunder { color: var(--danger); }
.coach-comment-move > .coach-grade { margin-left: 0.25rem; }

/* The help card (js/coach.js): closed at the top of the comments on the player's turn, with a little movement when it
   comes; it opens when clicked. */
.coach-help {
    border: 1px dashed var(--gold-ink);
    border-radius: var(--radius-sm);
    background: var(--paper);
    animation: coach-help-in 0.35s ease-out;
}

.coach-help.open { border-style: solid; }

.coach-help-open {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.85rem;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.coach-help-open:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.coach-help-open svg { flex: none; width: 1.25rem; height: 1.25rem; color: var(--gold-ink); animation: coach-help-glow 1.1s ease-in-out 0.35s 2; }
.coach-help-open::after { content: "\25BE"; margin-left: auto; color: var(--ink-soft); transition: transform 0.2s; }
.coach-help.open .coach-help-open::after { transform: rotate(180deg); }
.coach-help-body { padding: 0 0.85rem 0.7rem; animation: coach-help-open 0.25s ease-out; }
.coach-help-body[hidden] { display: none; }
.coach-help-body p { margin: 0.4rem 0 0; }
.coach-help-body .button { margin-top: 0.5rem; }
.coach-help-foot { display: flex; justify-content: flex-end; margin-top: 0.3rem; }
.coach-help-habit { color: var(--ink-soft); font-size: 0.9rem; }
.coach-help-look { font-weight: 600; }

@keyframes coach-help-in {
    from { opacity: 0; transform: translateY(-0.4rem) scale(0.98); }
}

@keyframes coach-help-glow {
    50% { transform: scale(1.35) rotate(-8deg); filter: drop-shadow(0 0 4px var(--gold)); }
}

@keyframes coach-help-open {
    from { opacity: 0; transform: translateY(-0.25rem); }
}

@media (prefers-reduced-motion: reduce) {
    .coach-help, .coach-help-open svg, .coach-help-body { animation: none; }
    .coach-help-open::after { transition: none; }
}

.coach-comment.verdict-only {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.1rem 0.6rem;
    padding-block: 0.4rem;
}

.coach-comment.verdict-only p { margin: 0; font-weight: 600; }
.coach-comment.verdict-only > div { flex-basis: 100%; }

/* Dragging on the coach's board (js/coach.js): pieces that can move can be picked up (a finger on one drags it
   rather than scrolling the page); the piece follows the pointer while its own square shows it faded. */
.coach-board .tap-square.movable {
    cursor: grab;
    touch-action: none;
}

.coach-board .tap-square.drag-from img {
    opacity: 0.3;
}

.coach-drag-ghost {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    cursor: grabbing;
}

/* The Coach tab before its first comment: what to expect, and the work-in-progress note. */
.coach-empty {
    padding: 0.75rem 0.9rem;
    border-left: 4px solid var(--rule);
    background: var(--paper-deep);
    color: var(--ink-soft);
}

.coach-empty[hidden] { display: none; }
.coach-empty p { margin: 0; }
.coach-empty p + p { margin-top: 0.6rem; }
/* How to start, first in the card until the game starts. */
.coach-empty .coach-setup { color: var(--ink); font-weight: 600; }
.coach-empty .coach-setup[hidden] { display: none; }
.coach-empty .coach-setup[hidden] + p { margin-top: 0; }

/* Feedback on each comment: thumbs and a note's button at the card's top right, beside the move's label. */
.coach-comment-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.coach-votes {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.15rem;
    margin: -0.35rem -0.45rem -0.2rem 0;   /* into the card's padding, so the label's line stays about the same height */
}

.coach-vote,
.coach-rollback,
.coach-note-open {
    display: inline-grid;
    place-items: center;
    min-width: 1.9rem;
    height: 1.9rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 0 0.3rem;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.coach-vote:hover,
.coach-rollback:hover,
.coach-note-open:hover,
.coach-note-open[aria-expanded="true"] { border-color: var(--rule); background: var(--paper); color: var(--ink); }
.coach-note-open svg, .coach-rollback svg { width: 1.05rem; height: 1.05rem; }
.coach-rollback[hidden], .coach-takeback-row[hidden] { display: none; }
.coach-takeback-row, .coach-resign-row { margin-top: 0.5rem; }

/* A recorded game on the admin's page (js/coach.js, showReplay): the cards' buttons are there as the player had them,
   but not to press; the card about the move on the board is marked; the player's notes follow the card they are about. */
.coach-votes button:disabled, .coach-takeback:disabled { cursor: default; pointer-events: none; }
.coach-comment.current { outline: 2px solid var(--gold); outline-offset: -2px; }
.coach-player-note {
    margin-top: 0.5rem;
    padding: 0.35rem 0.6rem;
    border: 1px dashed var(--rule);
    border-radius: var(--radius-sm);
    background: var(--paper);
    font-size: 0.95rem;
}
.coach-resign-row[hidden] { display: none; }

/* A card's move label: shows the position after the move. */
.coach-goto {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}
.coach-goto:hover { color: var(--ink); text-decoration: underline; }
.coach-goto:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }

.coach-vote[aria-pressed="true"] {
    border-color: var(--gold);
    background: var(--paper);
    color: var(--ink);
}

.coach-vote:focus-visible,
.coach-rollback:focus-visible,
.coach-note-open:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }

.coach-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.coach-note[hidden] { display: none; }
.coach-note textarea { width: 100%; font: inherit; }

.coach-note-hint { margin: 0.75rem 0 0; }

.coach-forum {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
}

.coach-forum h3 { margin: 0 0 0.4rem; }
.coach-forum p { margin: 0 0 0.5rem; }

/* Rank and file labels on the coach's board (the shared .coord in css/tablebase.css), each in the other square colour so it
   reads on both. */
.coach-board .coord { font-size: 0.7rem; font-weight: 700; }
.coach-board .tap-square.light .coord { color: var(--board-dark); }
.coach-board .tap-square.dark .coord { color: var(--board-light); }

/* A card's buttons (take back, thumbs, feedback) always show, with a mouse as on a touch screen: shown only under the
   pointer they went unnoticed (the site owner, 2026-11-17). */

/* ---------- Opening and endgame pages: step through a line, then play it (Shared/LessonBoard.razor, js/lesson.js) ---------- */
.lesson-ideas { max-width: 46rem; margin: 0 0 1.5rem; }
.lesson-ideas h2 { margin-top: 0; }
.lesson-moves-line { margin-top: -0.5rem; }

.lesson-layout {
    display: grid;
    grid-template-columns: minmax(0, 480px) minmax(0, 1fr);
    gap: 1.5rem 2rem;
    align-items: start;
}

@media (max-width: 860px) {
    .lesson-layout { grid-template-columns: minmax(0, 1fr); }
}

.lesson-status { min-height: 1.6em; margin: 0 0 0.5rem; font-weight: 600; }

.lesson-steps { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; }
.lesson-steps[hidden] { display: none; }
.lesson-steps .button { min-width: 3rem; }

/* Components/Shared/SoundToggle.razor, under the coach's, the puzzles' and the lessons' boards. */
.sound-toggle { margin: 0.5rem 0 0; }
.sound-toggle-button { display: inline-flex; align-items: center; justify-content: center; padding: 0.35rem 0.5rem; line-height: 0; }
.sound-toggle-button .sound-off,
.sound-toggle-button.is-off .sound-on { display: none; }
.sound-toggle-button.is-off .sound-off { display: block; }

.lesson-moves { font-family: var(--serif); font-size: 1.1rem; margin: 0 0 0.75rem; line-height: 1.7; }

.lesson-move {
    border: none;
    background: none;
    padding: 0 0.15rem;
    font: inherit;
    color: inherit;
    border-radius: var(--radius-sm);
}

button.lesson-move { cursor: pointer; }
button.lesson-move:hover { background: var(--paper-deep); }
.lesson-move.current { background: var(--ink); color: var(--paper); }
button.lesson-move.current:hover { background: var(--ink); }

.lesson-panel h2 { margin: 0.5rem 0 0.3rem; }
.lesson-intro { margin: 0 0 0.75rem; color: var(--ink-soft); }

.lesson-lines { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.lesson-line-button,
.lesson-modes button {
    min-height: 40px;
    padding: 0.3rem 0.9rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font: 500 0.95rem var(--sans);
    cursor: pointer;
}

.lesson-line-button.active,
.lesson-modes button.active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.lesson-modes { display: flex; gap: 0.4rem; margin: 0 0 0.75rem; }
.lesson-modes button { flex: 1; }
.lesson-line-button:focus-visible,
.lesson-modes button:focus-visible,
.lesson-move:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }

.lesson-task { margin: 0 0 0.5rem; font-weight: 600; }
.lesson-task[hidden] { display: none; }

.lesson-note {
    min-height: 4.5rem;
    padding: 0.6rem 0.9rem;
    border-left: 4px solid var(--gold);
    background: var(--paper-deep);
    border-radius: 0 6px 6px 0;
}

.lesson-note p { margin: 0 0 0.4rem; }
.lesson-note p:last-child { margin-bottom: 0; }
.lesson-note:empty { display: none; }
.lesson-right { color: var(--win); font-weight: 600; }
.lesson-wrong { color: var(--danger); font-weight: 600; }

/* Pieces that can move can be picked up and dragged, as on the coach's board. */
.lesson-board .tap-square.movable { cursor: grab; touch-action: none; }
.lesson-board .tap-square.drag-from img { opacity: 0.3; }
.lesson-board .coord { font-size: 0.7rem; font-weight: 700; }
.lesson-board .tap-square.light .coord { color: var(--board-dark); }
.lesson-board .tap-square.dark .coord { color: var(--board-light); }

.lesson-drag-ghost {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    cursor: grabbing;
}

/* The lines written out under the board. */
.lesson-text { max-width: 46rem; margin: 2rem 0 1.5rem; }
.lesson-text h3 { margin: 1.25rem 0 0.25rem; }
.lesson-text-moves { line-height: 1.7; }
.lesson-text-move strong { font-family: var(--serif); font-size: 1.1rem; }
.coach-history-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
