/* Last-move highlight (works on both light and dark squares) */
#board .last-move {
    box-shadow: inset 0 0 0 100px rgba(255, 214, 10, 0.38);
}

/* Error / status message shown inside the viewer area */
.viewer-message {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted, #888);
}

/* Visible keyboard focus for the control buttons */
.move-controls button:focus-visible {
    outline: 2px solid #ffd60a;
    outline-offset: 2px;
}

/* download button in the viewer (shown only for own requests) */
#download-pgn-btn[hidden]{display:none !important}

/* =====================================================================
   UX update (Nov 2026): readable comments, clock labels, coloured marks,
   board stays in view on desktop, clearer controls
   ===================================================================== */

/* A. move list reads like a book: moves and full comments flow as text */
/* main line flows next to each other (like ChessBase); comments stay inline,
   opened variations and prep marks are blocks and start on their own line */
/* everything wraps; only a few px of move padding can stick out at a line end, so no sideways scrollbar */
#moves { line-height: 1.95; overflow-x: hidden; }
#moves .move-row { display: inline; padding: 0; }
#moves .move-container { display: inline; }
#moves .move-number { display: inline; min-width: 0; margin: 0 1px 0 2px; }
/* O-O-O must not wrap at its hyphens */
#moves .move-span,
#moves .variation-move > span:not(.variation-comment) { white-space: nowrap; }
#moves .move-comment,
#moves .variation-comment {
    display: inline;
    white-space: normal;
    font-style: normal;
    font-size: 13.5px;
    line-height: 1.6;
    color: #c9d4df;
    margin: 0 8px 0 4px;
}
#moves .variation-comment { font-size: 12.5px; color: #b7c6d6; }
#moves .root-comment { display: block; margin: 0 0 6px; } /* comment before move 1 */
.comment-text { overflow-wrap: anywhere; }

/* C. thinking time / clock as a small label instead of comment text */
.move-clock {
    display: inline-block;
    margin-right: 6px;
    padding: 0 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.07);
    color: #8b97a5;
    font-size: 11px;
    font-style: normal;
    line-height: 1.6;
    white-space: nowrap;
    vertical-align: 1px;
}

/* F. coloured annotation marks */
.nag { font-weight: 700; margin-left: 1px; }
.nag-good { color: #4ade80; }
.nag-bad { color: #f87171; }
.nag-dubious { color: #fbbf24; }
.nag-interesting { color: #60a5fa; }
.nag-other { color: #9ca3af; font-weight: 600; }

/* D. clear variation toggle per move: "▸ 2 var." / "▾ 2 var." */
#moves .variation-indicator-wrapper { display: inline; }
#moves .variation-indicator-btn {
    display: inline-block;
    margin: 0 6px 0 4px;
    padding: 0 8px;
    border: 1px solid rgba(74, 144, 217, 0.5);
    border-radius: 999px;
    background: rgba(74, 144, 217, 0.12);
    color: #9cc3ec;
    font: inherit;
    font-size: 11.5px;
    line-height: 1.7;
    cursor: pointer;
    vertical-align: 1px;
}
#moves .variation-indicator-btn::before { content: "▸ "; }
#moves .variation-indicator-btn.open::before { content: "▾ "; }
#moves .variation-indicator-btn:hover { background: rgba(74, 144, 217, 0.25); }
#moves .variation-indicator-btn:focus-visible { outline: 2px solid #ffd60a; outline-offset: 2px; }


/* B. desktop: the board column stays in view while the move list scrolls */
@media (min-width: 901px) {
    .left-panel { position: sticky; top: 12px; align-self: flex-start; }
    body:has(#header-placeholder) .left-panel { top: 86px; }
}

/* D. keyboard hint (only on devices with a keyboard and mouse) */
.kb-hint { margin: 2px 0 0; font-size: 12px; color: #8b97a5; text-align: center; }
@media (hover: none), (max-width: 900px) { .kb-hint { display: none; } }

/* larger, consistent control buttons */
.move-controls button { min-width: 40px; min-height: 36px; }

/* phones: keep comments readable (they were 9-10px) */
@media (max-width: 600px) {
    #moves .move-comment { font-size: 12.5px; }
    #moves .variation-comment { font-size: 12px; }
    .move-clock { font-size: 10.5px; }
}

/* =====================================================================
   UX update 2: bigger controls, compact variations (E), key moments (G)
   ===================================================================== */

/* bigger, easier to click controls */
.left-panel .move-controls { gap: 8px; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
.left-panel .move-controls button {
    height: 46px;
    min-width: 48px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 15px;
}
.left-panel .move-controls #start,
.left-panel .move-controls #prev,
.left-panel .move-controls #next,
.left-panel .move-controls #end { min-width: 56px; font-size: 19px; }
@media (max-width: 600px) {
    .left-panel .move-controls { gap: 6px; }
    .left-panel .move-controls button { height: 42px; min-width: 44px; padding: 0 10px; font-size: 13px; }
    .left-panel .move-controls #start,
    .left-panel .move-controls #prev,
    .left-panel .move-controls #next,
    .left-panel .move-controls #end { min-width: 52px; font-size: 18px; }
}

/* current move clearly visible (was dark grey on a dark background) */
#moves .move-span.active,
#moves .variation-move.active {
    background: #c59d5f !important;
    color: #111 !important;
    box-shadow: none !important;
}

/* E. compact variations: inline text in parentheses, like a book */
#moves .variations-container {
    margin: 2px 0 6px 18px;
    padding: 2px 0 2px 12px;
    background: none;
    border-left: 2px solid rgba(74, 144, 217, 0.45);
    border-radius: 0;
}
#moves .variation-wrapper {
    margin: 0;
    padding: 2px 0;
    border: 0;
    line-height: 1.85;
}
#moves .variation-label { display: none; }
#moves .variation-preamble { display: inline; margin: 0 6px 0 0; font-size: 12.5px; color: #b7c6d6; font-style: normal; }
#moves .variation-moves-container { display: inline; }
#moves .variation-moves-container::before { content: "("; color: #6f8aa6; margin-right: 2px; }
#moves .variation-moves-container::after { content: ")"; color: #6f8aa6; margin-left: 1px; }
#moves .variation-move {
    display: inline;
    padding: 1px 3px;
    margin: 0 1px;
    background: none;
    border-radius: 4px;
    font-size: 13px;
    color: #9cc3ec;
}
#moves .variation-move:hover { background: rgba(74, 144, 217, 0.18); }
#moves .variation-move-number { color: #6f8aa6; margin-right: 2px; }

/* G. key moments bar above the move list */
.key-moments {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid rgba(197, 157, 95, 0.35);
    border-radius: 10px;
    background: rgba(197, 157, 95, 0.06);
}
.key-moments[hidden] { display: none; }
.key-moments-title { margin-right: 4px; color: #c59d5f; font-size: 13px; font-weight: 600; }
.key-moment {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #e5e7eb;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.key-moment:hover { border-color: #c59d5f; }
.key-moment.active { background: #c59d5f; border-color: #c59d5f; color: #111; }
.key-moment .key-moment-comment { font-size: 11px; opacity: 0.8; }
.key-moment:focus-visible { outline: 2px solid #ffd60a; outline-offset: 2px; }

/* H. arrows and highlighted squares from [%cal] / [%csl] (drawn by viewer.js) */
#boardContainer { position: relative; }
#boardContainer svg.board-marks { position: absolute; z-index: 20; pointer-events: none; overflow: visible; }

/* embedded viewer (My games, services page): no room needed for the site header */
body:not(:has(#header-placeholder)) .viewer { margin-top: 0; padding-top: 4px; }
/* dark, thin scrollbars (the browser's default ones are light), also inside the embedded viewer */
:root { color-scheme: dark; scrollbar-width: thin; scrollbar-color: #3a4350 transparent; }
* { scrollbar-width: thin; scrollbar-color: #3a4350 transparent; }

/* Repertoire marks: the move where the game left your prep (sent by the Repertoire page) */
#moves .move-span.prep-exit { border-radius: 4px; box-shadow: inset 0 -2px 0 var(--prep-c); }
#moves .move-span.prep-exit:not(.active) { color: var(--prep-c); }
#moves .prep-exit-me, #moves .prep-mark-me { --prep-c: #fbbf24; }
#moves .prep-exit-opp, #moves .prep-mark-opp { --prep-c: #93c5fd; }
#moves .prep-exit-end, #moves .prep-mark-end { --prep-c: #4ade80; }
#moves .prep-mark {
    display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
    margin: 4px 0 6px 26px; padding: 6px 10px; line-height: 1.45; font-size: 12.5px;
    border-left: 3px solid var(--prep-c); border-radius: 0 6px 6px 0; background: rgba(255, 255, 255, 0.04); color: #e6edf3;
}
#moves .prep-open {
    border: 1px solid var(--prep-c); background: transparent; color: var(--prep-c); border-radius: 999px;
    padding: 2px 10px; font: 600 12px 'Poppins', sans-serif; cursor: pointer;
}
#moves .prep-open:hover { background: rgba(255, 255, 255, 0.06); }
#moves .prep-open:focus-visible { outline: 2px solid #ffd60a; outline-offset: 2px; }

/* phones: the page scrolls; below the board the move list gets (almost) a full screen,
   instead of only the space left under the board */
@media (max-width: 600px) {
    .viewer { height: auto; overflow: visible; }
    #right-panel { flex: none; height: calc(100svh - 70px); }
}
