.lsk-games-wrap,
.lsk-club-game,
.lsk-games-access-card {
    --lsk-blue: #145c8e;
    --lsk-blue-dark: #0d436a;
    --lsk-green: #177245;
    --lsk-red: #b42318;
    --lsk-border: #d9dee5;
    --lsk-muted: #5d6875;
    --lsk-surface: #f7f9fb;
    box-sizing: border-box;
    width: 100%;
    margin: 1.5rem 0;
}

.lsk-games-archive-template {
    width: 100%;
}

.lsk-games-access-template {
    width: 100%;
}

.lsk-games-archive-page {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem) 0;
}

.lsk-games-access-card {
    width: min(760px, calc(100% - 2rem));
    margin: clamp(2rem, 6vw, 4rem) auto;
    padding: clamp(1rem, 3vw, 1.6rem);
    border: 1px solid var(--lsk-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(20, 34, 49, .05);
}

.lsk-games-access-card h1 {
    margin-top: 0;
}

.lsk-games-wrap *,
.lsk-club-game *,
.lsk-games-access-card * {
    box-sizing: border-box;
}

.lsk-games-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0 0 1.5rem;
    padding: .65rem;
    border: 1px solid var(--lsk-border);
    border-radius: 10px;
    background: var(--lsk-surface);
}

.lsk-games-nav a {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    padding: .5rem .8rem;
    border-radius: 7px;
    color: var(--lsk-blue-dark);
    font-weight: 650;
    text-decoration: none;
}

.lsk-games-nav a:hover,
.lsk-games-nav a:focus,
.lsk-games-nav a[aria-current="page"] {
    background: #e3eef6;
}

.lsk-notice {
    margin: 0 0 1.25rem;
    padding: .85rem 1rem;
    border-left: 4px solid var(--lsk-blue);
    border-radius: 4px;
    background: var(--lsk-surface);
}

.lsk-notice-success {
    border-left-color: var(--lsk-green);
    background: #eef8f2;
}

.lsk-notice-error {
    border-left-color: var(--lsk-red);
    background: #fff1f0;
}

.lsk-game-form {
    max-width: 850px;
    margin: 1.25rem 0 2rem;
    padding: clamp(1rem, 3vw, 1.6rem);
    border: 1px solid var(--lsk-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(20, 34, 49, .05);
}

.lsk-game-form h2 {
    margin-top: 0;
}

.lsk-field {
    margin: 0 0 1.25rem;
}

.lsk-field > label,
.lsk-field > legend {
    display: block;
    margin: 0 0 .45rem;
    color: #202a34;
    font-weight: 700;
}

.lsk-field textarea,
.lsk-field input[type="text"],
.lsk-field select,
.lsk-games-filters input[type="search"],
.lsk-games-filters select,
.lsk-player-name-filter input[type="text"],
.lsk-analysis select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding: .65rem .75rem;
    border: 1px solid #aeb7c2;
    border-radius: 7px;
    background: #fff;
    color: #17212b;
    font: inherit;
}

.lsk-field textarea {
    min-height: 120px;
    resize: vertical;
}

.lsk-field textarea[name="lsk_pgn"] {
    min-height: 310px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .93rem;
    line-height: 1.5;
}

.lsk-field textarea:focus,
.lsk-field input:focus,
.lsk-games-filters input:focus,
.lsk-games-filters select:focus,
.lsk-player-name-filter input:focus,
.lsk-analysis select:focus {
    border-color: var(--lsk-blue);
    outline: 3px solid rgba(20, 92, 142, .18);
    outline-offset: 1px;
}

.lsk-field-help {
    margin: .35rem 0 0;
    color: var(--lsk-muted);
    font-size: .92rem;
}

.lsk-optional {
    color: var(--lsk-muted);
    font-weight: 400;
}

.lsk-visibility-field {
    padding: 0;
    border: 0;
}

.lsk-visibility-field label {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    margin: .55rem 0;
    padding: .75rem;
    border: 1px solid var(--lsk-border);
    border-radius: 8px;
    cursor: pointer;
}

.lsk-visibility-field label:has(input:checked) {
    border-color: var(--lsk-blue);
    background: #f0f7fc;
}

.lsk-visibility-field input {
    width: 18px;
    height: 18px;
    margin-top: .2rem;
}

.lsk-visibility-field small {
    display: block;
    margin-top: .12rem;
    color: var(--lsk-muted);
}

.lsk-button,
button.lsk-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin: 0 .35rem .35rem 0;
    padding: .62rem 1rem;
    border: 1px solid var(--lsk-blue);
    border-radius: 7px;
    background: #fff;
    color: var(--lsk-blue-dark);
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.lsk-button-primary,
button.lsk-button-primary {
    background: var(--lsk-blue);
    color: #fff;
}

.lsk-button:hover,
.lsk-button:focus {
    border-color: var(--lsk-blue-dark);
    background: #e9f2f8;
}

.lsk-button-primary:hover,
.lsk-button-primary:focus {
    background: var(--lsk-blue-dark);
    color: #fff;
}

.lsk-button:disabled {
    cursor: wait;
    opacity: .58;
}

.lsk-form-status {
    min-height: 1.5rem;
    margin: 0 0 .5rem;
    color: var(--lsk-muted);
}

.lsk-form-status.is-error {
    color: var(--lsk-red);
    font-weight: 650;
}

.lsk-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.lsk-games-table,
.lsk-saved-analysis table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.lsk-games-table th,
.lsk-games-table td,
.lsk-saved-analysis th,
.lsk-saved-analysis td {
    padding: .7rem;
    border-bottom: 1px solid var(--lsk-border);
    text-align: left;
    vertical-align: top;
}

.lsk-games-table th,
.lsk-saved-analysis th {
    background: var(--lsk-surface);
    white-space: nowrap;
}

.lsk-actions {
    white-space: nowrap;
}

.lsk-actions a,
.lsk-link-button {
    margin-right: .55rem;
}

.lsk-actions form {
    display: inline;
}

.lsk-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--lsk-red);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.lsk-status,
.lsk-visibility-badge {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: #edf0f3;
    color: #384552;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}

.lsk-visibility-public {
    background: #e8f7ef;
    color: #12633c;
}

.lsk-visibility-members {
    background: #fff1d6;
    color: #73510b;
}

.lsk-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
}

.lsk-archive-tools,
.lsk-my-games-tools {
    margin: 0 0 1.25rem;
}

.lsk-games-filters,
.lsk-player-name-filter {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .75rem;
    align-items: end;
    margin: 0 0 1rem;
    padding: clamp(.85rem, 2.5vw, 1.15rem);
    border: 1px solid var(--lsk-border);
    border-radius: 11px;
    background: var(--lsk-surface);
}

.lsk-player-name-filter {
    grid-template-columns: minmax(min(100%, 280px), 1fr) auto;
}

.lsk-filter-field span {
    display: block;
    margin: 0 0 .32rem;
    color: #202a34;
    font-weight: 700;
}

.lsk-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: center;
}

.lsk-filter-reset {
    color: var(--lsk-muted);
    font-weight: 700;
}

.lsk-period-archive {
    margin: 0 0 1.25rem;
    padding: 1rem;
    border: 1px solid var(--lsk-border);
    border-radius: 11px;
    background: #fff;
}

.lsk-period-archive h3 {
    margin: 0 0 .75rem;
}

.lsk-period-years,
.lsk-period-months {
    list-style: none;
}

.lsk-period-years {
    display: grid;
    gap: .8rem;
    margin: 0;
    padding: 0;
}

.lsk-period-months {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: .45rem 0 0;
    padding: 0;
}

.lsk-period-year > a,
.lsk-period-months a,
.lsk-my-games-tabs a {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: .3rem;
    padding: .38rem .62rem;
    border: 1px solid var(--lsk-border);
    border-radius: 999px;
    color: var(--lsk-blue-dark);
    font-weight: 700;
    text-decoration: none;
}

.lsk-period-year > a span,
.lsk-period-months a span {
    color: var(--lsk-muted);
    font-size: .85em;
}

.lsk-period-year > a:hover,
.lsk-period-year > a:focus,
.lsk-period-months a:hover,
.lsk-period-months a:focus,
.lsk-my-games-tabs a:hover,
.lsk-my-games-tabs a:focus,
.lsk-period-archive a[aria-current="true"],
.lsk-my-games-tabs a[aria-current="page"] {
    border-color: var(--lsk-blue);
    background: #e3eef6;
}

.lsk-my-games-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0 0 .8rem;
}

.lsk-filter-hint {
    margin: 0 0 .75rem;
    color: var(--lsk-muted);
}

.lsk-game-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 1.1rem;
    border: 1px solid var(--lsk-border);
    border-radius: 11px;
    background: #fff;
}

.lsk-game-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .7rem;
}

.lsk-game-card h3 {
    margin: 0 0 .8rem;
    font-size: 1.08rem;
}

.lsk-game-preview {
    display: flex;
    justify-content: center;
    margin: .2rem 0 1rem;
}

.lsk-game-preview-shell {
    display: inline-flex;
    width: min(280px, 100%);
    flex-direction: column;
    gap: .35rem;
    align-items: center;
    color: inherit;
}

.lsk-game-preview-board {
    display: grid;
    width: 100%;
    aspect-ratio: 1;
    grid-template-columns: repeat(8, 1fr);
    overflow: hidden;
    border: 1px solid #b68b6a;
    border-radius: 3px;
    background: #f1dfc4;
    box-shadow: 0 2px 8px rgba(20, 34, 49, .08);
}

.lsk-preview-square {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    line-height: 1;
}

.lsk-preview-square-light {
    background: #f0dec4;
}

.lsk-preview-square-dark {
    background: #b98262;
}

.lsk-preview-piece {
    color: #0b0d10;
    font-family: "Segoe UI Symbol", "DejaVu Sans", "Arial Unicode MS", sans-serif;
    font-size: clamp(1rem, 9vw, 2rem);
    text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}

.lsk-game-preview-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .28rem;
    justify-content: center;
    width: 100%;
}

.lsk-game-preview-controls button {
    display: inline-flex;
    width: 34px;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #e2e7ec;
    color: #253242;
    font: inherit;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.lsk-game-preview-controls button:hover,
.lsk-game-preview-controls button:focus {
    background: var(--lsk-blue);
    color: #fff;
    outline: none;
}

.lsk-game-preview-controls button:focus-visible {
    outline: 3px solid rgba(20, 92, 142, .24);
    outline-offset: 2px;
}

.lsk-game-preview-controls button:disabled {
    background: #edf0f3;
    color: #9aa4af;
    cursor: not-allowed;
}

.lsk-game-preview-caption {
    color: var(--lsk-muted);
    font-size: .85rem;
    font-weight: 700;
}

.lsk-game-card-meta,
.lsk-game-metadata,
.lsk-analysis-result {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .65rem 1rem;
    margin: 0 0 1rem;
}

.lsk-game-card-meta div,
.lsk-game-metadata div,
.lsk-analysis-result div {
    min-width: 0;
}

.lsk-game-card-meta dt,
.lsk-game-metadata dt,
.lsk-analysis-result dt {
    color: var(--lsk-muted);
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.lsk-game-card-meta dd,
.lsk-game-metadata dd,
.lsk-analysis-result dd {
    margin: .1rem 0 0;
    overflow-wrap: anywhere;
}

.lsk-card-link {
    margin-top: auto;
    font-weight: 700;
}

.lsk-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: 1.25rem;
}

.lsk-pagination .page-numbers {
    display: inline-flex;
    min-width: 38px;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: .35rem .6rem;
    border: 1px solid var(--lsk-border);
    border-radius: 6px;
    text-decoration: none;
}

.lsk-pagination .current {
    border-color: var(--lsk-blue);
    background: var(--lsk-blue);
    color: #fff;
}

.lsk-game-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    margin-bottom: 1rem;
}

.lsk-download-link {
    font-weight: 700;
}

.lsk-game-metadata {
    padding: 1rem;
    border: 1px solid var(--lsk-border);
    border-radius: 9px;
    background: var(--lsk-surface);
}

.lsk-club-game-viewer {
    max-width: 100%;
    overflow-x: auto;
}

.lsk-plain-pgn {
    max-height: 36rem;
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--lsk-border);
    border-radius: 8px;
    background: var(--lsk-surface);
    white-space: pre-wrap;
}

.lsk-analysis {
    margin-top: 1.5rem;
    padding: clamp(.9rem, 3vw, 1.25rem);
    border: 1px solid var(--lsk-border);
    border-radius: 10px;
    background: #fff;
}

.lsk-analysis h2 {
    margin-top: 0;
}

.lsk-analysis-privacy {
    color: var(--lsk-muted);
}

.lsk-analysis-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .8rem;
}

.lsk-analysis-position-row {
    display: grid;
    gap: .35rem;
    margin: .75rem 0;
    font-weight: 700;
}

.lsk-analysis-status {
    min-height: 1.5rem;
    margin: .75rem 0;
}

.lsk-eval-bar {
    position: relative;
    width: 100%;
    height: .7rem;
    margin: .8rem 0;
    border: 1px solid #8d97a3;
    background: linear-gradient(90deg, #222 0 50%, #f4f4f4 50% 100%);
}

.lsk-eval-bar span {
    position: absolute;
    top: -3px;
    left: 50%;
    width: 3px;
    height: calc(100% + 6px);
    background: #d63638;
}

.lsk-saved-analysis {
    margin-top: 1rem;
}

.lsk-game-comment {
    margin: 1.5rem 0;
    padding: clamp(.9rem, 3vw, 1.25rem);
    border: 1px solid var(--lsk-border);
    border-radius: 10px;
    background: #fff;
}

.lsk-game-comment h2 {
    margin-top: 0;
}

.lsk-game-comment-body > :last-child {
    margin-bottom: 0;
}

@media (max-width: 760px) {
    .lsk-games-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .lsk-games-table,
    .lsk-games-table tbody,
    .lsk-games-table tr,
    .lsk-games-table td {
        display: block;
        width: 100%;
    }

    .lsk-games-table tr {
        margin-bottom: .9rem;
        padding: .65rem;
        border: 1px solid var(--lsk-border);
        border-radius: 9px;
    }

    .lsk-games-table td {
        display: grid;
        grid-template-columns: minmax(90px, .7fr) 1.3fr;
        gap: .6rem;
        padding: .4rem;
        border: 0;
        white-space: normal;
    }

    .lsk-games-table td::before {
        content: attr(data-label);
        color: var(--lsk-muted);
        font-weight: 700;
    }

    .lsk-actions form {
        display: inline-block;
    }
}

@media (max-width: 540px) {
    .lsk-games-nav a,
    .lsk-analysis-controls .lsk-button,
    .lsk-game-form > .lsk-button {
        width: 100%;
        margin-right: 0;
    }

    .lsk-game-card-top,
    .lsk-game-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}
