/**
 * Opening Lab: the same board frame as the puzzles and the Game Report (48px strip, player strips,
 * slim eval bar, nav row) with a flat explorer panel on the right. Work mode: the sidebar is the 56px rail.
 */

.lab-page {
    --strip-h: 48px;
    /* 16px kept for the page scrollbar: this panel scrolls */
    --scrollbar: 16px;
    max-width: none;
    padding: 0;
}

/* Top strip: breadcrumb left, the data source in the middle, shortcuts right */
.strip-status {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    font-size: var(--fs-xs);
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.keys-hint {
    align-items: center;
    gap: var(--space-1);
    font-size: var(--fs-xs);
    color: var(--ink-3);
}

.keys-hint .keys-label { margin: 0 var(--space-2) 0 var(--space-1); }

.lab-layout {
    display: grid;
    grid-template-columns: auto minmax(var(--side-min), 440px);
    gap: var(--col-gap);
    align-items: start;
    justify-content: center;
    padding: var(--pad);
}

/* Board column: player strips and the nav row line up with the board, not the eval bar */
.board-col {
    position: sticky;
    top: var(--pad);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.lab-board {
    width: var(--board-size);
    max-width: none;
}

.eval-ink { height: 50%; }

/* Explorer panel: flat sections split by hairlines, no boxes */
.lab-side {
    min-width: 0;
}

.lab-line {
    padding-bottom: var(--space-3);
}

.lab-opening {
    margin: 0 0 var(--space-1);
    font-size: var(--fs-2xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.lab-opening:empty { display: none; }

.lab-move-list {
    min-height: 1.5em;
    font-size: var(--fs-sm);
    line-height: 1.5;
    color: var(--ink-2);
}

.lab-filters,
.lab-panel {
    padding: var(--space-3) 0;
    border-top: 1px solid var(--hair);
}

.lab-panel h2 {
    margin: 0 0 var(--space-2);
    font-size: var(--fs-md);
    font-weight: 600;
}

.muted {
    color: var(--ink-2);
    font-weight: 400;
}

/* Filters: compact segmented controls, label left */
.lab-filters summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    font-size: var(--fs-md);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.lab-filters summary::-webkit-details-marker {
    display: none;
}

/* A drawn disclosure chevron, no glyph */
.lab-filters summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 4px;
    border-right: 1.5px solid var(--ink-2);
    border-bottom: 1.5px solid var(--ink-2);
    transform: rotate(-135deg);
}

.lab-filters:not([open]) summary::after {
    transform: rotate(45deg);
}

/* Buckets and the compare band are for custom ranges: folded away until wanted */
.lab-more {
    padding-top: var(--space-1);
}

.lab-filters .lab-more summary {
    justify-content: flex-start;
    gap: var(--space-2);
    min-height: 28px;
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--ink-2);
}

.lab-filters .lab-more summary::after {
    margin: 0;
    transform: rotate(45deg);
}

.lab-filters .lab-more[open] summary::after {
    transform: rotate(-135deg);
}

.filter-row {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    padding: 6px 0;
}

.filter-label {
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--ink-2);
}

.filter-row .chip,
.lab-actions .chip {
    min-height: 28px;
    padding: 4px 10px;
    font-size: var(--fs-sm);
}

.filter-row .chip-row {
    min-width: 0;
}

.filter-hint {
    grid-column: 2;
    font-size: var(--fs-xs);
    color: var(--ink-3);
}

/* Train actions: one compact row */
.lab-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--hair);
}

.lab-actions .btn {
    min-height: 32px;
    padding: 4px var(--space-3);
    font-size: var(--fs-sm);
}

.lab-actions #lab-study { margin-left: auto; }

/* Move tables: one type size; rank is weight and hairlines only */
.move-table-wrap {
    overflow-x: auto;
}

.move-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    font-variant-numeric: tabular-nums;
}

.move-table th,
.move-table td {
    text-align: left;
    padding: 7px var(--space-2) 7px 0;
    border-bottom: 1px solid var(--hair);
    font-size: var(--fs-sm);
}

.move-table th {
    font-weight: 400;
    color: var(--ink-3);
    font-size: var(--fs-xs);
    white-space: nowrap;
}

.move-table tr.move-row {
    cursor: pointer;
}

.move-table tr.move-row:hover {
    background: var(--surface);
}

.move-table td:not(.san) {
    font-family: var(--font-mono);
    color: var(--ink-2);
}

.move-table td.muted.mono-line {
    font-size: var(--fs-xs);
}

.move-table .san {
    font-weight: 600;
    white-space: nowrap;
}

.move-table .san i {
    margin-left: var(--space-1);
}

/* Thin three-segment results bar: White wins, draws, Black wins */
.move-table .wdl {
    height: 6px;
    min-width: 96px;
    border: 0;
    border-radius: 3px;
    background: transparent;
}

.move-table .wdl-w { background: var(--ink); }
.move-table .wdl-d { background: var(--ink-3); }
.move-table .wdl-b { background: #33363c; }

.compare-summary {
    margin: 0;
    line-height: 1.55;
    font-size: var(--fs-sm);
}

.compare-summary strong {
    color: var(--ink);
}

.dual-note {
    margin: var(--space-2) 0 0;
    font-size: var(--fs-sm);
}

/* Compare deltas: sign and weight, not colour */
.delta-up,
.delta-down {
    font-weight: 600;
}

.mono-line {
    font-variant-numeric: tabular-nums;
}

/* Narrow laptop and tablet (761-1208px): the sidebar is the 56px rail (nav-rail.css), no Menu button */
@media (min-width: 761px) and (max-width: 1208px) {
    .strip { padding-left: var(--space-5); }
}

/* Not enough room for two columns: board on top, panel below */
@media (max-width: 900px) {
    .lab-layout {
        grid-template-columns: minmax(0, calc(var(--board-size) + var(--bar) + var(--bar-gap)));
    }

    .board-col {
        position: static;
    }
}

/* Phone: no rail (bottom tab bar), thin eval bar, board full width, then the panel */
@media (max-width: 760px) {
    .lab-page {
        padding-bottom: 88px;
    }

    .strip {
        height: auto;
        min-height: var(--strip-h);
        padding: var(--space-2) var(--space-3);
    }

    .strip-crumb { flex: none; }

    .strip-status {
        flex: 1 1 0;
        text-align: right;
    }

    .lab-layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-3);
        gap: var(--space-4);
    }

    /* The bar is too thin for a hover value on a phone */
    .eval-tip { display: none !important; }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .filter-hint {
        grid-column: 1;
    }

    .lab-actions .btn {
        flex: 1;
        min-height: 40px;
    }

    .move-table tr.move-row td {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}
