body {
    font-family: "Arial", sans-serif;
    margin: 0;
    background-color: #f4f7fc;
    color: #333
}

.global-nav {
    padding: 8px 16px;
    background: #333;
    color: #fff;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

.global-nav a {
    color: #7aa2ff;
    text-decoration: none;
}

.global-nav a:hover {
    text-decoration: underline;
}

.global-nav-sep {
    margin: 0 10px;
    color: #666;
    user-select: none;
}

h1 {
    color: #333;
    font-weight: 700;
    text-align: center;
    padding: 0;
    margin-top: 20px;
    margin-bottom: 20px;
    font-size: 24px
}

h2 {
    text-align: center;
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 10px
}

h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
    color: #555
}

.tabs,
.view-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap
}

.tabs a {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    margin-right: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease
}

.tabs a:hover {
    background-color: #0056b3
}

.tabs a.active {
    background-color: #ff6f00;
    font-weight: bold;
    pointer-events: none;
    color: white
}

.container,
#all-events,
#list,
#current {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 0 auto;
    margin-bottom: 20px
}

.game-container {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    margin: 15px 0;
    border: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background-color: white
}

.odd-game {
    background-color: #f9f9f9
}

.even-game {
    background-color: #fff
}

.game-container p {
    margin: 10px 0;
    font-size: 16px;
    line-height: 1.6
}

strong {
    color: #0056b3;
    font-size: 18px
}

span.claim {
    display: block;
    margin-left: 20px;
    color: #333;
    font-size: 16px;
    margin-top: 5px
}

.bold-claim {
    font-weight: bold;
    font-size: 16px
}

.red-claim {
    color: #e74c3c;
    font-weight: bold
}

.two-fold {
    color: #666;
    font-size: 14px;
    padding: 2px 0 2px 20px;
    margin: 0;
    border: none;
    border-left: 3px solid #ccc;
    background-color: #f9f9f9
}

.round-btn,
.view-tab-btn {
    font-size: 15px;
    background-color: #f8f9fa;
    color: #444;
    text-decoration: none;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 30px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease
}

.round-btn:hover,
.view-tab-btn:hover {
    background-color: #e9ecef;
    transform: translatey(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08)
}

.round-btn.active,
.view-tab-btn.active {
    background-color: #007bff;
    color: white;
    font-weight: 500;
    border-color: #007bff;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.3);
    pointer-events: none
}

footer {
    text-align: center;
    font-size: 14px;
    color: #777;
    margin-top: 40px
}

#game-details {
    background-color: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    margin-top: 5px;
    display: none;
    padding: 0
}

#iframe-viewer {
    width: 100%;
    height: calc(100vh - 100px);
    border: none
}

button {
    background-color: #0056b3;
    color: white;
    border: none;
    padding: 12px 24px;
    margin-top: 10px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px
}

button:hover {
    background-color: #ff6f00
}

.view-tab-content {
    display: block
}

.list-event {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start
}

.list-event strong {
    color: #333;
    font-size: 1em
}

.list-event-content {
    flex-grow: 1
}

.list-event .bold-claim {
    font-weight: normal
}

#list {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px
}

.chessboard-icon {
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0
}

.chessboard-icon svg {
    width: 24px;
    height: 24px
}

.last_move {
    padding: 8px 10px;
    margin: 10px 0;
    font-size: 16px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #ccc
}

.game-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    flex-shrink: 0
}

#list .game-content {
    margin-bottom: 20px
}

.game-info {
    flex-grow: 1;
    padding: 10px 15px
}

#list .game-info strong {
    padding-bottom: 4px;
    display: inline-block;
    color: #333;
    font-size: 1em
}

.game-info p {
    margin: 0
}

.game-info .bold-claim {
    margin-left: 20px;
    font-weight: normal;
    color: #333
}

.game-info h3 {
    margin-bottom: 5px
}

.claim-info {
    color: #006400;
    font-weight: bold
}

#current {
    display: none
}

#current .game-info {
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px
}

.current-position-claim {
    margin: 0;
    padding: 5px 8px;
    border-radius: 6px;
    background-color: #f0fff0;
    border: 1px solid #d1e7dd;
    font-weight: 500;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-bottom: 8px;
    border-left: 3px solid #1c6e2f
}

.current-position-claim strong {
    font-weight: 700;
    color: #155724
}

.by-playing-claim {
    border-left: 3px solid #ffc107;
    background-color: #fffaf0;
    margin-bottom: 5px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 15px
}

.claim-active,
.current-position-claim {
    border-left: 6px solid #28a745 !important;
    background-color: #f0fff0 !important;
    border-radius: 4px;
    display: inline-block;
    font-size: 15px;
    padding: 8px 12px
}

.forced-draw-claim {
    border-left: 6px solid #dc3545 !important;
    background-color: #fff5f5 !important;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 15px;
    color: #dc3545
}

.forced-draw-claim strong {
    color: #dc3545;
    font-size: 15px
}

.claim-inactive {
    border-left: 3px solid #666;
    background-color: #f7f7f9;
    color: #495057;
    font-size: 14px;
    padding: 5px;
    margin-bottom: 5px
}

.claim.by-playing-claim,
.claim-active.by-playing-claim,
.current-position-claim.by-playing-claim {
    border-left: 3px solid #e9bb31 !important;
    background-color: #fffaf0 !important
}

.future-claim,
.by-playing-claim {
    background-color: #e7f3ff;
    border-color: #b8daff
}

.future-claim strong,
.by-playing-claim strong {
    color: #333;
    font-size: 15px
}

.is-claimable {
    color: #155724;
    font-weight: bold;
    text-transform: uppercase;
    background-color: #d4edda;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    display: inline-block;
    font-size: 14px;
    border-color: #c3e6cb;
}

.not-claimable {
    color: #333;
    font-weight: normal;
    margin-left: 10px;
    display: inline-block;
    font-size: 15px
}

.claims {
    margin-top: 8px
}

.claims .claim,
.two-fold {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 1px 0;
    font-size: 15px;
    border-bottom: 1px solid #ddd
}

.two-fold strong {
    color: #333;
    font-size: 15px
}

.claims .claim-active {
    border-left: 6px solid #198754 !important;
    background-color: #f0fff0
}

.claims .claim-inactive {
    background-color: transparent
}

.claim-active strong,
.twofold strong {
    color: #333;
    font-weight: bold;
    font-size: 15px
}

.claim-inactive strong {
    color: #555;
    font-weight: normal;
    font-size: 15px
}

.last-move-with-claim {
    background-color: #f0fff0;
    border-left: 4px solid #28a745 !important;
    font-weight: bold;
    color: #1c6e2f
}

.last-move-with-possible-claim {
    background-color: #fffaf0;
    border-left: 4px solid #e9bb31
}

.claim-status-achieved {
    font-weight: bold;
    color: #155724;
    margin-left: 10px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    max-width: fit-content;
}

.stats-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px 15px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.6
}

.stats-container strong {
    font-weight: bold;
    color: inherit
}

.stats-highlight {
    font-weight: bold;
    color: inherit
}

.tab {
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: #f1f1f1
}

.tab button {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 16px
}

.tab button:hover {
    background-color: #ddd
}

.tab button.active {
    background-color: #ccc
}

.tabcontent {
    display: none;
    padding: 6px 12px;
    border: none;
    border-top: none
}

.game-header {
    padding: 10px 15px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px
}

.game-selector-container {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
    overflow-x: auto
}

.stats-view-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px
}

.view-tabs {
    margin-top: 10px
}

.claim.two-fold {
    padding-top: 4px;
    padding-bottom: 4px;
    color: #666
}

.claim-tool-table {
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 0.9em
}

.claim-tool-table table {
    width: auto;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 14px
}

.claim-tool-table th,
.claim-tool-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd
}

.claim-tool-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none
}

.claim-tool-table th::after {
    content: "";
    float: right;
    margin-top: 7px;
    border-width: 4px;
    border-style: solid;
    border-color: #ccc transparent transparent transparent;
    visibility: hidden
}

.claim-tool-table th.sort-asc::after {
    border-color: transparent transparent #333 transparent;
    visibility: visible
}

.claim-tool-table th.sort-desc::after {
    border-color: #333 transparent transparent transparent;
    visibility: visible
}

.claim-tool-table th:hover::after {
    visibility: visible
}

/* Header styling to match column classes */
.claim-tool-table th.timestamp-header {
    width: 80px;
    min-width: 80px;
    max-width: 05px;
}

.claim-tool-table th.section-header {
    width: 60px;
    min-width: 60px;
    max-width: 80px;
}

.claim-tool-table th.board-header {
    width: 50px;
    min-width: 50px;
    max-width: 60px;
}

.claim-tool-table th.players-header {
    min-width: 250px;
    max-width: 350px;
}

.claim-tool-table th.move-header {
    width: 80px;
    min-width: 70px;
    max-width: 100px;
}

.claim-tool-table th.type-header {
    min-width: 200px;
}

.claim-tool-table tbody tr:hover {
    background-color: #f8f9fa
}

.claim-tool-table tbody tr:nth-child(even) {
    background-color: #f9f9f9
}

.claim-tool-table tbody tr:nth-child(odd) {
    background-color: #fff
}

/* Column-specific styling with appropriate widths */
.claim-tool-table .timestamp-cell {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    font-size: 13px;
}

.claim-tool-table .section-cell {
    width: 60px;
    min-width: 60px;
    max-width: 80px;
    font-weight: 500;
    text-align: center;
}

.claim-tool-table .board-cell {
    width: 50px;
    min-width: 50px;
    max-width: 60px;
    font-weight: 500;
}

.claim-tool-table .players-cell {
    min-width: 250px;
    max-width: 350px;
}

.claim-tool-table .players-cell .player-names {
    font-weight: bold;
}

.claim-tool-table .players-cell .player-move {
    font-weight: normal;
}

.claim-tool-table .move-cell {
    width: 110px;
    min-width: 110px;
    max-width: 140px;
    font-family: inherit;
    font-weight: bold;
}

.claim-tool-table .type-cell {
    min-width: 200px;
    font-weight: bold;
}

/* Forced draw styling - red text for 5-fold, 75-move, stalemate, insufficient material */
.claim-tool-table tr.forced-draw td {
    color: #dc3545;
}

.claim-filter-buttons {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap
}

.claim-filter-btn {
    font-size: 14px;
    background-color: #f8f9fa;
    color: #444;
    padding: 6px 12px;
    margin: 0 5px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer
}

.claim-filter-btn:hover {
    background-color: #e9ecef
}

.claim-filter-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff
}

.claim-tool-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1)
}

.claim-tool-section h2 {
    color: #0056b3;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600
}

.view-tab-inner-content {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 0 auto;
    margin-bottom: 20px
}

.arbiter-claim-status {
    background-color: #dc3545;
    color: #fff5f5 !important;
    font-weight: bold;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    display: inline-block;
    font-size: 15px
}

.pairings-list {
    list-style: none;
    padding: 0;
    margin: 0
}

.pairings-list li {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease
}

.pairings-list li:hover {
    background-color: #f0f0f0
}

.pairings-list li.active {
    background-color: #e7f3ff;
    font-weight: bold
}

.pairings-list li a {
    text-decoration: none;
    color: #333
}

.last-move {
    padding: 8px 10px;
    margin: 10px 0;
    font-size: 16px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #ccc;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold
}

.next-claim-status {
    color: #856404;
    font-weight: bold;
    background-color: #fff3cd;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    border: 1px solid #ffeaa7;
    display: inline-block;
    max-width: fit-content;
}

.claim.twofold {
    border-left: 4px solid #ced4da !important;
}

.claim.by-playing-claim {
    border-left: 4px solid #e9bb31 !important;
    background-color: #fffaf0 !important;
    padding: 8px 12px;
    border-radius: 4px
}

.claim.three-fold {
    border-left: 4px solid #28a745 !important;
    background-color: #f0fff0 !important
}

.claim.claim-active {
    border-left: 4px solid #28a745 !important;
    background-color: #f0fff0 !important
}

.claim.five-fold {
    background-color: #fff5f5 !important;
    border-left: 4px solid #dc3545 !important
}

.claim-status-possible {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    padding: 2px 6px;
    margin-left: 10px;
    display: inline-block;
}

.claim.forced-draw-claim {
    background-color: #fff5f5 !important;
    border-left: 4px solid #dc3545 !important
}

.no-claims-banner {
    padding: 8px 12px;
    background-color: #f8f9fa;
    color: #6c757d;
    border-left: 4px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-style: italic
}

.last-move span.not-claimable,
.last-move .claim-status-not-claimable {
    background-color: #d6d8d9;
    color: #1b1e21;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    margin-left: 10px;
    border-color: #d6d8d9;
    font-weight: normal;

}

/* Main content container - full width, no split layout */
.main-content-container {
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    position: relative;
    overflow-y: auto;
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: fixed;
    z-index: 999; /* Below mobile header */
    background-color: transparent;
    color: #333;
    border: none;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Adjust sidebar toggle for mobile header */
@media (max-width: 767px) {
    .sidebar-toggle-btn {
        top: 130px; /* Below mobile header */
    }
}

.sidebar-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.sidebar-toggle-btn:hover {
    color: #666;
    transform: scale(1.1);
}

.sidebar-toggle-btn:active {
    transform: scale(0.95);
}

/* When sidebar is expanded, position button within the left sidebar area */
.sidebar-toggle-btn {
    left: 365px; /* Position within the left sidebar (400px width - 40px margin) */
}

/* When sidebar is collapsed, move button to left side of page */
/* Left pane removed - sidebar toggle and related styles no longer needed */
.main-content-container .sidebar-toggle-btn {
    display: none; /* Hide sidebar toggle since there's no sidebar */
}

.round-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px;
}

#round-select {
    flex-grow: 1;
    margin: 0 10px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 14px;
    background-color: #fff
}

.round-nav-btn {
    padding: 6px 12px;
    background-color: #0056b3;
    color: white;
    border: 1px solid #0056b3;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    margin-top: 0
}

.round-nav-btn:hover {
    background-color: #004494
}

.round-nav-btn:disabled {
    background-color: #ccc;
    border-color: #ccc;
    color: #666;
    opacity: 0.7;
    cursor: not-allowed
}

.claim-tool-link-container {
    margin-bottom: 15px;
    text-align: center
}

#claim-tool-link {
    font-size: 14px;
    color: #0056b3;
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid #0056b3;
    border-radius: 4px;
    background-color: #e7f3ff;
    transition: background-color 0.2s ease
}

#claim-tool-link:hover {
    background-color: #d0e7ff;
    text-decoration: underline
}

.game-list-item {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fff;
    border-left: 4px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 10px;
    margin-left: 3px;
}

.game-list-item:nth-child(even) {
    background-color: #f8f9fa
}

.game-list-item:nth-child(odd) {
    background-color: #fff
}

/* Add spacing after section headers */
.section-header+.game-list-item {
    margin-top: 8px;
}

.game-list-item:hover {
    background-color: #eef4ff
}

.game-list-item.active,
.game-list-item .selected {
    background-color: #d4eaff !important;
}

.section-header {
    background-color: #0056b3;
    color: white;
    font-weight: bold;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 4px rgba(0, 86, 179, 0.2);
}

.game-list-main {
    display: flex;
    align-items: center;
    flex-grow: 1;
    min-width: 200px
}

.game-list-board {
    min-width: 20px;
    max-width: 35px;
    font-weight: bold;
    margin-right: 8px;
    font-size: 14px;
    text-align: left;
    flex-shrink: 0
}

.game-list-players {
    flex-grow: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    font-weight: bold
}

.game-list-status {
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 4px;
    border-left-width: 3px;
    border-left-style: solid;
    border-left-color: transparent;
    display: block;
    gap: 4px;
    flex-shrink: 0;
    text-align: right;
    min-height: 0;
    padding-left: 26px;
    width: 322px
}

.game-list-status .status-line {
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    margin-top: 5px;
}

.claim-status-draw {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    border: 1px solid #f5c6cb;
    display: inline-block;
}

.game-list-status.last-move-with-claim {
    border-bottom: none
}

.game-list-status.last-move-with-forced-draw {
    border-bottom: none
}

.game-list-status.last-move-two-fold {
    border-bottom: none
}

.game-list-status .next-claim-status,
.game-list-status .arbiter-claim-status,
.game-list-status .is-claimable,
.game-list-status .two-fold-status {
    padding: 3px 8px;
    font-size: 13px;
    margin-left: 0;
    line-height: 1.2;
    white-space: normal;
    display: inline-block;
}

.game-list-status .not-claimable {
    display: none
}

.game-list-status .move-counter {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    text-align: right;
    padding-bottom: 5px
}

.main-content-container .game-viewer-container {
    max-width: none;
    box-shadow: none;
    border-radius: 0;
    padding: 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

#claim-tool-view {
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    height: 100%;
    overflow-y: auto
}

/* MultiBoard layout inside right pane */
#multiboard-view {
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    min-height: 100%;
    overflow-y: auto;
    display: block;
    position: relative;
}

.multiboard-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 16px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #f3f5f7;
    border: 1px solid #d7dde2;
    border-radius: 8px;
    box-shadow: none;
}

.multiboard-controls-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.multiboard-controls-group label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 0;
    white-space: nowrap;
}

.multiboard-controls-divider {
    width: 1px;
    height: 28px;
    background: #d0d7de;
    flex-shrink: 0;
}

.multiboard-select {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #c7ced5;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    min-width: 64px;
    cursor: pointer;
}

.multiboard-select:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 2px rgba(0, 86, 179, 0.2);
}

.multiboard-controls-group .round-nav-btn {
    padding: 6px 10px;
    min-width: 36px;
}

.multiboard-controls-group-checkbox {
    margin-left: 0;
}

.multiboard-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500 !important;
    cursor: pointer;
    user-select: none;
}

.multiboard-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4b6478;
}

.multiboard-display-menu {
    position: relative;
    flex: 0 0 auto;
}

.multiboard-display-menu > summary {
    list-style: none;
    cursor: pointer;
    border: 1px solid #c7ced5;
    border-radius: 6px;
    background: #fff;
    color: #25313c;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
    user-select: none;
}

.multiboard-display-menu > summary::-webkit-details-marker { display: none; }
.multiboard-display-menu > summary::after { content: " ▾"; color: #66727d; }
.multiboard-display-menu[open] > summary { border-color: #667b8c; }

.multiboard-display-popover {
    position: absolute;
    z-index: 100;
    top: calc(100% + 6px);
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    gap: 7px 12px;
    width: 300px;
    padding: 11px;
    border: 1px solid #cbd3da;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(35, 48, 60, .18);
}

.multiboard-display-popover label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #34414d;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.multiboard-display-popover input { accent-color: #4b6478; }
.multiboard-display-heading {
    grid-column: 1 / -1;
    color: #697681;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.wdl-alert-controls {
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.wdl-threshold-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #65717d !important;
    font-size: 11px !important;
}

#wdl-alert-threshold {
    width: 52px;
    padding: 5px 4px;
    border: 1px solid #5d6f7d;
    border-radius: 5px;
    background: #f8fafc;
    color: #17212b;
    font: inherit;
    font-weight: 800;
    text-align: center;
}

.wdl-alert-formula {
    padding: 4px 6px;
    border-radius: 5px;
    background: #e5e9ed;
    color: #5e6974;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
    cursor: help;
}

.multiboard-controls #round-select {
    min-width: 100px;
}

/* Opening book WDL bar in multiview board cards */
.multiboard-opening-book-bar {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #e9ecef;
    font-size: 12px;
}

.multiboard-opening-book-bar .stats-bar-container {
    height: 15px;
    margin: 4px 0;
}

.multiboard-opening-book-bar .stats-counts-wrapper {
    font-size: 11px;
    color: #6c757d;
}

.multiboard-tournament-name-wrap {
    margin-right: 4px;
}

.multiboard-tournament-name {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.multiboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    align-items: start;
}

.multiboard-section-header {
    grid-column: 1 / -1; /* Span all columns */
    background: #3e596d;
    color: white;
    font-weight: bold;
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: none;
    margin: 8px 0;
    text-align: center;
}

.multiboard-empty-state {
    grid-column: 1 / -1;
    padding: 24px 16px;
    text-align: center;
    color: #666;
    font-size: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px dashed #ccc;
}

.board-card {
    background: #fff;
    color: inherit;
    text-decoration: none;
    position: relative;
    border: 1px solid #d9e0e5;
    border-radius: 7px;
    padding: 4px;
    box-shadow: 0 1px 5px rgba(23, 39, 52, 0.06);
    display: flex;
    gap: 3px;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    transition: background-color .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.board-card:visited {
    color: inherit;
}

.board-card:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

.board-card.wdl-blunder-alert {
    box-shadow: 0 0 0 2px rgba(153, 27, 27, .14);
}

.board-card.wdl-blunder-alert.wdl-alert-0 {
    background: #fff7f7;
    border-color: #f8d7da;
}

.board-card.wdl-blunder-alert.wdl-alert-5 {
    background: #feeceb;
    border-color: #f5b8b4;
}

.board-card.wdl-blunder-alert.wdl-alert-15 {
    background: #fbcac7;
    border-color: #eb8881;
}

.board-card.wdl-blunder-alert.wdl-alert-25 {
    background: #ef6a62;
    border-color: #cf4037;
}

.board-card.wdl-blunder-alert.wdl-alert-50 {
    background: #991f1f;
    border-color: #651313;
    box-shadow: 0 0 0 2px rgba(101, 19, 19, .3);
}

.board-card.wdl-blunder-alert::before {
    display: none;
}

/* A newly reported result is visible for 20 seconds. Player bars stay neutral;
   the card highlight only says that the result just arrived. */
.board-card.result-arrived,
.board-card.result-arrived.result-arrived-white,
.board-card.result-arrived.result-arrived-black {
    background: #eaf3fb;
    border-color: #7398b8;
    box-shadow: 0 0 0 2px rgba(64, 111, 151, .18);
}

.board-card.result-arrived-draw {
    background: #eef1f4;
    border-color: #8b98a4;
}

.board-card .board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 14px;
}

.board-card .board-header .board-result {
    font-weight: bold;
}

.board-card .player-top,
.board-card .player-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    height: 26px;
    min-height: 26px;
    flex: 0 0 26px;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    margin: 0px 0;
    width: var(--multiboard-board-size, 260px);
    box-sizing: border-box;
}

.board-card .player-top {
    background: #3f3f40;
    color: white;
}

.board-card .player-bottom {
    background: #ecf0f1;
    color: #2c3e50;
}

.board-card .player-bar .player-name {
    display: flex;
    align-items: center;
    height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 20px;
}

.board-card .player-bar .player-score {
    display: flex;
    align-items: center;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin-right: 5px;
    padding: 2px 4px;
    min-height: 16px;
    min-width: 16px;
    text-align: center;
}

.board-card .player-bottom .player-score {
    background: rgba(44, 62, 80, 0.1);
}

/* Solid result bars: top is always Black, bottom is always White. */
.board-card .player-bar.result-win {
    opacity: 1;
}
.board-card .player-bar.result-draw {
    opacity: 1;
}
.board-card .player-bar.result-loss {
    opacity: 1;
}
.board-card .player-top:is(.result-win, .result-draw, .result-loss) {
    background: #3f3f40;
    color: #fff;
}
.board-card .player-bottom:is(.result-win, .result-draw, .result-loss) {
    background: #ecf0f1;
    color: #2c3e50;
}

.board-card .board-canvas {
    width: var(--multiboard-board-size, 260px);
    height: var(--multiboard-board-size, 260px);
    margin: 0 auto;
    box-sizing: border-box;
    display: block;
    grid-column: 1;
}

/* Tournament-control draft: Moment Radar-style eval + WDL rails. */
.board-card .board-stage {
    display: grid;
    grid-template-columns: minmax(0, auto) 36px;
    grid-template-rows: auto auto auto auto;
    align-items: stretch;
    justify-content: center;
    column-gap: 4px;
    row-gap: 0;
    width: 100%;
}

.board-card .board-stage > .player-top {
    grid-column: 1;
    grid-row: 1;
}

.board-card .board-stage > .board-canvas {
    grid-column: 1;
    grid-row: 2;
}

.board-card .board-stage > .player-bottom {
    grid-column: 1;
    grid-row: 3;
}

.board-card .board-stage > .last-move-line {
    grid-column: 1;
    grid-row: 4;
}

.board-card .board-stage::before {
    display: none;
}

.board-card .position-bars {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    min-height: 0;
    grid-column: 2;
    grid-row: 2;
    align-items: center;
    height: 100%;
}

.board-card .bar-block {
    position: relative;
    display: grid;
    grid-template-rows: 1fr;
    justify-items: center;
    gap: 0;
    height: 100%;
    align-items: center;
}

.board-card .bar-label {
    display: none;
}

.board-card .eval-rail,
.board-card .wdl-rail {
    position: relative;
    height: 100%;
    min-height: 0;
    border: 1px solid #9ca3af;
    box-sizing: border-box;
}

.board-card .eval-rail {
    width: 14px;
    background: linear-gradient(to bottom, #111 0%, #2d2d2d 49%, #fff 51%, #fff 100%);
}

.board-card .eval-rail.empty,
.board-card .wdl-rail.empty {
    background: repeating-linear-gradient(135deg, #e5e7eb, #e5e7eb 4px, #f4f5f6 4px, #f4f5f6 8px);
}

.board-card .eval-midline {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: -4px;
    width: 22px;
    height: 2px;
    background: #ef4444;
    box-shadow: none;
    transform: translateY(-50%);
}

.board-card .wdl-rail {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 14px;
    background: #f7f7f7;
    border-color: #fff;
}

.board-card .wdl-black { background: #050505; }
.board-card .wdl-draw { background: #b9bec5; }
.board-card .wdl-white { background: #fff; }

.board-canvas .sq-highlight,
.main-content-container #board .sq-highlight {
    isolation: isolate;
    outline: none;
    box-shadow: none;
}

/* A real overlay keeps the original light/dark square visible, while the
   piece itself stays fully opaque above it. */
.board-canvas .sq-highlight::after,
.main-content-container #board .sq-highlight::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgb(255 225 0);
    opacity: .45;
    pointer-events: none;
}

.board-canvas .sq-highlight :is(.piece-417db, .notation-322f9),
.main-content-container #board .sq-highlight :is(.piece-417db, .notation-322f9) {
    position: relative;
    z-index: 2;
}


.board-card .last-move-line {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    color: #333;
    background: #f8f9fa;
    border: 0;
    border-radius: 4px;
    padding: 3px 6px;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
}

.board-card .last-move-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-card .last-move-time-since {
    flex: 0 0 auto;
    max-width: 100%;
    margin-left: auto;
    overflow: hidden;
    color: #59636e;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-card .status-block {
    margin-top: 4px;
    width: 100%;
    min-height: 153px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* Reuse game-list status styling for multiboard cards */
.board-card .status-block {
    text-align: center;
}

.board-card .status-block .status-line {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    margin-top: 2px;
    width: 100%;
    text-align: center;
    display: inline-block;
}

.board-card .live-control-panel {
    overflow: hidden;
    border: 1px solid #d7dee6;
    border-radius: 6px;
    background: #fff;
    box-shadow: none;
    text-align: left;
}

.board-card .live-analysis-line {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding: 6px 7px;
    background: #263744;
    color: #fff;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.board-card .analysis-pill {
    flex: 0 0 auto;
    align-self: center;
    border-radius: 3px;
    background: #fff;
    color: #111827;
    padding: 2px 5px;
}

.board-card .analysis-pill.analysis-pill-negative,
html.multiboard-dark .board-card .analysis-pill.analysis-pill-negative {
    background: #000;
    color: #fff;
    border: 1px solid #fff;
}

.board-card .wdl-probabilities {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 7px;
    margin-left: auto;
    padding: 2px 4px;
    border-radius: 2px;
}
.board-card .wdl-probabilities.wdl-leading-white {
    background: #f2f4f6;
    color: #111827;
}
.board-card .wdl-probabilities.wdl-leading-draw {
    background: #c5c9cf;
    color: #111827;
}
.board-card .wdl-probabilities.wdl-leading-black {
    background: #20242a;
    color: #fff;
}

.board-card .wdl-value {
    padding: 0;
    white-space: nowrap;
    color: inherit;
}

/* Highlight the leading WDL outcome without changing the surrounding analysis bar. */
.board-card .wdl-value b {
    display: inline;
    margin: 0;
    font-size: inherit;
    letter-spacing: 0;
}

.board-card .wdl-unavailable { grid-column: 1 / -1; color: #d7dee7; padding: 3px 0; }

.board-card .control-info-line {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    padding: 3px 7px;
    border-top: 1px solid #e7eaee;
    color: #263442;
    font-size: 12px;
    line-height: 1.25;
}

.board-card .control-info-line.quiet { color: #6b7280; }
.board-card .tablebase-line { background: transparent; color: inherit; }
.board-card .classification-line { background: #f7f9fb; }
.board-card .classification-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    width: 100%;
}

.board-card .classification-metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 6px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: inherit;
}
.board-card .metric-caption { font: inherit; color: #53606d; }
.board-card .classification-metric b { font-weight: 700; }
.board-card .classification-metric.metric-pending b { font-style: italic; }
.board-card .classification-metric.metric-class-inaccuracy,
.board-card .classification-metric.metric-class-mistake,
.board-card .classification-metric.metric-class-blunder {
    border-radius: 3px;
    color: #fff;
    padding-left: 6px;
    padding-right: 6px;
}
.board-card .classification-metric.metric-class-inaccuracy { background: #b91c1c; }
.board-card .classification-metric.metric-class-mistake { background: #991b1b; }
.board-card .classification-metric.metric-class-blunder { background: #7f1d1d; }
.board-card .only-move-line { background: transparent; color: inherit; }
.board-card .only-move-line .control-label { background: #efb54f; color: #3f2500; }
.board-card .control-label {
    align-self: start;
    border-radius: 4px;
    background: #edf1f5;
    color: #53606d;
    padding: 2px 5px;
    font-size: 11px;
    font-weight: 800;
}
.board-card .classification-line .control-label {
    width: 8.5em;
    min-width: 8.5em;
    max-width: 8.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 900px) {
    .board-card .classification-line .control-label {
        width: auto;
        max-width: none;
    }
}

.multiboard-feature-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #1e3a5f;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.multiboard-feature-link:hover,
.multiboard-feature-link:focus-visible {
    border-color: #2f5fb3;
    color: #244c91;
    outline: none;
}

.moment-radar-page {
    margin: 0;
    background: #f4f7fb;
    color: #172033;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.moment-radar-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 60px;
}

.moment-radar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.moment-radar-header h1 {
    margin: 2px 0 4px;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.moment-radar-eyebrow,
.moment-radar-subtitle {
    margin: 0;
    color: #5d6a7e;
}

.moment-radar-eyebrow {
    color: #315eaf;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.moment-radar-back,
.moment-radar-sections a {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #244c91;
    font-weight: 750;
    text-decoration: none;
}

.moment-radar-back { padding: 10px 14px; white-space: nowrap; }

.moment-radar-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0;
}

.moment-radar-sections a { padding: 8px 12px; }
.moment-radar-sections a.is-active { background: #315eaf; border-color: #315eaf; color: #fff; }

.moment-radar-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.moment-radar-summary article,
.moment-radar-game {
    border: 1px solid #d8e0eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(36, 55, 84, 0.05);
}

.moment-radar-summary article { padding: 16px; }
.moment-radar-summary strong { display: block; font-size: 1.55rem; }
.moment-radar-summary span { color: #647287; font-size: 0.85rem; }
.moment-radar-status { min-height: 1.3em; margin: 18px 2px 10px; color: #647287; }
.moment-radar-games { display: grid; gap: 14px; }
.moment-radar-game { padding: 17px; }

.moment-radar-game-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.moment-radar-game h2 { margin: 0; font-size: 1.05rem; }
.moment-radar-game p { margin: 4px 0 0; color: #68758a; }
.moment-radar-badge,
.moment-radar-authority {
    border-radius: 999px;
    padding: 4px 9px;
    background: #e8eef7;
    color: #42536b;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}
.moment-radar-badge.is-live,
.moment-radar-authority { background: #e5f5e9; color: #23613b; }
.moment-radar-badge.is-waiting,
.moment-radar-badge.is-pending { background: #fff3d6; color: #805b00; }
.moment-radar-moment-list { list-style: none; margin: 14px 0 0; padding: 0; }
.moment-radar-moment {
    display: grid;
    grid-template-columns: minmax(90px, 140px) 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-top: 1px solid #e8edf4;
}
.moment-radar-move { color: #244c91; font-weight: 800; }
.moment-radar-moment-copy { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.moment-radar-moment-copy span { color: #68758a; font-size: 0.82rem; }
.moment-radar-moment.is-provisional .moment-radar-authority { background: #fff3d6; color: #805b00; }
.moment-radar-empty { padding: 14px 0 2px; font-style: italic; }

@media (max-width: 700px) {
    .moment-radar-shell { width: min(100% - 20px, 1180px); padding-top: 16px; }
    .moment-radar-header { flex-direction: column; gap: 12px; }
    .moment-radar-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .moment-radar-moment { grid-template-columns: 1fr auto; }
    .moment-radar-moment-copy { grid-column: 1 / -1; }
}
.board-card .claim-control-slot {
    text-align: left;
}
.board-card :is(.control-info-line, .opening-cell, .claim-cell, .claim-row) > .control-label {
    width: 8.5em;
    min-width: 8.5em;
    max-width: 8.5em;
    box-sizing: border-box;
}

.board-card .claim-cell {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 6px;
    align-items: center;
    padding: 2px 7px;
}

.board-card .claim-control-slot {
    border-top: 1px solid #dfe3e8;
}

.board-card .claim-list { min-width: 0; }

.board-card .claim-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 8px;
    padding: 1px 0;
    color: #253440;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
}

.board-card .claim-row .control-label {
    background: transparent;
    color: inherit;
    padding: 0;
}
.board-card .claim-row > .control-label { font-weight: 700; }
.board-card .claim-row > .control-label {
    width: 5.5em;
    min-width: 5.5em;
    max-width: 5.5em;
}
.board-card .opening-book-slot { border-top: 1px solid #dfe3e8; padding: 0; }
.board-card .opening-book-slot .multiboard-opening-book-bar { margin-top: 4px; border-top: 0; }

.board-card .opening-cell {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 3px 7px;
    color: #33404b;
    font-size: 12px;
    line-height: 1.25;
}

.board-card .opening-cell.quiet { color: #77818a; }
.board-card .opening-cell strong { color: inherit; font-size: inherit; }

.board-card .opening-wdl-cell {
    align-items: start;
}

.board-card .opening-wdl-content {
    min-width: 0;
    width: 100%;
}

.board-card .opening-wdl-heading {
    line-height: 18px;
}

.board-card .opening-wdl-cell .stats-bar-container {
    height: 16px;
    margin: 2px 0;
}

.board-card .opening-wdl-cell .bar-white,
.board-card .opening-wdl-cell .bar-draw,
.board-card .opening-wdl-cell .bar-black {
    overflow: hidden;
    white-space: nowrap;
}

.board-card .opening-wdl-cell .stats-counts-wrapper {
    margin-top: 2px;
    padding: 0;
    color: #68727d;
    font-size: 10px;
}

.board-card .opening-checking,
.board-card .opening-unavailable,
.board-card .opening-empty {
    padding: 8px 2px 2px;
    color: #687586;
    font-size: 11px;
    text-align: center;
}

.board-card .opening-unavailable { color: #9a4b42; }
.board-card .opening-unavailable.neutral { color: #687586; }

.board-card .novelty-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 2px 8px;
    margin-top: 6px;
    padding: 7px 8px;
    border: 1px solid #d8c58f;
    border-radius: 6px;
    background: linear-gradient(135deg, #fffaf0, #f6edcf);
    color: #493b19;
}

.board-card .novelty-card span {
    border-radius: 999px;
    background: #6f571a;
    color: #fff;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.board-card .novelty-card strong { font-size: 13px; }
.board-card .novelty-card small { grid-column: 1 / -1; color: #77632f; font-size: 9px; letter-spacing: .015em; }

/* User-controlled visibility. These alter presentation only; source data and
   Firebase/Mongo payloads are untouched. */
#multiboard-view.mb-hide-eval-bar .bar-eval,
#multiboard-view.mb-hide-wdl-bar .bar-wdl,
#multiboard-view.mb-hide-analysis-summary .live-analysis-line,
#multiboard-view.mb-hide-eval-change .metric-eval,
#multiboard-view.mb-hide-wdl-change .metric-wdl,
#multiboard-view.mb-hide-classification .metric-name,
#multiboard-view.mb-hide-claims .claim-control-slot,
#multiboard-view.mb-hide-only-move .only-move-line,
#multiboard-view.mb-hide-tablebase .tablebase-line,
#multiboard-view.mb-hide-opening :is(.opening-status-line, .opening-book-slot) {
    display: none;
}

#multiboard-view.mb-hide-eval-bar.mb-hide-wdl-bar .position-bars { display: none; }
#multiboard-view.mb-hide-eval-bar.mb-hide-wdl-bar .board-stage { grid-template-columns: minmax(0, auto); }
#multiboard-view.mb-hide-eval-change.mb-hide-wdl-change.mb-hide-classification .classification-line { display: none; }

#multiboard-view.mb-hide-eval-bar:not(.mb-hide-wdl-bar) .board-stage,
#multiboard-view.mb-hide-wdl-bar:not(.mb-hide-eval-bar) .board-stage {
    grid-template-columns: minmax(0, auto) 18px;
}

/* Optional control-room palette. Board squares and alert meaning stay intact. */
html.multiboard-dark body { background: #15191e; color: #d8dee5; }
html.multiboard-dark #multiboard-view { background: #15191e; }
html.multiboard-dark .multiboard-controls {
    background: #20262d;
    border-color: #39434d;
}
html.multiboard-dark :is(.multiboard-controls-group label, .multiboard-checkbox-label) { color: #d8dee5; }
html.multiboard-dark .multiboard-controls-divider { background: #414b55; }
html.multiboard-dark :is(.multiboard-select, .multiboard-display-menu > summary, #wdl-alert-threshold) {
    background: #2a3139;
    border-color: #4b5864;
    color: #eef2f6;
}
html.multiboard-dark .multiboard-display-popover {
    background: #252c33;
    border-color: #4a5661;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
}
html.multiboard-dark .multiboard-display-popover label { color: #d9dfe5; }
html.multiboard-dark .multiboard-display-heading { color: #9ca9b4; }
html.multiboard-dark .wdl-alert-formula { background: #343d46; color: #bdc7d0; }
html.multiboard-dark .multiboard-grid .section-header { color: #dce3e9; border-color: #46515b; }
html.multiboard-dark .board-card {
    background: #20262d;
    border-color: #3d4751;
    color: #dce2e8;
}
html.multiboard-dark .board-card .player-top,
html.multiboard-dark .board-card .player-top:is(.result-win, .result-draw, .result-loss) {
    background: #252b32;
    color: #f2f4f6;
}
html.multiboard-dark .board-card .player-bottom,
html.multiboard-dark .board-card .player-bottom:is(.result-win, .result-draw, .result-loss) {
    background: #343c45;
    color: #f2f4f6;
}
html.multiboard-dark .board-card .last-move-line {
    background: #2b323a;
    border-color: #414b55;
    color: #edf1f5;
}

html.multiboard-dark .board-card .last-move-time-since {
    color: #d8dee5;
}
html.multiboard-dark .board-card .live-control-panel { background: #222930; border-color: #414c56; }
html.multiboard-dark .board-card .live-analysis-line { background: #1d2a34; }
html.multiboard-dark .board-card .analysis-pill { background: #e8edf1; color: #18212a; }
html.multiboard-dark .board-card .control-info-line,
html.multiboard-dark .board-card .claim-control-slot,
html.multiboard-dark .board-card .opening-book-slot { border-color: #404a54; }
html.multiboard-dark .board-card .classification-line { background: #252c33; color: #dbe2e8; }
html.multiboard-dark .board-card .classification-metric.metric-eval,
html.multiboard-dark .board-card .classification-metric.metric-wdl { color: inherit; }
html.multiboard-dark .board-card .classification-metric.metric-name,
html.multiboard-dark .board-card .classification-metric.metric-pending { color: inherit; }
html.multiboard-dark .board-card .control-label { background: #38424b; color: #dce3e9; }
html.multiboard-dark .board-card .claim-row,
html.multiboard-dark .board-card .claim-row:is(.claim-now, .claim-forced, .claim-watch) {
    color: #e0e6eb;
}
html.multiboard-dark .board-card .claim-row .control-label { background: transparent; color: inherit; }
html.multiboard-dark .board-card .tablebase-line { background: transparent; color: inherit; }
html.multiboard-dark .board-card .only-move-line { background: transparent; color: inherit; }
html.multiboard-dark .board-card .only-move-line .control-label { background: #b87316; color: #fff6df; }
html.multiboard-dark .board-card .opening-cell { color: #d5dde4; }
html.multiboard-dark .board-card .opening-cell.quiet { color: #98a4ae; }

html.multiboard-dark .board-card.result-arrived,
html.multiboard-dark .board-card.result-arrived.result-arrived-white,
html.multiboard-dark .board-card.result-arrived.result-arrived-black {
    background: #243849;
    border-color: #5f85a5;
}
html.multiboard-dark .board-card.result-arrived-draw { background: #303840; border-color: #667480; }
html.multiboard-dark .board-card.wdl-blunder-alert.wdl-alert-0 { background: #382728; border-color: #704246; }
html.multiboard-dark .board-card.wdl-blunder-alert.wdl-alert-5 { background: #49292a; border-color: #8b4848; }
html.multiboard-dark .board-card.wdl-blunder-alert.wdl-alert-15 { background: #632f30; border-color: #aa5553; }
html.multiboard-dark .board-card.wdl-blunder-alert.wdl-alert-25 { background: #843735; border-color: #d0645f; }
html.multiboard-dark .board-card.wdl-blunder-alert.wdl-alert-50 { background: #7e2525; border-color: #ed716a; }

/* Compact multiview density. No chess data is removed: the same rows and both
   vertical rails remain, but labels and chrome stop competing with the board. */
.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) {
    align-items: stretch;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .board-card {
    gap: 2px;
    height: 100%;
    padding: 3px;
    border-radius: 5px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .board-stage {
    grid-template-columns: minmax(0, auto) 26px;
    column-gap: 2px;
    row-gap: 2px;
}

#multiboard-view.mb-hide-eval-bar:not(.mb-hide-wdl-bar) .multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .board-stage,
#multiboard-view.mb-hide-wdl-bar:not(.mb-hide-eval-bar) .multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .board-stage {
    grid-template-columns: minmax(0, auto) 14px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .position-bars {
    gap: 2px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .bar-block {
    grid-template-rows: 9px 1fr 9px;
    gap: 1px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .bar-label {
    font-size: 7px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) :is(.eval-rail, .wdl-rail) {
    width: 10px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .eval-midline {
    left: -3px;
    width: 16px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) :is(.player-top, .player-bottom) {
    min-height: 18px;
    padding: 1px 0;
    font-size: 11px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .player-bar .player-name {
    padding-left: 6px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .player-bar .player-score {
    min-height: 13px;
    min-width: 13px;
    margin-right: 3px;
    padding: 1px 3px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .last-move-line {
    margin-top: 1px;
    gap: 2px;
    padding: 2px;
    font-size: 10px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .last-move-time-since {
    font-size: 9px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .status-block {
    margin-top: 2px;
    min-height: 112px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .live-control-panel {
    border-radius: 4px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .live-analysis-line {
    gap: 4px;
    padding: 4px 5px;
    font-size: 10px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .analysis-pill {
    padding: 1px 3px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .wdl-probabilities {
    gap: 3px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) :is(.control-info-line, .claim-row, .opening-cell) {
    gap: 4px;
    padding: 4px 5px;
    font-size: 10px;
    line-height: 1.2;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .claim-row {
    border-left-width: 3px;
    font-weight: 600;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .control-label {
    padding: 1px 3px;
    font-size: 9px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .classification-line .control-label {
    width: 8em;
    min-width: 8em;
    max-width: 8em;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) [data-compact-label] {
    font-size: 0;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) [data-compact-label]::before {
    content: attr(data-compact-label);
    font-size: 9px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .classification-metrics {
    gap: 2px;
}

.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) .classification-metric {
    padding: 1px 3px;
    font-size: 9px;
}

@media (max-width: 900px) {
    .wdl-alert-controls { margin-left: 0; }
    .multiboard-controls-divider { display: none; }
}


/* No left borders for multiboard cards */
.board-card.last-move-with-claim,
.board-card.last-move-with-forced-draw,
.board-card.last-move-two-fold {
    border-left: none !important;
}

.main-content-container .game-header {
    flex-shrink: 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 10px;
    font-weight: bold;
    padding: 0 15px;
    background-color: #f1f1f8
}

.main-content-container .game-header h2 {
    font-size: 18px;
    margin: 0
}

.main-content-container .game-header .game-info span {
    font-size: 15px;
    padding: 3px 6px
}

.main-content-container .viewer-claims-area {
    flex-grow: 1;
    flex-shrink: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    overflow: hidden
}

.main-content-container #last-move-display {
    margin-bottom: 0;
    padding: 8px 12px;
    font-size: 15px;
    border-radius: 6px 6px 0 0;
    border-left: 6px solid #ced4da;
    background-color: #f8f9fa;
    border-bottom: none;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.main-content-container #claimable-status-display {
    padding: 8px 12px;
    font-size: 15px;
    border-radius: 0 0 6px 6px;
    background-color: #f8f9fa;
    border-top: none;
    flex-shrink: 0;
}

/* Green left border for threefold claim */
.main-content-container #claimable-status-display:has(.claim-status-achieved) {
    border-left: 6px solid #28a745;
}

/* Gray left border for twofold claim */
.main-content-container #claimable-status-display:has(.claim-status-twofold) {
    border-left: 6px solid #ced4da;
}

/* Red left border for fivefold claim */
.main-content-container #claimable-status-display:has(.claim-status-fivefold) {
    border-left: 6px solid #dc3545;
}

/* Yellow left border for sevenfold claim */
.main-content-container #claimable-status-display:has(.claim-status-possible) {
    border-left: 6px solid #ffc107;
}

.main-content-container #claimable-status-display .not-claimable {
    background-color: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    display: block;
    margin-bottom: 4px;
    width: fit-content;
}

.main-content-container #claimable-status-display .claim-status-achieved {
    background-color: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
    width: fit-content;
    border-color: #c3e6cb;
    ;
}

.main-content-container #claimable-status-display .claim-status-draw {
    background-color: #dc3545;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
    width: fit-content;
}

.main-content-container #claimable-status-display .next-claim-status {
    background-color: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
    width: fit-content;
    border-color: #ffeeba;
}

.main-content-container #claimable-status-display .claim-status-twofold {
    background-color: #e2e3e5;
    color: #495057;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
    width: fit-content;
    border-color: #d6d8db;
}

/* Historical potential claims styling */
.claims .historical-potential-claim {
    opacity: 0.8;
    border-left: 3px solid #ffc107;
}

.claims .historical-potential-claim:hover {
    opacity: 1;
}

.main-content-container #last-move-display.last-move-with-claim,
.main-content-container #last-move-display.last-move-with-forced-draw,
.main-content-container #last-move-display.last-move-two-fold {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0
}

.main-content-container #last-move-display.last-move-with-claim {
    border-left-color: #28a745
}

.main-content-container #last-move-display.last-move-with-forced-draw {
    border-left-color: #dc3545
}

.main-content-container #last-move-display.last-move-two-fold {
    border-left-color: #ccc
}

.main-content-container .game-viewer-header-content {
    display: flex;
    flex-direction: column;
}

.opening-explorer-status-bar {
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 13px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.opening-explorer-status-bar.status-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.opening-explorer-status-bar a {
    color: inherit;
    text-decoration: underline;
}

.opening-explorer-status-bar a:hover {
    text-decoration: none;
}

.opening-explorer-error-inline {
    display: inline;
    margin-right: 12px;
    font-size: 13px;
    color: #721c24;
    background: #f8d7da;
    padding: 4px 8px;
    border-radius: 4px;
}
.opening-explorer-error-inline a {
    color: inherit;
    text-decoration: underline;
}

.main-content-container #claims-list {
    flex-grow: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 5px;
    margin-left: 30px
}

.main-content-container #claims-list .claim {
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 4px;
    display: block
}

.main-content-container #claims-list .clickable-claim {
    cursor: pointer
}

.main-content-container #claims-list .clickable-claim:hover {
    background-color: #e9ecef
}

/* One row: game content (board + moves) + frequency graphs (opening recap lives inside graphs grid) */
.main-content-container .game-and-frequency-row {
    display: flex;
    flex-direction: row;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 20px;
}

.main-content-container .game-and-frequency-row .game-content {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    margin-top: 0;
}

/* Opening recap: first card in position-year-graphs-grid, same size as graph cards */
.position-year-graphs-container .opening-recap-container {
    flex: 0 0 527px;
    width: 527px;
    min-height: 343px;
    flex-shrink: 0;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.position-year-graphs-container .opening-recap-inner {
    min-height: 300px;
    height: 300px;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.opening-recap-title {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #333;
    text-align: center;
}

.opening-recap-opening-line,
.opening-recap-novelties-title {
    font-size: 12px;
    color: #334155;
    margin-bottom: 6px;
    font-weight: 600;
}

.opening-recap-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.fide-h2h-rows {
    gap: 8px;
    overflow-y: auto;
}

.fide-h2h-row {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 8px;
    background: #f8fafc;
}

.fide-h2h-heading {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: #334155;
}

.opening-recap-tab-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.opening-recap-tab-btn.active {
    background: #4361ee;
    color: #fff;
    border-color: #4361ee;
}

.opening-recap-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.opening-recap-panel.hidden {
    display: none;
}

.opening-recap-lines {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    overflow: hidden;
    flex: 1 1 auto;
}

.opening-recap-line {
    font-size: 12px;
    line-height: 1.35;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 4px 8px;
    background: #f8fafc;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.opening-recap-line-label {
    font-weight: 600;
    flex: 0 0 auto;
}

.opening-recap-line-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.opening-recap-muted {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    padding: 4px 0;
}

.opening-recap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    color: #334155;
}

.opening-recap-table th,
.opening-recap-table td {
    padding: 6px 8px;
    text-align: left;
    border: 1px solid #e2e8f0;
}

.opening-recap-table th {
    font-weight: 600;
    background: #f1f5f9;
}

.opening-recap-table tbody tr.odd {
    background: #fafafa;
}

.opening-recap-table tbody tr.even {
    background: #fff;
}

.opening-recap-table tbody tr.odd td,
.opening-recap-table tbody tr.even td {
    border-radius: 0;
}

.novelty-top-game {
    display: inline;
    margin-left: 0;
    font-size: 12px;
    color: #334155;
    font-style: normal;
    font-weight: normal;
}

.novelty-top-game-more {
    color: #334155;
    font-style: normal;
}

.main-content-container .game-and-frequency-row .position-year-graphs-container {
    flex: 1 1 400px;
    min-width: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    border-top: none;
}

.main-content-container .game-content {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: row;
    gap: 15px;
    overflow: visible;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    box-sizing: border-box;
    margin-top: 20px;
    align-items: flex-start;
    justify-content: center;
}

.main-content-container .board-container {
    flex: 0 0 auto;
    width: 426px;
    min-width: 280px;
    max-width: 432px;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 100%;
    overflow: visible;
}

.game-board-stage {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.main-content-container .game-board-stage #board {
    flex: 1 1 auto;
    width: calc(100% - 26px) !important;
    min-width: 0;
    max-width: 400px;
}

.game-viewer-eval-bar {
    position: relative;
    display: grid;
    flex: 0 0 20px;
    grid-template-rows: 13px minmax(0, 1fr) 13px;
    justify-items: center;
    gap: 3px;
    min-height: 0;
}

.game-viewer-eval-side {
    color: #6b7280;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
}

.game-viewer-eval-rail {
    --black-percent: 50%;
    position: relative;
    width: 18px;
    min-height: 0;
    border: 1px solid #7c828b;
    background: linear-gradient(to bottom, #111 0%, #111 var(--black-percent), #fff var(--black-percent), #fff 100%);
    box-sizing: border-box;
}

.game-viewer-eval-bar.is-pending .game-viewer-eval-rail {
    background: repeating-linear-gradient(135deg, #e5e7eb, #e5e7eb 5px, #f5f6f7 5px, #f5f6f7 10px);
}

.game-viewer-eval-midline {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: -3px;
    width: 22px;
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 0 1px #fff;
    transform: translateY(-50%);
}
.multiboard-grid:is([data-columns="7"], [data-columns="8"], [data-columns="9"], [data-columns="10"]) :is(.control-info-line, .opening-cell, .claim-cell, .claim-row) > .control-label {
    width: 8em;
    min-width: 8em;
    max-width: 8em;
}

.game-viewer-analysis-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 12px;
    width: calc(100% - 26px);
    margin: 6px 26px 0 0;
    padding: 6px 8px;
    box-sizing: border-box;
    border: 1px solid #d8dee6;
    border-radius: 5px;
    background: #f8fafc;
    color: #1f2937;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
}

.game-viewer-analysis-summary.is-pending {
    color: #64748b;
    font-weight: 600;
}

#game-viewer-classification-summary.is-provisional {
    color: #805b00;
}

.main-content-container #board {
    width: 100% !important;
    max-width: 400px;
    margin-bottom: 10px;
    flex-shrink: 1;
    flex-grow: 0
}

.main-content-container .navigation-controls {
    margin-top: auto;
    padding-top: 10px;
    flex-shrink: 0
}

.main-content-container .game-side-panel {
    flex: 0 0 auto;
    width: 300px;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%
}

.main-content-container .moves-container {
    max-width: 300px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    background-color: #fff;
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0
}

.game-viewer-container {
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1)
}

.game-header h1 {
    margin: 0;
    font-size: 22px;
    color: #333
}

.game-header .game-info {
    display: flex;
    gap: 15px
}

.game-header .game-info span {
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #f0f0f0
}

.game-header-bar {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
}

.game-header-bar .game-selector-container {
    flex: 1 1 auto;
    min-width: 0;
}

.game-header-actions {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    flex: 0 0 auto;
    padding-top: 10px;
}

.game-links-toggle {
    padding: 6px 12px;
    font-size: 0.9em;
    font-weight: 700;
    color: #111;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.game-links-toggle:hover {
    background-color: #f8fafc;
}

.game-links-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 560px;
    max-width: min(760px, 96vw);
    max-height: 70vh;
    overflow: auto;
    padding: 12px;
    background: #fff;
    border: 1px solid #dbe3ec;
    border-radius: 2px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    z-index: 80;
}

.game-links-menu[hidden] {
    display: none;
}

.game-links-menu-title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

.game-links-page-link {
    color: #111827;
    text-decoration: none;
    border-bottom: 1px solid #dbeafe;
}

.game-links-page-link:hover {
    color: #0f172a;
    border-bottom-color: #93c5fd;
}

.game-links-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-links-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-links-group-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.game-links-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid #eef2f7;
    border-radius: 3px;
}

.game-links-row:last-child {
    border-bottom: 0;
}

.game-links-row-inline {
    background: #f8fbff;
}

.game-links-row-odd {
    background: #fbfdff;
}

.game-links-row-even {
    background: #f5f9fd;
}

.game-links-row-label {
    font-size: 0.86rem;
    color: #111827;
    min-width: 0;
    font-weight: 600;
}

.game-links-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.game-links-action {
    padding: 5px 9px;
    border-radius: 2px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1f2937;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.game-links-action:hover {
    background: #eff6ff;
}

.game-links-helper {
    margin-top: 10px;
    font-size: 0.74rem;
    color: #64748b;
}

.claims-container {
    flex: 100%;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1)
}

.claims-container h3 {
    display: none
}

.claim-active {
    margin-bottom: 5px;
    padding: 5px;
    border-left: 3px solid #1c6e2f;
    background-color: #f0fff0
}

.not-claimable,
.claim-status-twofold {
    background-color: #e2e3e5;
    color: #383d41;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 10px;
    border: 1px solid #d6d8db;
    display: inline-block;
}

.games-list-container p{
    text-align: center;
}
.claim {
    margin-bottom: 5px;
    padding: 5px 8px;
    cursor: pointer
}

.claim strong {
    cursor: pointer
}

.board-container {
    flex: 1;
    min-width: 400px;
    align-self: flex-start
}

.game-side-panel {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-self: flex-start
}

.moves-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    background-color: #fff
}

.moves-list {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 5px 6px;
    color: #333
}

.white-move,
.black-move {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.white-move:hover,
.black-move:hover {
    background-color: #f0f0f0
}

.current-move {
    background-color: #0056b3 !important;
    color: white !important
}

.navigation-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px
}

.copy-buttons-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap
}

.btn-copy-data {
    padding: 6px 12px;
    font-size: 0.9em;
    background-color: #495057;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer
}

.btn-copy-data:hover {
    background-color: #343a40
}

.nav-button {
    padding: 8px 15px;
    background-color: #0056b3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 0;
    font-size: 20px
}

.nav-button:hover {
    background-color: #003d82
}

.nav-button:disabled {
    background-color: #ccc;
    cursor: not-allowed
}

.back-button {
    display: inline-block;
    margin-bottom: 20px;
    padding: 8px 15px;
    background-color: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 4px
}

.back-button:hover {
    background-color: #e0e0e0
}

.tabs {
    margin-bottom: 20px
}

.related-move {
    background-color: #a8d5ff !important
}

.current-move.claim-move {
    background-color: #3a74b1 !important;
    color: white !important
}

.claim-indicator {
    display: inline-block;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    margin-right: 5px !important;
    vertical-align: middle;
    background-color: transparent;
    padding: 0 !important;
    border: 1px solid #ccc
}

.claim-indicator.red {
    background-color: #dc3545;
    border-color: #b02a37
}

.claim-indicator.green {
    background-color: #28a745;
    border-color: #1c6e2f
}

.claim-indicator.yellow {
    background-color: #ffc107;
    border-color: #e9b400
}

.claim-indicator.gray {
    background-color: #adb5bd;
    border-color: #6c757d
}

.claim-move {
    font-weight: 600;
    text-decoration: none
}

#btnPrev,
#btnNext {
    padding: 8px 45px
}

.claim-tool-table td.clickable-game {
    cursor: pointer
}

.claim-tool-table td.clickable-game:hover {
    color: #003d82
}

.round-nav-btn,
#show-claim-tool-btn {
    background-color: #f1f1f8;
    border-color: #ced4da;
    width: 100%;
    margin-top: 5px;
    color: #333;
    font-weight: bold
}

.round-nav-btn:hover,
#show-claim-tool-btn:hover {
    background-color: #dee2e6;
    border-color: #adb5bd;
    color: #212529
}

.moves-list span {
    padding: 2px 4px;
    margin: 1px;
    border-radius: 3px;
    cursor: pointer;
    display: inline-block
}

.moves-list .move-number {
    cursor: default;
    margin-right: 5px
}

.moves-list span.white-move,
.moves-list span.black-move {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.moves-list .move-pos-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

.moves-list .move-pos-count.move-pos-count-zero {
    color: #94a3b8;
}

.moves-list span.current-move .move-pos-count {
    color: white;
}

.moves-list .variation-move-line {
    grid-column: 1 / -1;
    font-style: italic;
    color: #5a4d2d;
    background: #fff7dd;
    border-left: 3px solid #e0b84b;
    padding: 2px 8px;
    cursor: pointer;
}

.moves-list .variation-move-line.current-variation-move {
    background: #f3d89d;
    font-weight: 700;
}

.moves-list .variation-move-line:hover {
    background: #f7e5b9;
}

.moves-list .variation-move-token {
    display: inline-block;
    border-radius: 4px;
    padding: 1px 4px;
    cursor: pointer;
}

.moves-list .variation-move-token:hover {
    background: #ead09a;
}

.moves-list .variation-move-token.current-variation-token {
    background: #0056b3;
    color: #fff;
    font-weight: 700;
}

.moves-list .variation-panel {
    grid-column: 1 / -1;
    border: 1px solid #e6d39d;
    border-radius: 6px;
    background: #fffaf0;
    padding: 6px;
    margin-bottom: 4px;
    display: grid;
    gap: 4px;
}

.moves-list .variation-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 12px;
    color: #6a5120;
}

.moves-list .variation-close-btn {
    margin: 0;
    padding: 0 8px;
    line-height: 18px;
    height: 20px;
    min-width: 20px;
    border-radius: 10px;
    background: #8b6b2a;
    color: #fff;
    border: none;
    cursor: pointer;
}

.moves-list .variation-close-btn:hover {
    background: #6f541f;
}

.moves-list span.current-move {
    background-color: #d0e0f0;
    font-weight: bold
}

.moves-list span.related-move {
    background-color: #ffc
}

.moves-list span.claim-move {
    font-weight: bold;
    border-radius: 3px;
    padding: 1px 3px
}

.moves-list span.claim-move.claim-active {
    background-color: #d4edda;
    color: #155724
}

.moves-list span.claim-move.by-playing {
    background-color: #fff3cd;
    color: #856404
}

.moves-list span.claim-move.forced-draw {
    background-color: #f8d7da;
    color: #721c24
}

.moves-list span.claim-move.two-fold {
    border: none;
    background: none
}

.claim-indicator.is-threefold,
.claim-indicator.is-multiple-repetition {
    background-color: #28a745;
    border-color: #1c6e2f
}

.claim-indicator.is-fifty-move {
    background-color: #28a745;
    border-color: #1c6e2f
}

.claim-indicator.is-twofold {
    background-color: #adb5bd;
    border-color: #6c757d
}

.claim-indicator.by-playing {
    background-color: #ffc107;
    border-color: #e9b400
}

.claim-indicator.is-seventyfive-move,
.claim-indicator.is-stalemate,
.claim-indicator.is-insufficient-material {
    background-color: #dc3545;
    border-color: #b02a37
}

.claim-indicator.inactive-claim,
.claim-indicator.unknown {
    background-color: #adb5bd;
    border-color: #6c757d
}

.games-list-container .game-list-status {
    border-left: none !important;
    background: none
}

.last-move .claim-status-achieved,
.last-move .claim-status-possible,
.last-move .next-claim-status,
.last-move .claim-status-twofold {
    display: table;
    margin-bottom: 5px;
    margin-top: 5px;
    margin-left: 0
}

.quiet-moves-counter,
.move-counter {
    font-size: 13px;
    font-style: italic;
    font-weight: normal !important;
    margin-left: 5px;
}

.game-list-item:has(.last-move-with-claim) {
    border-left-color: #28a745;
    /* Green */
}

.game-list-item:has(.last-move-with-forced-draw) {
    border-left-color: #dc3545;
    /* Red */
}

.game-list-item:has(.last-move-two-fold) {
    border-left-color: #ccc;
    /* Gray */
}

.game-list-item:has(.last-move-two-fold),
.last-move:has(.last-move-two-fold) {
    border-left-color: #adb5bd !important;
}

.game-list-item:has(.claim-status-possible),
.last-move:has(.claim-status-possible) {
    border-left-color: #e9bb31 !important;
    /* Yellow */
}

.game-list-item:has(.claim-status-achieved),
.game-list-item:has(.is-claimable),
.last-move:has(.claim-status-achieved),
.last-move:has(.is-claimable) {
    border-left-color: #28a745 !important;
    /* Green */
}

.game-list-item:has(.claim-status-draw),
.last-move:has(.claim-status-draw) {
    border-left-color: #dc3545 !important;
    /* Red */
}

/* Future claim statuses - only apply when no confirmed claim (green/red) is present */
.game-list-item:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-twofold),
.last-move:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-twofold) {
    border-left-color: #adb5bd !important;
    /* Gray for twofold */
}

.game-list-item:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-fivefold),
.last-move:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-fivefold) {
    border-left-color: #6f42c1 !important;
    /* Purple for fivefold */
}

/* Also target next-claim-status spans for future claims */
.game-list-item:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.next-claim-status),
.last-move:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.next-claim-status) {
    border-left-color: #e9bb31 !important;
    /* Yellow for future claims */
}

/* Move selection indicator for historical moves */
.move-selection-indicator {
    display: inline-block;
    font-size: 15px;
}

/* Latest move claims section */
/* Move sections */
.move-section {
    margin-bottom: 12px;
    padding: 8px 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #ccc;
    font-weight: bold;
    color: #333;
    display: inline-block;
    width: auto;
}

.move-text {
    margin-bottom: 6px;
    font-size: 16px;
}

.move-claims {
    font-size: 14px;
    font-weight: normal;
    margin-top: 6px;
}

.move-claims span {
    display: block;
    margin-bottom: 4px;
}

/* Latest move section border colors */
.latest-move-section:has(.claim-status-achieved),
.latest-move-section:has(.is-claimable) {
    border-left-color: #28a745 !important; /* Green for achieved */
}

.latest-move-section:has(.claim-status-possible) {
    border-left-color: #e9bb31 !important; /* Yellow for possible */
}

.latest-move-section:has(.claim-status-draw) {
    border-left-color: #dc3545 !important; /* Red for draw */
}

.latest-move-section:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-twofold) {
    border-left-color: #adb5bd !important; /* Gray for twofold */
}

.latest-move-section:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-fivefold) {
    border-left-color: #6f42c1 !important; /* Purple for fivefold */
}

/* Selected move section - same color scheme as latest move */
.selected-move-section:has(.claim-status-achieved),
.selected-move-section:has(.is-claimable) {
    border-left-color: #28a745 !important; /* Green for achieved */
}

.selected-move-section:has(.claim-status-possible) {
    border-left-color: #e9bb31 !important; /* Yellow for possible */
}

.selected-move-section:has(.claim-status-draw) {
    border-left-color: #dc3545 !important; /* Red for draw */
}

.selected-move-section:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-twofold) {
    border-left-color: #adb5bd !important; /* Gray for twofold */
}

.selected-move-section:not(:has(.claim-status-achieved)):not(:has(.is-claimable)):not(:has(.claim-status-draw)):has(.claim-status-fivefold) {
    border-left-color: #6f42c1 !important; /* Purple for fivefold */
}

.move-selection-header {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 6px;
    color: #333;
}

.latest-move-notation {
    font-weight: 500;
    color: #333;
    background: transparent;
}

/* Current position not claimable styling */
.claim-status-not-claimable {
    display: inline-block;
    background-color: #f5f5f5;
    color: #666;
    padding: 3px 8px;
    margin-left: 10px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #ddd;
    font-weight: bold;
    text-transform: uppercase;
}

/* Claim status content wrapper */
.claim-status-content {
    display: inline-block;
    margin-left: 10px;
}

/* Page Footer */
.page-footer {
    position: fixed;
    bottom: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #ddd;
    border-left: 1px solid #ddd;
    padding: 8px 15px;
    font-size: 12px;
    color: #666;
    z-index: 1000;
    box-shadow: -2px -2px 5px rgba(0,0,0,0.1);
}

/* Adjust footer for mobile */
@media (max-width: 767px) {
    .page-footer {
        right: auto;
        left: 0;
        bottom: 0;
        width: 100%;
        text-align: center;
        border-left: none;
        border-top: 1px solid #ddd;
    }
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-home-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.back-home-link:hover {
    text-decoration: underline;
}

/* Mobile Header */
.mobile-header {
    display: none;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 15px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
}

.mobile-header h1 {
    margin: 0 0 10px 0;
    font-size: 18px;
    text-align: center;
}

.mobile-round-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.mobile-view-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.mobile-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 14px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mobile-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Mobile responsiveness */
@media (max-width: 767px) {
    /* Show mobile header on mobile */
    .mobile-header {
        display: block;
    }

    /* Hide desktop round navigation on mobile */
    .round-navigation,
    #tournament-title-h1 {
        display: none;
    }

    /* Hide multiboard button on mobile devices */
    #show-multiboard-btn {
        display: none !important;
    }

    /* Multiboard view should be visible on mobile too - removed hiding rule */
    /* #multiboard-view {
        display: none !important;
    } */

    /* Left pane removed - no longer needed */

    /* Ensure no horizontal scroll on mobile */
    .main-content-container {
        height: auto;
        min-height: calc(100vh - 140px); /* Account for mobile header */
        margin-top: 120px; /* Push content below fixed header */
    }

    .main-content-container {
        min-height: 50vh;
    }

    /* Adjust button layout for mobile */
    .view-toggle-buttons {
        display: none; /* Hide desktop buttons on mobile */
    }

    /* Main content container should always be visible */
    .main-content-container {
        display: block !important;
    }

    /* Override for larger screens */
    @media (min-width: 768px) {
        .mobile-header {
            display: none;
        }

        .round-navigation,
        #tournament-title-h1 {
            display: block;
        }

        .view-toggle-buttons {
            display: flex;
        }

        .main-content-container {
            display: block !important;
        }
    }
}

/* Position frequency per year – own row, horizontal scroll like opening books but separate section */
.position-year-graphs-container {
    margin-top: 24px;
    margin-bottom: 24px;
    padding: 20px 0;
    border-top: 1px solid #e2e8f0;
}

.position-year-graphs-grid {
    display: flex;
    flex-direction: row;
    gap: 24px;
    flex-wrap: nowrap;
    margin-top: 16px;
    overflow-x: auto;
    overflow-y: hidden;
}

.position-year-graph-card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    width: 527px;
    min-height: 343px;
    flex: 0 0 527px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.position-year-graph-title {
    margin: 0 0 12px 0;
    font-size: 1em;
    color: #333;
    font-weight: 600;
    text-align: center;
}

.position-year-graph {
    min-height: 300px;
    height: 300px;
    width: 100%;
    overflow: hidden;
}

.position-year-graph-empty {
    margin: 0;
    color: #999;
    font-style: italic;
    font-size: 13px;
}

/* Bar chart: years on x-axis, number of games on y-axis */
.position-year-barchart {
    display: block;
    width: 100%;
    min-height: 140px;
}

.position-year-bar {
    vector-effect: non-scaling-stroke;
}

.position-year-ygrid {
    vector-effect: non-scaling-stroke;
}

/* Line chart (player graphs): polyline + data points */
.position-year-linechart {
    display: block;
    width: 100%;
    min-height: 140px;
}

.position-year-line {
    vector-effect: non-scaling-stroke;
}

.position-year-point {
    vector-effect: non-scaling-stroke;
}

.position-year-linechart .position-year-xlabel,
.position-year-barchart .position-year-xlabel {
    font-size: 10px;
    fill: #555;
    font-family: inherit;
}

.position-year-linechart .position-year-xtick,
.position-year-barchart .position-year-xtick {
    vector-effect: non-scaling-stroke;
}

.position-year-linechart .position-year-ylabel,
.position-year-barchart .position-year-ylabel {
    font-size: 10px;
    fill: #555;
    font-family: inherit;
}

.position-year-linechart .position-year-yaxis-title,
.position-year-barchart .position-year-yaxis-title {
    font-size: 11px;
    fill: #666;
    font-family: inherit;
    font-weight: normal;
    text-anchor: start;
}



.opening-books-grid {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-top: 20px;
    overflow-x: auto;
    overflow-y: hidden;
}

.opening-book-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    padding-bottom: 0; /* Remove bottom padding, game history block will handle it */
    border: 1px solid #e2e8f0;
    width: 527px;
    min-height: 885px;
    height: auto;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    /* Ensure consistent structure for game history alignment */
    position: relative;
}

.opening-book-card h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 1.1em;
    color: #333;
}

.opening-book-card h3 a.opening-book-title-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.opening-book-card h3 a.opening-book-title-link:hover {
    color: inherit;
    text-decoration: none;
}

.opening-book-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0; /* Allow flex children to shrink below their content size */
    /* Enable mouse wheel scrolling even without visible scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    /* Ensure consistent height so game history aligns across cards */
    min-height: 437px;
    max-height: 437px;
}

/* Hide scrollbar but keep scrolling functionality */
.opening-book-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Use same styles as moves-list for consistency */
#opening-book-moves-list {
    list-style-type: none;
    padding: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    /* Enable mouse wheel scrolling even without visible scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar but keep scrolling functionality */
#opening-book-moves-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

#opening-book-moves-list .move-item {
    padding: 8px 10px;
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    cursor: default;
    transition: background-color 0.2s ease;
}

#opening-book-moves-list .move-item:last-child {
    border-bottom: none;
}

#opening-book-moves-list .move-item:nth-child(odd) {
    background-color: #fff;
}

#opening-book-moves-list .move-item:nth-child(even) {
    background-color: #f9f9f9;
}

#opening-book-moves-list .move-item:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

#opening-book-moves-list .opening-book-playable-move {
    cursor: pointer;
}

/* Game History → Top Games → Most Played (DOM order set in game_viewer_opening_books.js) */
/* Most Played uses margin-top:auto so it aligns at the bottom across cards */
.game-history-block {
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid #ddd;
    background: #f9f9f9;
    border-radius: 0;
    margin-left: -20px;
    margin-right: -20px;
    margin-bottom: 0; /* Keep block inside card so game-history-oldest is not clipped */
    padding: 12px 20px 16px 20px;
    flex-shrink: 0; /* Don't shrink, maintain consistent height */
    min-height: 120px; /* Ensure consistent height across all cards */
    /* Remove any unwanted borders */
    border-left: none !important;
    border-right: none !important;
    min-height: 230px;
    max-height: 230px;
}

.game-history-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.game-history-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: left;
}

.game-history-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0; /* Allow shrink so items stay inside container */
}

.game-history-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-left: 3px solid #999;
    min-width: 0; /* Allow shrink so content does not overflow */
}

.game-history-item.game-history-recent {
    border-left-color: #666;
}

.game-history-item.game-history-oldest {
    border-left-color: #999;
}

.game-history-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}

.game-history-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    line-height: 1.4;
    color: #333;
}

.game-history-move {
    font-family: inherit;
    color: #333;
    font-weight: 600;
    font-size: 13px;
}

.game-history-players {
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

.game-history-result {
    color: #333;
    font-weight: 500;
    font-size: 12px;
}

.game-history-event {
    color: #666;
    font-size: 12px;
}

.game-history-date {
    color: #999;
    font-size: 11px;
    padding-left: 8px;
    border-left: 1px solid #ddd;
    white-space: nowrap;
}

/* Top Games Section (sorted by rating) */
.top-games-block {
    padding-top: 12px;
    border-top: 1px solid #ddd;
    background: #f5f8ff;
    margin-left: -20px;
    margin-right: -20px;
    margin-bottom: 0;
    padding: 12px 20px 16px 20px;
    flex-shrink: 0;
    min-height: 380px;
    max-height: 380px;
}

.top-games-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.top-games-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: left;
}

.top-games-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
}

/* Most Played Players — last block in card; pulls to bottom for column alignment */
.top-players-block {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #ddd;
    background: #f4f4f5;
    margin-left: -20px;
    margin-right: -20px;
    margin-bottom: -20px;
    padding: 12px 20px 16px 20px;
    flex-shrink: 0;
}

/* Most Played Players: two columns White | Black, one line per player */
.top-players-block .top-players-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}
.top-players-block .top-players-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.top-players-block .top-players-col-title {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}
.top-players-block .top-players-col-lines {
    margin: 0;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #333;
    background: #f8f9fa;
    border-radius: 4px;
}
.top-players-block .top-players-line {
    margin-bottom: 2px;
}
.top-players-block .top-players-line:last-child {
    margin-bottom: 0;
}
.top-players-block .top-players-line strong {
    font-weight: 700;
    color: inherit;
    font-size: inherit;
}

.top-game-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-left: 3px solid #4361ee;
    font-size: 12px;
    line-height: 1.4;
    color: #333;
}

.top-game-item:hover {
    background: #f0f4ff;
}

.opening-book-game-link {
    cursor: pointer;
}

.top-game-players {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.top-game-white {
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

.top-game-vs {
    color: #999;
    font-size: 12px;
}

.top-game-black {
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

.top-game-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.top-game-move {
    font-family: inherit;
    color: #333;
    font-weight: 600;
    font-size: 11px;
}

.top-game-result {
    font-weight: 500;
    color: #333;
    font-size: 12px;
}

.top-game-event {
    color: #666;
    font-size: 12px;
    flex: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.top-game-link {
    color: #4361ee;
    text-decoration: none;
    font-weight: bold;
    padding: 0 4px;
}

.top-game-link:hover {
    color: #2646db;
}

.move-label {
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
    justify-content: center;
    margin-top: 4px;
    font-size: 0.8rem;
    padding: 0 2px;
    text-align: center;
}

.move-label.move-label-with-count {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
}

.move-label-main {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
}

.move-label-separator {
    color: inherit;
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
    display: inline-block;
    min-width: 1.2rem;
    text-align: center;
    opacity: 0.7;
}

.move-label-games {
    color: inherit;
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
}

.stats-bar-container {
    height: 16px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    width: 100%;
    border: 1px solid #ccc;
    margin-top: 4px;
    margin-bottom: 4px;
}

.bar-white {
    background-color: white;
    color: #333;
    text-align: center;
    font-size: 10px;
    line-height: 16px;
    font-weight: bold;
}

.bar-draw {
    background-color: #ced4da;
    color: #333;
    text-align: center;
    font-size: 10px;
    line-height: 16px;
    font-weight: bold;
}

.bar-black {
    background-color: black;
    color: white;
    text-align: center;
    font-size: 10px;
    line-height: 16px;
    font-weight: bold;
}

.stats-counts-wrapper {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #666;
    padding: 0 2px;
    width: 100%;
}

.stats-counts-wrapper span {
    flex-basis: 33%;
}

.stats-counts-wrapper .count-w {
    text-align: left;
}

.stats-counts-wrapper .count-d {
    text-align: center;
}

.stats-counts-wrapper .count-l {
    text-align: right;
}

@media (max-width: 900px) {
    .opening-books-grid {
        grid-template-columns: 1fr;
    }
}
.public-event-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    padding: .65rem 1rem;
    border-bottom: 1px solid #d7dde5;
    background: #fff;
}

.public-event-nav-link,
.public-event-nav-section select {
    min-height: 2.35rem;
    border: 1px solid #b8c2cf;
    border-radius: .45rem;
    background: #fff;
    color: #203047;
    font: inherit;
}

.public-event-nav [hidden] { display: none !important; }

.public-event-nav-link {
    display: inline-flex;
    align-items: center;
    padding: .4rem .75rem;
    text-decoration: none;
}

.public-event-nav-link[aria-current="page"] {
    border-color: #2f5fbd;
    background: #2f5fbd;
    color: #fff;
}

.public-event-nav-link:focus-visible,
.public-event-nav-section select:focus-visible {
    outline: 3px solid #f5b942;
    outline-offset: 2px;
}

.public-event-nav-section {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    min-height: 2.35rem;
    box-sizing: border-box;
    padding: .25rem .55rem;
    border: 1px solid #b8c2cf;
    border-radius: .45rem;
    background: #fff;
    color: #203047;
}

.public-event-nav-section select {
    min-height: 1.75rem;
    padding: .15rem .35rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

@media (max-width: 640px) {
    .public-event-nav { padding: .55rem .7rem; }
    .public-event-nav-section { flex: 1 1 100%; }
    .public-event-nav-section select { flex: 1; min-width: 0; }
}
