/* ============================================================
   Chess Board Styles — Texas Blindside Chess Platform
   ============================================================ */

/* Board container */
.chess-board-classic {
    display: grid;
    grid-template-columns: repeat(8, 80px);
    grid-template-rows: repeat(8, 80px);
    border: 2px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chess-board4-classic {
    display: grid;
    grid-template-columns: repeat(14, 75px);
    grid-template-rows: repeat(14, 75px);
}

.chess-board-threed {
    display: grid;
    grid-template-columns: repeat(8, 80px);
    grid-template-rows: repeat(8, 80px);
    /*    border: 2px solid #333;*/
    /* The gap creates the base for our 'groove' */
    gap: 2px;
    background-color: rgba(176, 141, 87, 0.79); /* The dark 'pit' of the groove */
    padding: 2px;
}

/* ── Highlights ── */

/* King danger squares — red highlight for attacked squares within King vision */
.square--danger {
    background-color: #e74c3c !important;
    box-shadow: inset 0 0 8px rgba(231, 76, 60, 0.6);
}

/* 2D - Selected piece square highlight */
.square--selected:not(.is-branch) {
    background-color: #7fc97f !important;
    box-shadow: inset 0 0 26px rgba(100, 200, 100, 0.5), inset 0 0 0 2px rgba(143, 224, 143, 0.85);
}
/* 2D - square the piece moved FROM */
.square--last-move-from:not(.is-branch) {
    background-color: #7fc97f !important;
    box-shadow: inset 0 0 26px rgba(100, 200, 100, 0.4), inset 0 0 0 2px rgba(143, 224, 143, 0.55);
    opacity: 0.7;
}
/* 3D - Selected piece square highlight */
.chess-square__threed.square--selected:not(.is-branch) {
    outline: 4px solid rgba(213, 166, 66, 0.95);
    outline-offset: -4px;
}
/* 3D - moved FROM outer box */
.chess-square__threed.square--last-move-from:not(.is-branch) {
    outline: 3px solid rgba(213, 166, 66, 0.85);
    outline-offset: -3px;
}
    /* 3D - moved FROM inner box */
    .chess-square__threed.square--last-move-from:not(.is-branch)::after {
        outline: 2px solid rgba(213, 166, 66, 0.8);
        outline-offset: -9px;
    }

/* 2D - Selected piece square highlight */
.square--selected.is-branch {
    background-color: #6c7bd4 !important;
    box-shadow: inset 0 0 26px rgba(108, 123, 212, 0.5), inset 0 0 0 2px rgba(150, 162, 230, 0.85);
}
/* 2D - square the piece moved FROM */
.square--last-move-from.is-branch {
    background-color: #6c7bd4 !important;
    box-shadow: inset 0 0 26px rgba(108, 123, 212, 0.4), inset 0 0 0 2px rgba(150, 162, 230, 0.55);
    opacity: 0.7;
}
/* 3D - Selected piece square highlight */
.chess-square__threed.square--selected.is-branch {
    outline: 4px solid rgba(108, 123, 212, 0.95);
    outline-offset: -4px;
}
/* 3D - moved FROM outer box */
.chess-square__threed.square--last-move-from.is-branch {
    outline: 3px solid rgba(108, 123, 212, 0.85);
    outline-offset: -3px;
}
    /* 3D - moved FROM inner box */
    .chess-square__threed.square--last-move-from.is-branch::after {
        outline: 2px solid rgba(108, 123, 212, 0.8);
        outline-offset: -9px;
    }

.king-threat-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    z-index: 12;
    pointer-events: none;
    animation: threatPulse 1.5s ease-in-out infinite;
}

.king-threat--check {
    background: rgba(213, 166, 66, 0.85);
    color: #130e08;
    box-shadow: 0 0 8px rgba(213, 166, 66, 0.5), 0 0 16px rgba(213, 166, 66, 0.2);
}

.king-threat--mate {
    background: rgba(184, 59, 59, 0.9);
    color: #fff;
    box-shadow: 0 0 8px rgba(184, 59, 59, 0.5), 0 0 16px rgba(184, 59, 59, 0.3);
}

@keyframes threatPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

/* Mobile — slightly smaller */
@media (max-width: 480px) {
    .segmented-control-divider {
        margin: 0 0.45rem !important; /* breathing room on both sides */
    }

    .king-threat-indicator {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
        top: 1px;
        right: 1px;
    }

    .check-alert {
        font-size: 0.75rem !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .game-movement-status {
        width: 90% !important;
        justify-content: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

        .game-movement-status > span,
        .game-movement-status--gameover > span {
            font-size: 0.75rem !important;
        }
}

/* ── Legal move indicators ── */
.legal-move-dot {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    z-index: 12;
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.8;
    animation: legal-move-dot-fadeInOut 3.75s ease-in-out infinite;
}

    .legal-move-dot:not(.is-branch) {
        background: radial-gradient(circle, rgba(255, 232, 160, 0.75) 0%, rgba(213, 166, 66, 0.55) 60%, transparent 90%);
        box-shadow: 0 0 8px rgba(213, 166, 66, 0.5), 0 0 16px rgba(213, 166, 66, 0.2);
    }

    .legal-move-dot.is-branch {
        background: radial-gradient(circle, rgba(190, 198, 245, 0.75) 0%, rgba(108, 123, 212, 0.55) 60%, transparent 90%);
        box-shadow: 0 0 8px rgba(108, 123, 212, 0.5), 0 0 16px rgba(108, 123, 212, 0.2);
    }

@keyframes legal-move-dot-fadeInOut {
    0% {
        opacity: 0.8;
        filter: brightness(1);
    }

    50% {
        opacity: 0.35;
        filter: brightness(1.8);
    }

    100% {
        opacity: 0.8;
        filter: brightness(1);
    }
}

/* When a legal move target has a piece (capture indicator) */
.chess-square:has(.chess-piece-classic) .legal-move-dot,
.chess-square:has(.chess-piece-threed) .legal-move-dot {
    width: 90%;
    height: 90%;
    border-radius: 50%;
    background: transparent;
    border: 3px solid rgba(184, 59, 59, 0.7);
    box-shadow: inset 0 0 12px rgba(184, 59, 59, 0.25), 0 0 8px rgba(184, 59, 59, 0.2);
    z-index: -1;
}

.chess4-square:has(.chess-piece-classic) .legal-move-dot,
.chess4-square:has(.chess-piece-threed) .legal-move-dot {
    width: 90%;
    height: 90%;
    border-radius: 50%;
    background: transparent;
    border: 3px solid rgba(184, 59, 59, 0.7);
    box-shadow: inset 0 0 12px rgba(184, 59, 59, 0.25), 0 0 8px rgba(184, 59, 59, 0.2);
    z-index: -1;
}

/* ── Piece images ── */
.chess-piece-classic {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    isolation: isolate;
    image-rendering: optimizeQuality;
    pointer-events: none;
}

/* Silhouette styles — neutral appearance for unknown identity pieces */
.chess-piece[src*="silhouette"] {
    opacity: 0.8;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.4));
}

/* ── Game-over fog dissolve animation ── */
@keyframes fog-dissolve {
    from {
        opacity: 0.85;
    }

    to {
        opacity: 0;
    }
}

.fog-dissolve .fog-overlay {
    animation: fog-dissolve 1.5s ease-out forwards;
}

/* ── Silhouette flip-to-reveal animation ── */
@keyframes silhouette-flip {
    0% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(90deg);
    }

    100% {
        transform: rotateY(0deg);
    }
}

.piece-reveal .chess-piece {
    pointer-events: none;
    animation: silhouette-flip 0.6s ease-in-out;
}

/* ── Game page layout ── */
.game-page {
    min-height: calc(100vh - 76px);
    display: grid;
    grid-template-columns: minmax(340px, 1.0fr) minmax(840px, 1.0fr) minmax(340px, 1.0fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
    padding: clamp(1rem, 2vw, 1.75rem) 5vw clamp(2rem, 5vw, 5rem);
}

.game-page__board-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.game-page__side-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 200px;
    max-width: 280px;
}

.game-page__controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.variant-selector {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.35rem;
    border-radius: 0.85rem;
    background: linear-gradient(180deg, rgba(23, 19, 15, 0.95), rgba(8, 8, 12, 0.95));
    border: 1px solid rgba(190, 147, 67, 0.45);
    box-shadow: inset 0 0 0 1px rgba(255, 230, 160, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.variant-selector__option {
    min-width: 7rem;
    padding: 0.65rem 1rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(190, 147, 67, 0.18);
    background: rgba(255, 255, 255, 0.03);
    color: #c8b98a;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 140ms ease;
}

    .variant-selector__option:hover {
        color: #ffe8a0;
        border-color: rgba(245, 211, 122, 0.45);
        background: rgba(190, 147, 67, 0.12);
    }

.variant-selector__option--active {
    color: #120d07;
    background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.55), transparent 40%), linear-gradient(135deg, #ffe8a0 0%, #d5a642 45%, #8f5f1d 100%);
    border-color: rgba(255, 232, 160, 0.95);
    box-shadow: 0 0 18px rgba(213, 166, 66, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.panel-card-right,
.panel-card-left,
.hero-board-panel {
    z-index: 1;
}













.scene {
    perspective: 1200px; /* Adjust for more/less "depth" */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: #000;
}

.board-container-threed {
    position: relative;
    margin-top: -30px;
    transform: rotateX(22deg) rotateZ(0deg); /* The "3D" Magic */
    box-shadow: 0 50px 100px rgba(0,0,0,0.5);
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}

.board-container-classic {
    position: relative;
    transform: none;
    box-shadow: 0 50px 100px rgba(0,0,0,0.5);
    transition: transform 0.5s ease;
}

.board-flipping {
    animation: perspective-flip 0.33s ease-in-out;
    pointer-events: none;
}

@keyframes perspective-flip {
    0% {
        transform: rotateX(22deg) rotateZ(0deg) scale(1);
        opacity: 1;
        filter: blur(0px) brightness(1);
    }

    50% {
        transform: rotateX(60deg) rotateZ(180deg) scale(0.90);
        opacity: 0.33;
        filter: blur(9px) brightness(1.8);
    }

    100% {
        transform: rotateX(22deg) rotateZ(359deg) scale(1);
        opacity: 1;
        filter: blur(0px) brightness(1);
    }
}

.board-frame {
    padding: 40px;
    background: #120F0D; /* Mahogany frame color */
    border: 4px solid #B08D57; /* Bronze filigree border */
    position: relative;
    border-radius: 4px;
}

.board4-frame {
    padding: 40px;
    background: #120F0D; /* Mahogany frame color */
    position: relative;
}

.chess-square {
    width: 80px;
    height: 80px;
    position: relative;
    overflow: visible;
    z-index: 1;
}

.chess4-square {
    width: 75px;
    height: 75px;
    position: relative;
    overflow: visible;
    z-index: 1;
}

.chess-board-threed .chess-square {
    transform: translateZ(140px);
}

.chess-square.chess-square__threed {
    /* THE GROOVE: Light highlight on top/left, shadow on bottom/right */
    box-shadow: inset 1.5px 1.5px 2px rgba(255, 255, 255, 0.08), inset -1.5px -1.5px 2px rgba(0, 0, 0, 0.5);
}

/* THE WEATHERING: Using a pseudo-element to layer texture over color */
.chess-square::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.85;
    mix-blend-mode: overlay;
    mix-blend-mode: soft-light;
    pointer-events: none; /* Ensures the texture doesn't block clicks */
    z-index: -1;
}

.chess4-square::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.85;
    mix-blend-mode: overlay;
    mix-blend-mode: soft-light;
    pointer-events: none; /* Ensures the texture doesn't block clicks */
    z-index: -1;
}

.chess-square.chess-square__threed::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.85;
    mix-blend-mode: overlay;
    /* Replace with your weathered stone/parchment texture URL */
    background-image: url('/images/weathered-stone.png');
    /* Unique offset per square using the variables from Razor */
    background-position: var(--tex-x) var(--tex-y);
    background-size: 256px 256px;
    mix-blend-mode: soft-light;
    pointer-events: none; /* Ensures the texture doesn't block clicks */
    z-index: -1;
}

.chess-square.square--dark,
.chess4-square.square--dark {
    background-color: #1E1B18; /* Obsidian base */
    background-image: linear-gradient(145deg, #1e1b18, #262422);
}
/* Charcoal Obsidian */
.chess-square.square--light,
.chess4-square.square--light {
    background-color: #7D6348; /* Aged Sepia base */
    background-image: linear-gradient(145deg, #7d6348, #5e4a36);
}
/* Aged Sepia */

.labels {
    position: absolute;
    color: #B08D57;
    font-family: 'Crimson Text', serif;
    font-weight: bold;
    font-size: 1.2rem;
}

.files {
    bottom: 5px;
    left: 40px;
    display: flex;
    width: 660px;
    justify-content: space-around;
}

.board4-frame > .files {
    width: 1050px !important;
}
    .board4-frame > .files > span {
        width: 18px !important;
        min-width: 18px !important;
        align-content: center;
        text-align: center;
    }

.files--compact {
    bottom: 3px;
    left: 25px;
    display: flex;
    width: 660px;
    justify-content: space-around;
}

.panel-card-left.mt-9,
.panel-card-right.mt-9 {
    margin-top: 9rem !important;
    z-index: 1;
}

@media (max-width: 1440px) {
    .hero {
        grid-template-columns: minmax(630px, 1.0fr) minmax(340px, 1.0fr) !important;
        /*        gap: clamp(2rem, 5vw, 5rem);
        padding: clamp(2rem, 5vw, 5rem) 5vw;*/
    }

    .files {
        width: 496px;
    }

    .files--compact {
        width: 496px;
    }

    .ranks {
        height: 496px !important;
    }

    .hero-board-panel {
        min-width: 630px !important;
        max-width: 630px !important;
        width: 630px !important;
    }

    .hero-copy {
        max-width: 458px;
    }

    .demo-playback-button {
        width: 36px;
        height: 36px;
    }

    .vision-helper-overlay {
        left: 40px !important;
        top: 40px !important;
        width: 480px !important;
        height: 480px !important;
    }

    .panel-card {
        min-width: 240px;
        max-width: 240px;
        width: 240px;
    }

    .game-page {
        grid-template-columns: minmax(255px, 1.0fr) minmax(630px, 1.0fr) minmax(255px, 1.0fr) !important;
        gap: clamp(1rem, 4vw, 4rem) !important;
        padding: clamp(1rem, 4vw, 4rem) 4vw !important;
    }

    .game-page__side-panel {
        min-width: 150px;
        max-width: 210px;
    }

    .chess-square {
        width: 60px;
        height: 60px;
    }

    .chess-board-classic {
        grid-template-columns: repeat(8, 60px);
        grid-template-rows: repeat(8, 60px);
        border: 1px solid #333;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .chess-board-threed {
        grid-template-columns: repeat(8, 60px);
        grid-template-rows: repeat(8, 60px);
        /*    border: 2px solid #333;*/
        /* The gap creates the base for our 'groove' */
        gap: 1px;
        background-color: rgba(176, 141, 87, 0.79); /* The dark 'pit' of the groove */
        padding: 1px;
    }

    .moving-piece {
        --sq-size: 60px !important;
        --frame-pad: 30px !important;
        --move-scale: 0.75 !important;
        --piece-base-transform: translate(-50%, -78%) rotateX(-22deg) translateY(-9px) translateX(12px);
    }
}

@media (max-width: 480px) {

    .hide-on-mobile {
        display: none !important;
    }

    .board-status {
        position: absolute;
        width: 90% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        top: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        color: rgba(247, 234, 208, 0.72);
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }
    /* ── Game page: single column ── */
    .game-page {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    .board-status {
        top: -9px !important;
        font-size: 0.65rem;
    }

    /* ── Board panel: full width ── */
    .hero-board-panel {
        order: 1 !important;
        min-width: unset !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* ── Board squares: 44px fits 8 in ~380px with frame ── */
    .chess-square {
        width: 36px;
        height: 36px;
    }

    .chess-board-classic {
        grid-template-columns: repeat(8, 36px);
        grid-template-rows: repeat(8, 36px);
    }

    .chess-board-threed {
        grid-template-columns: repeat(8, 36px);
        grid-template-rows: repeat(8, 36px);
    }

    /* ── Board container: reduce frame padding ── */
    .board-frame {
        padding: 12px !important;
    }

    /* ── Moving piece: scale for 44px squares ── */
    .moving-piece {
        --sq-size: 36px !important;
        --frame-pad: 12px !important;
        --board-scale: 0.55 !important;
        --piece-base-transform: translate(-50%, -78%) rotateX(-18deg) translateY(-6px) translateX(8px) !important;
    }

    /* ── Vision overlay ── */
    .vision-helper-overlay {
        left: 12px !important;
        top: 12px !important;
        width: 288px !important;
        height: 288px !important;
    }

    /* ── Rank/file labels: smaller ── */
    .ranks {
        height: 288px !important;
        font-size: 0.55rem !important;
    }

    .files {
        width: 288px !important;
        font-size: 0.55rem !important;
    }

    /* ── Side panels: full width, horizontal layout ── */
    /*    .panel-card-left {
        order: 2;
        width: 100% !important;
        min-width: unset !important;
        max-width: unset !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem;
    }*/

    .panel-card-left.mt-9,
    .panel-card-right.mt-9 {
        margin-top: 0.5rem !important;
    }

    .panel-card-right {
        order: 3;
        width: 100% !important;
        min-width: unset !important;
        max-width: unset !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem;
    }

    .panel-card {
        min-width: unset !important;
        max-width: unset !important;
        width: 100% !important;
        margin: 0 !important;
    }

    /* ── Player info cards: side by side above/below board ── */
    .panel-card-right .player-info-card {
        width: 100%;
    }

    /* ── Variant banner: smaller text ── */
    .game-variant-banner {
        font-size: 0.85rem !important;
        padding: 0rem 1rem !important;
        border: none !important;
        border-radius: unset !important;
        background: none !important;
        margin-bottom: -1.75rem !important;
    }

    .game-variant-banner__label {
        font-size: 0.55rem !important;
    }

    /* ── Style/mode toggles: compact ── */
    .preview-controls {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        justify-content: center !important;
        margin-bottom: 0.5rem !important;
    }

    .segmented-control {
        font-size: 0.6rem !important;
    }

    .segmented-control__label {
        font-size: 0.5rem !important;
    }

    .segmented-control__button {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.55rem !important;
    }

    /* ── Status bar: compact ── */
    .game-status-bar {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        padding: 0.4rem 0 !important;
    }

    .game-movement-status > span {
        font-size: 0.55rem !important;
        padding: 0.4rem 0.6rem !important;
    }

    .game-action-btn {
        font-size: 0.5rem !important;
        padding: 0.4rem 0.55rem !important;
    }

    /* ── Chat: shorter on mobile ── */
    .chat-messages {
        max-height: 120px !important;
    }

    .chat-input {
        font-size: 0.8rem !important;
    }

    /* ── Available moves: compact list ── */
    .available-moves-list {
        max-height: 100px !important;
    }

    /* ── Check alert: smaller ── */
    .check-alert__text {
        font-size: 0.7rem !important;
    }

    /* ── Captured pieces: smaller icons ── */
    .captured-piece {
        font-size: 0.85rem !important;
    }

    /* ── Top nav: compact ── */
    .top-nav {
        height: 52px !important;
        padding: 0 3vw !important;
    }

    .brand__mark {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }

    .brand__name {
        font-size: 0.8rem !important;
    }

    .brand__tagline {
        display: none !important;
    }

    .nav-links a {
        font-size: 0.65rem !important;
        letter-spacing: 0.04em !important;
    }

    /* ── Promotion dialog: fit screen ── */
    .promotion-dialog {
        padding: 1.2rem 1.5rem !important;
    }

    .promotion-dialog__options {
        gap: 0.4rem !important;
    }

    .promotion-dialog__option {
        padding: 0.7rem 0.85rem !important;
        font-size: 0.6rem !important;
    }

    /* ── Reconnecting overlay ── */
    .connection-overlay__card {
        padding: 1.5rem 2rem !important;
    }

    /* ── Disable 3D perspective on mobile — too hard to tap ── */
    .board-stage--3d {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        perspective: 300px !important;
    }

    .board-container-threed {
        transform: rotateX(18deg) rotateZ(0deg) !important;
    }

    /*    .board-status {
        left: 60px !important;
        right: 60px !important;
    }*/
    .fog-activity-indicator {
        top: 14px !important;
    }
}


.ranks {
    left: 10px;
    top: 40px;
    display: flex;
    flex-direction: column;
    height: 640px;
    justify-content: space-around;
}

.board4-frame > .ranks {
    height: 1050px !important;
}

/* Enhancing the Frame with a subtle inner bevel */
.board-frame {
    padding: 40px;
    background: #120F0D;
    border-radius: 7px;
}

    .board-frame:not(.is-branch) {
        border: 3px solid #B08D57;
        box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 15px rgba(176, 141, 87, 0.1);
    }

    .board-frame.is-branch {
        border: 3px solid #6c7bd4;
        box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 15px rgba(108, 123, 212, 0.15);
    }

.chess-piece-threed {
    width: 55%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    /* COUNTER-ROTATE: This makes the piece stand upright */
    transform: rotateX(-22deg) translateY(-12px) translateX(16px) scaleY(var(--piece-scale-y, 1)) scaleX(var(--piece-scale-x, 1));
    transform-origin: bottom;
    transition: all 0.3s ease;
    filter: drop-shadow(0 10px 5px rgba(0,0,0,0.5));
    /* Force pieces to be in a higher stacking context */
    z-index: 10;
    /* Keeps the piece from being 'ghostly' against the stone */
    isolation: isolate;
    image-rendering: optimizeQuality;
    pointer-events: none;
}

.piece-reveal {
    pointer-events: none;
    animation: pieceRevealThroughFog 520ms ease-out forwards;
}

@keyframes pieceRevealThroughFog {
    0% {
        opacity: 0;
        filter: blur(4px) brightness(0.65);
        transform: translateY(8px) scale(0.94);
    }

    45% {
        opacity: 0.65;
        filter: blur(2px) brightness(1.2);
    }

    100% {
        opacity: 1;
        filter: blur(0) brightness(1);
        transform: translateY(0) scale(1);
    }
}

.piece-white {
    mix-blend-mode: hard-light;
}

.piece-black {
    filter: brightness(1.2) contrast(1.1);
}

.piece-eliminated {
    opacity: 0.65; /* recede — reads as "out," not "active" */
    /* deliberately no glow — living pieces sit "up," dead pieces sit flat */
    filter: grayscale(0.5) contrast(0.8) brightness(0.7) drop-shadow(0 0 3px rgba(0, 0, 0, 0.7)); /* faint edge so dark pieces don't vanish on dark squares */
}

.chess-piece-threed.unknown-piece, .chess-piece-classic.unknown-piece {
    opacity: 0.37;
    filter: saturate(0.75) brightness(1.25) drop-shadow(0 0 10px rgba(255, 230, 170, 0.65));
    animation: specterPulse 1.75s ease-in-out infinite;
}

@keyframes specterPulse {
    0%, 100% {
        opacity: 0.28;
        filter: saturate(0.65) brightness(1.1) drop-shadow(0 0 6px rgba(255, 230, 170, 0.35));
    }

    50% {
        opacity: 0.55;
        filter: saturate(0.9) brightness(1.35) drop-shadow(0 0 16px rgba(255, 230, 170, 0.85));
    }
}

.square--light.chess-square.has-fog,
.square--light.chess4-square.has-fog {
    position: relative;
    overflow: hidden;
    opacity: 0.65;
}

.square--dark.chess-square.has-fog,
.square--dark.chess4-square.has-fog {
    position: relative;
    overflow: hidden;
    opacity: 0.90;
}

.chess-square.has-fog::before {
    content: "";
    position: absolute;
    inset: -35%;
    z-index: 5;
    pointer-events: none;
    background: radial-gradient(ellipse at 20% 30%, rgba(210, 210, 210, 0.28), transparent 37%), radial-gradient(ellipse at 75% 55%, rgba(160, 160, 160, 0.18), transparent 40%), radial-gradient(ellipse at 45% 80%, rgba(255, 230, 180, 0.16), transparent 44%), rgba(24, 24, 26, 0.92);
    background-size: 90px 70px, 110px 90px, 130px 110px, 100% 100%;
    filter: blur(8px);
    transform: rotate(0deg);
    animation: fogFlow 11s linear infinite;
}

.chess4-square.has-fog::before {
    content: "";
    position: absolute;
    inset: -35%;
    z-index: 5;
    pointer-events: none;
    background: radial-gradient(ellipse at 20% 30%, rgba(210, 210, 210, 0.28), transparent 37%), radial-gradient(ellipse at 75% 55%, rgba(160, 160, 160, 0.18), transparent 40%), radial-gradient(ellipse at 45% 80%, rgba(255, 230, 180, 0.16), transparent 44%), rgba(24, 24, 26, 0.92);
    background-size: 90px 70px, 110px 90px, 130px 110px, 100% 100%;
    filter: blur(8px);
    transform: rotate(0deg);
    animation: fogFlow 11s linear infinite;
}

.chess-square.has-fog::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 11;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, transparent 35%, rgba(180, 200, 210, 0.95) 94%), linear-gradient(45deg, transparent, rgba(255, 220, 150, 0.26), transparent);
    opacity: 0.85;
}

.chess4-square.has-fog::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 11;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, transparent 35%, rgba(180, 200, 210, 0.95) 94%), linear-gradient(45deg, transparent, rgba(255, 220, 150, 0.26), transparent);
    opacity: 0.85;
}

.chess-square.fog-lifting::before {
    content: "";
    position: absolute;
    inset: -35%;
    z-index: 5;
    pointer-events: none;
    background: radial-gradient(ellipse at 20% 30%, rgba(210, 210, 210, 0.28), transparent 37%), radial-gradient(ellipse at 75% 55%, rgba(160, 160, 160, 0.18), transparent 40%), radial-gradient(ellipse at 45% 80%, rgba(255, 230, 180, 0.16), transparent 44%), rgba(24, 24, 26, 0.92);
    background-size: 80px 60px, 100px 80px, 120px 100px, 100% 100%;
    filter: blur(6px);
    animation: fogFlow 24s linear infinite, fogLiftBefore 520ms ease-out forwards;
}

.chess4-square.fog-lifting::before {
    content: "";
    position: absolute;
    inset: -35%;
    z-index: 5;
    pointer-events: none;
    background: radial-gradient(ellipse at 20% 30%, rgba(210, 210, 210, 0.28), transparent 37%), radial-gradient(ellipse at 75% 55%, rgba(160, 160, 160, 0.18), transparent 40%), radial-gradient(ellipse at 45% 80%, rgba(255, 230, 180, 0.16), transparent 44%), rgba(24, 24, 26, 0.92);
    background-size: 80px 60px, 100px 80px, 120px 100px, 100% 100%;
    filter: blur(6px);
    animation: fogFlow 24s linear infinite, fogLiftBefore 520ms ease-out forwards;
}

.chess-square.fog-lifting::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 11;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, transparent 35%, rgba(180, 200, 210, 0.95) 94%), linear-gradient(45deg, transparent, rgba(255, 220, 150, 0.26), transparent);
    opacity: 0.85;
    animation: fogLiftAfter 520ms ease-out forwards;
}

.chess4-square.fog-lifting::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 11;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, transparent 35%, rgba(180, 200, 210, 0.95) 94%), linear-gradient(45deg, transparent, rgba(255, 220, 150, 0.26), transparent);
    opacity: 0.85;
    animation: fogLiftAfter 520ms ease-out forwards;
}

@keyframes fogFlow {
    0% {
        background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px;
    }

    100% {
        background-position: 90px 70px, 110px 90px, 130px 110px, 0px 0px;
    }
}

@keyframes fogLiftBefore {
    0% {
        /*        opacity: 1;*/
        filter: blur(6px);
    }

    35% {
        opacity: 0.65;
        /*        filter: blur(9px);*/
    }

    100% {
        opacity: 0;
        /*        filter: blur(12px);*/
    }
}

@keyframes fogLiftAfter {
    0% {
        opacity: 0.45;
    }

    35% {
        opacity: 0.62;
    }

    100% {
        opacity: 0;
    }
}

/* for new Index Page */
.env--standard,
.env--chess960 {
    --env-base-start: #14130f;
    --env-base-mid: #1a1812;
    --env-base-end: #070707;
    --env-gold-glow: rgba(213, 166, 66, 0.22);
    --env-blue-glow: rgba(94, 137, 145, 0.16);
    --env-fog-warm: rgba(220, 210, 185, 0.10);
    --env-fog-cool: rgba(145, 158, 162, 0.08);
    --env-fog-gold: rgba(255, 220, 160, 0.08);
    --env-fog-opacity: 0.48;
    --env-fog-blur: 18px;
    --env-vignette-mid: rgba(0, 0, 0, 0.18);
    --env-vignette-edge: rgba(0, 0, 0, 0.52);
    --env-side-shadow: rgba(0, 0, 0, 0.45);
    --env-fog-duration: 40s;
}

.env--shadow {
    --env-base-start: #0d0c0a;
    --env-base-mid: #13110e;
    --env-base-end: #040405;
    --env-gold-glow: rgba(213, 166, 66, 0.16);
    --env-blue-glow: rgba(71, 116, 128, 0.13);
    --env-fog-warm: rgba(190, 190, 180, 0.11);
    --env-fog-cool: rgba(130, 140, 145, 0.10);
    --env-fog-gold: rgba(255, 220, 160, 0.055);
    --env-fog-opacity: 0.64;
    --env-fog-blur: 22px;
    --env-vignette-mid: rgba(0, 0, 0, 0.26);
    --env-vignette-edge: rgba(0, 0, 0, 0.68);
    --env-side-shadow: rgba(0, 0, 0, 0.62);
    --env-fog-duration: 34s;
}

.env--blindside,
.env--decay {
    --env-base-start: #050505;
    --env-base-mid: #11100d;
    --env-base-end: #020203;
    --env-gold-glow: rgba(213, 166, 66, 0.10);
    --env-blue-glow: rgba(54, 91, 103, 0.12);
    --env-fog-warm: rgba(160, 160, 150, 0.10);
    --env-fog-cool: rgba(100, 112, 118, 0.12);
    --env-fog-gold: rgba(255, 220, 160, 0.035);
    --env-fog-opacity: 0.80;
    --env-fog-blur: 26px;
    --env-vignette-mid: rgba(0, 0, 0, 0.36);
    --env-vignette-edge: rgba(0, 0, 0, 0.84);
    --env-side-shadow: rgba(0, 0, 0, 0.78);
    --env-fog-duration: 28s;
}

.landing-page {
    position: relative;
    min-height: 100vh;
    color: #f7ead0;
    background: radial-gradient(circle at 20% 18%, var(--env-gold-glow), transparent 28%), radial-gradient(circle at 78% 34%, var(--env-blue-glow), transparent 34%), linear-gradient(135deg, var(--env-base-start) 0%, var(--env-base-mid) 44%, var(--env-base-end) 100%);
    overflow-x: hidden;
}

    .landing-page::before {
        content: "";
        position: fixed;
        inset: -20%;
        z-index: 0;
        pointer-events: none;
        background: radial-gradient( ellipse at 15% 36%, var(--env-fog-warm), transparent 34% ), radial-gradient( ellipse at 80% 55%, var(--env-fog-cool), transparent 38% ), radial-gradient( ellipse at 50% 85%, var(--env-fog-gold), transparent 42% );
        filter: blur(var(--env-fog-blur));
        opacity: var(--env-fog-opacity);
        animation: landingPageFogDrift var(--env-fog-duration) linear infinite;
    }

    .landing-page::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 0;
        pointer-events: none;
        background: radial-gradient( circle at 50% 45%, transparent 0%, var(--env-vignette-mid) 58%, var(--env-vignette-edge) 100% ), linear-gradient( 90deg, var(--env-side-shadow), transparent 22%, transparent 72%, var(--env-side-shadow) );
    }

    .landing-page,
    .landing-page::before,
    .landing-page::after {
        transition: background 4s ease-in-out, opacity 4s ease-in-out, filter 4s ease-in-out;
    }

@media (max-width: 480px) {
    .landing-page::before {
        display: none !important;
        filter: none !important;
        background: none !important;
        opacity: 0 !important;
    }

    .landing-page::after {
        display: none !important;
        background: none !important;
    }

    header.top-nav.hide-on-desktop {
        display: block !important;
        border: none !important;
    }
}

@keyframes landingPageFogDrift {
    0% {
        transform: translate3d(-6%, -4%, 0) scale(1.05);
    }

    100% {
        transform: translate3d(6%, 4%, 0) scale(1.15);
    }
}




.top-nav {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5vw;
    border-bottom: 1px solid rgba(213, 166, 66, 0.25);
    background: rgba(5, 5, 6, 0.58);
    backdrop-filter: blur(10px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand__mark, .brand__mark > a {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #120d07;
    background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.65), transparent 32%), linear-gradient(135deg, #ffe8a0 0%, #d6a745 45%, #8f5f1d 100%);
    box-shadow: 0 0 22px rgba(213, 166, 66, 0.35);
    font-size: 1.35rem;
}

    .brand__mark > a {
        text-decoration: none;
    }

.brand__name, .brand__name > a {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffe8a0;
}

    .brand__name > a {
        text-decoration: none;
    }

.brand__tagline, .brand__tagline > a {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(247, 234, 208, 0.56);
}

    .brand__tagline > a {
        text-decoration: none;
    }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 5px;
}

    .nav-links a {
        color: rgba(247, 234, 208, 0.72);
        text-decoration: none;
        font-size: 0.88rem;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        transition: color 160ms ease, text-shadow 160ms ease;
    }

        .nav-links a:hover {
            color: #ffe8a0;
            text-shadow: 0 0 12px rgba(213, 166, 66, 0.45);
        }

.nav-links__login {
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(213, 166, 66, 0.45);
    border-radius: 999px;
}

.hero {
    min-height: calc(100vh - 76px);
    display: grid;
    grid-template-columns: minmax(840px, 1.0fr) minmax(340px, 1.0fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
    padding: clamp(2rem, 5vw, 5rem) 5vw;
}

.hero-board-panel {
    min-width: 840px;
    max-width: 840px;
    width: 840px;
    justify-self: end;
}
.hero-board-panel4 {
    min-width: 1130px;
    max-width: 1130px;
    width: 1130px;
    justify-self: center;
}

    .hero-board-panel4 .segmented-control {
        margin: -12px auto;
    }

    .hero-copy {
        max-width: 610px;
        text-align: center;
        justify-self: start;
    }

.preview-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.segmented-control {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid rgba(213, 166, 66, 0.32);
    border-radius: 999px;
    background: rgba(8, 8, 10, 0.72);
    box-shadow: inset 0 0 0 1px rgba(255, 232, 160, 0.06), 0 12px 28px rgba(0, 0, 0, 0.28);
}

.segmented-control__label {
    padding: 0 0.25rem 0 0.70rem;
    font-size: 0.72rem;
    color: rgba(247, 234, 208, 0.58);
    text-transform: uppercase;
    letter-spacing: 0.11em;
    white-space: nowrap;
}

.segmented-control-divider {
    width: 1px;
    align-self: stretch; /* fills the height of the control row */
    background: rgba(213, 166, 66, 0.25); /* muted gold, matches your palette */
    margin: 0 0.65rem; /* breathing room on both sides */
}

.segmented-control__button {
    border: 0;
    border-radius: 999px;
    padding: 0.45rem 0.72rem;
    background: transparent;
    color: rgba(247, 234, 208, 0.68);
    cursor: pointer;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 140ms ease;
}

    .segmented-control__button:focus {
        outline: none;
    }

    .segmented-control__button:hover {
        color: #ffe8a0;
        background: rgba(213, 166, 66, 0.12);
    }

    .segmented-control__button.segmented-control__button--active:focus, .segmented-control__button.segmented-control__button--active {
        color: #130e08;
        background: radial-gradient(circle at 40% 0%, rgba(255, 255, 255, 0.55), transparent 42%), linear-gradient(135deg, #ffe8a0 0%, #d6a745 45%, #8f5f1d 100%);
        box-shadow: 0 0 14px rgba(213, 166, 66, 0.36);
    }

.board-stage {
    position: relative;
    display: grid;
    padding: 40px;
    max-height: 850px;
    place-items: center;
    padding: clamp(1rem, 3vw, 2rem);
    border-radius: 28px;
    background: radial-gradient(circle at 50% 0%, rgba(213, 166, 66, 0.18), transparent 48%), linear-gradient(180deg, rgba(22, 18, 15, 0.96), rgba(3, 3, 4, 0.95));
    border: 1px solid rgba(213, 166, 66, 0.28);
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 232, 160, 0.06);
}

.board4-stage {
    position: relative;
    display: grid;
    padding: 0px;
    max-height: 1130px;
    place-items: center;
    background: radial-gradient(circle at 50% 0%, rgba(213, 166, 66, 0.18), transparent 48%), linear-gradient(180deg, rgba(22, 18, 15, 0.96), rgba(3, 3, 4, 0.95));
}

    .board4-stage.border-radius-28 {
        border-radius: 28px;
        border: 1px solid rgba(213, 166, 66, 0.28);
    }

    .board-stage--3d {
        perspective: 1200px; /* Adjust for more/less "depth" */
    }

.board-stage--flat {
    transform: none;
}

.board-status {
    position: absolute;
    left: 34px;
    right: 34px;
    top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: rgba(247, 234, 208, 0.72);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.board-status__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #41ffb4;
    box-shadow: 0 0 14px rgba(65, 255, 180, 0.75);
}

.square {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: inset 1.5px 1.5px 2px rgba(255, 255, 255, 0.08), inset -1.5px -1.5px 2px rgba(0, 0, 0, 0.5);
}

.piece {
    position: relative;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 78%;
    height: 78%;
    user-select: none;
    transition: transform 260ms ease, filter 260ms ease, opacity 260ms ease;
}

.board-caption {
    display: grid;
    gap: 0.3rem;
    margin-top: 1rem;
    padding: 1rem 1.15rem;
    border-radius: 18px;
    border: 1px solid rgba(213, 166, 66, 0.22);
    background: rgba(5, 5, 6, 0.55);
}

    .board-caption strong {
        color: #ffe8a0;
        font-size: 0.95rem;
    }

    .board-caption span {
        color: rgba(247, 234, 208, 0.68);
        font-size: 0.9rem;
        line-height: 1.45;
    }

.eyebrow {
    display: inline-flex;
    padding: 0.42rem 0.7rem;
    margin: 0 auto 1rem;
    border-radius: 999px;
    border: 1px solid rgba(213, 166, 66, 0.32);
    color: #ffe8a0;
    background: rgba(213, 166, 66, 0.10);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero-board-panel h1, .hero-copy h1 {
    margin: 0;
    max-width: 12ch;
    color: #ffe8a0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.8rem, 6.2vw, 6.8rem);
    line-height: 0.92;
    letter-spacing: -0.055em;
    text-align: center;
    text-shadow: 0 0 18px rgba(213, 166, 66, 0.28), 0 0 42px rgba(213, 166, 66, 0.12);
}

.hero-copy > p {
    max-width: 46ch;
    margin: 1.3rem auto 0;
    color: rgba(247, 234, 208, 0.76);
    font-size: clamp(1.02rem, 1.6vw, 1.22rem);
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1.65rem;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.8rem 1.15rem;
    border-radius: 999px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 160ms ease;
}

.button--primary {
    color: #130e08;
    background: radial-gradient(circle at 40% 0%, rgba(255, 255, 255, 0.58), transparent 42%), linear-gradient(135deg, #ffe8a0 0%, #d6a745 45%, #8f5f1d 100%);
    box-shadow: 0 0 26px rgba(213, 166, 66, 0.34);
}

    .button--primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 0 36px rgba(213, 166, 66, 0.48);
    }

.button--secondary {
    color: #ffe8a0;
    border: 1px solid rgba(213, 166, 66, 0.5);
    background: rgba(5, 5, 6, 0.45);
}

    .button--secondary:hover {
        background: rgba(213, 166, 66, 0.12);
    }

.feature-list {
    display: grid;
    gap: 0.85rem;
    margin-top: 2rem;
}

.feature-card {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 0.85rem;
    align-items: start;
    padding: 0.95rem;
    border-radius: 18px;
    border: 1px solid rgba(213, 166, 66, 0.18);
    background: rgba(7, 7, 9, 0.48);
}

.feature-card__icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #ffe8a0;
    border: 1px solid rgba(213, 166, 66, 0.35);
    background: rgba(213, 166, 66, 0.08);
}

    .feature-card__icon img {
        width: 32px;
        height: 32px;
        object-fit: contain;
    }

.feature-card h3 {
    margin: 0 0 0.2rem;
    color: #f7ead0;
    font-size: 0.98rem;
}

.feature-card p {
    margin: 0;
    color: rgba(247, 234, 208, 0.58);
    font-size: 0.88rem;
    line-height: 1.45;
}

@keyframes fogFlow {
    0% {
        background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px;
    }

    100% {
        background-position: 180px 140px, 220px 180px, 260px 220px, 0px 0px;
    }
}

@keyframes pulseHighlight {
    0%, 100% {
        opacity: 0.65;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

@media (prefers-reduced-motion: reduce) {
    .piece,
    .button,
    .segmented-control__button {
        transition: none !important;
    }
}

.top-nav, .hero {
    position: relative;
    z-index: 1;
}

.moving-piece-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

.moving-piece {
    position: absolute;
    width: calc(var(--sq-size) * 0.55);
    height: auto;
    /*    --sq-size: 80px;*/
    --frame-pad: 40px;
    --move-scale: 1;
    /* Compute pixel positions from file/rank indices */
    --start-x: calc(var(--from-file) * var(--sq-size) + var(--sq-size) / 2 + var(--frame-pad));
    --start-y: calc((var(--top-y) - var(--from-rank)) * var(--sq-size) + var(--sq-size) / 2 + var(--frame-pad));
    /* Delta from start to destination */
    --move-x: calc((var(--to-file) - var(--from-file)) * var(--sq-size));
    --move-y: calc((var(--from-rank) - var(--to-rank)) * var(--sq-size));
    left: var(--start-x);
    top: var(--start-y);
    --piece-base-transform: translate(-50%, -78%) rotateX(-22deg) translateY(-12px) translateX(16px);
    transform: var(--piece-base-transform);
    animation: pieceSlide 120ms ease-out forwards;
    filter: drop-shadow(0 14px 7px rgba(0, 0, 0, 0.55));
    isolation: isolate;
    image-rendering: optimizeQuality;
}
.moving-piece4 {
    position: absolute;
    width: calc(var(--sq-size) * 0.55);
    height: auto;
    --frame-pad: 40px;
    --move-scale: 1;
    /* Compute pixel positions from file/rank indices */
    --start-x: calc(var(--from-file) * var(--sq-size) + var(--sq-size) / 2 + var(--frame-pad));
    --start-y: calc((var(--top-y) - var(--from-rank)) * var(--sq-size) + var(--sq-size) / 2 + var(--frame-pad));
    /* Delta from start to destination */
    --move-x: calc((var(--to-file) - var(--from-file)) * var(--sq-size));
    --move-y: calc((var(--from-rank) - var(--to-rank)) * var(--sq-size));
    left: var(--start-x);
    top: var(--start-y);
    --piece-base-transform: translate(-50%, -78%) rotateX(-22deg) translateY(-12px) translateX(16px);
    transform: var(--piece-base-transform);
    animation: pieceSlide 120ms ease-out forwards;
    filter: drop-shadow(0 14px 7px rgba(0, 0, 0, 0.55));
    isolation: isolate;
    image-rendering: optimizeQuality;
}

@keyframes pieceSlide {
    from {
        transform: var(--piece-base-transform) translate(0, 0);
    }

    to {
        transform: var(--piece-base-transform) translate(var(--move-x), var(--move-y));
    }
}

.board-caption__hint {
    font-size: 0.8em;
    opacity: 0.6;
    font-style: italic;
}

.fog-activity-indicator {
    position: absolute;
    left: 50%;
    top: 28px;
    transform: translateX(-50%);
    z-index: 100;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 220, 150, 0.36);
    background: rgba(5, 5, 7, 0.72);
    color: #ffe8a0;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 0 18px rgba(213, 166, 66, 0.22);
}

.identity-reveal-indicator {
    margin-top: 0.25rem;
    padding: 0.25rem 0.65rem;
    color: rgba(247, 234, 208, 0.58);
    font-size: 0.66rem;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: 0.025em;
    text-align: center;
}

.fog-disturbance-active.chess-square.has-fog::before {
    animation: fogFlow 1.2s linear infinite, fogSurge 520ms ease-out forwards;
    filter: blur(12px) brightness(1.25);
}

.fog-disturbance-active.chess4-square.has-fog::before {
    animation: fogFlow 1.2s linear infinite, fogSurge 520ms ease-out forwards;
    filter: blur(12px) brightness(1.25);
}

.fog-disturbance-active.chess-square.has-fog::after {
    animation: fogFlash 520ms ease-out forwards;
}

.fog-disturbance-active.chess4-square.has-fog::after {
    animation: fogFlash 520ms ease-out forwards;
}

@keyframes fogSurge {
    0% {
        opacity: 0.75;
        transform: scale(1);
    }

    30% {
        opacity: 1;
        transform: scale(1.12);
    }

    65% {
        opacity: 0.9;
        transform: scale(1.05);
    }

    100% {
        opacity: 0.75;
        transform: scale(1);
    }
}

@keyframes fogFlash {
    0% {
        opacity: 0.45;
    }

    30% {
        opacity: 0.82;
    }

    100% {
        opacity: 0.45;
    }
}

.demo-playback-button {
    position: absolute;
    inset: auto auto 1rem 1rem;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 1px solid rgba(255, 232, 160, 0.5);
    background: rgba(5, 5, 7, 0.72);
    color: #ffe8a0;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 160ms ease, transform 160ms ease;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.board-container-threed:hover .demo-playback-button, .board-container-threed.is-paused .demo-playback-button, .board-container-classic:hover .demo-playback-button, .board-container-classic.is-paused .demo-playback-button {
    opacity: 1;
    transform: translateY(0);
}

.vision-helper-overlay {
    position: absolute;
    left: 50px;
    top: 40px;
    width: 640px;
    height: 640px;
    z-index: 80;
    pointer-events: none;
    overflow: visible;
}
.vision-helper-overlay4 {
    position: absolute;
    left: 40px;
    top: 40px;
    width: 1050px;
    height: 1050px;
    z-index: 80;
    pointer-events: none;
    overflow: visible;
}

.vision-helper-line {
    stroke: rgba(255, 232, 160, 0.95);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 8 7;
    filter: drop-shadow(0 0 5px rgba(255, 232, 160, 0.75)) drop-shadow(0 0 12px rgba(213, 166, 66, 0.42));
    animation: visionLineAppear 350ms ease-out forwards, visionDashFlow 420ms linear infinite;
}

.vision-helper-dot {
    fill: rgba(255, 232, 160, 0.95);
    stroke: rgba(90, 65, 18, 0.9);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 5px rgba(255, 232, 160, 0.85)) drop-shadow(0 0 14px rgba(213, 166, 66, 0.45));
    animation: visionDotPulse 900ms ease-out forwards;
}

.vision-helper-overlay--held .vision-helper-line {
    opacity: 1;
    animation: visionDashFlow 420ms linear infinite;
}

.vision-helper-overlay--held .vision-helper-dot {
    opacity: 1;
    animation: none;
}

.vision-helper-eye {
    opacity: 0;
    animation: visionEyeFade 750ms ease-out forwards;
    filter: drop-shadow(0 0 5px rgba(255, 232, 160, 0.85)) drop-shadow(0 0 14px rgba(213, 166, 66, 0.45));
}

.vision-helper-eye__outline {
    fill: rgba(5, 5, 7, 0.55);
    stroke: rgba(255, 232, 160, 0.95);
    stroke-width: 2;
}

.vision-helper-eye__iris {
    fill: rgba(255, 232, 160, 0.95);
}

.vision-helper-overlay--held .vision-helper-eye {
    opacity: 1;
    animation: visionEyeHeldPulse 1.4s ease-in-out infinite;
}

@keyframes visionEyeHeldPulse {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(255, 232, 160, 0.55)) drop-shadow(0 0 10px rgba(213, 166, 66, 0.28));
    }

    50% {
        filter: drop-shadow(0 0 7px rgba(255, 232, 160, 0.95)) drop-shadow(0 0 18px rgba(213, 166, 66, 0.55));
    }
}

@keyframes visionEyeFade {
    0% {
        opacity: 0;
    }

    18% {
        opacity: 1;
    }

    78% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes visionLineAppear {
    0% {
        opacity: 0;
        stroke-width: 1;
    }

    18% {
        opacity: 1;
        stroke-width: 3.5;
    }

    100% {
        opacity: 0;
        stroke-width: 2;
    }
}

@keyframes visionDashFlow {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -15;
    }
}

@keyframes visionDotPulse {
    0% {
        opacity: 0;
    }

    25% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}
/* ============================================================
   Game Panel Components
   PlayerInfoCard | AvailableMovesCard | ChatCard
   ============================================================ */
section.panel-card-left .panel-card {
    justify-self: end;
}
section.panel-card-left .panel-card-centered {
    justify-self: center;
}
section.panel-card-right .panel-card-centered {
    justify-self: center;
}

section.panel-card-right .panel-card {
    justify-self: start;
}

/* ── Shared panel card base ── */
.panel-card,
.panel-card-centered {
    min-width: 320px;
    max-width: 320px;
    width: 320px;
    border: 1px solid rgba(213, 166, 66, 0.28);
    border-radius: 6px;
    background: rgba(10, 9, 8, 0.92);
    overflow: hidden;
    margin: 18px 0;
}

.panel-card__header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* Necessary for absolute positioning of the count */
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(213, 166, 66, 0.18);
    background: rgba(213, 166, 66, 0.04);
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #d5a642;
}

.panel-card__header-icon {
    font-size: 0.85rem;
}

.panel-card__header-count {
    position: absolute;
    right: 0.75rem; /* Pins the count to the right while text stays centered */
    font-family: 'Crimson Text', serif;
    font-size: 0.65rem;
    color: rgba(247, 234, 208, 0.45);
    letter-spacing: 0;
    text-transform: none;
}

.panel-card__body {
    padding: 0.65rem 0.75rem;
    text-align: center;
    /* Centers block-level elements (buttons, divs, etc.) */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
/* ════════════════════════════════════════════
   1. PLAYER INFO CARD
   ════════════════════════════════════════════ */
.player-identity {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: center;
    padding: 0.25rem;
}

.player-emblem {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.player-emblem--sun {
    border: 2px solid #d5a642;
    background: radial-gradient(circle at 40% 35%, rgba(255, 232, 160, 0.15), transparent 60%), rgba(10, 9, 8, 0.9);
    color: #d5a642;
    font-size: 1.5rem;
    box-shadow: 0 0 14px rgba(213, 166, 66, 0.2);
}

.player-emblem--moon {
    border: 2px solid rgba(160, 180, 200, 0.5);
    background: radial-gradient(circle at 60% 35%, rgba(160, 180, 200, 0.12), transparent 60%), rgba(10, 9, 8, 0.9);
    color: rgba(180, 200, 220, 0.8);
    font-size: 1.5rem;
    box-shadow: 0 0 14px rgba(160, 180, 200, 0.15);
}
/* ════════════════════════════════════════════
   2. CAPTURED PIECES CARD
   ════════════════════════════════════════════ */
.captured-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    height: 112px;
    min-height: 112px;
    max-height: 112px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(213, 166, 66, 0.35) transparent;
}

    .captured-grid::-webkit-scrollbar {
        width: 3px;
    }

    .captured-grid::-webkit-scrollbar-thumb {
        background: rgba(213, 166, 66, 0.35);
        border-radius: 2px;
    }

.captured-piece {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    opacity: 0.75;
    transition: opacity 140ms ease;
}

    .captured-piece:hover {
        opacity: 1;
    }

.captured-piece__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(0.2) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.captured-empty {
    color: rgba(247, 234, 208, 0.38);
    font-size: 0.75rem;
    font-style: italic;
}
/* ════════════════════════════════════════════
   3. AVAILABLE MOVES CARD
   ════════════════════════════════════════════ */
.moves-waiting {
    color: rgba(247, 234, 208, 0.38);
    font-size: 0.75rem;
    font-style: italic;
    text-align: center;
    padding: 0.5rem 0;
}

.moves-list {
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(213, 166, 66, 0.35) transparent;
}

    .moves-list::-webkit-scrollbar {
        width: 3px;
    }

    .moves-list::-webkit-scrollbar-thumb {
        background: rgba(213, 166, 66, 0.35);
        border-radius: 2px;
    }

.moves-group {
    margin-bottom: 0.35rem;
}

.moves-group__label {
    padding: 0.25rem 0.4rem;
    font-family: 'Cinzel', serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: rgba(247, 234, 208, 0.56);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.move-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.4rem 0.25rem 1rem;
    border-radius: 3px;
    font-size: 0.76rem;
    color: rgba(247, 234, 208, 0.56);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

    .move-row:hover {
        background: rgba(213, 166, 66, 0.1);
        color: #f7ead0;
    }

.move-row--selected {
    background: rgba(213, 166, 66, 0.15);
    color: #ffe8a0;
}

.move-row--capture .move-to {
    color: #b83b3b;
}

.move-row--capture:hover .move-to {
    color: #d94f4f;
}

.move-arrow {
    color: rgba(247, 234, 208, 0.3);
    font-size: 0.65rem;
}

.move-to {
    color: #d5a642;
    font-weight: 600;
}

.move-capture-icon {
    margin-left: auto;
    font-size: 0.6rem;
    color: rgba(184, 59, 59, 0.6);
}
/* ════════════════════════════════════════════
   4. CHAT CARD
   ════════════════════════════════════════════ */
.chat-card {
    display: flex;
    flex-direction: column;
    height: 520px;
    min-height: 520px;
    max-height: 520px;
}

    .chat-card .panel-card__header {
        flex-shrink: 0;
    }
/* ── Mute button ── */
.chat-mute-btn {
    margin-left: auto;
    padding: 0;
    border: none;
    background: none;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 140ms ease;
}

    .chat-mute-btn:hover {
        opacity: 1;
    }

.chat-muted-badge {
    margin-left: 0.35rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(184, 59, 59, 0.15);
    color: rgba(184, 59, 59, 0.7);
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chat-unread-badge {
    margin-left: 0.35rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(213, 166, 66, 0.2);
    color: #d5a642;
    font-size: 0.55rem;
    font-weight: 700;
}
/* ── Messages area ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(213, 166, 66, 0.25) transparent;
}

    .chat-messages::-webkit-scrollbar {
        width: 3px;
    }

    .chat-messages::-webkit-scrollbar-thumb {
        background: rgba(213, 166, 66, 0.25);
        border-radius: 2px;
    }

.chat-empty {
    color: rgba(247, 234, 208, 0.3);
    font-size: 0.75rem;
    font-style: italic;
    text-align: center;
    padding: 1.5rem 0;
}
/* ── Individual message ── */
.chat-message {
    max-width: 85%;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border-left: 3px solid var(--sender-color, #444);
    animation: chatMessageAppear 200ms ease-out;
}

.chat-message--local {
    align-self: flex-end;
    background: rgba(213, 166, 66, 0.1);
    border: 1px solid rgba(213, 166, 66, 0.2);
}

.chat-message--opponent {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-message--local .chat-message__sender {
    color: #d5a642;
}

.chat-message__sender {
    color: var(--sender-color, #63c0bd);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}

.chat-message__text {
    font-size: 0.8rem;
    color: #f7ead0;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message__time {
    font-size: 0.55rem;
    color: rgba(247, 234, 208, 0.3);
    text-align: right;
    margin-top: 0.2rem;
}

.chat-message--system {
    border-left-color: #8f8776;
    background: #181713;
    color: #b9ad93;
    font-style: italic;
}
/* ── Note — game events inline in chat ── */
.chat-message--note {
    align-self: center;
    max-width: 100%;
    border-left: 3px solid rgba(213, 166, 66, 0.25);
    background: rgba(213, 166, 66, 0.04);
    text-align: center;
}

    .chat-message--note .chat-message__text {
        font-size: 0.68rem;
        color: rgba(213, 166, 66, 0.45);
        font-style: italic;
    }

    .chat-message--note .chat-message__time {
        display: none;
    }
/* ── Whisper — private message between spectators ── */
.chat-message--whisper {
    background: rgba(160, 130, 200, 0.06);
}
    /* Override the sender-color for whispers regardless of auth status */
    .chat-message--whisper.chat-message__sender {
        color: rgba(160, 130, 200, 0.65) !important;
        font-style: italic;
    }

        .chat-message--whisper.chat-message__sender::before {
            content: '🔒 ';
            font-size: 0.5rem;
            font-style: normal;
        }

    .chat-message--whisper .chat-message__text {
        color: rgba(200, 180, 220, 0.7);
        font-style: italic;
    }

    .chat-message--whisper .chat-message__time {
        color: rgba(160, 130, 200, 0.25);
        font-style: italic;
    }

.chat-watchers__label {
    width: 100%;
    margin: 3px;
    color: rgba(201, 161, 74, 0.55);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-watcher-chip {
    margin: 2px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 140px;
    height: 24px;
    padding: 0 9px;
    color: var(--watcher-color, #cbb98a);
    border-radius: 999px;
    border-color: var(--watcher-color, rgba(182, 145, 70, 0.45));
    border-width: 1px;
    background: rgba(18, 15, 10, 0.72);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 8px rgba(0, 0, 0, 0.35);
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, color 140ms ease;
}

    .chat-watcher-chip:hover:not(:disabled) {
        transform: translateY(-1px);
        background: rgba(38, 31, 18, 0.92);
        border-color: rgba(229, 184, 92, 0.75);
        color: #ffe3a0;
    }

.chat-watcher-chip--auth::before {
    content: "@";
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--watcher-color, #55d6d0);
}

.chat-watcher-chip--anon {
    opacity: 0.9;
}

@keyframes chatMessageAppear {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ── Input area ── */
.chat-input-area {
    display: flex;
    gap: 0;
    padding: 0.45rem 0.55rem;
    border-top: 1px solid rgba(213, 166, 66, 0.18);
    background: rgba(5, 5, 6, 0.5);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid rgba(213, 166, 66, 0.2);
    border-right: none;
    border-radius: 4px 0 0 4px;
    background: rgba(10, 9, 8, 0.8);
    color: #f7ead0;
    font-family: 'Crimson Text', serif;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 140ms ease;
}

    .chat-input::placeholder {
        color: rgba(247, 234, 208, 0.3);
    }

    .chat-input:focus {
        border-color: rgba(213, 166, 66, 0.45);
    }

    .chat-input:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.chat-send-btn {
    padding: 0.4rem 0.7rem;
    border: 1px solid rgba(213, 166, 66, 0.3);
    border-radius: 0 4px 4px 0;
    background: rgba(213, 166, 66, 0.08);
    color: #d5a642;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 140ms ease;
}

    .chat-send-btn:hover:not(:disabled) {
        background: rgba(213, 166, 66, 0.18);
        color: #ffe8a0;
    }

    .chat-send-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.game-variant-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    padding: 1.05rem 1.25rem;
    border: 1px solid rgba(213, 166, 66, 0.28);
    border-radius: 999px;
    background: radial-gradient(circle at 50% 0%, rgba(255, 232, 160, 0.16), transparent 50%), rgba(5, 5, 7, 0.58);
    box-shadow: 0 0 24px rgba(213, 166, 66, 0.16), inset 0 0 0 1px rgba(255, 232, 160, 0.045);
    text-align: center;
    width: 100%;
}

.game-variant-banner__label {
    color: rgba(247, 234, 208, 0.48);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.game-variant-banner strong {
    margin-top: 0.08rem;
    color: #ffe8a0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.25rem, 2.2vw, 2.1rem);
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 0 18px rgba(213, 166, 66, 0.25);
}

.variant-standard strong {
    color: #f7ead0;
}

.variant-shadow strong {
    color: #d5d5d5;
    text-shadow: 0 0 18px rgba(180, 200, 210, 0.28);
}

.variant-blindside strong {
    color: #ffe8a0;
    text-shadow: 0 0 16px rgba(213, 166, 66, 0.38), 0 0 28px rgba(255, 232, 160, 0.16);
}

.game-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.1rem 2.75rem 0.5rem 0;
    gap: 1rem;
}

.check-alert {
    color: #d5a642;
    font-weight: 900;
    font-size: larger;
    white-space: nowrap;
    width: fit-content;
    text-shadow: 0 0 8px rgba(184, 59, 59, 0.4);
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(184, 59, 59, 0.25);
    border-radius: 6px;
}

.game-movement-status {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    padding-left: 1.75rem;
    flex: 1;
}

    .game-movement-status > span {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.55rem 1rem;
        white-space: nowrap;
        width: fit-content;
        border-radius: 6px;
        border: 1px solid rgba(213, 166, 66, 0.25);
        background: linear-gradient(135deg, rgba(213, 166, 66, 0.08), rgba(213, 166, 66, 0.02));
        font-family: 'Cinzel', serif;
        font-size: larger;
        font-weight: 900;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: #ffe8a0;
        text-shadow: 0 0 10px rgba(213, 166, 66, 0.2);
    }

.game-movement-status--gameover > span {
    border-color: rgba(213, 166, 66, 0.5);
    background: linear-gradient(135deg, rgba(213, 166, 66, 0.15), rgba(213, 166, 66, 0.05));
    font-size: larger;
    box-shadow: 0 0 16px rgba(213, 166, 66, 0.2);
}

.game-action-buttons {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    padding-right: 1.75rem;
}

.game-action-buttons--center {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    align-items: center;
}

.game-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 160ms ease;
}

.game-action-btn--draw {
    border: 1px solid rgba(213, 166, 66, 0.28);
    background: rgba(213, 166, 66, 0.04);
    color: rgba(247, 234, 208, 0.71);
}

    .game-action-btn--draw:hover {
        background: rgba(213, 166, 66, 0.12);
        border-color: rgba(213, 166, 66, 0.45);
        color: #ffe8a0;
        box-shadow: 0 0 12px rgba(213, 166, 66, 0.15);
    }

.draw-offer-status {
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f5f5f5;
}

.game-action-btn--resign {
    border: 1px solid rgba(184, 59, 59, 0.25);
    background: rgba(184, 59, 59, 0.04);
    color: rgba(184, 59, 59, 0.71);
}

    .game-action-btn--resign:hover {
        background: rgba(184, 59, 59, 0.12);
        border-color: rgba(184, 59, 59, 0.5);
        color: rgba(184, 59, 59, 0.9);
        box-shadow: 0 0 12px rgba(184, 59, 59, 0.15);
    }

.game-action-btn--replay {
    border: 1px solid rgba(213, 166, 66, 0.28);
    background: rgba(213, 166, 66, 0.04);
    color: rgba(247, 234, 208, 0.71);
}

    .game-action-btn--replay:hover {
        background: rgba(213, 166, 66, 0.12);
        border-color: rgba(213, 166, 66, 0.45);
        color: #ffe8a0;
        box-shadow: 0 0 12px rgba(213, 166, 66, 0.15);
    }

.game-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

.connection-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(5, 5, 6, 0.88);
    backdrop-filter: blur(6px);
    z-index: 9999;
}

.connection-overlay__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 3rem;
    border: 1px solid rgba(213, 166, 66, 0.28);
    border-radius: 12px;
    background: rgba(10, 9, 8, 0.95);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.connection-overlay__icon {
    font-size: 2rem;
    color: rgba(184, 59, 59, 0.8);
}

.connection-overlay__title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ffe8a0;
}

.connection-overlay__text {
    font-size: 0.85rem;
    color: rgba(247, 234, 208, 0.56);
    max-width: 28ch;
    line-height: 1.5;
}

.connection-overlay__btn {
    margin-top: 0.5rem;
    padding: 0.6rem 1.8rem;
    border: 1px solid rgba(213, 166, 66, 0.45);
    border-radius: 6px;
    background: rgba(213, 166, 66, 0.08);
    color: #ffe8a0;
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 160ms ease;
}

    .connection-overlay__btn:hover {
        background: rgba(213, 166, 66, 0.18);
        box-shadow: 0 0 14px rgba(213, 166, 66, 0.25);
    }

.connection-overlay__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(213, 166, 66, 0.2);
    border-top-color: #d5a642;
    border-radius: 50%;
    animation: overlaySpinner 0.8s linear infinite;
}

@keyframes overlaySpinner {
    to {
        transform: rotate(360deg);
    }
}

.promotion-dialog-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(5, 5, 6, 0.85);
    backdrop-filter: blur(6px);
    z-index: 9999;
}

.promotion-dialog {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 2.5rem;
    border: 1px solid rgba(213, 166, 66, 0.35);
    border-radius: 12px;
    background: rgba(10, 9, 8, 0.95);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(213, 166, 66, 0.08);
    text-align: center;
}

    .promotion-dialog h3 {
        font-family: 'Cinzel', serif;
        font-size: 1.1rem;
        font-weight: 900;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: #ffe8a0;
        margin: 0;
    }

    .promotion-dialog p {
        font-size: 0.8rem;
        color: rgba(247, 234, 208, 0.5);
        margin: 0;
    }

.promotion-dialog__options {
    display: flex;
    gap: 0.65rem;
}

.promotion-dialog__option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem 1.2rem;
    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.7);
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 160ms ease;
}

    .promotion-dialog__option:hover {
        background: rgba(213, 166, 66, 0.12);
        border-color: rgba(213, 166, 66, 0.5);
        color: #ffe8a0;
        box-shadow: 0 0 16px rgba(213, 166, 66, 0.2);
        transform: translateY(-2px);
    }

    .promotion-dialog__option:active {
        transform: translateY(0);
        box-shadow: 0 0 8px rgba(213, 166, 66, 0.15);
    }

.analytics-row--reveal .analytics-value {
    display: flex;
    gap: 0.3rem;
}

.analytics-reveal-piece {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(213, 166, 66, 0.3);
    background: rgba(213, 166, 66, 0.08);
    font-size: 0.85rem;
    cursor: default;
}
/* ════════════════════════════════════════════
   Resign Modal
   ════════════════════════════════════════════ */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 2000;
}

.modal-shell-custom {
    position: fixed;
    inset: 0;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-card-custom {
    width: min(460px, 100%);
    background: #202020;
    color: #f5f5f5;
    border: 1px solid #555;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
    overflow: hidden;
}

.modal-header-custom {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #444;
}

    .modal-header-custom h3 {
        margin: 0;
        font-size: 1.25rem;
    }

.modal-body-custom {
    padding: 1.25rem;
}

    .modal-body-custom p {
        margin: 0;
        line-height: 1.5;
    }

.modal-actions-custom {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid #444;
}

.country-flag-preview {
    width: 1.75rem;
    height: 1.25rem;
    flex: 0 0 auto;
}

.board-stage--active {
    border-color: rgba(213, 166, 66, 0.65);
    box-shadow: 0 0 14px rgba(213, 166, 66, 0.12);
}


.rematch-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.rematch-option {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
}

    .rematch-option:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .rematch-option input {
        margin-top: 0.2rem;
    }

    .rematch-option span {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    .rematch-option small {
        opacity: 0.75;
        line-height: 1.35;
    }

.rematch-option--readonly {
    cursor: default;
    opacity: 0.9;
}

    .rematch-option--readonly:hover {
        background: rgba(255, 255, 255, 0.06);
    }

/* ═══════════════════════════════════════════════════════════
   Available Moves — grouped pills with buttonized destinations
   Pair this with your existing .panel-card / .available-moves-card.
   ═══════════════════════════════════════════════════════════ */

/* The body should let the groups area scroll on overflow.
   If your .panel-card__body already sets a height, this inherits it;
   otherwise cap it here so overflow scrolls instead of growing. */
.available-moves-card .panel-card__body {
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow inner scroll within a flex parent */
    max-height: 420px; /* tune to your layout; remove if parent caps height */
    overflow: hidden;
}

/* groups fill left → right, then wrap; scroll vertically on overflow */
.moves-groups {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start; /* pack rows to the top */
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

/* each piece = one bordered group holding its destination chips */
.move-group {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid rgba(255, 232, 160, 0.12);
    border-radius: 10px;
    background: rgba(8, 7, 10, 0.5);
    transition: border-color 0.12s ease, background 0.12s ease;
}

/* highlighted when its piece is the selected source square on the board */
.move-group--active {
    border-color: rgba(255, 232, 160, 0.7);
    background: rgba(255, 232, 160, 0.08);
}

.move-group__piece {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.move-group__icon {
    opacity: 0.9;
}

.move-group__from {
    opacity: 0.7;
    letter-spacing: 0.02em;
}

.move-group__arrow {
    opacity: 0.4;
}

.move-group__dests {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* destination chip = clickable button */
.dest-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(255, 232, 160, 0.2);
    border-radius: 999px;
    background: rgba(8, 7, 10, 0.7);
    color: rgba(235, 228, 212, 0.9);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

    .dest-chip:hover {
        border-color: rgba(255, 232, 160, 0.6);
        background: rgba(255, 232, 160, 0.1);
        color: rgba(255, 244, 220, 1);
    }

/* capture moves get a distinct accent */
.dest-chip--capture {
    border-color: rgba(232, 140, 110, 0.45);
}

    .dest-chip--capture:hover {
        border-color: rgba(232, 140, 110, 0.85);
        background: rgba(232, 140, 110, 0.12);
    }

.dest-chip__capture {
    font-size: 0.75rem;
    opacity: 0.85;
}

.moves-waiting {
    padding: 1rem;
    text-align: center;
    color: rgba(220, 210, 190, 0.55);
    font-size: 0.85rem;
}

.board-flip-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(213, 166, 66, 0.25);
    border-radius: var(--radius, 8px);
    background: transparent;
    cursor: pointer;
    transition: all 140ms ease;
}

    .board-flip-btn:hover {
        border-color: rgba(213, 166, 66, 0.5);
        background: rgba(213, 166, 66, 0.08);
        transform: scale(1.05);
    }

    .board-flip-btn:active {
        transform: scale(0.96);
    }

    .board-flip-btn:focus-visible {
        outline: 2px solid rgba(239, 198, 100, 0.9);
        outline-offset: 2px;
    }

.board-flip-square {
    display: block;
    width: 32px;
    height: 32px;
}

.board-flip-icon {
    width: 34px;
    height: 34px;
    display: block;
}

/* ============================================
   HELP ICON — question mark in circle
   ============================================ */
.help-icon {
    --gold: #d4a94a;
    --gold-bright: #f0c95f;
    --gold-dim: #8a7332;
    --panel-bg: #1a1408;
    --panel-border: #4a3d1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--gold-dim);
    color: var(--gold-dim);
    background: transparent;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    padding: 0;
    transition: color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    -webkit-user-select: none;
    user-select: none;
}

    .help-icon::before {
        content: "?";
    }

    .help-icon:hover,
    .help-icon:focus-visible {
        color: var(--gold-bright);
        border-color: var(--gold-bright);
        box-shadow: 0 0 8px rgba(240, 201, 95, 0.45);
        transform: scale(1.08);
        outline: none;
    }

    .help-icon:focus-visible {
        box-shadow: 0 0 0 2px rgba(240, 201, 95, 0.35), 0 0 8px rgba(240, 201, 95, 0.45);
    }

/* Corner placement inside a panel header */
.panel-header {
    position: relative;
}

.help-icon--corner {
    position: absolute;
    top: 10px;
    right: 12px;
}

.pred-board__tray > .help-icon--corner {
    right: -28px;
}

/* Inline placement (e.g. beside the prediction-tray question) */
.help-icon--inline {
    margin-left: 8px;
    vertical-align: middle;
}

/* ============================================
   POPOVER
   ============================================ */
.help-popover {
    position: absolute;
    z-index: 50;
    max-width: 280px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #221a0b 0%, #1a1408 100%);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 169, 74, 0.08), inset 0 1px 0 rgba(240, 201, 95, 0.06);
    color: #e8dcc0;
    font-family: Georgia, serif;
    font-size: 13px;
    line-height: 1.55;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

    .help-popover[data-open="true"] {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

.help-popover__title {
    color: var(--gold-bright);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 8px;
}

.help-popover__learn-more {
    display: inline-block;
    margin-top: 10px;
    color: var(--gold);
    font-size: 12px;
    text-decoration: none;
    border-bottom: 1px solid rgba(212, 169, 74, 0.4);
    cursor: pointer;
}

    .help-popover__learn-more:hover {
        color: var(--gold-bright);
        border-color: var(--gold-bright);
    }

/* Arrow — flip side with a modifier class when opening leftward */
.help-popover::after {
    content: "";
    position: absolute;
    top: -6px;
    right: 14px;
    width: 10px;
    height: 10px;
    background: #221a0b;
    border-left: 1px solid var(--panel-border);
    border-top: 1px solid var(--panel-border);
    transform: rotate(45deg);
}

.help-popover--flip-left::after {
    right: auto;
    left: 14px;
}


/* ============================================
   POPOVER CLOSE BUTTON
   ============================================ */
.help-popover__close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--gold-dim, #8a7332);
    font-family: Georgia, serif;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

    .help-popover__close::before {
        content: "\00d7"; /* × multiplication sign — cleaner than a keyboard x */
    }

    .help-popover__close:hover,
    .help-popover__close:focus-visible {
        color: var(--gold-bright, #f0c95f);
        background: rgba(240, 201, 95, 0.1);
        transform: scale(1.1);
        outline: none;
    }

    .help-popover__close:focus-visible {
        box-shadow: 0 0 0 2px rgba(240, 201, 95, 0.35);
    }

.upgrade-modal {
    position: relative;
    max-width: 400px;
    padding: 30px 32px 24px;
    background: linear-gradient(180deg, #221a0b 0%, #16110a 100%);
    border: 1px solid #4a3d1c;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.65);
    color: #e8dcc0;
    font-family: Georgia, serif;
}

.upgrade-modal__title {
    color: var(--gold-bright, #f0c95f);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
    text-align: center;
    line-height: 1.3;
}

.upgrade-modal__sub {
    font-size: 13px;
    color: #cbb98a;
    margin: 0 0 22px;
    text-align: center;
    line-height: 1.45;
}

.upgrade-field {
    margin-bottom: 16px;
}

    .upgrade-field label {
        display: block;
        font-size: 11px;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        color: var(--gold-dim, #8a7332);
        margin-bottom: 5px;
    }

.upgrade-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    background: rgba(0,0,0,0.35);
    border: 1px solid #4a3d1c;
    border-radius: 7px;
    color: #e8dcc0;
    font-family: Georgia, serif;
    font-size: 14px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

    .upgrade-input:focus {
        outline: none;
        border-color: var(--gold, #d4a94a);
        box-shadow: 0 0 0 2px rgba(240,201,95,0.18);
    }

.upgrade-input--good {
    border-color: #6f9c5c;
}

.upgrade-input--bad {
    border-color: #b5563f;
}

.upgrade-input-wrap {
    position: relative;
}

.upgrade-reveal {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--gold-dim, #8a7332);
    font-family: Georgia, serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

    .upgrade-reveal:hover {
        color: var(--gold-bright, #f0c95f);
    }

.upgrade-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #7a6f58;
}

.upgrade-hint--good {
    color: #8fbf7a;
}

.upgrade-hint--bad {
    color: #d98b6a;
}

.upgrade-errors {
    margin: 4px 0 14px;
    padding: 10px 12px;
    background: rgba(181,86,63,0.12);
    border: 1px solid rgba(181,86,63,0.4);
    border-radius: 7px;
}

    .upgrade-errors p {
        margin: 0 0 4px;
        font-size: 12.5px;
        color: #e0a48c;
    }

        .upgrade-errors p:last-child {
            margin-bottom: 0;
        }

.upgrade-submit {
    width: 100%;
    margin-top: 6px;
}

    .upgrade-submit:disabled {
        opacity: 0.55;
        cursor: default;
    }

.upgrade-modal__foot {
    margin: 16px 0 0;
    text-align: center;
    font-size: 11.5px;
    color: #7a6f58;
    line-height: 1.4;
}

.upgrade-guest-link {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--gold-dim, #8a7332);
    font-family: Georgia, serif;
    font-size: 12.5px;
    cursor: pointer;
    transition: color 0.16s ease;
}

    .upgrade-guest-link:hover {
        color: var(--gold-bright, #f0c95f);
        text-decoration: underline;
    }

.chess-square.square--dark.square--decayed,
.chess4-square.square--dark.square--decayed {
    position: relative;
    box-shadow: inset 0 0 24px 10px rgba(0, 0, 0, 0.7);
}

    .chess-square.square--dark.square--decayed::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: url('/images/decay1.png');
        mix-blend-mode: luminosity;
        opacity: 0.5;
        z-index: 0;
        background-size: 110%;
        background-position: center;
        background-repeat: no-repeat;
        animation: decay-dark-fadeInOut 4.0s ease-in-out infinite;
    }

    .chess4-square.square--dark.square--decayed::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: url('/images/decay1.png');
        mix-blend-mode: luminosity;
        opacity: 0.5;
        z-index: 0;
        background-size: 110%;
        background-position: center;
        background-repeat: no-repeat;
        animation: decay-dark-fadeInOut 4.0s ease-in-out infinite;
    }

@keyframes decay-dark-fadeInOut {
    0% {
        opacity: 0.6;
        filter: contrast(1.0) brightness(0.9);
    }

    50% {
        opacity: 0.5;
        filter: contrast(1.1) brightness(0.65);
    }

    100% {
        opacity: 0.6;
        filter: contrast(1.0) brightness(0.9);
    }
}

.chess-square.square--light.square--decayed,
.chess4-square.square--light.square--decayed {
    position: relative;
    box-shadow: inset 0 0 24px 10px rgba(0, 0, 0, 0.2);
}

    .chess-square.square--light.square--decayed::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: url('/images/decay1.png');
        mix-blend-mode: soft-light;
        opacity: 0.9;
        z-index: 0;
        background-size: 110%;
        background-position: center;
        background-repeat: no-repeat;
        transform: rotate(270deg);
        animation: decay-light-fadeInOut 4.0s ease-in-out infinite;
    }

    .chess4-square.square--light.square--decayed::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: url('/images/decay1.png');
        mix-blend-mode: soft-light;
        opacity: 0.9;
        z-index: 0;
        background-size: 110%;
        background-position: center;
        background-repeat: no-repeat;
        transform: rotate(270deg);
        animation: decay-light-fadeInOut 4.0s ease-in-out infinite;
    }

@keyframes decay-light-fadeInOut {
    0% {
        opacity: 0.95;
        filter: contrast(1.0) brightness(1.1);
    }

    50% {
        opacity: 0.75;
        filter: contrast(1.1) brightness(0.7);
    }

    100% {
        opacity: 0.95;
        filter: contrast(1.0) brightness(1.1);
    }
}

section.panel-card-left.hide-on-mobile > div.abyss-card {
    position: relative;
    overflow: visible; /* let the bleed escape */
    background: transparent;
    border: none !important;
    width: 320px;
    max-width: 320px;
    min-width: 320px;
    height: 220px;
    padding: 34px 60px 60px;
    z-index: 0;
}

    section.panel-card-left.hide-on-mobile > div.abyss-card::before {
        content: "";
        position: absolute;
        inset: -40px -40px; /* bleeds past the card */
        z-index: -1; /* behind everything in the card */
        pointer-events: none;
        background: radial-gradient(ellipse at center, rgba(6, 4, 3, 0.85) 0%, rgba(6, 4, 3, 0.55) 32%, rgba(6, 4, 3, 0.25) 52%, transparent 72%), url('/images/decay1.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-blend-mode: multiply;
        opacity: 0.6;
        filter: brightness(0.7);
        -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 70%);
        mask-image: radial-gradient(ellipse at center, #000 30%, transparent 70%);
    }

@media (min-width: 1920px) {
    section.panel-card-left.hide-on-mobile > div.abyss-card {
        width: 347px !important;
        max-width: 347px !important;
        min-width: 347px !important;
        height: 347px !important;
        margin-top: -40px !important;
        margin-bottom: -40px !important;
    }

        section.panel-card-left.hide-on-mobile > div.abyss-card::before {
            inset: -40px -40px;
            background: radial-gradient(ellipse at center, rgba(6, 4, 3, 0.85) 0%, rgba(6, 4, 3, 0.55) 32%, rgba(6, 4, 3, 0.25) 52%, transparent 72%), url('/images/decay1.png');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-blend-mode: multiply;
            opacity: 0.6;
            filter: brightness(0.7);
            -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 70%);
            mask-image: radial-gradient(ellipse at center, #000 30%, transparent 70%);
            animation: abyss-slow-rotate 320s linear infinite;
        }
}

.abyss-card__content {
    position: absolute;
    width: 200px !important;
    max-width: 200px !important;
    min-width: 200px !important;
    height: 200px !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1; /* above the ::before atmosphere */
}

.abyss-card__label {
    font-family: Georgia, serif;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8a7332;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2; /* above the atmosphere */
}

.abyss-slots {
    position: absolute;
    display: grid;
    grid-template-columns: repeat(var(--abyss-cols, 3), 1fr);
    gap: 6px;
    top: 32px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(64, 64, 64, 0.7);
}

.abyss-slot {
    aspect-ratio: 1;
    display: flex;
    width: 47px;
    height: 47px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(74, 61, 28, 0.5);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.abyss-slot--empty {
    border-style: dashed;
    border-color: rgba(74, 61, 28, 0.3);
    background: rgba(0, 0, 0, 0.2);
}

/* The next piece to return — the abyss reaches for it. */
.abyss-slot--returning {
    border-color: #d4a94a;
    box-shadow: 0 0 10px rgba(240, 201, 95, 0.4);
    animation: abyss-pulse 2.2s ease-in-out infinite;
}

@keyframes abyss-slow-rotate {
    from {
        rotate: 0deg;
    }

    to {
        rotate: 360deg;
    }
}

@keyframes abyss-pulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(240, 201, 95, 0.3);
    }

    50% {
        box-shadow: 0 0 16px rgba(240, 201, 95, 0.6);
    }
}

/* The coffin — buried, dim, permanent. */
.abyss-coffin {
    position: absolute;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    bottom: 32px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-top: 6px;
    border-top: 2px solid rgba(64, 64, 64, 0.7);
}

.abyss-coffin__piece {
    width: 47px;
    height: 47px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5; /* the unmade — dimmed */
    filter: grayscale(0.7) brightness(0.7);
}

@media (prefers-reduced-motion: reduce) {
    .abyss-slot--returning {
        animation: none;
    }
}
