/* Updated chess.css - Coordinates moved inside board */

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

body {
    min-height: 100vh;
    font-family: 'Source Sans Pro', sans-serif;
    background-color: #0a0a0a;
    color: #f0f0f0;
    overflow-x: hidden;
    position: relative;
}

.background {
    background: rgba(3, 3, 3, 0.4);
    opacity: 1;
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -2;
}

.mist-overlay {
    background: url('../assets/images/mist-overlay.png') repeat;
    opacity: 0.9;
    position: fixed;
    width: 100%;
    height: 500vh;
    top: 0;
    left: 0;
    z-index: -1;
    animation: mistScroll 120s linear infinite;
}

@keyframes mistScroll {
    from { background-position: 0 0; }
    to { background-position: -500px 500px; }
}

/* Enhanced floating particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    animation: float 25s infinite linear;
    opacity: 0;
}

.particle.golden {
    background: radial-gradient(circle, rgba(222, 184, 135, 0.6) 0%, rgba(222, 184, 135, 0.1) 70%, transparent 100%);
    box-shadow: 0 0 4px rgba(222, 184, 135, 0.4);
}

.particle.purple {
    background: radial-gradient(circle, rgba(138, 43, 226, 0.5) 0%, rgba(138, 43, 226, 0.1) 70%, transparent 100%);
    box-shadow: 0 0 4px rgba(138, 43, 226, 0.3);
}

.particle.silver {
    background: radial-gradient(circle, rgba(192, 192, 192, 0.4) 0%, rgba(192, 192, 192, 0.08) 70%, transparent 100%);
    box-shadow: 0 0 3px rgba(192, 192, 192, 0.2);
}

@keyframes float {
    0% { 
        transform: translateY(100vh) translateX(0) rotate(0deg) scale(0.3); 
        opacity: 0; 
    }
    5% { 
        opacity: 0.6;
        transform: translateY(95vh) translateX(10px) rotate(18deg) scale(0.5);
    }
    50% {
        transform: translateY(50vh) translateX(var(--drift, 50px)) rotate(180deg) scale(0.8);
        opacity: 0.4;
    }
    95% { 
        opacity: 0.3; 
    }
    100% { 
        transform: translateY(-10vh) translateX(calc(var(--drift, 50px) * 2)) rotate(360deg) scale(0.1); 
        opacity: 0; 
    }
}

.game-container {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 2rem;
    max-width: 800px;
    margin: 2rem auto;
    position: relative;
    z-index: 1;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(138, 43, 226, 0.1);
}

.game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.game-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 500;
    color: #f2f2f2;
    margin: 0 0 1rem 0;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.7), 0 0 40px rgba(138, 43, 226, 0.2);
}

.game-status {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 10px 0;
    min-height: 30px;
    padding: 0.5rem 1rem;
    background: rgba(138, 43, 226, 0.2);
    border: 1px solid rgba(138, 43, 226, 0.4);
    border-radius: 20px;
    display: inline-block;
}

/* Game Settings Container - Side by side layout */
.game-settings-container {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.music-controls {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    margin-top: 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.music-controls h4 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.75rem;
    text-align: center;
    text-shadow: 0 0 8px rgba(138, 43, 226, 0.4);
}

.music-btn {
    background: rgba(138, 43, 226, 0.3);
    color: #fff;
    border: 1px solid rgba(138, 43, 226, 0.5);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    font-family: 'Source Sans Pro', sans-serif;
}

.music-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.3s;
}

.music-btn:hover::before {
    left: 100%;
}

.music-btn:hover {
    background: rgba(138, 43, 226, 0.5);
    border-color: rgba(138, 43, 226, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(138, 43, 226, 0.4);
}

.music-btn.playing {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
    animation: musicPulse 2s ease-in-out infinite alternate;
}

.music-btn.playing:hover {
    background: rgba(76, 175, 80, 0.5);
    border-color: rgba(76, 175, 80, 0.8);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(76, 175, 80, 0.4);
}

@keyframes musicPulse {
    0% { 
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
    }
    100% { 
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.6);
    }
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.volume-control span {
    font-size: 1.1rem;
}

.volume-control input[type="range"] {
    width: 100px;
    height: 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(138, 43, 226, 0.8);
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(138, 43, 226, 0.8);
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

/* UPDATED: Simplified board wrapper - coordinates moved inside */
.chess-board-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    width: fit-content;
}

/* REMOVED: External coordinate labels */
/* .rank-labels and .file-labels styles removed since they're now inside the board */

.chess-board-container {
    position: relative;
    display: inline-block;
}

.chess-board-mist {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: 
        radial-gradient(circle at 20% 80%, rgba(138, 43, 226, 0.4) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(138, 43, 226, 0.3) 0%, transparent 55%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 60% 70%, rgba(138, 43, 226, 0.25) 0%, transparent 45%),
        linear-gradient(45deg, rgba(138, 43, 226, 0.1) 0%, transparent 30%, rgba(138, 43, 226, 0.08) 50%, transparent 70%, rgba(138, 43, 226, 0.1) 100%);
    background-size: 
        300px 300px,
        250px 250px,
        180px 180px,
        220px 220px,
        80px 80px;
    animation: 
        mistFlow1 25s linear infinite,
        mistFlow2 30s linear infinite reverse,
        mistFlow3 20s linear infinite,
        mistFlow4 40s linear infinite,
        mistScroll2 35s linear infinite;
    pointer-events: none;
    z-index: 1;
    border-radius: 18px;
    opacity: 1;
}

@keyframes mistFlow1 {
    0% { background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px; }
    100% { background-position: 300px 300px, 0px 0px, 0px 0px, 0px 0px, 0px 0px; }
}

@keyframes mistFlow2 {
    0% { background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px; }
    100% { background-position: 0px 0px, 250px 250px, 0px 0px, 0px 0px, 0px 0px; }
}

@keyframes mistFlow3 {
    0% { background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px; }
    100% { background-position: 0px 0px, 0px 0px, 180px 180px, 0px 0px, 0px 0px; }
}

@keyframes mistFlow4 {
    0% { background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px; }
    100% { background-position: 0px 0px, 0px 0px, 0px 0px, 220px 220px, 0px 0px; }
}

@keyframes mistScroll2 {
    0% { background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px; }
    100% { background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 80px 80px; }
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 80px);
    grid-template-rows: repeat(8, 80px);
    border: 3px solid rgba(138, 43, 226, 0.8);
    border-radius: 15px;
    background: #f0d9b5;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(138, 43, 226, 0.7),
        0 0 80px rgba(138, 43, 226, 0.5),
        0 0 120px rgba(138, 43, 226, 0.3);
    animation: boardGlow 3s ease-in-out infinite alternate;
    position: relative;
    z-index: 2;
}

@keyframes boardGlow {
    0% { 
        box-shadow: 
            0 10px 30px rgba(0, 0, 0, 0.5),
            0 0 40px rgba(138, 43, 226, 0.7),
            0 0 80px rgba(138, 43, 226, 0.5),
            0 0 120px rgba(138, 43, 226, 0.3);
    }
    100% { 
        box-shadow: 
            0 10px 40px rgba(0, 0, 0, 0.7),
            0 0 60px rgba(138, 43, 226, 1),
            0 0 120px rgba(138, 43, 226, 0.8),
            0 0 180px rgba(138, 43, 226, 0.5);
    }
}

/* NEW: Inside board coordinate labels */
.board-coordinates {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.rank-label-inside {
    position: absolute;
    color: rgba(255, 255, 255, 0.95);
    font-weight: bold;
    font-size: 14px;
    text-shadow: 
        0 0 8px rgba(0, 0, 0, 0.9),
        0 0 16px rgba(138, 43, 226, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    font-family: 'Source Sans Pro', sans-serif;
    line-height: 1;
    left: 6px;
    width: 20px;
    text-align: center;
}

.file-label-inside {
    position: absolute;
    color: rgba(255, 255, 255, 0.95);
    font-weight: bold;
    font-size: 14px;
    text-shadow: 
        0 0 8px rgba(0, 0, 0, 0.9),
        0 0 16px rgba(138, 43, 226, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    font-family: 'Source Sans Pro', sans-serif;
    line-height: 1;
    bottom: 6px;
    width: 20px;
    text-align: center;
}

/* Position rank labels (8, 7, 6, 5, 4, 3, 2, 1) on left side */
.rank-label-inside:nth-child(1) { top: 6px; }    /* 8 */
.rank-label-inside:nth-child(2) { top: 86px; }   /* 7 */
.rank-label-inside:nth-child(3) { top: 166px; }  /* 6 */
.rank-label-inside:nth-child(4) { top: 246px; }  /* 5 */
.rank-label-inside:nth-child(5) { top: 326px; }  /* 4 */
.rank-label-inside:nth-child(6) { top: 406px; }  /* 3 */
.rank-label-inside:nth-child(7) { top: 486px; }  /* 2 */
.rank-label-inside:nth-child(8) { top: 566px; }  /* 1 */

/* Position file labels (a, b, c, d, e, f, g, h) on bottom */
.file-label-inside:nth-child(9) { left: 54px; }   /* a */
.file-label-inside:nth-child(10) { left: 134px; } /* b */
.file-label-inside:nth-child(11) { left: 214px; } /* c */
.file-label-inside:nth-child(12) { left: 294px; } /* d */
.file-label-inside:nth-child(13) { left: 374px; } /* e */
.file-label-inside:nth-child(14) { left: 454px; } /* f */
.file-label-inside:nth-child(15) { left: 534px; } /* g */
.file-label-inside:nth-child(16) { left: 614px; } /* h */

.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.game-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.overlay-text {
    font-family: 'Bangers', cursive;
    font-size: 6rem;
    font-weight: 400;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    padding: 0;
}

.overlay-text.begin {
    color: rgba(76, 175, 80, 0.8);
    text-shadow: 
        0 0 15px rgba(76, 175, 80, 0.7),
        0 0 30px rgba(76, 175, 80, 0.5),
        0 0 45px rgba(76, 175, 80, 0.3),
        2px 2px 4px rgba(0,0,0,0.4);
    animation: beginExpansion 2.5s ease-in-out forwards;
}

.overlay-text.check {
    color: rgba(255, 87, 34, 0.8);
    text-shadow: 
        0 0 15px rgba(255, 87, 34, 0.7),
        0 0 30px rgba(255, 87, 34, 0.5),
        0 0 45px rgba(255, 87, 34, 0.3),
        2px 2px 4px rgba(0,0,0,0.4);
    animation: checkPulse 0.6s ease-in-out 3;
}

.overlay-text.checkmate {
    color: rgba(233, 30, 99, 0.8);
    text-shadow: 
        0 0 20px rgba(233, 30, 99, 0.7),
        0 0 40px rgba(233, 30, 99, 0.5),
        0 0 60px rgba(233, 30, 99, 0.3),
        2px 2px 4px rgba(0,0,0,0.4);
    animation: checkmateExpand 3s ease-out forwards;
}

@keyframes beginExpansion {
    0% { 
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    30% { 
        transform: scale(1.3);
        opacity: 1;
        filter: brightness(1.2);
    }
    70% { 
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    100% { 
        transform: scale(1);
        opacity: 0;
        filter: brightness(1);
    }
}

@keyframes checkPulse {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.15);
        filter: brightness(1.3);
    }
}

@keyframes checkmateExpand {
    0% { 
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    80% { 
        transform: scale(1.4);
        opacity: 0.8;
        filter: brightness(1.3);
    }
    100% { 
        transform: scale(1.6);
        opacity: 0;
        filter: brightness(1.5);
    }
}

.checkmate-particle {
    position: fixed;
    pointer-events: none;
    z-index: 999;
    border-radius: 50%;
    animation: checkmateParticle 3s ease-out forwards;
}

@keyframes checkmateParticle {
    0% {
        transform: scale(0) rotate(0deg) translate(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(3) rotate(90deg) translate(calc(var(--final-x) * 0.3), calc(var(--final-y) * 0.3));
        opacity: 1;
    }
    50% {
        transform: scale(2) rotate(180deg) translate(calc(var(--final-x) * 0.7), calc(var(--final-y) * 0.7));
        opacity: 1;
    }
    80% {
        transform: scale(1.5) rotate(270deg) translate(var(--final-x), var(--final-y));
        opacity: 0.8;
    }
    100% {
        transform: scale(0.5) rotate(360deg) translate(calc(var(--final-x) * 1.5), calc(var(--final-y) * 1.5 - 200px));
        opacity: 0;
    }
}

.move-particle {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    border-radius: 50%;
    animation: moveParticle 1s ease-out forwards;
}

.capture-particle {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    border-radius: 50%;
    animation: captureParticle 1.5s ease-out forwards;
}

@keyframes moveParticle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: scale(1.2) rotate(72deg);
        opacity: 1;
    }
    60% {
        transform: scale(1) rotate(216deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.3) rotate(360deg) translateY(-50px);
        opacity: 0;
    }
}

@keyframes captureParticle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(2) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }
    75% {
        transform: scale(1) rotate(270deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.2) rotate(360deg) translateY(-80px);
        opacity: 0;
    }
}

.square {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 3;
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square.selected {
    background-color: rgba(138, 43, 226, 0.7) !important;
    box-shadow: inset 0 0 15px rgba(138, 43, 226, 0.8);
}

.square.valid-move {
    background-color: rgba(46, 204, 113, 0.6) !important;
    box-shadow: inset 0 0 10px rgba(46, 204, 113, 0.8);
}

.square.check {
    background-color: rgba(231, 76, 60, 0.8) !important;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
}

.square.ai-from {
    background-color: rgba(241, 196, 15, 0.6) !important;
    box-shadow: inset 0 0 15px rgba(241, 196, 15, 0.8);
    animation: aiMoveHighlight 2s ease-out;
}

.square.ai-to {
    background-color: rgba(241, 196, 15, 0.7) !important;
    box-shadow: inset 0 0 20px rgba(241, 196, 15, 0.9);
    animation: aiMoveHighlight 2s ease-out;
}

@keyframes aiMoveHighlight {
    0% {
        transform: scale(1.1);
        box-shadow: 0 0 25px rgba(241, 196, 15, 1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        box-shadow: inset 0 0 10px rgba(241, 196, 15, 0.5);
    }
}

.piece {
    user-select: none;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    font-weight: bold;
    position: relative;
    z-index: 4;
}

.piece:hover {
    transform: scale(1.1);
}

/* White pieces - bright with golden glow */
.piece.white {
    color: #fff;
    text-shadow: 
        0 0 8px rgba(255, 255, 255, 0.8),
        0 0 15px rgba(222, 184, 135, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Black pieces - mystical purple glow */
.piece.black {
    color: #e8d5ff;
    text-shadow: 
        0 0 8px rgba(138, 43, 226, 0.9),
        0 0 15px rgba(138, 43, 226, 0.6),
        0 0 25px rgba(138, 43, 226, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.8);
}

.piece.white:hover {
    text-shadow: 
        0 0 12px rgba(255, 255, 255, 1),
        0 0 20px rgba(222, 184, 135, 0.8),
        0 2px 6px rgba(0, 0, 0, 0.8);
}

.piece.black:hover {
    text-shadow: 
        0 0 12px rgba(138, 43, 226, 1),
        0 0 20px rgba(138, 43, 226, 0.8),
        0 0 30px rgba(138, 43, 226, 0.6),
        0 2px 6px rgba(0, 0, 0, 0.8);
}

.controls {
    text-align: center;
    margin-top: 2rem;
}

.btn {
    background: rgba(138, 43, 226, 0.3);
    color: #fff;
    border: 1px solid rgba(138, 43, 226, 0.5);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    margin: 0 10px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

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

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: rgba(138, 43, 226, 0.5);
    border-color: rgba(138, 43, 226, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(138, 43, 226, 0.4);
}

.btn:disabled {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled:hover {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    transform: none;
    box-shadow: none;
}

.move-history {
    margin-top: 2rem;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 5px rgba(138, 43, 226, 0.2);
}

.move-history-container {
    font-family: 'Source Sans Pro', sans-serif; 
    line-height: 1.8; 
    font-size: 0.9rem;
}

.move-history-entry {
    margin-bottom: 0.5rem; 
    padding: 0.3rem; 
    background: rgba(255,255,255,0.05); 
    border-radius: 4px;
}

.move-history-entry.white {
    border-left: 3px solid rgba(222,184,135,0.6);
}

.move-history-entry.black {
    border-left: 3px solid rgba(138,43,226,0.6);
}

.move-number {
    color: rgba(255,255,255,0.5); 
    font-weight: bold; 
    margin-right: 0.5rem;
}

.move-notation.white {
    color: rgba(255,255,255,0.9);
}

.move-notation.black {
    color: rgba(180,120,255,1);
}

.move-check { color: rgba(255, 87, 34, 0.9); font-weight: bold; }
.move-checkmate { color: rgba(233, 30, 99, 1); font-weight: bold; }
.move-stalemate { color: rgba(255, 193, 7, 1); font-weight: bold; }
.move-castling { color: rgba(76, 175, 80, 0.9); font-weight: bold; }
.move-promotion { color: rgba(156, 39, 176, 0.9); font-weight: bold; }

.game-instructions {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(138, 43, 226, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.game-instructions h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    text-align: center;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.instruction {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.instruction:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(138, 43, 226, 0.4);
    transform: translateY(-1px);
}

.instruction-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.instruction-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.3;
    text-shadow: 0 0 5px rgba(138, 43, 226, 0.3);
}

/* Difficulty Controls */
.difficulty-controls {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.difficulty-controls h4 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.75rem;
    text-align: center;
    text-shadow: 0 0 8px rgba(138, 43, 226, 0.4);
}

.difficulty-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.difficulty-btn {
    background: rgba(138, 43, 226, 0.2);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(138, 43, 226, 0.4);
    padding: 0.6rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 500;
    text-align: center;
}

.difficulty-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.3s;
}

.difficulty-btn:hover::before {
    left: 100%;
}

.difficulty-btn:hover {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), 0 0 15px rgba(138, 43, 226, 0.3);
}

.difficulty-btn.active {
    background: rgba(138, 43, 226, 0.8) !important;
    border: 2px solid rgba(138, 43, 226, 1) !important;
    box-shadow: 
        0 0 25px rgba(138, 43, 226, 0.8),
        0 0 50px rgba(138, 43, 226, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    font-weight: 700 !important;
    transform: translateY(-3px) scale(1.05) !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
    animation: difficultyChange 0.3s ease-out;
}

.difficulty-btn.active:hover {
    background: rgba(138, 43, 226, 0.9) !important;
    box-shadow: 
        0 5px 20px rgba(0, 0, 0, 0.4), 
        0 0 35px rgba(138, 43, 226, 1),
        0 0 70px rgba(138, 43, 226, 0.8),
        inset 0 0 25px rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-3px) scale(1.05) !important;
}

.difficulty-btn[data-difficulty="novice"] {
    border-color: rgba(76, 175, 80, 0.4);
    background: rgba(76, 175, 80, 0.2);
}

.difficulty-btn[data-difficulty="novice"]:hover,
.difficulty-btn[data-difficulty="novice"].active {
    border-color: rgba(76, 175, 80, 0.8);
    background: rgba(76, 175, 80, 0.4);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.difficulty-btn[data-difficulty="novice"].active {
    background: rgba(76, 175, 80, 0.8) !important;
    border: 2px solid rgba(76, 175, 80, 1) !important;
    box-shadow: 
        0 0 25px rgba(76, 175, 80, 0.8),
        0 0 50px rgba(76, 175, 80, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.2) !important;
}

.difficulty-btn[data-difficulty="knight"] {
    border-color: rgba(255, 152, 0, 0.4);
    background: rgba(255, 152, 0, 0.2);
}

.difficulty-btn[data-difficulty="knight"]:hover,
.difficulty-btn[data-difficulty="knight"].active {
    border-color: rgba(255, 152, 0, 0.8);
    background: rgba(255, 152, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.3);
}

.difficulty-btn[data-difficulty="knight"].active {
    background: rgba(255, 152, 0, 0.8) !important;
    border: 2px solid rgba(255, 152, 0, 1) !important;
    box-shadow: 
        0 0 25px rgba(255, 152, 0, 0.8),
        0 0 50px rgba(255, 152, 0, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.2) !important;
}

.difficulty-btn[data-difficulty="grandmaster"] {
    border-color: rgba(233, 30, 99, 0.4);
    background: rgba(233, 30, 99, 0.2);
}

.difficulty-btn[data-difficulty="grandmaster"]:hover,
.difficulty-btn[data-difficulty="grandmaster"].active {
    border-color: rgba(233, 30, 99, 0.8);
    background: rgba(233, 30, 99, 0.4);
    box-shadow: 0 0 15px rgba(233, 30, 99, 0.3);
}

.difficulty-btn[data-difficulty="grandmaster"].active {
    background: rgba(233, 30, 99, 0.8) !important;
    border: 2px solid rgba(233, 30, 99, 1) !important;
    box-shadow: 
        0 0 25px rgba(233, 30, 99, 0.8),
        0 0 50px rgba(233, 30, 99, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.2) !important;
}

.game-status-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.difficulty-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(138, 43, 226, 0.4);
    transition: all 0.3s ease;
}

.difficulty-indicator.novice {
    border-color: rgba(76, 175, 80, 0.6);
    background: rgba(76, 175, 80, 0.2);
    color: rgba(76, 175, 80, 1);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.difficulty-indicator.knight {
    border-color: rgba(255, 152, 0, 0.6);
    background: rgba(255, 152, 0, 0.2);
    color: rgba(255, 152, 0, 1);
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.3);
}

.difficulty-indicator.grandmaster {
    border-color: rgba(233, 30, 99, 0.6);
    background: rgba(233, 30, 99, 0.2);
    color: rgba(233, 30, 99, 1);
    box-shadow: 0 0 15px rgba(233, 30, 99, 0.3);
}

@keyframes difficultyChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .game-container {
        padding: 1.5rem;
        margin: 1rem auto;
    }

    .chess-board {
        grid-template-columns: repeat(8, 60px);
        grid-template-rows: repeat(8, 60px);
        border-radius: 12px;
    }

    .chess-board-mist {
        top: -15px;
        left: -15px;
        right: -15px;
        bottom: -15px;
        border-radius: 15px;
    }

    .square {
        width: 60px;
        height: 60px;
        font-size: 38px;
    }

    /* Update coordinate positions for mobile */
    .rank-label-inside {
        font-size: 12px;
        left: 4px;
    }

    .file-label-inside {
        font-size: 12px;
        bottom: 4px;
    }

    .rank-label-inside:nth-child(1) { top: 4px; }
    .rank-label-inside:nth-child(2) { top: 64px; }
    .rank-label-inside:nth-child(3) { top: 124px; }
    .rank-label-inside:nth-child(4) { top: 184px; }
    .rank-label-inside:nth-child(5) { top: 244px; }
    .rank-label-inside:nth-child(6) { top: 304px; }
    .rank-label-inside:nth-child(7) { top: 364px; }
    .rank-label-inside:nth-child(8) { top: 424px; }

    .file-label-inside:nth-child(9) { left: 42px; }
    .file-label-inside:nth-child(10) { left: 102px; }
    .file-label-inside:nth-child(11) { left: 162px; }
    .file-label-inside:nth-child(12) { left: 222px; }
    .file-label-inside:nth-child(13) { left: 282px; }
    .file-label-inside:nth-child(14) { left: 342px; }
    .file-label-inside:nth-child(15) { left: 402px; }
    .file-label-inside:nth-child(16) { left: 462px; }

    .overlay-text {
        font-size: 3rem;
    }

    .game-settings-container {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .difficulty-controls,
    .music-controls {
        max-width: 100%;
        min-width: auto;
        width: 100%;
    }
    
    .difficulty-selector {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.3rem;
    }
    
    .difficulty-btn {
        flex: 1;
        padding: 0.5rem 0.3rem;
        font-size: 0.8rem;
    }

    .game-status-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .difficulty-indicator {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .overlay-text {
        font-size: 2rem;
    }

    .chess-board {
        grid-template-columns: repeat(8, 45px);
        grid-template-rows: repeat(8, 45px);
        border-radius: 10px;
    }

    .chess-board-mist {
        top: -12px;
        left: -12px;
        right: -12px;
        bottom: -12px;
        border-radius: 13px;
    }

    .square {
        width: 45px;
        height: 45px;
        font-size: 28px;
    }

    .game-container {
        padding: 1.5rem 0.5rem;
        margin: 0 auto 2rem;
        max-width: 100vw;
        overflow-x: hidden;
        text-align: center;
    }

    /* Update coordinate positions for small mobile */
    .rank-label-inside {
        font-size: 10px;
        left: 3px;
    }

    .file-label-inside {
        font-size: 10px;
        bottom: 3px;
    }

    .rank-label-inside:nth-child(1) { top: 3px; }
    .rank-label-inside:nth-child(2) { top: 48px; }
    .rank-label-inside:nth-child(3) { top: 93px; }
    .rank-label-inside:nth-child(4) { top: 138px; }
    .rank-label-inside:nth-child(5) { top: 183px; }
    .rank-label-inside:nth-child(6) { top: 228px; }
    .rank-label-inside:nth-child(7) { top: 273px; }
    .rank-label-inside:nth-child(8) { top: 318px; }

    .file-label-inside:nth-child(9) { left: 32px; }
    .file-label-inside:nth-child(10) { left: 77px; }
    .file-label-inside:nth-child(11) { left: 122px; }
    .file-label-inside:nth-child(12) { left: 167px; }
    .file-label-inside:nth-child(13) { left: 212px; }
    .file-label-inside:nth-child(14) { left: 257px; }
    .file-label-inside:nth-child(15) { left: 302px; }
    .file-label-inside:nth-child(16) { left: 347px; }

    .difficulty-selector {
        flex-direction: column;
        gap: 0.4rem;
    }
    
    .difficulty-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .difficulty-controls h4,
    .music-controls h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .difficulty-indicator {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}