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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: start;
}

.sidebar {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar h2 {
    font-size: 24px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chess-board-container {
    position: relative;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.square .piece {
    transition: none;
}

.square.moving .piece {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.square.light {
    background: #f0d9b5;
}

.square.dark {
    background: #b58863;
}

.square.selected {
    background: #7fc97f !important;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.square.legal-move {
    background: #9ecfff !important;
}

.square.last-move {
    background: #cdd26a !important;
}

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

.piece {
    font-size: 50px;
    user-select: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: transform 0.2s ease;
}

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

.piece.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.difficulty-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.difficulty-btn {
    padding: 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateX(5px);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.difficulty-btn .label {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
}

.difficulty-btn .desc {
    display: block;
    font-size: 12px;
    opacity: 0.7;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-box {
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.info-box h3 {
    font-size: 14px;
    opacity: 0.7;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-box p {
    font-size: 18px;
    font-weight: 600;
}

.timer {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    color: #667eea;
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.status-message {
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    margin-top: 15px;
}

.status-message.info {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
}

.status-message.success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
}

.status-message.error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.4);
}

.title {
    text-align: center;
    margin-bottom: 30px;
    grid-column: 1 / -1;
}

.title h1 {
    font-size: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.title p {
    opacity: 0.7;
    font-size: 18px;
}

.thinking {
    display: none;
    padding: 15px;
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.4);
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    margin-top: 15px;
}

.thinking.active {
    display: block;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.thinking::after {
    content: '...';
    animation: pulse 1.5s infinite;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .chess-board {
        grid-template-columns: repeat(8, 50px);
        grid-template-rows: repeat(8, 50px);
    }
    
    .piece {
        font-size: 35px;
    }
}
