/* =============================================================================
   Vanguard Chess — Global Styles
   Palette from design doc:
     Light square  #F0D9B5   Dark square   #B58863
     Accent blue   #4A90D9   Accent red    #D94A4A
     Highlight     #F5E663   Background    #1E1E1E
     Surface       #2A2A2A   Text          #E8E8E8
============================================================================= */

:root {
    --board-light: #F0D9B5;
    --board-dark: #B58863;
    --accent-you: #c5a059;
    --accent-opp: #D94A4A;
    --highlight: #c5a059;
    --bg: #050505;
    --surface: #0e0e0e;
    --surface-2: #1a1a1a;
    --text: #e0e0e0;
    --text-muted: #888888;
    --sq-size: clamp(55px, 9vh, 92px);
    --card-w: 140px;
    --card-h: 200px;
    --radius: 6px;
    --font: 'Segoe UI', system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
}

.vc-game-page {
    min-height: 100vh;
    width: 100%;
    background: radial-gradient(circle at center, #1b202e 0%, #0a0d14 100%);
    color: var(--text);
    font-family: var(--font);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

/* =============================================================================
   LAYOUT
============================================================================= */

.game-layout {
    display: grid;
    grid-template-columns: 1fr auto 340px 1fr;
    grid-template-rows: auto 1fr auto auto auto;
    gap: 16px;
    padding: 16px;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    align-items: stretch;
}

.board-column {
    grid-column: 2;
    grid-row: 1 / span 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
}

.player-column {
    display: contents;
}

#opp-hud {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
}

.card-hand {
    grid-column: 2;
    grid-row: 5;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 8px 0;
    overflow-x: visible;
    max-width: none;
    justify-content: center;
}

#player-hud {
    grid-column: 3;
    grid-row: 3;
    align-self: end;
}

.game-log {
    grid-column: 3;
    grid-row: 2;
    height: 100%;
    max-height: none;
}

.player-controls {
    grid-column: 3;
    grid-row: 4;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-self: start;
}

/* =============================================================================
   CHESS BOARD
============================================================================= */

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, var(--sq-size));
    grid-template-rows: repeat(8, var(--sq-size));
    border: 3px solid var(--surface-2);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .55);
    position: relative;
}

.chess-square {
    width: var(--sq-size);
    height: var(--sq-size);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background 80ms;
    user-select: none;
}

.sq-light {
    background: var(--board-light);
}

.sq-dark {
    background: var(--board-dark);
}

.sq-selected {
    outline: 3px solid var(--highlight);
    outline-offset: -3px;
}

.sq-move {
    background-color: color-mix(in srgb, var(--accent-you) 30%, transparent);
}

.sq-capture {
    background-color: color-mix(in srgb, var(--accent-opp) 30%, transparent);
}

.sq-card-target {
    outline: 2px dashed var(--highlight);
    outline-offset: -2px;
}

.sq-card-target:hover {
    background-color: color-mix(in srgb, var(--highlight) 30%, transparent);
}

.sq-card-highlight {
    outline: 2px solid var(--highlight);
    outline-offset: -2px;
    background-color: color-mix(in srgb, var(--highlight) 25%, transparent);
}

.sq-card-highlight:hover {
    background-color: color-mix(in srgb, var(--highlight) 45%, transparent);
    cursor: crosshair;
}

.sq-opp-last-move {
    box-shadow: inset 0 0 10px color-mix(in srgb, var(--accent-opp) 60%, transparent), 0 0 15px color-mix(in srgb, var(--accent-opp) 40%, transparent);
    z-index: 1;
    animation: opp-move-glow 2s infinite alternate ease-in-out;
}

@keyframes opp-move-glow {
    from {
        box-shadow: inset 0 0 6px color-mix(in srgb, var(--accent-opp) 40%, transparent), 0 0 10px color-mix(in srgb, var(--accent-opp) 30%, transparent);
    }

    to {
        box-shadow: inset 0 0 14px color-mix(in srgb, var(--accent-opp) 80%, transparent), 0 0 20px color-mix(in srgb, var(--accent-opp) 60%, transparent);
    }
}

/* When card-targeting is active, non-target squares show not-allowed cursor */
.board-card-targeting .chess-square {
    cursor: not-allowed;
}

.board-card-targeting .sq-card-highlight {
    cursor: crosshair;
}

.piece {
    font-size: calc(var(--sq-size) * 0.72);
    line-height: 1;
    cursor: grab;
    transition: filter 80ms;
    position: relative;
    z-index: 2;
}

.piece-white {
    color: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.piece-black {
    color: #000000;
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.6)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

.piece-attached::after {
    content: '★';
    font-size: .45em;
    position: absolute;
    bottom: 0;
    right: 0;
    color: var(--highlight);
}

.move-dot {
    position: absolute;
    width: 28%;
    height: 28%;
    background: var(--accent-you);
    border-radius: 50%;
    opacity: 0.65;
    pointer-events: none;
}

.capture-ring {
    position: absolute;
    inset: 4px;
    border: 3px solid var(--accent-opp);
    border-radius: 50%;
    opacity: 0.7;
    pointer-events: none;
}

/* Square labels */
.sq-label {
    position: absolute;
    font-size: 10px;
    color: var(--text-muted);
    opacity: .5;
    pointer-events: none;
}

.sq-file {
    bottom: 2px;
    right: 3px;
}

.sq-rank {
    top: 2px;
    left: 3px;
}

/* =============================================================================
   CARD HAND
============================================================================= */


.card-slot,
.vc-card-item {
    position: relative;
    background: #0e0e0e !important;
    border: 1px solid #1a1a1a !important;
    border-radius: 16px !important;
    padding: 16px !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.card-slot {
    width: var(--card-w);
    height: var(--card-h);
    padding: 10px !important;
    gap: 8px;
}

.vc-card-item {
    width: 200px;
    height: 280px;
    /* Longer and narrower! */
}

.card-slot:hover,
.vc-card-item:hover {
    border-color: #c5a059 !important;
    transform: translateY(-12px) scale(1.04);
    box-shadow: 0 8px 20px rgba(197, 160, 89, 0.25) !important;
}

.card-selected {
    border-color: #c5a059 !important;
    box-shadow: 0 0 15px rgba(197, 160, 89, 0.6), 0 8px 20px rgba(0, 0, 0, 0.5) !important;
}

.card-unplayable {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Redesigned Card Core Elements (shared) */
.vc-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.vc-card-tier {
    font-family: var(--font-body);
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #555555 !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vc-card-badge {
    background: rgba(197, 160, 89, 0.08) !important;
    border: 1px solid rgba(197, 160, 89, 0.25) !important;
    color: #c5a059 !important;
    border-radius: 9999px !important;
    padding: 3px 10px !important;
    font-size: 11px !important;
    font-weight: 700;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.vc-card-badge .material-symbols-outlined {
    font-size: 13px !important;
    font-variation-settings: 'FILL' 1;
}

.vc-card-name {
    font-family: var(--font-sans);
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    margin: 4px 0 0 0 !important;
    line-height: 1.2;
    text-align: left;
}

.card-slot .vc-card-name {
    font-size: 12px !important;
}

.vc-card-art {
    flex: 1;
    background: rgba(8, 8, 8, 0.5) !important;
    border: none !important;
    border-radius: 12px !important;
    width: 100% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    z-index: 10;
    padding: 8px 0 !important;
}

.vc-card-art svg {
    width: auto !important;
    height: 80% !important;
    color: rgba(255, 255, 255, 0.8) !important;
    transition: transform 0.5s ease;
}

.vc-card-item:hover .vc-card-art svg,
.card-slot:hover .vc-card-art svg {
    transform: scale(1.1);
    color: #ffffff !important;
}

.vc-card-desc {
    font-size: 12px !important;
    color: #888888 !important;
    line-height: 1.5 !important;
    text-align: left;
    margin: 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-slot .vc-card-desc {
    font-size: 9px !important;
    line-height: 1.3 !important;
}

.vc-card-bar {
    width: 100% !important;
    height: 4px !important;
    background: #1a1a1a !important;
    border-radius: 9999px !important;
    overflow: hidden;
    margin-top: 4px !important;
}

.vc-card-bar-fill {
    height: 100%;
    background: #c5a059 !important;
    border-radius: 9999px;
}

/* =============================================================================
   HUD PANELS
============================================================================= */

.player-hud,
.opponent-hud {
    background: var(--surface);
    border: 2px solid var(--surface-2);
    border-radius: var(--radius);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hud-active {
    border-color: var(--accent-you);
}

.opponent-hud.hud-active {
    border-color: var(--accent-opp);
}

.hud-name {
    font-size: 1rem;
    font-weight: 700;
}

.hud-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.hud-tp-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-tp-dots {
    display: flex;
    gap: 4px;
}

.tp-dot {
    font-size: 1rem;
}

.tp-dot.filled {
    color: var(--highlight);
}

.tp-dot.empty {
    color: var(--surface-2);
}

.hud-tp-num {
    font-size: .75rem;
    color: var(--text-muted);
}

.hud-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .8rem;
    color: var(--text-muted);
}

.hud-turn-badge {
    margin-left: auto;
    font-size: .7rem;
    font-weight: 700;
    color: var(--bg);
    background: var(--accent-you);
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: .04em;
}

.opp-badge {
    background: var(--accent-opp);
}

/* =============================================================================
   GAME LOG
============================================================================= */

.game-log {
    background: var(--surface);
    border: 1px solid var(--surface-2);
    border-radius: var(--radius);
    padding: 8px 10px;
    min-width: 240px;
    max-height: 200px;
    overflow-y: auto;
    font-size: .78rem;
}

.log-header {
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    color: var(--text-muted);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--surface-2);
    margin-bottom: 4px;
}

.log-title {
    font-weight: 600;
}

.log-toggle {
    user-select: none;
}

.log-entry {
    padding: 2px 0;
    display: flex;
    gap: 6px;
}

.log-turn {
    color: var(--accent-you);
    min-width: 24px;
}

.log-text {
    color: var(--text-muted);
}

.log-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* =============================================================================
   REACTIVE WINDOW BANNER
============================================================================= */

.reactive-banner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    background: color-mix(in srgb, var(--highlight) 15%, var(--surface));
    border: 2px solid var(--highlight);
    border-radius: var(--radius);
    padding: 12px 16px;
    animation: reactive-pulse 0.9s ease-in-out infinite alternate;
    width: 240px;
    box-sizing: border-box;
    position: absolute;
    right: calc(100% + 16px);
    top: 0;
    z-index: 10;
}

@keyframes reactive-pulse {
    from {
        box-shadow: 0 0 4px var(--highlight);
    }

    to {
        box-shadow: 0 0 16px var(--highlight);
    }
}

.reactive-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reactive-icon {
    font-size: 1.2rem;
}

.reactive-label {
    font-weight: 700;
    letter-spacing: .06em;
    font-size: .85rem;
}

.reactive-countdown {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--highlight);
    margin-left: auto;
}

.reactive-guidance {
    font-size: 0.8rem;
    color: var(--text);
    opacity: 0.95;
    line-height: 1.4;
    border-top: 1px solid rgba(245, 230, 99, 0.25);
    padding-top: 8px;
    margin-top: 2px;
}

.reactive-guidance strong {
    color: var(--highlight);
}

.reactive-pass-btn {
    background: var(--surface-2);
    border: 1px solid var(--text-muted);
    color: var(--text);
    padding: 6px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    align-self: flex-end;
    transition: background 150ms;
}

.reactive-pass-btn:hover {
    background: var(--surface);
}

/* =============================================================================
   TARGETING PROMPT
============================================================================= */

.targeting-prompt {
    background: var(--surface);
    border: 2px solid var(--accent-you);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: .82rem;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--accent-opp);
    color: var(--accent-opp);
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
}

/* =============================================================================
   END TURN BUTTON
============================================================================= */

.btn-end-turn {
    background: var(--accent-you);
    color: #000000;
    border: none;
    border-radius: var(--radius);
    padding: 10px 22px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .04em;
    transition: opacity 120ms;
    align-self: flex-start;
}

.btn-end-turn:hover {
    opacity: .85;
}

/* =============================================================================
   GAME OVER OVERLAY
============================================================================= */

.game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .62);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.game-over-box {
    background: var(--surface);
    border: 2px solid var(--surface-2);
    border-radius: 10px;
    padding: 36px 44px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.game-over-box h2 {
    font-size: 2.2rem;
}

.btn-menu,
.btn-rematch {
    padding: 10px 24px;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-menu {
    background: var(--surface-2);
    color: var(--text);
}

.btn-rematch {
    background: var(--accent-you);
    color: #000000;
}

/* =============================================================================
   ERROR TOAST
============================================================================= */

.toast-error {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-opp);
    color: white;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
    animation: toast-in .22s ease-out;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* =============================================================================
   LOBBY PAGE
============================================================================= */

.lobby-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
    padding: 24px;
}

.lobby-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: .05em;
}

.lobby-sub {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 24px;
}

.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.btn-lobby {
    min-width: 220px;
    padding: 14px 28px;
    border-radius: var(--radius);
    border: none;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .04em;
    transition: opacity 120ms;
}

.btn-lobby:hover {
    opacity: .85;
}

.btn-primary {
    background: var(--accent-you);
    color: #000000;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--text-muted);
}

.searching-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-muted);
}

.searching-spinner {
    display: inline-block;
    font-size: 1.4rem;
    animation: spin 1s linear infinite;
}

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

.found-badge {
    background: var(--accent-you);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-weight: 700;
}

.lobby-error {
    color: var(--accent-opp);
    font-size: .9rem;
    max-width: 320px;
    text-align: center;
}

/* =============================================================================
   LOADING
============================================================================= */

.game-loading {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-muted);
}

/* =============================================================================
   MOBILE ELEMENTS DEFAULT (DESKTOP)
============================================================================= */

.mobile-drawer,
.drawer-body {
    display: contents;
}

.drawer-header {
    display: none;
}

.mobile-floating-btn {
    display: none;
}

.drawer-backdrop {
    display: none;
}

/* =============================================================================
   RESPONSIVE — phones
============================================================================= */

@media (max-width: 720px) {
    .game-layout {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        height: 100dvh;
        max-height: 100dvh;
        padding: 10px;
        gap: 10px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .board-column {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 0;
        gap: 0;
    }

    .opponent-hud {
        padding: 8px 12px;
    }

    .player-column {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding-top: 0;
        width: 100%;
    }

    .player-hud {
        flex: 1;
        padding: 8px 12px;
    }

    .player-controls {
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .btn-end-turn {
        align-self: center;
        margin-top: 0;
        padding: 10px 18px;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    :root {
        --sq-size: min(11vw, 7vh);
        --card-w: 100%;
        --card-h: auto;
    }

    /* Drawers */
    .mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        height: 100dvh;
        background: rgba(30, 30, 30, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        z-index: 1000;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
        box-sizing: border-box;
    }

    .cards-drawer {
        right: 0;
        width: 320px;
        max-width: 85vw;
        transform: translateX(100%);
        border-left: 1px solid rgba(255, 255, 255, 0.08);
    }

    .cards-drawer.drawer-open {
        transform: translateX(0);
    }

    .log-drawer {
        left: 0;
        width: 300px;
        max-width: 80vw;
        transform: translateX(-100%);
        border-right: 1px solid rgba(255, 255, 255, 0.08);
    }

    .log-drawer.drawer-open {
        transform: translateX(0);
    }

    .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .drawer-title {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--highlight);
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .drawer-close-btn {
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 1.6rem;
        line-height: 1;
        cursor: pointer;
        transition: color 150ms;
    }

    .drawer-close-btn:hover {
        color: var(--accent-opp);
    }

    .drawer-body {
        display: block;
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }

    .cards-drawer .card-hand {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 12px;
        max-width: 100%;
        overflow-x: visible;
        overflow-y: visible;
        padding: 0;
    }

    .cards-drawer .card-slot {
        width: 100%;
        min-height: 140px;
        height: auto;
    }

    .log-drawer .game-log {
        background: transparent;
        border: none;
        padding: 0;
        width: 100%;
        max-height: 100%;
        overflow-y: visible;
    }

    /* Backdrop */
    .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        z-index: 999;
        animation: backdrop-fade-in 0.3s ease-out;
    }

    @keyframes backdrop-fade-in {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    /* Floating Action Buttons */
    .mobile-floating-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 80px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 2px solid rgba(255, 255, 255, 0.1);
        color: white;
        cursor: pointer;
        z-index: 950;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .mobile-log-trigger {
        left: 16px;
        background: rgba(40, 40, 40, 0.8);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .mobile-cards-trigger {
        right: 16px;
        background: linear-gradient(135deg, var(--accent-you), #2c5ba0);
        border-color: rgba(255, 255, 255, 0.25);
    }

    .mobile-floating-btn:active {
        transform: scale(0.9);
    }

    .fab-icon {
        width: 24px;
        height: 24px;
    }

    .card-count-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        background: #f59e0b;
        color: #1e1e1e;
        font-size: 0.75rem;
        font-weight: 800;
        min-width: 18px;
        height: 18px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        border: 1.5px solid white;
    }

    .mobile-cards-trigger.has-playable-cards {
        animation: fab-pulse 2s infinite alternate;
    }

    @keyframes fab-pulse {
        0% {
            box-shadow: 0 4px 16px rgba(74, 144, 217, 0.4), 0 0 0 0px rgba(74, 144, 217, 0.4);
        }

        100% {
            box-shadow: 0 4px 20px rgba(74, 144, 217, 0.6), 0 0 0 8px rgba(74, 144, 217, 0);
        }
    }

    /* Floating Targeting Prompt */
    .targeting-prompt {
        position: fixed;
        bottom: 74px;
        left: 10px;
        right: 10px;
        z-index: 900;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
        border: 2px solid var(--accent-you);
        background: rgba(30, 30, 30, 0.95);
        backdrop-filter: blur(8px);
        animation: prompt-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes prompt-slide-up {
        from {
            transform: translateY(15px);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Mobile Reactive Banner */
    .reactive-banner {
        position: fixed;
        top: 12px;
        left: 12px;
        right: 12px;
        width: auto;
        z-index: 950;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
    }
}

.trap-indicator {
    position: absolute;
    font-size: calc(var(--sq-size) * 0.45);
    color: var(--highlight);
    pointer-events: none;
    opacity: 0.8;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    inset: 0;
}

/* =============================================================================
   MODALS AND DIALOGS
   ============================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 15, 0.82);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-box {
    background: var(--surface);
    border: 2px solid var(--surface-2);
    border-radius: 12px;
    padding: 28px 36px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 600px;
    width: 90%;
    animation: modal-scale-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-scale-in {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-box h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--highlight);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    border-bottom: 2px solid rgba(245, 230, 99, 0.15);
    padding-bottom: 10px;
    width: 100%;
}

/* Recon Specific Choices */
.recon-choices {
    display: flex;
    gap: 20px;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

@media (max-width: 500px) {
    .recon-choices {
        flex-direction: column;
        align-items: center;
    }
}

.recon-choice {
    flex: 1;
    max-width: 200px;
    background: var(--surface-2);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    transition: transform 180ms ease, border-color 180ms ease;
}

.recon-choice:hover {
    transform: translateY(-4px);
    border-color: var(--accent-you);
}

.recon-choice strong {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

.recon-choice p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    flex-grow: 1;
}

.recon-choice .btn-primary {
    background: var(--accent-you);
    color: #000000;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: opacity 120ms;
}

.recon-choice .btn-primary:hover {
    opacity: 0.85;
}

/* Resurrection Specific Choices */
.resurrection-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.btn-piece-choice {
    background: var(--surface-2);
    border: 2px solid var(--surface-2);
    color: var(--text);
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    min-width: 110px;
    text-align: center;
    text-transform: capitalize;
    transition: all 150ms ease;
}

.btn-piece-choice:hover {
    background: var(--surface);
    border-color: var(--accent-you);
    color: var(--accent-you);
    transform: translateY(-2px);
}

/* Targeting Banner / Overlay Bar */
.targeting-banner {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 2px solid var(--highlight);
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 180;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    animation: slide-down 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-down {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.targeting-banner .btn-cancel {
    background: transparent;
    border: 1.5px solid var(--accent-opp);
    color: var(--accent-opp);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 120ms ease;
}

.targeting-banner .btn-cancel:hover {
    background: var(--accent-opp);
    color: white;
}

.btn-card-option {
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 120ms ease;
}

.btn-card-option:hover {
    background: var(--surface);
    border-color: var(--accent-you);
    color: var(--accent-you);
}

/* =============================================================================
   CARDS COLLECTION PAGE
   ============================================================================= */
.vc-cards-page {
    min-height: 100dvh;
    background-image: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url('/_content/VanguardChess.Shared/images/vanguard_background_image.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #e0e0e0;
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.vc-cards-main {
    padding-top: 88px;
    /* clear topbar */
    padding-left: 24px;
    padding-right: 24px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.vc-topbar-collection {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    background: #0c0c0c;
    border-bottom: 1px solid #1a1a1a;
}

.vc-collection-back-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border: none;
    border-radius: 0px !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.vc-collection-back-btn:hover {
    opacity: 0.9;
}

.vc-collection-back-btn .material-symbols-outlined {
    font-size: 20px !important;
    font-weight: bold !important;
}

.vc-collection-header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.vc-collection-brand {
    font-size: 11px;
    font-weight: 700;
    color: #c5a059;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
    line-height: 1;
}

.vc-collection-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    font-family: var(--font-display);
    margin: 2px 0 0 0;
}

/* ── Rules Briefing Panel ────────────────────────────────── */
.vc-rules-panel {
    background: rgba(14, 14, 14, 0.4);
    border: 1px solid #1a1a1a;
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.vc-rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: background 0.2s;
}

.vc-rules-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.vc-rules-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vc-rules-icon {
    color: #c5a059;
}

.vc-rules-header h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.vc-collapse-arrow {
    color: var(--on-surface-var);
    transition: transform 0.2s;
}

.vc-rules-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), padding 0.3s ease;
    padding: 0 20px;
}

.vc-rules-body.expanded {
    max-height: 500px;
    padding: 16px 20px 24px 20px;
    transition: max-height 0.3s cubic-bezier(1, 0, 1, 0), padding 0.3s ease;
}

.vc-rules-intro {
    font-size: 14px;
    color: #777777;
    line-height: 1.6;
    margin-bottom: 16px;
}

.vc-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.vc-rule-card {
    background: rgba(8, 8, 8, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 16px;
    position: relative;
}

.vc-rule-num {
    position: absolute;
    top: 12px;
    right: 16px;
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    color: rgba(197, 160, 89, 0.05);
}

.vc-rule-card h4 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: #c5a059;
    margin-bottom: 6px;
}

.vc-rule-card p {
    font-size: 12px;
    color: #777777;
    line-height: 1.5;
}

/* ── Arsenal Title & Filters ──────────────────────────────── */
.vc-arsenal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    border-bottom: 1px solid #1a1a1a;
    padding-bottom: 16px;
    flex-wrap: wrap;
}

.vc-arsenal-title h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--on-surface);
    margin-bottom: 4px;
}

.vc-arsenal-title p {
    font-size: 14px;
    color: #777777;
}

.vc-filters {
    display: flex;
    gap: 8px;
}

.vc-filter-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1a1a1a;
    color: #777777;
    padding: 6px 16px;
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.vc-filter-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.vc-filter-btn.active {
    background: #c5a059 !important;
    border-color: #c5a059 !important;
    color: #000000 !important;
}

/* ── Cards Grid ───────────────────────────────────────────── */
.vc-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    overflow: visible;
    justify-items: center;
}

.vc-card-item {
    position: relative;
    overflow: visible;
}

@media (min-width: 768px) {
    .vc-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 32px;
    }

    .vc-card-item {
        width: 240px;
        height: 320px;
    }
}

/* ── Tooltip Briefing (Tactical Briefing balloon) ─────────── */
.vc-briefing-tooltip {
    position: absolute;
    bottom: 112%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 280px;
    background: #121212 !important;
    border: 1px solid rgba(197, 160, 89, 0.3) !important;
    border-radius: 12px !important;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    z-index: 200;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.vc-briefing-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: #121212 transparent transparent transparent !important;
}

.vc-card-item:hover .vc-briefing-tooltip,
.vc-card-item.show-briefing .vc-briefing-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.vc-briefing-header {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: #c5a059;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vc-briefing-header::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c5a059;
}

.vc-briefing-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    text-align: left;
}

.vc-briefing-desc {
    font-size: 11px;
    color: #aaaaaa;
    line-height: 1.5;
    margin-bottom: 12px;
    text-align: left;
}

.vc-briefing-effects-header {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    color: #c5a059;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
}

.vc-briefing-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.vc-briefing-list li {
    font-size: 10px;
    color: #888888;
    line-height: 1.4;
    position: relative;
    padding-left: 14px;
}

.vc-briefing-list li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 5px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #555555;
}

/* ── Staggered Entrance Animations ────────────────────────── */
@keyframes card-fade-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vc-card-anim {
    animation: card-fade-in 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    opacity: 0;
}

/* ── Responsive Collection Adaptations ─────────────────────── */
@media (max-width: 768px) {
    .vc-arsenal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .vc-filters {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .vc-briefing-tooltip {
        width: 260px;
    }
}

/* ── Bottom nav bar (Global) ─────────────────────────────────── */
.vc-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    min-height: 72px;
    height: calc(72px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--surface-container);
    border-top: 1px solid var(--outline-var);
    box-sizing: border-box;
}

.vc-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 16px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: color 0.15s;
    color: var(--on-surface-var);
}

.vc-nav-btn--active {
    background: var(--secondary-container);
    color: var(--on-secondary-cont);
    padding: 6px 20px;
}

.vc-nav-btn .material-symbols-outlined {
    font-size: 22px;
}

.vc-nav-btn span:last-child {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

@media (max-width: 768px) {
    .vc-cards-page {
        background-image: none;
        position: relative;
        z-index: 1;
    }
    .vc-cards-page::before {
        content: "";
        position: fixed;
        top: 50%;
        left: 50%;
        width: 100vh;
        height: 100vw;
        transform: translate(-50%, -50%) rotate(90deg);
        background-image: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url('/_content/VanguardChess.Shared/images/vanguard_background_image.jpeg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        z-index: -1;
        pointer-events: none;
    }
}