/* ========================================================
   NEON CYBER CHESS — Stylesheet
   Theme: Cyan #00f7ff, Pink #ff2bd6, Gold #ffd700, Cyber Dark #050816
======================================================== */

:root {
    --cyan:        #00f7ff;
    --pink:        #ff2bd6;
    --purple:      #8b5cf6;
    --yellow:      #ffd700;
    --green:       #10b981;
    --dark:        #050816;
    --text:        #ffffff;
    --card-bg:     rgba(13, 20, 44, 0.75);
    --card-border: rgba(255, 255, 255, 0.15);
    --muted:       #94a3b8;
}

body.light-theme {
    --dark:        #edf7ff;
    --text:        #0f172a;
    --card-bg:     rgba(255, 255, 255, 0.85);
    --card-border: rgba(15, 23, 42, 0.15);
    --muted:       #475569;
}

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

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 15%, #1e1b4b 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, #172554 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #0d1430 0%, transparent 70%),
        var(--dark);
    background-attachment: fixed;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 40px;
}

/* Background animated glow orbs */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}
.bg-glow-1 {
    width: 380px;
    height: 380px;
    background: var(--cyan);
    top: -80px;
    left: -80px;
}
.bg-glow-2 {
    width: 420px;
    height: 420px;
    background: var(--pink);
    bottom: -100px;
    right: -100px;
}

.chess-container {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Header */
.chess-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 14px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    margin-bottom: 18px;
}
.nav-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cyan);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(0, 247, 255, 0.1);
    border: 1px solid rgba(0, 247, 255, 0.3);
    transition: all 0.2s ease;
}
.nav-back-link:hover {
    background: rgba(0, 247, 255, 0.22);
    box-shadow: 0 0 14px rgba(0, 247, 255, 0.3);
    transform: translateX(-3px);
}
.nav-back-link svg {
    width: 18px;
    height: 18px;
}

.chess-title h1 {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-align: center;
}
.chess-title h1 span {
    background: linear-gradient(135deg, var(--cyan), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mini-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mini-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}
.mini-btn svg {
    width: 18px;
    height: 18px;
}

/* Control & Mode Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(14px);
    padding: 12px 18px;
    border-radius: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.mode-selectors {
    display: flex;
    gap: 8px;
}
.mode-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.mode-btn.active {
    background: linear-gradient(135deg, var(--cyan), #0284c7);
    color: #050816;
    border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 247, 255, 0.4);
}

.turn-status-badge {
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.turn-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.turn-white {
    background: var(--cyan);
    box-shadow: 0 0 12px var(--cyan);
}
.turn-black {
    background: var(--pink);
    box-shadow: 0 0 12px var(--pink);
}

/* Captured Pieces Bar */
.captured-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(13, 20, 44, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 14px;
    margin-bottom: 16px;
    font-size: 1.15rem;
    min-height: 42px;
}
.captured-side {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.captured-cyan { color: var(--cyan); text-shadow: 0 0 8px rgba(0, 247, 255, 0.5); }
.captured-pink { color: var(--pink); text-shadow: 0 0 8px rgba(255, 43, 214, 0.5); }

/* The Neon Chess Board */
.chess-board-wrap {
    background: linear-gradient(145deg, #0f1c3f, #09132b);
    border: 2px solid rgba(0, 247, 255, 0.45);
    border-radius: 20px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 247, 255, 0.18);
    padding: 12px;
    margin: 0 auto 20px;
    max-width: 580px;
    aspect-ratio: 1;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.chess-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Squares */
.square {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    font-size: clamp(2rem, 5.5vw, 3.2rem);
    transition: background 0.15s ease, transform 0.1s ease;
    line-height: 1;
}
.square.light {
    background: rgba(15, 28, 64, 0.85);
}
.square.dark {
    background: rgba(6, 12, 30, 0.95);
}

/* Selected square */
.square.selected {
    background: rgba(0, 247, 255, 0.28) !important;
    box-shadow: inset 0 0 14px rgba(0, 247, 255, 0.7);
}

/* Legal Move Highlight */
.square.possible-move::after {
    content: "";
    position: absolute;
    width: 24%;
    height: 24%;
    border-radius: 50%;
    background: rgba(0, 247, 255, 0.65);
    box-shadow: 0 0 10px rgba(0, 247, 255, 0.8);
    pointer-events: none;
}
.square.possible-capture {
    background: rgba(255, 43, 214, 0.25) !important;
    box-shadow: inset 0 0 14px rgba(255, 43, 214, 0.6);
}

/* In Check Highlight */
.square.in-check {
    background: rgba(239, 68, 68, 0.4) !important;
    animation: pulseCheck 1s infinite alternate;
}
@keyframes pulseCheck {
    0% { box-shadow: inset 0 0 10px #ef4444; }
    100% { box-shadow: inset 0 0 25px #ef4444; }
}

/* Pieces Styling */
.piece {
    pointer-events: none;
    transition: transform 0.15s ease;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.8));
}
.piece.white {
    color: var(--cyan);
    filter: drop-shadow(0 0 8px rgba(0, 247, 255, 0.75));
}
.piece.black {
    color: var(--pink);
    filter: drop-shadow(0 0 8px rgba(255, 43, 214, 0.75));
}

/* Action Controls Bar */
.game-actions-bar {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 10px;
}
.chess-action-btn {
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-reset {
    background: linear-gradient(135deg, var(--cyan), #0284c7);
    color: #050816;
    box-shadow: 0 4px 16px rgba(0, 247, 255, 0.35);
}
.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(0, 247, 255, 0.55);
}

/* Victory / Game Over Modal */
.victory-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 8, 22, 0.88);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.victory-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.victory-modal {
    background: var(--card-bg);
    border: 2px solid var(--cyan);
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 247, 255, 0.35);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.victory-modal-overlay.active .victory-modal {
    transform: scale(1);
}
.victory-modal h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 900;
}
.victory-modal p {
    color: var(--muted);
    font-size: 1rem;
    margin-bottom: 24px;
}
