@font-face {
    font-family: 'Roboto';
    src: url('../fonts/Roboto-Regular.ttf');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Roboto';
    src: url('../fonts/Roboto-Medium.ttf');
    font-weight: bolder;
    font-style: normal;
}

@font-face {
    font-family: 'FreeSerif';
    src: url('../fonts/FreeSerif-YO4a.otf') format('opentype');
}

body {
    overflow-y: auto !important;
}

.gameVariation {
    font-size: max(1.5vw, 1.1rem);
    display: block;
    margin-left: 5vw;
    margin-top: 0.6vw;
    margin-bottom: 0.6vw;
}

.gameVariation .gameMoves {
    font-weight: normal;
}

.comment {
    font-size: max(1.5vw, 1.1rem);
    display: block;
    margin-top: 0.6vw;
    margin-bottom: 0.6vw;
    color: green;
    font-weight: normal;
}

.bookMoves {
    font-size: max(1.65vw, 1.15rem);
    font-family: Roboto, FreeSerif, sans-serif;
}

.gameMoves {
    font-size: max(1.8vw, 1.25rem);
    font-weight: bolder;
    line-height: 150%;
    font-family: Roboto, FreeSerif, sans-serif;
}

.figurine {
    font-family: FreeSerif, serif;
    font-size: 1.2em;
    line-height: 1;
    margin-right: -0.05em;
}

.gameMoves .highlight {
    color: darkgreen;
    font-size: max(1.8vw, 1.25rem);
}

.gameMoves a {
    text-decoration: none;
}

.gameResult {
    font-size: max(1.8vw, 1.25rem);
}

#pgn h4 {
    font-size: max(1.65vw, 1.15rem);
}

#pgn h5 {
    font-size: max(1.4vw, 1.05rem);
}

.panel-heading {
    overflow: hidden;
}

.panel-heading>.nav-tabs {
    border-bottom: none;
    margin-bottom: -10px;
    overflow: visible;
}

.panel .panel-borderless .panel-primary {
    border: 0;
    box-shadow: none;
}

.card-body {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.panel-body {
    padding-top: 1.5vh;
    padding-right: 1.2vw;
    padding-bottom: 1.2vh;
    padding-left: 1.5vw;
}

div.dataTables_info {
    font-size: 1vw;
}

.dataTables_processing {
    font-size: 1vw;
}

div.dataTables_wrapper div.dataTables_length select {
    width: 20vw;
}

.svg-container {
    display: inline-block;
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    vertical-align: middle;
    overflow: hidden;
}

.svg-content {
    display: inline-block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#boardcontrol {
    padding-left: 0px;
    padding-right: 0px;
}

#boardButtons {
    margin-top: 10px;
}

#boardButtons .btn {
    min-height: 42px;
    min-width: 44px;
    font-size: 1rem;
    touch-action: manipulation;
}

#DGTClockStatus {
    font-size: 3vh;
}

#DGTClockText {
    font-size: 5vh;
}

#clockbuttons {
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 0px;
    padding-right: 0px;
}

.boardinfo {
    padding-top: 1vh;
    padding-bottom: 30px;
}

#BoardStatus {
    font-size: 1.8em;
    line-height: .75em;
    vertical-align: -15%;
}

.scroll_movelist {
    height: 30vh;
    overflow: auto;
    margin-bottom: 1vh;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.scroll_movelist .card-body {
    flex: 1 1 auto;
    min-height: 0;
}

.scroll_obooklist {
    height: 33vh;
    overflow-x: hidden;
    overflow-y: auto;
}

#GameTable_wrapper {
    min-height: 30vh;
    max-height: 30vh;
    overflow-x: hidden;
}

.scroll_engine {
    max-height: 30vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.card-header {
    padding: 5px;
}

/* Nav-pills tab bar: distribute buttons evenly across the full available
   width so they never overflow on narrow windows (right column).
   min-width:0 + overflow:hidden prevent the <ul> from growing wider than
   its flex slot in the card-header, which would make it overlap the gear. */
#pills-tab {
    flex-wrap: nowrap;      /* keep all four tabs on one line */
    min-width: 0;           /* allow the <ul> to shrink below content size */
    overflow: hidden;       /* clip any overflow so the gear is never covered */
}
#pills-tab .nav-item {
    flex: 1 1 0;            /* equal share of available width */
    min-width: 0;           /* allow shrinking below content size */
}
#pills-tab .nav-link {
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Replace the fixed 14px padding with a fluid value that shrinks on
       narrow containers while still looking comfortable when wide. */
    padding: 8px max(4px, 1vw);
}

.nav-link.engine-mode-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bs-secondary-bg, #d0d4d9);
    color: var(--mdb-body-color, var(--bs-body-color, #212529));
    border: 1px solid rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.18);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    text-shadow: none;
}

.nav-link.engine-mode-button:hover,
.nav-link.engine-mode-button:focus,
.nav-link.engine-mode-button.active {
    background: var(--bs-secondary-bg, #c1c5ca);
    color: var(--mdb-body-color, var(--bs-body-color, #212529));
    border-color: rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.28);
    filter: brightness(1.05);
}

#data {
    margin-top: 10px;
    width: 100%;
}

/* Igualar altura de columnas - Sistema responsive universal */


canvas {
    width: 20vw;
    height: 2vh;
    vertical-align: middle;
}

table.compact.dataTable tbody th,
table.compact.dataTable tbody td {
    vertical-align: middle;
    padding-top: 0px;
    padding-bottom: 0px;
    padding-left: 4px;
    padding-right: 4px;
}

table.dataTable {
    margin-top: 0px !important;
}

.dataTables_wrapper table thead {
    display: none;
}

td.dt-right.zero-border-right {
    text-align: right;
    border-right: 0px;
}

td.dt-center.zero-border-right {
    text-align: center;
    border-right: 0px;
}

td.result {
    text-align: center;
    white-space: nowrap;
}

/* Corrected size of icons in buttons */
.fa-lg {
    font-size: 1.4em;
}

#engineMultiPVStatus {
    font-size: 1.5vw;
    vertical-align: text-top;
}

.list-group-item {
    color: var(--mdb-card-color);
    padding-left: 8px;
}

.tutor-mistake-item {
    cursor: pointer;
}

.tutor-mistake-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.tutor-mistake-analysis-btn {
    border: 0;
    border-radius: 8px;
    min-width: 34px;
    padding: 2px 10px;
    margin-left: 4px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.tutor-mistake-analysis-btn:hover {
    background: linear-gradient(135deg, #0069d9, #004085);
}

.tutor-mistake-analysis-btn:disabled {
    opacity: 0.45;
}

.tutor-loss-display {
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.82rem;
    display: inline-block;
}

.tutor-loss-good {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.tutor-loss-warn {
    background: linear-gradient(135deg, #ffc107, #d39e00);
    color: #212529;
}

.tutor-loss-bad {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

#listener {
    width: 0px;
    height: 0px;
}

/* better visible hover for dark mode */
#GameTable>tbody>tr:hover>* {
    box-shadow: inset 0 0 0 9999px white;
}

/* start promotion */
.promotion-overlay {
    z-index: 4;
    background: rgba(22, 21, 18, .7);
    width: 100%;
    height: 100%;
    position: absolute;
}

.promotion-overlay square {
    cursor: pointer;
    border-radius: 50%;
    background-color: #b0b0b0;
    box-shadow: inset 0 0 25px 3px gray;
    transition: all 150ms;
    z-index: 2;
    position: absolute;
    top: 0;
    left: 0;
    width: 12.5%;
    height: 12.5%;
    transition: all 150ms;
}

.promotion-overlay piece {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    ;
    background-size: cover;
    z-index: 5;
    pointer-events: none;
    transition: all 150ms;
}

.promotion-overlay square:hover piece {
    transform: scale(120%);
}

.promotion-overlay square:hover {
    box-shadow: inset 0 0 48px 8px #d64f00;
    border-radius: 0%;
}

#promotoion-choice {
    background: rgba(22, 21, 18, .7);
    z-index: 205;
    position: absolute;
    width: var(--cg-width, 100%);
    height: var(--cg-height, 100%);
    right: 0;
}

#promotion-choice piece {
    pointer-events: auto;
    opacity: 1;
}

/* Merida pieces */
.merida .pawn.white { background-image: url('chessground/images/pieces/merida/wP.svg') }
.merida .knight.white { background-image: url('chessground/images/pieces/merida/wN.svg') }
.merida .bishop.white { background-image: url('chessground/images/pieces/merida/wB.svg') }
.merida .rook.white { background-image: url('chessground/images/pieces/merida/wR.svg') }
.merida .queen.white { background-image: url('chessground/images/pieces/merida/wQ.svg') }
.merida .king.white { background-image: url('chessground/images/pieces/merida/wK.svg') }
.merida .pawn.black { background-image: url('chessground/images/pieces/merida/bP.svg') }
.merida .knight.black { background-image: url('chessground/images/pieces/merida/bN.svg') }
.merida .bishop.black { background-image: url('chessground/images/pieces/merida/bB.svg') }
.merida .rook.black { background-image: url('chessground/images/pieces/merida/bR.svg') }
.merida .queen.black { background-image: url('chessground/images/pieces/merida/bQ.svg') }
.merida .king.black { background-image: url('chessground/images/pieces/merida/bK.svg') }

/* Alpha pieces */
.alpha .pawn.white { background-image: url('chessground/images/pieces/alpha/wP.svg') }
.alpha .knight.white { background-image: url('chessground/images/pieces/alpha/wN.svg') }
.alpha .bishop.white { background-image: url('chessground/images/pieces/alpha/wB.svg') }
.alpha .rook.white { background-image: url('chessground/images/pieces/alpha/wR.svg') }
.alpha .queen.white { background-image: url('chessground/images/pieces/alpha/wQ.svg') }
.alpha .king.white { background-image: url('chessground/images/pieces/alpha/wK.svg') }
.alpha .pawn.black { background-image: url('chessground/images/pieces/alpha/bP.svg') }
.alpha .knight.black { background-image: url('chessground/images/pieces/alpha/bN.svg') }
.alpha .bishop.black { background-image: url('chessground/images/pieces/alpha/bB.svg') }
.alpha .rook.black { background-image: url('chessground/images/pieces/alpha/bR.svg') }
.alpha .queen.black { background-image: url('chessground/images/pieces/alpha/bQ.svg') }
.alpha .king.black { background-image: url('chessground/images/pieces/alpha/bK.svg') }

/* Leipzig pieces */
.leipzig .pawn.white { background-image: url('chessground/images/pieces/leipzig/wP.svg') }
.leipzig .knight.white { background-image: url('chessground/images/pieces/leipzig/wN.svg') }
.leipzig .bishop.white { background-image: url('chessground/images/pieces/leipzig/wB.svg') }
.leipzig .rook.white { background-image: url('chessground/images/pieces/leipzig/wR.svg') }
.leipzig .queen.white { background-image: url('chessground/images/pieces/leipzig/wQ.svg') }
.leipzig .king.white { background-image: url('chessground/images/pieces/leipzig/wK.svg') }
.leipzig .pawn.black { background-image: url('chessground/images/pieces/leipzig/bP.svg') }
.leipzig .knight.black { background-image: url('chessground/images/pieces/leipzig/bN.svg') }
.leipzig .bishop.black { background-image: url('chessground/images/pieces/leipzig/bB.svg') }
.leipzig .rook.black { background-image: url('chessground/images/pieces/leipzig/bR.svg') }
.leipzig .queen.black { background-image: url('chessground/images/pieces/leipzig/bQ.svg') }
.leipzig .king.black { background-image: url('chessground/images/pieces/leipzig/bK.svg') }
/* Neo pieces */
.neo .pawn.white { background-image: url('chessground/images/pieces/neo/wP.svg') }
.neo .knight.white { background-image: url('chessground/images/pieces/neo/wN.svg') }
.neo .bishop.white { background-image: url('chessground/images/pieces/neo/wB.svg') }
.neo .rook.white { background-image: url('chessground/images/pieces/neo/wR.svg') }
.neo .queen.white { background-image: url('chessground/images/pieces/neo/wQ.svg') }
.neo .king.white { background-image: url('chessground/images/pieces/neo/wK.svg') }
.neo .pawn.black { background-image: url('chessground/images/pieces/neo/bP.svg') }
.neo .knight.black { background-image: url('chessground/images/pieces/neo/bN.svg') }
.neo .bishop.black { background-image: url('chessground/images/pieces/neo/bB.svg') }
.neo .rook.black { background-image: url('chessground/images/pieces/neo/bR.svg') }
.neo .queen.black { background-image: url('chessground/images/pieces/neo/bQ.svg') }
.neo .king.black { background-image: url('chessground/images/pieces/neo/bK.svg') }
/* --- ESTILOS DEL BOTÓN MUTE (GLOBAL) --- */

/* Estilo base del botón */
#btn-mute {
    position: relative;
}

#btn-mute span {
    z-index: 1;
    pointer-events: none;
}

#btn-mute.is-muted {
    background-color: #ffb3b3;
    border-color: #ff0000;
    box-shadow: inset 0px 2px 5px rgba(0, 0, 0, 0.15);
}

#btn-mute.is-muted::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 4px;
    background-color: white;
    border: 1px solid #cc0000;
    border-radius: 2px;
    transform: translate(-50%, -50%) rotate(-45deg);
    z-index: 10;
    pointer-events: none;
}

#pv_output {
    background-color: transparent !important;
    padding: 0;
    margin-top: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

#pv_output,
#pv_output *,
#pv_output div,
#pv_output div[id^="pv_"] {
    background-color: transparent !important;
}

/* Asegurar que hereda del contenedor padre */
#pv_output .list-group-item,
.analysis-sources .list-group-item {
    background-color: transparent !important;
    color: inherit !important;
    border: 1px solid rgba(var(--bs-border-color-rgb, 128, 128, 128), 0.45) !important;
    border-radius: 4px;
    margin: 0 0 3px 0;
    padding: 6px 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    min-height: auto;
    width: 100%;
    box-sizing: border-box;
}

#pv_output .list-group-item:hover,
.analysis-sources .list-group-item:hover {
    background-color: rgba(0, 123, 255, 0.1) !important;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* NUEVA ESTRUCTURA: Una sola línea compacta */
.analysis-line-compact {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
    font-size: 0.9rem;
    line-height: 1.3;
    text-align: left;
    box-sizing: border-box;
    min-width: 0;
}

/* Botón de copiar */
.list-group-item-heading .btn {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    margin-right: 10px;
}

/* Score pill — same size as depth pill */
.score-display {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.82rem;
    flex-shrink: 0;
}

/* Puntuación positiva (ventaja blancas) */
.score-positive {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

/* Puntuación negativa (ventaja negras) */
.score-negative {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Puntuación de mate */
.score-mate {
    background: linear-gradient(135deg, #fd7e14, #e55100);
    animation: pulse-mate 2s infinite;
}

@keyframes pulse-mate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ── ThreeCheck counters ──────────────────────────────── */
.check-counter-row {
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0.3rem 0.5rem;
}

.check-badge {
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.check-badge-white {
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
}

.check-badge-black {
    background: #adb5bd;
    color: #212529;
    border: 1px solid #6c757d;
}

.check-king-icon {
    width: 1.4em;
    height: 1.4em;
    vertical-align: middle;
}

/* Profundidad compacta */
.depth-display {
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.82rem;
    flex-shrink: 0;
}

/* Continuation moves — same size as first-move */
.continuation-moves {
    font-size: 0.95rem;
    font-weight: normal;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Movimientos en la variación */
.pv-moves {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* First move — bold, no background pill */
.first-move {
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* Source label for backend analysis lines */
.analysis-source {
    font-weight: normal;
    color: currentColor;
    margin-right: 0.25em;
    flex-shrink: 0;
    font-size: 1em;
    line-height: inherit;
}

.analysis-sources {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0px 0 0 0;
    color: inherit;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

#analysisLineEngine,
#analysisLineTutor {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Match backend analysis lines with web engine styling */
.analysis-sources .analysis-line-compact {
    margin: 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Números de jugada */
.move-number {
    color: #6c757d;
    font-weight: normal;
    margin-right: 4px;
}

/* Contenedor de múltiples líneas */
.multi-pv-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Indicador de línea múltiple */
.pv-line-indicator {
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    border-radius: 2px;
}

.pv-line-1 { background: #007bff; }
.pv-line-2 { background: #28a745; }
.pv-line-3 { background: #ffc107; }
.pv-line-4 { background: #dc3545; }
.pv-line-5 { background: #6f42c1; }

/* Controles del motor - MÁS COMPACTOS */
#engineMultiPVStatus {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    color: #495057;
    border: 1px solid #ced4da;
    font-size: 0.85rem;
}

.engine-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.engine-version-label {
    margin-left: auto;
    text-align: right;
    border: 0.0625rem solid rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.2);
    border-radius: 999rem;
    color: var(--mdb-body-color, var(--bs-body-color, #757575));
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    white-space: nowrap;
}

/* Estilos adicionales para la nueva estructura */
.move-number {
    color: #6c757d;
    font-weight: normal;
    font-size: 0.8rem;
}

.pv-moves {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* Responsive para móviles */


/* Clase para contenedor de PV */
.pv-container {
    margin: 0;
}

/* Single-row layout for extra PV lines (pv_2+): pills + moves on one line */
.pv-extra-line {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0.35rem;
    flex-wrap: nowrap;
    padding: 0.15rem 0.5rem;
    min-width: 0;
}

#sf18Pv1Body > .pv-extra-line {
    padding-left: 0;
    padding-right: 0;
}

/* Two-row PV item layout (server engine + SF18) */
.pv-two-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.35rem 0.5rem;
}

.analysis-row-collapsed {
    display: none !important;
}

.pv-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.pv-body {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 0.3rem;
    flex-wrap: nowrap;
    min-width: 0;
}

/* Engine / source name — plain bold label, no pill */
.engine-name-badge {
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bs-body-color, #212529);
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto;
}

.backend-source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.35);
    border-radius: 4px;
    color: var(--bs-body-color, #212529);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.backend-source-badge.tutor-source {
    border-color: rgba(13, 110, 253, 0.55);
    color: #0d6efd;
}

/* Rubber spacer: pushes buttons to the right in pv-header */
.pv-spacer {
    flex: 1;
}

.analysis-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.25rem 0.5rem 0.35rem;
    margin-bottom: 0.15rem;
    border-bottom: 1px solid rgba(var(--bs-body-color-rgb, 33, 37, 41), 0.14);
}

.analysis-control-set {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.analysis-control-label {
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.analysis-toolbar-btn,
.analysis-toolbar .book-switch-btn {
    min-height: 36px;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    touch-action: manipulation;
}

#tutorWatchBtn.analysis-toolbar-btn {
    min-width: 48px;
}

@media (max-width: 480px) {
    .analysis-toolbar {
        gap: 0.25rem;
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    .analysis-control-set {
        gap: 0.18rem;
    }

    .analysis-control-label {
        font-size: 0.75rem;
    }

    .analysis-toolbar-btn,
    .analysis-toolbar .book-switch-btn {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    #tutorWatchBtn.analysis-toolbar-btn {
        min-width: 44px;
    }
}

/* Small move-number label in server analysis header */
.move-number {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
    flex-shrink: 0;
}

/* Optimización para 1024x600 y 1024x800 - Análisis compacto */


/* Ajustes adicionales solo para 1024x800 */




/* Meta containers: transparent to flexbox so score/depth join the row directly */
#engineMeta, #sf18Meta {
    display: contents;
}

/* Colour overrides for score / depth / first-move in all analysis containers */
#pv_output .score-display,
#engineRow .score-display,
#sf18Row .score-display,
.analysis-sources .score-display {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    color: white !important;
}

#pv_output .score-positive,
#engineRow .score-positive,
#sf18Row .score-positive,
.analysis-sources .score-positive {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
    color: white !important;
}

#pv_output .score-negative,
#engineRow .score-negative,
#sf18Row .score-negative,
.analysis-sources .score-negative {
    background: linear-gradient(135deg, #dc3545, #c82333) !important;
    color: white !important;
}

#pv_output .score-mate,
#engineRow .score-mate,
#sf18Row .score-mate,
.analysis-sources .score-mate {
    background: linear-gradient(135deg, #fd7e14, #e55100) !important;
    color: white !important;
}

#pv_output .first-move,
#engineRow .first-move,
#sf18Row .first-move,
.analysis-sources .first-move {
    background: #fff3cd !important;
    color: #856404 !important;
    border-color: #ffc107 !important;
}

/* Continuation moves inherit body text colour, bypassing any grey from Bootstrap/MDB card overrides */
#pv_output .continuation-moves,
#engineRow .continuation-moves,
#sf18Row .continuation-moves {
    color: inherit !important;
}

#pv_output .depth-display,
#engineRow .depth-display,
#sf18Row .depth-display,
.analysis-sources .depth-display {
    background: #6c757d !important;
    color: white !important;
}

/* Tema oscuro */
/* Optimización del tablero para resoluciones específicas */

/* Para resoluciones 1024x600 y 1024x800 */

/***************************************************/
/* Optimización específica para 1024x600 y 1024x768*/
/***************************************************/

/*****************************************/
/* Optimización específica para 1280x800 */
/*****************************************/


/* Prevenir desbordamiento de piezas */
.cg-board piece.dragging {
    cursor: move;
    z-index: 999 !important;
}

/* Asegurar que las piezas se vean correctamente */
piece {
    pointer-events: auto !important;
}

/* Mejorar la visualización de movimientos posibles */
.cg-board square.move-dest {
    background: radial-gradient(rgba(20, 85, 30, 0.6) 22%, #208530 0, rgba(0, 0, 0, 0.4) 0, rgba(0, 0, 0, 0) 0) !important;
}

/* Mejorar la visualización del último movimiento */
.cg-board square.last-move {
    background-color: rgba(155, 199, 0, 0.5) !important;
}

/* Asegurar que la promoción se vea correctamente */
.promotion-overlay {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1000 !important;
}

.promotion-overlay square {
    width: 12.5% !important;
    height: 12.5% !important;
}

.promotion-overlay piece {
    width: 80% !important;
    height: 80% !important;
    top: 10% !important;
    left: 10% !important;
}

/* Estilos comunes para 1024x600 y 1280x800 */


/* Asegurar que el movimiento activo se vea centrado */
.scroll_movelist .text-warning {
    scroll-margin-top: 90px;
    scroll-margin-bottom: 90px;
}

#data .card-body {
    height: calc(100% - 50px) !important;
    overflow: hidden !important;
}

#data .tab-content {
    height: 100% !important;
}

#data .tab-pane {
    height: 100% !important;
}

/* Reducir espacio del boardcontrol - TODAS LAS RESOLUCIONES */
#boardcontrol {
    padding-left: 0px !important;
    padding-right: 0px !important;
}

#boardcontrol > .row:last-child {

    min-height: 30px !important;
}

/* ═══════════════════════════════════════════════════
   VERTICAL EVALUATION BAR (left of board, like Lichess)
   Uses position:relative wrapper so the svg-container
   padding-bottom:100% square trick keeps working.
   ═══════════════════════════════════════════════════ */
.board-eval-wrapper {
    position: relative;   /* establishes containing block for the eval bar */
    padding-left: 16px;   /* reserve space for the 10px bar + 6px gap */
}

.pico-eval-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    border-radius: 3px;
    overflow: hidden;
    background: #ffffff;
}

#evaluationFill {
    background: #000000;
    width: 100%;
    height: 50%;   /* updated by JS; 0.00 = 50% black on top */
    position: absolute;
    top: 0;
    transition: height 0.4s ease;
}

#evaluationValue {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%) rotate(-90deg);
    font-size: 0.52rem;
    font-weight: 700;
    color: #888;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    mix-blend-mode: difference;
    filter: invert(1);
    opacity: 0.85;
}

/* ═══════════════════════════════════════════════════
   CLOCK HEADER
   ═══════════════════════════════════════════════════ */
.pico-clock-header {
    padding: 0.45rem 0.5rem 0.4rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.clock-control-row {
    display: grid;
    grid-template-columns: 2.35rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.38rem;
}

.clock-control-spacer {
    width: 2.7rem;
    height: 2.5rem;
}

.clock-control-main {
    display: inline-flex;
    justify-content: center;
    gap: 0.5rem;
}

.pico-clock-action-separated {
    margin-right: 0.15rem;
}

.clock-control-right {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    min-width: 2.35rem;
}

.pico-clock-pgn-actions {
    display: none;
    align-items: center;
    gap: 0.35rem;
}

.pico-clock-pgn-actions.is-visible {
    display: inline-flex;
}

.pico-clock-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(128, 128, 128, 0.28);
    border-radius: 999px;
    background: rgba(128, 128, 128, 0.08);
    color: inherit;
    width: 2.35rem;
    height: 2.05rem;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.08s ease;
}

.clock-control-main .pico-clock-action {
    width: 2.85rem;
    height: 2.65rem;
    font-size: 1.14rem;
    touch-action: manipulation;
}

@media (min-width: 769px) and (orientation: landscape) {
    .clock-control-main .pico-clock-action {
        width: 4rem;
        height: 2.85rem;
        font-size: 1.25rem;
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    html.is-remote-web-client .clock-control-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    html.is-remote-web-client .clock-control-spacer {
        display: none;
    }

    html.is-remote-web-client .clock-control-main {
        justify-content: flex-start;
        min-width: 0;
    }
}

.pico-clock-action:hover,
.pico-clock-action:focus-visible {
    background: rgba(128, 128, 128, 0.16);
    border-color: rgba(128, 128, 128, 0.42);
}

.pico-clock-action:active {
    transform: translateY(1px);
}

.pico-clock-switch-btn {
    border-radius: 0.45rem 0.45rem 1.1rem 1.1rem;
}

.pico-gear-btn {
    background: rgba(128, 128, 128, 0.12);
    border: 1px solid rgba(108, 117, 125, 0.55);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.12);
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 1;
    cursor: pointer;
    color: inherit;
    transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.08s ease;
    flex-shrink: 0;
}

.pico-gear-btn:hover,
.pico-gear-btn:focus-visible {
    background: rgba(128, 128, 128, 0.22);
    border-color: rgba(108, 117, 125, 0.85);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 4px rgba(0, 0, 0, 0.16);
}

.pico-gear-btn:active {
    transform: translateY(1px);
}

.clock-time-row {
    display: flex;
    align-items: center;
    justify-content: space-around;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    font-weight: bold;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.clock-time-row .ctime-l,
.clock-time-row .ctime-r {
    flex: 1;
    text-align: center;
    transition: opacity 0.4s ease;
}

.clock-time-row .ctime-inactive {
    opacity: 0.35;
}

.clock-time-row .fa {
    flex: 0 0 2rem;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.45;
}

.pico-clock-pause-btn {
    border-radius: 1.1rem;
}

.pico-clock-mute-btn {
    display: none;
    justify-self: end;
    font-size: 1.08rem;
}

.pico-clock-mute-btn.is-visible {
    display: inline-flex;
}

.clock-status-row {
    text-align: center;
    font-size: 0.78rem;
    color: var(--bs-secondary-color, #6c757d);
    min-height: 0;
}

/* ═══════════════════════════════════════════════════
   REMOTE CONTROL BAR
   ═══════════════════════════════════════════════════ */
#row-remote {
    /* remote bar removed; hidden placeholder kept for JS button IDs */
}

.pico-remote-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.4rem 0.5rem;
    justify-content: flex-start;
    align-items: center;
}

.pico-remote-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 52px;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 6px;
    line-height: 1.2;
}

.pico-remote-btn i {
    font-size: 1rem;
    display: block;
}

.pico-remote-btn span {
    font-size: 0.65rem;
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════ */
#pico-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0.75rem;
    font-size: 0.75rem;
    border-top: 1px solid rgba(128, 128, 128, 0.25);
    color: var(--bs-secondary-color, #6c757d);
    flex-shrink: 0;
}

.footer-status {
    font-size: 0.78rem;
    opacity: 0.9;
}

#picoFooterDgt::before {
    content: "●";
    margin-right: 0.3em;
    color: #6c757d;   /* grey: not yet confirmed connected */
}

#picoFooterDgt.footer-connected::before {
    color: #28a745;   /* green: physical board confirmed connected */
}

.footer-version {
    font-size: 0.78rem;
    opacity: 0.85;
}

.footer-mute {
    position: relative;
    font-size: 18px;
    cursor: pointer;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 6px;
    background-color: transparent;
    width: 36px;
    height: 28px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.footer-mute.is-muted {
    background-color: #ffb3b3;
    border-color: #ff0000;
}

.footer-mute.is-muted::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    height: 3px;
    background-color: white;
    border: 1px solid #cc0000;
    border-radius: 2px;
    transform: translate(-50%, -50%) rotate(-45deg);
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════
   RIGHT PANEL FLEX LAYOUT
   ═══════════════════════════════════════════════════ */
#right-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#row-clock   { flex: 0 0 auto; }
#row-tabs    { flex: 1.35 1 48%; min-height: 0; display: flex; flex-direction: column; }
#row-remote  { flex: 0 0 auto; }

#row-movelist {
    flex: 0.8 1 30%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#row-movelist .card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#row-movelist .scroll_movelist {
    flex: 1;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto;
}

#row-tabs .card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#row-tabs .card-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#row-tabs .tab-content,
#row-tabs .tab-pane.show.active {
    height: 100%;
    overflow-y: auto;
}

@media (min-width: 1000px) and (max-width: 1100px) and (max-height: 770px) {
    #row-movelist {
        flex: 0 1 220px;
        max-height: 220px;
    }

    #row-tabs {
        flex: 1 1 0;
        min-height: 230px;
    }

    #data {
        margin-top: 2px;
    }

    #data.card {
        min-height: 230px;
    }

    #data .card-header {
        padding: 3px;
    }

    #data .card-body {
        padding: 4px 5px;
    }

    #row-movelist .scroll_movelist {
        margin-top: 2px;
        margin-bottom: 2px;
    }

    #right-panel.analysis-rows-none #row-movelist,
    #right-panel.analysis-rows-one #row-movelist {
        flex: 1 1 auto;
        max-height: none;
    }

    #right-panel.analysis-rows-none #row-tabs {
        flex: 0 0 auto;
        min-height: 0;
    }

    #right-panel.analysis-rows-one #row-tabs {
        flex: 0 0 auto;
        min-height: 145px;
    }

    #right-panel.analysis-rows-none #data.card,
    #right-panel.analysis-rows-one #data.card {
        min-height: 0;
    }

    #right-panel.analysis-rows-none #row-tabs .card,
    #right-panel.analysis-rows-one #row-tabs .card {
        flex: 0 0 auto;
    }

    #right-panel.analysis-rows-none #data .card-body,
    #right-panel.analysis-rows-one #data .card-body,
    #right-panel.analysis-rows-none #data .tab-content,
    #right-panel.analysis-rows-one #data .tab-content,
    #right-panel.analysis-rows-none #data .tab-pane,
    #right-panel.analysis-rows-one #data .tab-pane {
        height: auto !important;
    }

    .scroll_engine {
        max-height: none;
        height: 100%;
    }

    #right-panel.analysis-rows-none .scroll_engine,
    #right-panel.analysis-rows-one .scroll_engine {
        height: auto;
    }

    .analysis-toolbar {
        padding: 0.2rem 0.35rem 0.25rem;
        gap: 0.3rem;
    }

    .analysis-toolbar-btn,
    .analysis-toolbar .book-switch-btn {
        min-height: 34px;
        padding: 0.25rem 0.5rem;
    }

    .pv-two-row {
        padding: 0.25rem 0.35rem;
        gap: 0.15rem;
    }

    .pv-header {
        gap: 0.25rem;
    }

    #engineRow .score-display,
    #sf18Row .score-display,
    #pv_output .score-display,
    #engineRow .depth-display,
    #sf18Row .depth-display,
    #pv_output .depth-display {
        font-size: 0.88rem;
    }

    #engineRow .first-move,
    #sf18Row .first-move,
    #pv_output .first-move,
    #engineRow .continuation-moves,
    #sf18Row .continuation-moves,
    #pv_output .continuation-moves {
        font-size: 1rem;
    }
}

/* ── PICO CONTEXT MENU OVERLAY ─────────────────────────────── */
#pico-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1050;
}

#pico-menu-overlay.open {
    display: block;
}

.pico-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    cursor: pointer;
}

.pico-overlay-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, 96vw);
    max-height: 90vh;
    background: rgba(30, 30, 46, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    /* The panel backdrop is always dark (rgba 30,30,46) regardless of the
       page theme. Force light text so it stays legible in light mode. */
    color: rgba(255, 255, 255, 0.92);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Content wrapper: grows below header, clips sub-panels */
.pico-overlay-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.pico-overlay-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pico-overlay-header-back {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    color: inherit;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
    min-height: 34px;
    min-width: 76px;
    padding: 0.35rem 0.75rem;
    flex-shrink: 0;
}

.pico-overlay-header-back:hover {
    background: rgba(255, 255, 255, 0.14);
}

.pico-overlay-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    flex: 1;
    min-width: 0;
}

.pico-overlay-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.1;
}

.pico-overlay-path {
    color: var(--bs-secondary-color, rgba(255, 255, 255, 0.78));
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pico-overlay-state {
    background: rgba(128, 128, 128, 0.14);
    border: 1px solid rgba(128, 128, 128, 0.28);
    border-radius: 999px;
    color: inherit;
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.1;
    max-width: 9.5rem;
    overflow: hidden;
    padding: 0.28rem 0.55rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pico-overlay-manual {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    flex-shrink: 0;
    font-size: 1rem;
    height: 34px;
    justify-content: center;
    line-height: 1;
    min-width: 40px;
    text-decoration: none;
}

.pico-overlay-manual:hover,
.pico-overlay-manual:focus-visible {
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    text-decoration: none;
}

.pico-overlay-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    line-height: 1;
    color: inherit;
}

.pico-overlay-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
}

/* 3-column tile grid (3 rows × 3 cols = 9 tiles) */
.pico-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, 0.08);
}
.pico-tile.pico-tile-wide {
    grid-column: 1 / -1;
}

.pico-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 96px;
    padding: 1.0rem 0.4rem;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.pico-tile:hover {
    background: rgba(255, 255, 255, 0.09);
    color: inherit;
    text-decoration: none;
}

.pico-tile:active {
    background: rgba(255, 255, 255, 0.18);
}

.pico-tile.pico-empty-tile {
    cursor: default;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.01);
    opacity: 0;
}

.pico-tile-label {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.1;
}

.pico-tile-sub {
    font-size: 0.95rem;
    opacity: 0.70;
    text-align: center;
    line-height: 1.3;
}

/* DGT scan sub-panel inside overlay */
#overlay-scan {
    padding: 1rem 0;
}

/* ── ENGINE / LEVEL PICKER ──────────────────────────── */
#overlay-engine {
    display: none;          /* shown as flex by JS */
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0;
}

#pico-menu-overlay .pico-picker-header,
#pico-menu-overlay .pico-col-back,
#pico-menu-overlay .pico-sub-grid-label {
    display: none !important;
}

.pico-picker-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.pico-picker-title {
    font-weight: 600;
    font-size: 0.88rem;
    flex: 1;
}

.pico-overlay-back {
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 5px;
    padding: 0.2rem 0.6rem;
    font-size: 0.82rem;
    cursor: pointer;
    color: inherit;
    line-height: 1.4;
    flex-shrink: 0;
}

.pico-overlay-back:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Category tab strip (Engine modern/retro/favorites) */
.pico-cat-tabs {
    display: flex;
    gap: 4px;
    padding: 0 0 8px 0;
    flex-shrink: 0;
}
.pico-cat-tab {
    flex: 1;
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(128,128,128,0.25);
    background: rgba(128,128,128,0.06);
    color: inherit;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.pico-cat-tab.selected {
    border-color: rgba(13,110,253,0.5);
    background: rgba(13,110,253,0.15);
}
.pico-cat-tab:hover:not(.selected) {
    background: rgba(128,128,128,0.14);
}

.pico-picker-columns {
    display: flex;
    gap: 10px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.pico-picker-col {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scrollbar-width: auto;
}

/* Wide scrollbar for touch-friendly overlay columns */
.pico-picker-col::-webkit-scrollbar {
    width: 16px;
}
.pico-picker-col::-webkit-scrollbar-track {
    background: rgba(128, 128, 128, 0.1);
    border-radius: 8px;
}
.pico-picker-col::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.45);
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: content-box;
}
.pico-picker-col::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.7);
    background-clip: content-box;
}

.pico-picker-col + .pico-picker-col {
    border-left: 1px solid rgba(128, 128, 128, 0.2);
    padding-left: 10px;
}

.pico-picker-col-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.5;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.pico-picker-item {
    min-height: 60px;
    padding: 0.78rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.06rem;
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid transparent;
    text-align: left;
    transition: background 0.12s, border-color 0.12s;
    width: 100%;
    color: inherit;
    flex-shrink: 0;
    line-height: 1.35;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    touch-action: manipulation;
}

.pico-picker-item:hover {
    background: rgba(128, 128, 128, 0.2);
}

.pico-picker-item.selected {
    border-color: rgba(13, 110, 253, 0.55);
    background: rgba(13, 110, 253, 0.12);
}

.pico-picker-item.selected::after {
    content: "✓";
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(13, 110, 253, 0.9);
    font-weight: bold;
    font-size: 0.95em;
    pointer-events: none;
}

.pico-picker-item .picker-sub {
    font-size: 0.78em;
    opacity: 0.55;
    display: block;
}

.pico-engine-picker-item {
    font-size: 1.08rem;
}

/* ── GATEWAY SUB-PANEL ITEMS ────────────────────────── */
.pico-subpanel {
    display: none;          /* shown as flex by JS */
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0;
}

.pico-subpanel-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: auto;
}

/* Wide scrollbar for touch-friendly overlay sub-panels */
.pico-subpanel-list::-webkit-scrollbar {
    width: 16px;
}
.pico-subpanel-list::-webkit-scrollbar-track {
    background: rgba(128, 128, 128, 0.1);
    border-radius: 8px;
}
.pico-subpanel-list::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.45);
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: content-box;
}
.pico-subpanel-list::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.7);
    background-clip: content-box;
}

.pico-subpanel-group {
    margin: 0.45rem 0 0.1rem;
    padding: 0 0.25rem;
    color: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.2;
    opacity: 0.62;
    text-transform: uppercase;
    flex-shrink: 0;
}

.pico-subpanel-group:first-child {
    margin-top: 0;
}

.pico-system-info-list {
    font-size: 0.95rem;
    line-height: 1.8;
    padding: 0.4rem 0.55rem;
}

.pico-subpanel-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid transparent;
    cursor: pointer;
    text-align: left;
    color: inherit;
    width: 100%;
    transition: background 0.12s, border-color 0.12s;
    flex-shrink: 0;
}

.pico-subpanel-item:hover {
    background: rgba(128, 128, 128, 0.18);
}

.pico-subpanel-item.active {
    border-color: rgba(13, 110, 253, 0.5);
    background: rgba(13, 110, 253, 0.12);
}

.pico-subpanel-item:disabled,
.pico-subpanel-item[disabled] {
    cursor: default;
}

.pico-subpanel-item-control {
    cursor: default;
}

.pico-subpanel-item-control:hover {
    background: rgba(128, 128, 128, 0.08);
}

.pico-subpanel-icon {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
    width: 1.8rem;
    text-align: center;
}

.pico-subpanel-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pico-subpanel-label {
    font-size: 0.88rem;
    font-weight: 600;
    display: block;
}

.pico-subpanel-desc {
    font-size: 0.72rem;
    opacity: 0.55;
    display: block;
}

.pico-subpanel-badge {
    font-size: 0.72rem;
    opacity: 0.65;
    flex-shrink: 0;
    background: rgba(128, 128, 128, 0.15);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
}

.pico-segmented-control {
    display: inline-flex;
    flex-shrink: 0;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    background: rgba(128, 128, 128, 0.12);
}

.pico-segmented-button {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    min-width: 2.7rem;
    padding: 0.42rem 0.5rem;
}

.pico-segmented-button.active {
    background: rgba(13, 110, 253, 0.9);
    color: #fff;
}

@media (max-width: 520px) {
    .pico-subpanel-item-control {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .pico-subpanel-item-control .pico-subpanel-text {
        min-width: calc(100% - 2.6rem);
    }

    .pico-segmented-control {
        margin-left: 2.6rem;
    }
}

/* Menu trigger button — slightly highlighted */
.pico-menu-trigger {
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* ═══════════════════════════════════════════════════
   DARK THEME OVERRIDES
   Applied when html[data-theme="dark"] (set by clock.html on load and
   updated by the JS theme-switcher when the user changes theme).
   ═══════════════════════════════════════════════════ */

/* Best-move highlight: swap light-yellow for dark-amber in dark mode */
html[data-theme="dark"] .first-move,
html[data-theme="dark"] #pv_output .first-move,
html[data-theme="dark"] #engineRow .first-move,
html[data-theme="dark"] #sf18Row .first-move,
html[data-theme="dark"] .analysis-sources .first-move {
    background: rgba(255, 193, 7, 0.15) !important;
    color: #ffc107 !important;
    border-color: rgba(255, 193, 7, 0.35) !important;
    text-shadow: none !important;
}

html[data-theme="dark"] .engine-name-badge {
    color: #dee2e6 !important;
}

html[data-theme="dark"] .backend-source-badge {
    border-color: rgba(255, 255, 255, 0.35);
    color: #f1f3f5;
}

html[data-theme="dark"] .backend-source-badge.tutor-source {
    border-color: rgba(139, 171, 224, 0.75);
    color: #9ec5fe;
}

html[data-theme="dark"] .analysis-toolbar {
    border-bottom-color: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .analysis-control-label {
    color: rgba(255, 255, 255, 0.72);
}

html[data-theme="dark"] #pico-footer {
    border-top-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.82);
}

html[data-theme="dark"] .footer-status,
html[data-theme="dark"] .footer-version {
    color: rgba(255, 255, 255, 0.82);
}

/* Mute button: replace light-grey fill with a subtle dark fill */
html[data-theme="dark"] #btn-mute {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Promotion piece selection: lighten the dark-grey circles */
html[data-theme="dark"] .promotion-overlay square {
    background-color: #505050;
    box-shadow: inset 0 0 25px 3px #1a1a1a;
}

/* ── SUB-MENU TILE GRID ─────────────────────────────────────
   3×3 grid used inside sub-panels (Engine, Time, System …).
   Shares the visual language of .pico-tile-grid but scaled
   for the narrower overlay sub-panel area.
   ─────────────────────────────────────────────────────────── */
.pico-sub-tile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.pico-sub-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 96px;
    padding: 1.0rem 0.4rem;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    cursor: pointer;
    color: inherit;
    text-align: center;
    text-decoration: none;
    transition: background 0.12s;
    line-height: 1.1;
}

.pico-sub-tile:hover {
    background: rgba(255, 255, 255, 0.09);
    color: inherit;
}

.pico-sub-tile:active {
    background: rgba(255, 255, 255, 0.18);
}

.pico-sub-tile.selected {
    background: rgba(13, 110, 253, 0.18);
    outline: 1px solid rgba(13, 110, 253, 0.60);
    outline-offset: -1px;
}

.pico-sub-tile-label {
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.1;
}

.pico-sub-tile-sub {
    font-size: 0.95rem;
    opacity: 0.70;
    line-height: 1.3;
}

@media (max-width: 420px), (max-height: 520px) {
    .pico-overlay-panel {
        width: min(580px, 96vw);
    }

    .pico-tile-label {
        font-size: 1.2rem;
    }

    .pico-tile-sub {
        font-size: 0.82rem;
    }

    .pico-sub-tile-label {
        font-size: 1.2rem;
    }

    .pico-sub-tile-sub {
        font-size: 0.82rem;
    }

    .pico-picker-item {
        padding: 0.7rem 0.8rem;
        font-size: 0.9rem;
    }

    .pico-picker-item .picker-sub {
        font-size: 0.7em;
    }
}

/* Navigation tile used for pagination (◄ Prev / Next ►) */
.pico-sub-tile.pico-nav-tile {
    background: rgba(255, 255, 255, 0.07);
    font-size: 1.02rem;
    font-weight: 700;
    opacity: 0.95;
}

.pico-sub-tile.pico-nav-tile:hover {
    background: rgba(255, 255, 255, 0.14);
    opacity: 1;
}

/* Empty filler tile — preserves the grid shape, not interactive */
.pico-sub-tile.pico-empty-tile {
    cursor: default;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.01);
    opacity: 0;
}

/* Section label above a sub-tile grid */
.pico-sub-grid-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.5;
    padding: 0.4rem 0.5rem 0.15rem;
    flex-shrink: 0;
}

/* Scrollable wrapper used in the Time sub-panel */
.pico-time-scroll {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* ── SETTING SLIDER ─────────────────────────────────────
   Used for Voice Volume and Retro Speed in the System panel.
   ─────────────────────────────────────────────────────── */
.pico-slider-wrap {
    padding: 0.9rem 0.6rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.pico-slider-readout {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.02em;
    line-height: 1;
}

.pico-slider-sub {
    font-size: 0.84rem;
    opacity: 0.72;
    text-align: center;
    margin-top: -0.3rem;
}

.pico-slider-track {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    cursor: pointer;
    margin: 0.4rem 0;
}

.pico-slider-track::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.9);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    transition: background 0.12s, transform 0.1s;
}

.pico-slider-track::-moz-range-thumb {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(13, 110, 253, 0.9);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.pico-slider-track:active::-webkit-slider-thumb {
    transform: scale(1.15);
    background: rgba(13, 110, 253, 1);
}

.pico-slider-ends {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    opacity: 0.68;
    padding: 0 2px;
}

/* Inline back button used within a sub-panel column */
.pico-col-back {
    background: none;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 5px;
    padding: 0.2rem 0.6rem;
    font-size: 0.82rem;
    cursor: pointer;
    color: inherit;
    line-height: 1.4;
    flex-shrink: 0;
    margin-bottom: 0.4rem;
    align-self: flex-start;
}

.pico-col-back:hover {
    background: rgba(255, 255, 255, 0.08);
}
