﻿/* ============================================================
   Game Review Page — v2 with Audience View
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: #120F0D;
    border: 1px solid #B08D57;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.modal-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #D5A642;
}

.modal-card__body p {
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}

.modal-card__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.25rem;
}

.center-content {
    width: 98%;
    margin-left: auto;
    margin-right: auto;
}

.review-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(213, 166, 66, 0.25);
    border-radius: 8px;
    background: rgba(213, 166, 66, 0.04);
    color: rgba(247, 234, 208, 0.65);
    font-size: 1rem;
    cursor: pointer;
    transition: all 160ms ease;
}

    .review-btn:hover:not(:disabled) {
        background: rgba(213, 166, 66, 0.12);
        border-color: rgba(213, 166, 66, 0.45);
        color: #ffe8a0;
        box-shadow: 0 0 10px rgba(213, 166, 66, 0.15);
    }

    .review-btn:disabled {
        opacity: 0.25;
        cursor: not-allowed;
    }

.review-btn--play {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 1.2rem;
    border-color: rgba(213, 166, 66, 0.4);
    background: rgba(213, 166, 66, 0.08);
}

    .review-btn--play:hover:not(:disabled) {
        background: rgba(213, 166, 66, 0.18);
        box-shadow: 0 0 18px rgba(213, 166, 66, 0.25);
    }
.review-speed-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.65rem;
    margin-bottom: 0.7rem;
}
.review-controls-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 2px 0;
    flex-wrap: nowrap;
    z-index: 1;
}
/* The vertical bracket separating manual-step controls from autoplay controls */
.review-controls-mobile__divider {
    width: 1px;
    height: 26px;
    background: rgba(176, 141, 87, 0.35);
    margin: 0 3px;
    flex-shrink: 0;
}
.segmented-control--mobile {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    background: #1C1814;
    border: 0.5px solid rgba(176, 141, 87, 0.2);
    border-radius: 12px;
    flex-shrink: 0;
}
    .segmented-control--mobile button {
        display: flex;
        align-items: center;
        gap: 3px;
        padding: 5px 7px;
        font-size: 1rem !important;
        border: none;
        border-radius: 9px;
        background: transparent;
        color: #B0A78F;
        cursor: pointer;
        white-space: nowrap;
        transition: background 160ms ease, color 160ms ease;
    }

        /* Active speed pill — reuses your gold highlight; assumes GetSpeedButtonClass
           applies an 'active' class. Adjust the selector to match its actual output. */
        .segmented-control--mobile button.active {
            background: #D5A642;
            color: #2A1D08;
            font-weight: 500;
        }

.review-speed-label {
    font-size: 0.62rem;
    line-height: 1;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(218, 185, 108, 0.72);
    font-weight: 800;
}

.review-speed-control .segmented-control button {
    transition: opacity 150ms ease, background-color 150ms ease, color 150ms ease;
}
    .review-speed-control .segmented-control button:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        pointer-events: none;
    }

    /* Keep the active/selected speed visible even while disabled, just dimmer than an enabled active state */
        .review-speed-control .segmented-control button:disabled.active {
            opacity: 0.6;
        }

.review-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 60vh;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: rgba(247, 234, 208, 0.56);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ════════════════════════════════════════════
   AUDIENCE VIEW — 3-board layout
   ════════════════════════════════════════════ */

.review-audience-layout {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 76px);
    padding: 1rem 2vw;
    gap: 0.75rem;
}

.review-audience-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.review-audience-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.review-audience-boards {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 42px;
    margin: 0 auto;
}

.review-audience-board-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 1;
    transition: opacity 200ms ease, filter 200ms ease, transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
    .review-audience-board-panel:not(.review-audience-board-panel--active) {
        opacity: 0.75;
        filter: saturate(0.75) brightness(0.82);
    }
.review-audience-board-panel--active {
    transform: scale(1.015);
    opacity: 1.0;
    filter: none;
}

.review-audience-board-panel--center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    align-self: center;
    z-index: 1;
}
.review-audience-board-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border: 1px solid rgba(213, 166, 66, 0.22);
    border-radius: 999px;
    background: rgba(10, 9, 8, 0.8);
    font-family: 'Cinzel', serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(247, 234, 208, 0.65);
}

.player-emblem--sun-sm {
    color: #d5a642;
}

.player-emblem--moon-sm {
    color: rgba(180, 200, 220, 0.8);
}

/* ── Compact boards for side panels ── */
.board-stage--compact {
    padding: 0.5rem;
    border-radius: 16px;
}

.board-container-threed--compact {
    transform: rotateX(22deg) rotateZ(0deg) scale(0.8);
    transform-origin: top center;
    margin-bottom: -120px; /* compensate for scale whitespace */
}
.board-container-classic--compact {
    transform: scale(0.8);
    transform-origin: top center;
    margin-bottom: -120px; /* compensate for scale whitespace */
}

    .board-container-threed--compact .board-frame {
        padding: 30px;
    }
    .board-container-classic--compact .board-frame {
        padding: 30px;
    }

/* ── Compact moving piece adjustments ── */
.moving-piece--compact {
    width: 30px;
}

/* ── Audience move list bar ── */
.review-audience-move-list-bar {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.review-move-list--horizontal {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.25rem;
    max-height: none;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(213, 166, 66, 0.3) transparent;
}

    .review-move-list--horizontal::-webkit-scrollbar {
        height: 3px;
    }

    .review-move-list--horizontal::-webkit-scrollbar-thumb {
        background: rgba(213, 166, 66, 0.3);
        border-radius: 2px;
    }

    .review-move-list--horizontal .review-move-row {
        flex-shrink: 0;
        padding: 0.3rem 0.5rem;
        border-left: none;
        border-bottom: 3px solid transparent;
        border-radius: 4px 4px 0 0;
    }

    .review-move-list--horizontal .review-move-row--active {
        border-bottom-color: #d5a642;
    }


/* ════════════════════════════════════════════
   SINGLE BOARD VIEW — Playback controls
   ════════════════════════════════════════════ */

.review-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 0;
    z-index: 1;
}
.z-index-1 {
    z-index: 1;
}

/* ════════════════════════════════════════════
   Move list (vertical — single board view)
   ════════════════════════════════════════════ */
.review-move-list {
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(213, 166, 66, 0.3) transparent;
}

    .review-move-list::-webkit-scrollbar {
        width: 3px;
    }

    .review-move-list::-webkit-scrollbar-thumb {
        background: rgba(213, 166, 66, 0.3);
        border-radius: 2px;
    }

.review-move-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: rgba(247, 234, 208, 0.5);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    border-left: 3px solid transparent;
}

    .review-move-row:hover {
        background: rgba(213, 166, 66, 0.08);
        color: rgba(247, 234, 208, 0.8);
    }

    .review-move-row:nth-child(even) {
        background: rgba(255, 255, 255, 0.012);
    }

.review-move-row--active {
    background: rgba(213, 166, 66, 0.12);
    color: #ffe8a0;
    border-left-color: #d5a642;
}

    .review-move-row--active:nth-child(even) {
        background: rgba(213, 166, 66, 0.12);
    }

.review-move-row--white .review-move-piece {
    color: rgba(247, 234, 208, 0.8);
}

.review-move-row--black .review-move-piece {
    color: rgba(160, 170, 180, 0.7);
}

.review-move-num {
    min-width: 2rem;
    font-weight: 700;
    color: rgba(247, 234, 208, 0.35);
    text-align: right;
}

.review-move-piece {
    font-size: 0.85rem;
}

.review-move-notation {
    flex: 1;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.review-move-flag {
    font-size: 0.6rem;
    opacity: 0.7;
}

.review-move-flag--capture {
    color: #b83b3b;
}

.review-move-flag--check {
    color: #e8a83e;
}

.review-move-flag--promo {
    color: #4ecdc4;
}


/* ════════════════════════════════════════════
   Analytics panel
   ════════════════════════════════════════════ */

.analytics-grid {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.analytics-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    font-size: 0.72rem;
}

    .analytics-row + .analytics-row {
        border-top: 1px solid rgba(255, 255, 255, 0.03);
    }

.analytics-label {
    color: rgba(247, 234, 208, 0.45);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.analytics-value {
    color: rgba(247, 234, 208, 0.8);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.analytics-row--highlight .analytics-value {
    color: #e8a83e;
}

.analytics-row--capture .analytics-value {
    color: #b83b3b;
}

.analytics-empty {
    color: rgba(247, 234, 208, 0.3);
    font-size: 0.75rem;
    font-style: italic;
    text-align: center;
    padding: 0.5rem 0;
}

/* Under 1920px: God View on top, player views side by side below */
@media (max-width: 1919px) {
    .review-audience-boards {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 1.5rem 1rem;
    }
}







/* Normal visible piece — no change */
/*.square--visible .piece {
    opacity: 1;
}*/

/* Piece hidden from active player but visible to audience */
.piece--audience-ghost .chess-piece-classic,
.piece--audience-ghost .chess-piece-threed {
    opacity: 0.75;
    filter: blur(0.5px) saturate(0.4) brightness(0.7);
    mix-blend-mode: screen;
    overflow: unset !important;
}

/* The fog overlay itself — slightly more transparent so ghost shows through */
.square--light.chess-square.has-fog.piece--audience-ghost {
    opacity: 0.95 !important; /*reduce from your normal fog opacity */
    overflow: unset !important;
}
.square--dark.chess-square.has-fog.piece--audience-ghost {
    opacity: 0.7 !important; /*reduce from your normal fog opacity */
    overflow: unset !important;
}
.chess-square.has-fog.piece--audience-ghost::before {
    opacity: 0.5 !important;
}
.chess-square.has-fog.piece--audience-ghost::after {
    opacity: 0.7 !important;
}

.piece--audience-ghost.audience-unknown-piece {
    animation: audienceIdentityFlicker 3.5s ease-in-out infinite;
}

.piece--audience-ghost.audience-specter-overlay {
    position: absolute;
    inset: 0;
    align-items: center;
    z-index: 11;
    pointer-events: none;
    animation: audienceSpecterFlicker 3.5s ease-in-out infinite;
}

/* Real piece fades out as specter fades in, and vice versa */
@keyframes audienceIdentityFlicker {
    0%, 40% {
        opacity: 0.85;
    }

    50%, 90% {
        opacity: 0.65;
    }

    100% {
        opacity: 0.85;
    }
}

@keyframes audienceSpecterFlicker {
    0%, 40% {
        opacity: 0;
    }

    50%, 90% {
        opacity: 0.45;
        filter: saturate(0.75) brightness(1.25) drop-shadow(0 0 10px rgba(255, 230, 170, 0.65));
    }

    100% {
        opacity: 0;
    }
}

.audience-perspective-shift {
    animation: perspectiveShift 800ms ease-in-out;
}

@keyframes perspectiveShift {
    0% {
        opacity: 1;
        filter: blur(0px) brightness(1);
    }

    30% {
        opacity: 0.4;
        filter: blur(8px) brightness(0.7) saturate(0.3);
    }

    50% {
        opacity: 0.3;
        filter: blur(12px) brightness(0.5) saturate(0.1);
    }

    70% {
        opacity: 0.4;
        filter: blur(8px) brightness(0.7) saturate(0.3);
    }

    100% {
        opacity: 1;
        filter: blur(0px) brightness(1);
    }
}

.audience-perspective-shift::before {
    content: '';
    position: absolute;
    inset: 15%;
    z-index: 200;
    mix-blend-mode: screen;
    pointer-events: none;
    background: radial-gradient(ellipse at 30% 40%, rgba(180, 190, 200, 0.35), transparent 50%), radial-gradient(ellipse at 70% 60%, rgba(160, 170, 180, 0.25), transparent 45%), radial-gradient(ellipse at 50% 50%, rgba(24, 24, 26, 0.85), transparent 70%);
    animation: fogSweep 800ms ease-in-out;
}

@keyframes fogSweep {
    0% {
        opacity: 0;
        transform: scale(1.0);
    }

    30% {
        opacity: 0.15;
        transform: scale(0.9);
    }

    50% {
        opacity: 0.4;
        transform: scale(1.1);
    }

    70% {
        opacity: 0.15;
        transform: scale(0.9);
    }

    100% {
        opacity: 0;
        transform: scale(1.0);
    }
}







































.moves-panel {
    border: 1px solid rgba(213, 166, 66, 0.28);
    border-radius: 6px;
    background: rgba(10, 9, 8, 1.0);
    overflow: hidden;
    margin: 18px 0;
    max-width: 414px;
}

.moves-table {
    display: flex;
    flex-direction: column;
    max-height: 450px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(213, 166, 66, 0.3) transparent;
}
    .moves-table::-webkit-scrollbar {
        width: 3px;
    }

    .moves-table::-webkit-scrollbar-thumb {
        background: rgba(213, 166, 66, 0.3);
        border-radius: 2px;
    }

.moves-table__row {
    display: grid;
    grid-template-columns: 2.5rem 1fr 1fr;
    gap: 0.55rem;
    align-items: center;
    padding: 0.25rem 0.45rem;
    border-bottom: none;
}

.moves-table__row--odd {
    background: rgba(255, 255, 255, 0.025);
}

.moves-table__row--even {
    background: rgba(213, 166, 66, 0.075);
}

.moves-table__row:hover {
    background: rgba(213, 166, 66, 0.19);
}

.moves-table__row--header {
    color: #d5a642;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.moves-table__number {
    color: #d5a642;
    opacity: 0.95;
}

.moves-table__move-cell {
    min-width: 0;
    display: flex;
    align-items: center;
}

.move-entry {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0.2rem 0.35rem;
    border-radius: 0.35rem;

    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    cursor: pointer;
    min-width: 0;
}
    .move-entry:hover {
        background: rgba(213, 166, 66, 0.5);
        border-color: rgba(213, 166, 66, 0.35);
    }

    .move-entry:focus-visible {
        outline: 2px solid rgba(213, 166, 66, 0.75);
        outline-offset: 2px;
    }

    .move-entry:disabled {
        cursor: not-allowed;
        pointer-events: none;
    }

.move-entry--disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.move-entry--current {
    background: linear-gradient( 90deg, rgba(213, 166, 66, 0.24), rgba(213, 166, 66, 0.10) );
    border-color: rgba(213, 166, 66, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 230, 160, 0.18), 0 0 10px rgba(213, 166, 66, 0.18);
}

    .move-entry--current .move-square,
    .move-entry--current .move-arrow {
        color: #f5d37a;
    }

.move-entry--visible {
    opacity: 1;
}

.move-entry--partial {
    opacity: 1;
}

.move-entry--fogged {
    opacity: 0.5;
    filter: grayscale(1);
}

.move-piece {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.move-piece__img {
    width: 1.65rem;
    height: 1.65rem;
    object-fit: contain;
    display: block;
}
    .move-piece__img[src*="black"]:not(.move-piece.move-square--fogged) {
        filter: brightness(1.65) contrast(1.15) drop-shadow(0 0 2px rgba(255, 220, 140, 0.25));
    }

.move-square--visible {
    opacity: 1;
}

.move-piece.move-square--fogged,
.move-square--fogged {
    opacity: 0.35;
    filter: grayscale(1);
}

.move-symbol {
    font-weight: 700;
    text-shadow: 0 0 6px currentColor;
}

.move-symbol--capture {
    color: #d66b3d;
}

.move-symbol--check {
    color: #f2c94c;
}

.move-symbol--checkmate {
    color: #ff3b3b;
    text-shadow: 0 0 6px #ff3b3b, 0 0 12px rgba(255, 59, 59, 0.65);
}

.move-promotion {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    color: #d5a642;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 5px;
}
    .move-promotion .move-piece__img {
        width: 1.5rem;
        height: 1.5rem;
        object-fit: contain;
        display: inline-block;
        vertical-align: middle;
    }

.move-captured-piece {
    opacity: 0.85;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .game-variant-banner svg {
        flex-shrink: 0;
        vertical-align: middle;
    }

    .review-controls {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.55rem 0;
    }

    .segmented-control--mobile button {
        font-size: 0.75rem !important;
    }

    .review-btn {
        width: 36px;
        height: 36px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(213, 166, 66, 0.25);
        border-radius: 8px;
        background: rgba(213, 166, 66, 0.04);
        color: rgba(247, 234, 208, 0.65);
        font-size: 1rem;
        cursor: pointer;
        transition: all 160ms ease;
    }

    .review-speed-control {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        margin-top: 0.55rem;
        margin-bottom: 0.6rem;
    }

    .moves-panel {
        margin: -4px 0;
        max-width: none;
    }

    .moves-horizontal {
        display: flex !important;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0.6rem;
        scroll-snap-type: x proximity;
    }

    .moves-horizontal__pair {
        flex: 0 0 auto;
        min-width: 72px;
        background: rgba(28, 24, 20, 0.6);
        border: 1px solid rgba(213, 166, 66, 0.2);
        border-radius: 8px;
        padding: 6px 10px;
        scroll-snap-align: start;
    }

        .moves-horizontal__pair.current {
            border-color: rgba(213, 166, 66, 0.7);
            background: rgba(42, 38, 34, 0.8);
        }

    .moves-horizontal__num {
        font-size: 0.65rem;
        color: rgba(213, 166, 66, 0.8);
        margin-bottom: 3px;
    }

    .moves-horizontal__move {
        font-size: 0.72rem;
        color: #ede3d0;
        white-space: nowrap;
    }

    /* ── Mobile merged playback row ── */

        .segmented-control--mobile button {
            font-size: 10px;
            padding: 5px 7px;
        }

            .segmented-control--mobile button i {
                font-size: 12px;
            }

            /* Active speed pill — reuses your gold highlight; assumes GetSpeedButtonClass
           applies an 'active' class. Adjust the selector to match its actual output. */
            .segmented-control--mobile button.active {
                background: #D5A642;
                color: #2A1D08;
                font-weight: 500;
            }
}