.oefeningen-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg) var(--space-4xl);
}

.oefeningen-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.oefeningen-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: 4px;
}

.oefeningen-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.oefeningen-empty {
    text-align: center;
    padding: var(--space-4xl) var(--space-lg);
    color: var(--text-secondary);
}

.oefeningen-empty svg {
    opacity: .3;
    margin-bottom: var(--space-md);
}

/* ── List view ───────────────────────────────────────────────── */

.oefeningen-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: linear-gradient(155deg, var(--bg-primary) 0%, var(--bg-tertiary) 130%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 0 rgba(0, 0, 0, .05), 0 5px 0 rgba(0, 0, 0, .06), 0 14px 26px -10px rgba(0, 0, 0, .18);
}

.oefening-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding: 14px var(--space-xl);
    border-bottom: 1px solid var(--color-gray-100);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background .15s ease;
}

.oefening-row:last-child {
    border-bottom: none;
}

.oefening-row:hover {
    background: var(--bg-secondary);
}

.oefening-row-main {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.oefening-row-index {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    letter-spacing: .04em;
    flex-shrink: 0;
}

.oefening-row-players {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
}

.oefening-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.oefening-row-vs {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.oefening-row-badges {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.oefening-row-tag {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: linear-gradient(160deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 var(--bevel-primary-edge), 0 2px 6px var(--bevel-primary-glow);
    white-space: nowrap;
}

.oefening-row-event {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
}

.oefening-row-info {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.oefening-row-moves {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

.oefening-row-grade {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 2px 0 rgba(0, 0, 0, .1), 0 2px 6px rgba(0, 0, 0, .12);
}

.oefening-row-grade--new {
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    border: 1px solid var(--color-gray-200);
    box-shadow: none;
}

.oefening-row-cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-primary);
    white-space: nowrap;
}

.oefening-row-cta svg {
    transition: transform var(--transition-fast);
}

.oefening-row:hover .oefening-row-cta svg {
    transform: translateX(3px);
}

@media (max-width: 640px) {
    .oefening-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .oefening-row-info {
        justify-content: flex-start;
        width: 100%;
    }

    .oefening-row-name {
        max-width: 140px;
    }
}

@media (max-width: 480px) {
    .oefeningen-title {
        font-size: var(--text-2xl);
    }

    .oefeningen-page {
        padding: var(--space-lg) var(--space-md) var(--space-3xl);
    }
}

/* ── Placeholder (temporary play-page stub) ─────────────────────── */

.oefening-placeholder {
    max-width: 480px;
    margin: var(--space-4xl) auto;
    text-align: center;
    color: var(--text-secondary);
}

.oefening-placeholder svg {
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}

.oefening-placeholder h1 {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.oefening-placeholder p {
    margin-bottom: var(--space-lg);
}

/* Override global .main-content so the chess layout fills the viewport */
.main-content {
    padding: var(--space-lg) 0 0 0;
    overflow: hidden;
}

@media (max-width: 768px) {
    .main-content {
        margin-right: 0;
    }
}

/* ── Play page layout ───────────────────────────────────────────── */

.oefening-play-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg) var(--space-4xl);
    display: grid;
    grid-template-columns: minmax(0, 640px) minmax(280px, 360px);
    gap: var(--space-2xl);
    align-items: start;
    height: calc(100vh - var(--topbar-height) - var(--space-lg));
    max-height: calc(100vh - var(--topbar-height) - var(--space-lg));
    box-sizing: border-box;
}

.oefening-play-board {
    min-width: 0;
    align-self: start;
    display: flex;
    justify-content: center;
}

.chessboard-container {
    max-width: min(680px, 95vw, calc(100vh - 100px));
    max-height: calc(100vh - 100px);
}

.oefening-play-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    overflow-y: auto;
    height: 100%;
    max-height: 100%;
    padding-right: var(--space-sm);
}

.oefening-play-sidebar::-webkit-scrollbar {
    display: none;
}

.oefening-play-sidebar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#oefeningBoard.chessboard {
    position: relative;
}

.oefening-arrow-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.oefening-arrow {
    stroke-width: 1.6;
    stroke-linecap: round;
    opacity: .85;
    fill: none;
}

.oefening-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.oefening-action-btn:disabled .oefening-spinner {
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Sidebar cards ───────────────────────────────────────────────── */

.oefening-meta-card,
.oefening-score-card,
.oefening-panel {
    background: linear-gradient(155deg, var(--bg-primary) 0%, var(--bg-tertiary) 130%);
    border-radius: var(--radius-xl);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 0 rgba(0, 0, 0, .05), 0 4px 0 rgba(0, 0, 0, .05), 0 10px 18px -8px rgba(0, 0, 0, .16);
    padding: var(--space-lg);
}

.oefening-meta-players {
    font-weight: var(--font-bold);
    font-size: var(--text-base);
    color: var(--text-primary);
}

.oefening-meta-players span {
    color: var(--text-tertiary);
    font-weight: var(--font-normal);
    font-size: var(--text-sm);
    margin: 0 4px;
}

.oefening-meta-sub {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: 6px;
}

.oefening-meta-tag {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: linear-gradient(160deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 var(--bevel-primary-edge), 0 2px 6px var(--bevel-primary-glow);
}

.oefening-meta-event {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.oefening-score-card {
    text-align: center;
}

.oefening-score-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.oefening-score-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

.oefening-score-best {
    margin-top: 4px;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ── Guidance panel ──────────────────────────────────────────────── */

.oefening-panel {
    min-height: 120px;
}

.oefening-step-label {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.oefening-instruction {
    font-size: var(--text-base);
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: var(--space-md);
}

.oefening-move-line {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.oefening-move-chip {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    border: none;
}

.oefening-move-chip.white {
    background: linear-gradient(160deg, #ffffff 0%, #e5e7eb 100%);
    color: #18181b;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 2px 0 rgba(0, 0, 0, .12), 0 2px 5px rgba(0, 0, 0, .12);
}

.oefening-move-chip.black {
    background: linear-gradient(160deg, #3f3f46 0%, #18181b 100%);
    color: #fafafa;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 2px 0 rgba(0, 0, 0, .3), 0 2px 5px rgba(0, 0, 0, .3);
}

.oefening-note {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.oefening-feedback {
    font-size: var(--text-sm);
    line-height: 1.5;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
}

.oefening-feedback--best {
    background: linear-gradient(155deg, #f0fdf4 0%, #dcfce7 100%);
    color: #15803d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 0 rgba(21, 128, 61, .15), 0 3px 8px rgba(34, 197, 94, .15);
}

.oefening-feedback--alt {
    background: linear-gradient(155deg, #fffbeb 0%, #fef3c7 100%);
    color: #b45309;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 0 rgba(180, 83, 9, .15), 0 3px 8px rgba(245, 158, 11, .15);
}

.oefening-feedback--wrong {
    background: linear-gradient(155deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 0 rgba(220, 38, 38, .15), 0 3px 8px rgba(239, 68, 68, .15);
}

.oefening-points {
    font-weight: var(--font-bold);
}

.oefening-action-btn {
    margin-top: var(--space-sm);
}

.oefening-action-btn:first-of-type {
    margin-top: 0;
}

/* ── Final results ───────────────────────────────────────────────── */

.oefening-results {
    text-align: center;
}

.oefening-results-title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.oefening-results-score {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.oefening-grade-badge {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    padding: 5px 16px;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-lg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 3px 0 rgba(0, 0, 0, .1), 0 4px 10px rgba(0, 0, 0, .14);
}

.oefening-results-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

@media (max-width: 860px) {
    .main-content {
        overflow: visible;
    }

    .oefening-play-container {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }

    .oefening-play-board {
        position: sticky;
        top: var(--topbar-height);
        z-index: 10;
        background: var(--bg-primary);
        padding: var(--space-sm) 0;
        height: auto;
    }

    .chessboard-container {
        max-width: min(97vw, 82vh);
        max-height: 70vh;
        margin: 0 auto;
    }

    .oefening-play-sidebar {
        position: static;
        overflow-y: visible;
        height: auto;
        margin-top: var(--space-lg);
        padding-right: 0;
    }

    .oefening-play-sidebar::-webkit-scrollbar {
        display: block;
    }
}

@media (max-width: 860px) and (max-height: 900px) {
    .chessboard-container {
        max-width: min(97vw, 78vh);
        max-height: 65vh;
    }
}

@media (max-width: 860px) and (max-height: 800px) {
    .chessboard-container {
        max-width: min(97vw, 73vh);
        max-height: 60vh;
    }
}

@media (max-width: 860px) and (max-height: 750px) {
    .chessboard-container {
        max-width: min(97vw, 68vh);
        max-height: 55vh;
    }
}

@media (max-width: 860px) and (max-height: 700px) {
    .chessboard-container {
        max-width: min(97vw, 63vh);
        max-height: 50vh;
    }
}

/* ── Locked (cooldown) page ──────────────────────────────────────── */

.oefening-locked {
    max-width: 480px;
    margin: var(--space-4xl) auto;
    text-align: center;
    color: var(--text-secondary);
}

.oefening-locked svg {
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.oefening-locked h1 {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.oefening-locked p {
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.oefening-locked-date {
    display: inline-block;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
    background: linear-gradient(160deg, #cbd5e1 0%, #94a3b8 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 3px 0 var(--bevel-gray-edge), 0 3px 8px var(--bevel-gray-glow);
    border-radius: var(--radius-full);
    padding: 6px 16px;
    margin-bottom: var(--space-lg);
}

/* ── Locked row in overview list ─────────────────────────────────── */

.oefening-row.is-locked {
    cursor: default;
    opacity: .65;
}

.oefening-row.is-locked:hover {
    background: none;
}

.oefening-row-lock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    white-space: nowrap;
}