/* Lichfield chess components — diagrams, puzzles, league tables.
   Loaded unconditionally by default.hbs; the matching JS bails early
   when no .chess-diagram / .chess-puzzle / .league-table is on the page. */

.chess-diagram-wrapper,
.chess-puzzle-wrapper {
    margin: 1.5em auto;
    max-width: 640px;
}

/* Grid: 18px rank-label column + board, 18px file-label row below. The grid
   is square overall, so the board cell is (W-18)x(H-18) and stays square. */
.chess-board-grid {
    display: grid;
    grid-template-columns: 18px 1fr;
    grid-template-rows: 1fr 18px;
    aspect-ratio: 1 / 1;
    width: 100%;
}

.chess-board-grid .cg-wrap {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
}

.chess-coords-corner {
    grid-column: 1;
    grid-row: 2;
}

.chess-coords {
    display: flex;
    align-items: center;
    justify-content: space-around;
    font-size: 11px;
    font-weight: 600;
    color: #5a5a5a;
    user-select: none;
}

.chess-coords-ranks {
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
}

.chess-coords-files {
    grid-column: 2;
    grid-row: 2;
    flex-direction: row;
}

.chess-diagram-caption,
.chess-puzzle-caption {
    text-align: center;
    font-size: 0.95em;
    color: #6b6b6b;
    margin-top: 0.5em;
    font-style: italic;
    line-height: 1.35;
}

.chess-puzzle-controls {
    display: flex;
    gap: 0.5em;
    justify-content: center;
    margin-top: 0.75em;
}

.chess-puzzle-controls button {
    font: inherit;
    padding: 0.4em 0.9em;
    border: 1px solid currentColor;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
}

.chess-puzzle-solution {
    margin-top: 0.75em;
    padding: 0.6em 0.8em;
    border-left: 3px solid #4a8;
    background: rgba(74, 136, 136, 0.06);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.9em;
}

.league-table-wrapper {
    margin: 1.5em 0;
    overflow-x: auto;
}

.league-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.league-table-wrapper th,
.league-table-wrapper td {
    padding: 0.4em 0.6em;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.league-table-wrapper th {
    font-weight: 600;
    background: rgba(0, 0, 0, 0.03);
}

.league-table-wrapper tr.is-lichfield {
    font-weight: 600;
    background: rgba(255, 200, 0, 0.08);
}

.league-table-meta {
    margin-top: 0.5em;
    font-size: 0.8em;
    color: #888;
    text-align: right;
}

.league-table-error {
    padding: 0.8em 1em;
    border-left: 3px solid #c44;
    background: rgba(196, 68, 68, 0.06);
    color: #933;
    font-size: 0.95em;
}

@media (max-width: 600px) {
    .chess-diagram-wrapper,
    .chess-puzzle-wrapper {
        max-width: 100%;
    }
}
