/* ===== PIXEL CHESS - 80s NEON STYLE ===== */
/* Optimiert für Full HD (1920x1080) */

:root {
    --neon-pink: #cc00cc;
    --neon-cyan: #00cccc;
    --neon-purple: #9900cc;
    --neon-blue: #0066cc;
    --neon-yellow: #ffdd00;
    --neon-green: #00cc66;
    --neon-orange: #cc6600;
    --dark-bg: #0a0a1a;
    --darker-bg: #050510;
    --grid-dark: #1a1a3a;
    --grid-light: #2a2a5a;
    --white-piece: #ffffff;
    --black-piece: #1a1a2e;
}

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

body {
    min-height: 100vh;
    background: url('assets/Sunrise.png') no-repeat center center fixed;
    background-size: cover;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    overflow: hidden;
    position: relative;
}

/* Subtle overlay for better readability */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    z-index: 0;
    pointer-events: none;
}

/* Retro scan lines */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(0deg, 
            transparent, 
            transparent 2px, 
            rgba(255, 255, 255, 0.02) 2px, 
            rgba(255, 255, 255, 0.02) 4px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
}

/* Scanline Effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08) 0px,
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 1000;
    opacity: 0.6;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.main-game-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 200px;
}


/* ===== HEADER ===== */
.game-header {
    text-align: center;
    margin-bottom: 2px;
}

.neon-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.4rem;
    color: #ffffff;
    text-shadow: 
        0 0 7px #00ffff,
        0 0 10px #00ffff,
        0 0 21px #00ffff,
        0 0 42px #0ff,
        0 0 82px #0ff,
        0 0 92px #0ff,
        0 0 102px #0ff,
        0 0 151px #0ff;
    animation: neonFlicker 1.5s infinite alternate;
    letter-spacing: 3px;
    -webkit-text-stroke: 1px rgba(0, 255, 255, 0.3);
}

@keyframes neonFlicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow: 
            0 0 7px #00ffff,
            0 0 10px #00ffff,
            0 0 21px #00ffff,
            0 0 42px #0ff,
            0 0 82px #0ff,
            0 0 92px #0ff,
            0 0 102px #0ff,
            0 0 151px #0ff;
    }
    20%, 24%, 55% {
        text-shadow: 
            0 0 4px #00ffff,
            0 0 7px #00ffff,
            0 0 18px #00ffff,
            0 0 38px #0ff;
    }
}

.subtitle {
    font-size: 0.55rem;
    color: var(--neon-cyan);
    text-shadow: 
        0 0 5px var(--neon-cyan),
        0 0 10px var(--neon-cyan);
    margin-top: 4px;
    letter-spacing: 5px;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        text-shadow: 
            0 0 5px var(--neon-pink),
            0 0 10px var(--neon-pink),
            0 0 20px var(--neon-pink),
            0 0 40px var(--neon-pink);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* ===== UNIFIED CONTROL PANEL ===== */
.unified-control-panel {
    width: 100%;
    padding: 25px 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid var(--neon-yellow);
    border-radius: 15px;
    box-shadow: 
        0 0 20px var(--neon-yellow),
        inset 0 0 25px rgba(255, 221, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
}

/* ===== GAME MODE ===== */
.mode-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 221, 0, 0.3);
}

.mode-button {
    font-family: 'Press Start 2P', cursive;
    padding: 15px;
    background: #555555;
    color: #ffffff;
    border: 3px solid #444444;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 90px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.mode-icon {
    font-size: 2.5rem;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.mode-text {
    font-size: 0.35rem;
    text-align: center;
    line-height: 1.5;
    letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow: none;
}

.mode-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6);
}

.mode-button.active {
    background: var(--neon-yellow);
    border-color: var(--neon-yellow);
    box-shadow: 
        0 0 20px var(--neon-yellow),
        0 4px 10px rgba(0, 0, 0, 0.5);
}

.mode-button.active .mode-icon {
    filter: grayscale(0%);
}

.mode-button.active .mode-text {
    color: #000000;
    font-weight: 900;
}

/* ===== PLAYER INFO ===== */
.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.player-indicator {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 5px solid var(--neon-yellow);
    box-shadow: 
        0 0 20px var(--neon-yellow),
        0 0 35px rgba(255, 221, 0, 0.5),
        inset 0 0 15px rgba(255, 221, 0, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: orbGlow 3s ease-in-out infinite;
}

@keyframes orbGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px var(--neon-yellow),
            0 0 35px rgba(255, 221, 0, 0.5),
            inset 0 0 15px rgba(255, 221, 0, 0.3),
            0 5px 15px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 
            0 0 30px var(--neon-yellow),
            0 0 50px rgba(255, 221, 0, 0.7),
            inset 0 0 20px rgba(255, 221, 0, 0.4),
            0 8px 20px rgba(0, 0, 0, 0.6);
    }
}

.player-white .player-indicator {
    background: radial-gradient(circle at 30% 30%, #ffffff, #e0e0e0);
}

.player-black .player-indicator {
    background: radial-gradient(circle at 30% 30%, #2a2a4e, #0a0a1a);
}

.player-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--neon-yellow);
    text-shadow: 
        0 0 8px var(--neon-yellow),
        0 0 15px var(--neon-yellow),
        0 0 25px rgba(255, 221, 0, 0.5);
    letter-spacing: 3px;
    text-align: center;
    text-transform: uppercase;
    animation: textPulse 3s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% {
        text-shadow: 
            0 0 8px var(--neon-yellow),
            0 0 15px var(--neon-yellow),
            0 0 25px rgba(255, 221, 0, 0.5);
    }
    50% {
        text-shadow: 
            0 0 12px var(--neon-yellow),
            0 0 20px var(--neon-yellow),
            0 0 35px rgba(255, 221, 0, 0.7);
    }
}

.turn-indicator {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, 
        rgba(255, 221, 0, 0.15) 0%, 
        rgba(0, 0, 0, 0.8) 50%,
        rgba(255, 221, 0, 0.15) 100%);
    border: 4px solid var(--neon-yellow);
    border-radius: 12px;
    animation: pulse-border 2s infinite;
    text-align: center;
    box-shadow: 
        0 0 20px var(--neon-yellow),
        0 0 35px rgba(255, 221, 0, 0.5),
        inset 0 0 20px rgba(255, 221, 0, 0.2),
        0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.turn-indicator::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255, 221, 0, 0.1) 50%, 
        transparent 70%);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }
    100% {
        transform: translateX(100%) translateY(100%);
    }
}

.turn-indicator span {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    color: var(--neon-yellow);
    text-shadow: 
        0 0 10px var(--neon-yellow),
        0 0 20px var(--neon-yellow),
        0 0 30px rgba(255, 221, 0, 0.5);
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
}

@keyframes pulse-border {
    0%, 100% { 
        box-shadow: 
            0 0 20px var(--neon-yellow),
            0 0 35px rgba(255, 221, 0, 0.5),
            inset 0 0 20px rgba(255, 221, 0, 0.2),
            0 5px 15px rgba(0, 0, 0, 0.5);
        border-color: var(--neon-yellow);
    }
    50% { 
        box-shadow: 
            0 0 30px var(--neon-yellow), 
            0 0 50px var(--neon-yellow),
            0 0 70px rgba(255, 221, 0, 0.7),
            inset 0 0 30px rgba(255, 221, 0, 0.3),
            0 8px 20px rgba(0, 0, 0, 0.6);
        border-color: #ffed4e;
    }
}

.captured-pieces {
    display: flex;
    gap: 1px;
    font-size: 0.7rem;
    min-height: 18px;
    flex-wrap: wrap;
    max-width: 80px;
    justify-content: center;
}

/* ===== CHESS BOARD ===== */
.board-container {
    perspective: 1000px;
}

.board-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #1a1a3a 0%, #0a0a1a 100%);
    border: 2px solid var(--neon-cyan);
    border-radius: 10px;
    box-shadow: 
        0 0 15px var(--neon-cyan),
        0 0 30px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 55px);
    grid-template-rows: repeat(8, 55px);
    border: 2px solid var(--neon-pink);
    box-shadow: 
        0 0 12px var(--neon-pink),
        inset 0 0 8px rgba(255, 0, 255, 0.2);
}

.square {
    width: 55px;
    height: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.square.light {
    background: linear-gradient(135deg, #3a3a6a 0%, #2a2a5a 100%);
}

.square.dark {
    background: linear-gradient(135deg, #1a1a3a 0%, #0f0f2a 100%);
}

.square:hover {
    filter: brightness(1.3);
}

.square.selected {
    background: rgba(255, 0, 255, 0.5) !important;
    box-shadow: inset 0 0 15px var(--neon-pink);
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--neon-green);
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: 0 0 10px var(--neon-green);
    animation: pulse 1s infinite;
}

.square.valid-capture {
    background: rgba(255, 0, 0, 0.3) !important;
    box-shadow: inset 0 0 12px rgba(255, 0, 0, 0.5);
}

.square.valid-capture::after {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    border: 3px solid #ff0040;
    border-radius: 50%;
    box-shadow: 0 0 10px #ff0040;
    animation: pulse 1s infinite;
}

.square.last-move {
    background: rgba(255, 255, 0, 0.15) !important;
}

.square.check {
    animation: check-flash 0.5s infinite alternate;
}

@keyframes check-flash {
    from { background: rgba(255, 0, 0, 0.3); }
    to { background: rgba(255, 0, 0, 0.6); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* ===== CHESS PIECES ===== */
.piece {
    font-size: 2.4rem;
    cursor: grab;
    user-select: none;
    transition: transform 0.1s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.piece:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.piece.white {
    color: #ffffff;
    text-shadow: 
        0 0 5px #ffffff,
        0 0 10px #ffffff,
        0 0 15px rgba(255, 255, 255, 0.9),
        0 0 20px rgba(0, 255, 255, 0.8),
        0 0 30px rgba(0, 255, 255, 0.5),
        2px 2px 0 rgba(0, 255, 255, 0.3);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6)) 
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.piece.black {
    color: #0a0a1a;
    text-shadow: 
        0 0 5px rgba(204, 0, 204, 1),
        0 0 10px rgba(204, 0, 204, 0.8),
        0 0 15px rgba(204, 0, 204, 0.6),
        0 0 25px rgba(191, 0, 255, 0.5),
        1px 1px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        2px 2px 0 #000;
    filter: drop-shadow(0 0 8px rgba(204, 0, 204, 0.6)) 
            drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* ===== GAME STATUS ===== */
.game-status {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    padding: 6px 15px;
    text-align: center;
    min-height: 30px;
}

.game-status.check {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
    animation: blink 0.5s infinite;
}

.game-status.checkmate {
    color: #ff0040;
    text-shadow: 0 0 15px #ff0040;
    animation: winner-glow 1s infinite alternate;
}

.game-status.stalemate, .game-status.draw {
    color: var(--neon-purple);
    text-shadow: 0 0 12px var(--neon-purple);
}

.game-status.thinking {
    color: var(--neon-orange);
    text-shadow: 0 0 10px var(--neon-orange);
}

@keyframes blink {
    50% { opacity: 0.5; }
}

@keyframes winner-glow {
    from { text-shadow: 0 0 10px #ff0040; }
    to { text-shadow: 0 0 25px #ff0040, 0 0 40px #ff0040; }
}

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0 10px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.neon-button {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5rem;
    padding: 14px 24px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(20, 20, 40, 0.8) 100%);
    color: #ffffff;
    border: 3px solid;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
    letter-spacing: 1.5px;
    font-weight: 700;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: 150px;
}

.neon-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.neon-button:hover::before {
    left: 100%;
}

.neon-button.primary {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 
        0 0 15px rgba(0, 204, 204, 0.5),
        inset 0 0 15px rgba(0, 204, 204, 0.1);
}

.neon-button.primary:hover {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #00a8a8 100%);
    color: #000000;
    box-shadow: 
        0 0 25px var(--neon-cyan),
        0 0 40px var(--neon-cyan),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    border-color: #00ffff;
}

.neon-button.secondary {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    box-shadow: 
        0 0 15px rgba(204, 0, 204, 0.5),
        inset 0 0 15px rgba(204, 0, 204, 0.1);
}

.neon-button.secondary:hover {
    background: linear-gradient(135deg, var(--neon-pink) 0%, #a800a8 100%);
    color: #000000;
    box-shadow: 
        0 0 25px var(--neon-pink),
        0 0 40px var(--neon-pink),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    border-color: #ff00ff;
}

.neon-button:active {
    transform: translateY(-1px) scale(0.98);
}

/* ===== GAME STATS ===== */
.game-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.stat-item {
    display: flex;
    gap: 5px;
    font-size: 0.5rem;
}

.stat-label {
    color: var(--neon-purple);
}

.stat-value {
    color: var(--neon-cyan);
    text-shadow: 0 0 5px var(--neon-cyan);
}

/* ===== MOVE HISTORY ===== */
.move-history {
    width: 100%;
    max-width: 420px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-purple);
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 0 10px rgba(191, 0, 255, 0.3);
}

.move-history h3 {
    text-align: center;
    color: var(--neon-purple);
    text-shadow: 0 0 8px var(--neon-purple);
    margin-bottom: 6px;
    font-size: 0.55rem;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    max-height: 80px;
    overflow-y: auto;
    font-size: 0.5rem;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--neon-purple);
    border-radius: 3px;
}

.move-entry {
    padding: 3px 6px;
    background: rgba(191, 0, 255, 0.1);
    border-radius: 2px;
    color: var(--neon-cyan);
}

.move-number {
    color: var(--neon-pink);
    margin-right: 4px;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a3a 0%, #0a0a1a 100%);
    border: 3px solid var(--neon-pink);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 
        0 0 25px var(--neon-pink),
        inset 0 0 15px rgba(255, 0, 255, 0.1);
}

.modal-content h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
    margin-bottom: 15px;
}

.promotion-options {
    display: flex;
    gap: 10px;
}

.promotion-piece {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid var(--neon-cyan);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.promotion-piece:hover {
    background: var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan);
    transform: scale(1.1);
}

/* Game Over Modal */
.modal-content.game-over {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 30px var(--neon-yellow);
}

.modal-content.game-over h2 {
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
}

.modal-content.game-over p {
    font-size: 0.6rem;
    color: var(--neon-cyan);
    margin-bottom: 15px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    .neon-title {
        font-size: 1rem;
    }
    
    .chess-board {
        grid-template-columns: repeat(8, 38px);
        grid-template-rows: repeat(8, 38px);
    }
    
    .square {
        width: 38px;
        height: 38px;
    }
    
    .piece {
        font-size: 1.6rem;
    }
    
    .game-info, .move-history, .game-mode {
        max-width: 320px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-buttons {
        flex-direction: column;
    }
}
