* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

#app {
    max-width: 720px;
    width: 100%;
}

/* Header Styling */
header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 20px;
    border-radius: 14px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    gap: 12px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
    margin: 0;
}

/* Controls Styling */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.7);
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.controls label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #94a3b8;
}

.controls select, .controls button {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    font-family: inherit;
}

.controls select {
    background: transparent;
    color: #f8fafc;
    outline: none;
    cursor: pointer;
}

.controls select option {
    background: #1e293b;
    color: #f8fafc;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: #334155;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: #475569;
    color: #ffffff;
    transform: translateY(-1px);
}

#soundToggle.sound-off {
    background: #475569;
    color: #94a3b8;
    opacity: 0.8;
}

/* Game Container Card */
.game-container {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-info {
    width: 100%;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Status Badge */
.status-badge {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #f1f5f9;
    text-align: center;
    transition: all 0.3s ease;
}

/* Captured Trays */
#captured-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(15, 23, 42, 0.5);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.captured-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.captured-label {
    color: #94a3b8;
    font-weight: 500;
}

.captured-pieces {
    font-size: 1.25rem;
    letter-spacing: 3px;
    min-height: 24px;
    display: flex;
    align-items: center;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Chessboard Styling */
.board-wrapper {
    display: flex;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    overflow: hidden;
}

#chessboard {
    display: inline-block;
    border: 3px solid #0f172a;
    border-radius: 10px;
    overflow: hidden;
    background: #0f172a;
}

.board-row {
    display: flex;
}

.square {
    width: 62px;
    height: 62px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 42px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
    position: relative;
}

/* High contrast chess square colors */
.square.light {
    background: #eeeed2;
    color: #2b2b2b;
}

.square.dark {
    background: #5c8241;
    color: #1a1a1a;
}

/* Make pieces super clear with crisp shadows */
.square span {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
    line-height: 1;
}

.square.selected {
    background: #baca44 !important;
}

/* CLEAR LEGAL MOVES */
.square.legal-move {
    position: relative;
}

/* Dot indicator for empty legal squares */
.square.legal-move::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(20, 85, 30, 0.35);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

/* Ring indicator if square contains an enemy piece to capture */
.square.legal-move:has(:not(:empty))::after {
    content: '';
    position: absolute;
    width: 52px;
    height: 52px;
    background: transparent;
    border: 5px solid rgba(20, 85, 30, 0.4);
    border-radius: 50%;
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2;
}

/* LAST MOVE HIGHLIGHT */
.square.last-move {
    background: rgba(246, 201, 71, 0.5) !important;
}

.square:hover {
    filter: brightness(1.06);
}

.floating-piece {
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
    z-index: 1000;
    filter: drop-shadow(0 12px 20px rgba(0,0,0,0.5)) !important;
}

/* Responsive Breakpoints */
@media (max-width: 680px) {
    header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .logo-area {
        justify-content: center;
    }

    .controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .square {
        width: 46px;
        height: 46px;
        font-size: 32px;
    }
    
    .square.legal-move:has(:not(:empty))::after {
        width: 38px;
        height: 38px;
        border-width: 4px;
    }
}

@media (max-width: 420px) {
    .square {
        width: 38px;
        height: 38px;
        font-size: 26px;
    }
    
    .square.legal-move:has(:not(:empty))::after {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }

    body {
        padding: 8px;
    }
}