body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
}

/* Logos del ajedrez */
.logo-oiss-chess {
    position: fixed;
    top: 20px;
    right: 20px;
    height: 80px;
    width: auto;
    max-width: 320px;
    z-index: 1000;
    object-fit: contain;
}

.logo-aecid-chess {
    position: fixed;
    bottom: 20px;
    left: 20px;
    height: 140px;
    width: auto;
    max-width: 500px;
    z-index: 1000;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Modal de selección de modo con slider */
.mode-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.mode-selection-content {
    background: white;
    padding: 0;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-width: 1000px;
    max-height: 85vh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.left-panel {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.right-panel {
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0 20px 20px 0;
    overflow-y: auto;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.left-panel h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 32px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-style: italic;
    font-size: 16px;
}

.right-panel h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}



.rules-section {
    margin-bottom: 15px;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.rules-section h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-section ul {
    margin: 0;
    padding-left: 20px;
}

.rules-section li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.rules-section li strong {
    color: #007bff;
}

.rules-section p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
}

.strategy-tip {
    background: linear-gradient(45deg, #fff3cd, #ffeaa7);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #ffc107;
    flex-shrink: 0;
}

.strategy-tip h4 {
    margin: 0 0 8px 0;
    color: #856404;
    font-size: 16px;
}

.strategy-tip p {
    margin: 0;
    color: #856404;
    font-size: 14px;
    line-height: 1.4;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.mode-button {
    padding: 20px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mode-button.two-players {
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: white;
}

.mode-button.vs-ai {
    background: linear-gradient(45deg, #2196f3, #1976d2);
    color: white;
}

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

.difficulty-selection {
    display: none;
    margin-top: 20px;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.difficulty-buttons.trivia-options {
    flex-direction: column;
    gap: 18px;
    padding: 35px;
}

.difficulty-button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
}

.difficulty-button.easy {
    background: #8bc34a;
    color: white;
}

.difficulty-button.medium {
    background: #ff9800;
    color: white;
}

.difficulty-button.hard {
    background: #f44336;
    color: white;
}

.difficulty-button:hover {
    transform: scale(1.05);
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    padding: 30px;
    display: flex;
    gap: 30px;
}

.board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

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

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

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

.square:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.square.selected {
    background-color: #7fb069 !important;
    box-shadow: inset 0 0 0 3px #5a8049;
}

.square.possible-move {
    background-color: #87ceeb !important;
}

.square.attack-move {
    background-color: #ff6b6b !important;
}

.square.ai-thinking {
    animation: aiPulse 1s infinite;
}

@keyframes aiPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

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

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



.experience-bar {
    position: absolute;
    bottom: 0px;
    left: 2px;
    right: 2px;
    height: 3px;
    background: rgba(0,0,0,0.2);
    border-radius: 2px;
}

.experience-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.info-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 350px;
}

.game-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.game-mode-display {
    background: linear-gradient(45deg, #e3f2fd, #bbdefb);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: bold;
}

.current-player {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.white-turn {
    background-color: #fff;
    color: #333;
    border: 2px solid #333;
}

.black-turn {
    background-color: #333;
    color: #fff;
    border: 2px solid #333;
}



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

button {
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: bold;
}

.new-game-btn {
    background: linear-gradient(45deg, #4caf50, #45a049);
    color: white;
}

.change-mode-btn {
    background: linear-gradient(45deg, #9c27b0, #7b1fa2);
    color: white;
}

.back-office-btn {
    background: linear-gradient(45deg, #1e88e5, #0d47a1);
    color: white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.coordinates {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin: 5px 0;
    font-size: 14px;
    color: #666;
    font-family: monospace;
}

.captured-pieces {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.captured-pieces h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #495057;
}

.captured-list {
    font-size: 24px;
    line-height: 1.2;
    min-height: 30px;
    word-wrap: break-word;
}

.move-history {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    max-height: 200px;
    overflow-y: auto;
}

.move-history h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #495057;
}

.move-list {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.4;
}



.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: #f44336;
}

.notification.warning {
    background: #ff9800;
}

.notification.info {
    background: #2196f3;
}

.ai-thinking-indicator {
    display: none;
    background: linear-gradient(45deg, #ffd54f, #ffb300);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    animation: aiThinking 1.5s infinite;
}

@keyframes aiThinking {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ai-thinking-indicator.active {
    display: block;
}

/* Modal de trivia mejorado */
#triviaModal .mode-selection-content {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid #007bff;
    box-shadow: 0 25px 50px rgba(0,123,255,0.3);
    max-width: 750px;
    min-height: 400px;
    padding: 0;
    overflow: hidden;
    animation: triviaAppear 0.4s ease-out;
}

@keyframes triviaAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#triviaModal .mode-selection-content h2 {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    margin: 0;
    padding: 25px 30px;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

#triviaModal .mode-selection-content h2::before {
    content: '🧠';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    animation: brainPulse 2s infinite;
}

@keyframes brainPulse {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
}

#triviaModal .mode-selection-content h2::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

#triviaOptions {
    padding: 35px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

#triviaOptions .difficulty-button {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    color: #495057;
    padding: 22px 25px 22px 65px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 65px;
    display: flex;
    align-items: center;
    line-height: 1.4;
    word-wrap: break-word;
    hyphens: auto;
}

#triviaOptions .difficulty-button:hover {
    background: linear-gradient(145deg, #007bff, #0056b3);
    color: white;
    border-color: #004085;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,123,255,0.4);
}

#triviaOptions .difficulty-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,123,255,0.3);
}

#triviaOptions .difficulty-button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #28a745, #20c997);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

#triviaOptions .difficulty-button:hover::before {
    transform: scaleY(1);
}

#triviaOptions .difficulty-button::after {
    content: attr(data-option);
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#triviaOptions .difficulty-button:hover::after {
    background: linear-gradient(45deg, #ffc107, #e0a800);
    color: #000;
    transform: translateY(-50%) scale(1.1);
}

#triviaModal.loading .mode-selection-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #20c997, #007bff);
    background-size: 200% 100%;
    animation: loadingBar 1.5s infinite;
}

@keyframes loadingBar {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive para pantallas pequeñas */
@media (max-width: 768px) {
    .mode-selection-content {
        grid-template-columns: 1fr;
        max-width: 90vw;
        max-height: 90vh;
    }
    
    .right-panel {
        border-radius: 0 0 20px 20px;
        max-height: 50vh;
        padding: 20px;
    }
    
    .left-panel {
        padding: 20px;
    }
    
    .left-panel h1 {
        font-size: 24px;
    }
    
    .mode-buttons {
        flex-direction: column;
    }
    
    .slider-controls {
        padding: 10px;
        gap: 10px;
    }
    
    .slider-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .slide-indicator {
        padding: 6px 12px;
        font-size: 14px;
    }

    #triviaModal .mode-selection-content {
        max-width: 95vw;
        margin: 10px;
    }
    
    #triviaOptions {
        padding: 25px;
        gap: 15px;
    }
    
    #triviaOptions .difficulty-button {
        padding: 18px 20px 18px 55px;
        font-size: 15px;
        min-height: 60px;
    }
    
    #triviaOptions .difficulty-button::after {
        width: 28px;
        height: 28px;
        font-size: 14px;
        left: 15px;
    }
}

@media (max-width: 480px) {
    #triviaModal .mode-selection-content {
        max-width: 98vw;
        margin: 5px;
    }
    
    #triviaOptions {
        padding: 20px;
        gap: 12px;
    }
    
    #triviaOptions .difficulty-button {
        padding: 16px 15px 16px 50px;
        font-size: 14px;
        min-height: 55px;
        line-height: 1.3;
    }
    
    #triviaOptions .difficulty-button::after {
        width: 26px;
        height: 26px;
        font-size: 13px;
        left: 12px;
    }
}

/* Estilos para coordenadas del tablero corregidas */
.board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board-with-coordinates {
    display: flex;
    align-items: center;
    gap: 10px;
}

.left-coordinates {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 568px; /* Altura total del tablero (8 * 70px + 8px de border) */
    font-size: 16px;
    color: #666;
    font-family: monospace;
    font-weight: bold;
}

.left-coordinates span {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-coordinates {
    display: flex;
    justify-content: space-around;
    width: 568px; /* Ancho total del tablero */
    margin-top: 10px;
    font-size: 16px;
    color: #666;
    font-family: monospace;
    font-weight: bold;
}

.bottom-coordinates span {
    width: 70px;
    text-align: center;
}


.coordinates {
    display: none;
}


@media (max-width: 768px) {
    .board-with-coordinates {
        gap: 5px;
    }
    
    .left-coordinates {
        height: 448px; 
        font-size: 14px;
    }
    
    .left-coordinates span {
        height: 56px;
    }
    
    .bottom-coordinates {
        width: 448px;
        margin-top: 5px;
        font-size: 14px;
    }
    
    .bottom-coordinates span {
        width: 56px;
    }
}


/* ========================================== */
/* MEJORAS ADICIONALES PARA MÓVILES */
/* ========================================== */

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 100vh;
    }
    
    /* Logos en móviles - más pequeños y abajo */
    .logo-oiss-chess {
        position: fixed;
        bottom: 10px;
        right: 10px;
        top: auto;
        left: auto;
        height: 40px;
        max-width: 150px;
        z-index: 1000;
    }
    
    .logo-aecid-chess {
        position: fixed;
        bottom: 10px;
        left: 10px;
        top: auto;
        right: auto;
        height: 40px;
        max-width: 150px;
        z-index: 1000;
    }
    
    .game-container {
        flex-direction: column;
        padding: 15px;
        padding-bottom: 60px;
        gap: 15px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .board-container {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .chess-board {
        grid-template-columns: repeat(8, 56px);
        grid-template-rows: repeat(8, 56px);
    }
    
    .square {
        width: 56px;
        height: 56px;
    }
    
    .piece {
        font-size: 38px;
    }
    
    .info-panel {
        width: 100%;
        max-width: 100%;
    }
    
    .game-info, .captured-pieces, .move-history {
        padding: 12px;
    }
    
    button {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .mode-selection-modal {
        padding: 10px;
    }
    
    .mode-selection-content {
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .logo-oiss-chess {
        height: 35px;
        max-width: 120px;
        bottom: 8px;
        right: 8px;
    }
    
    .logo-aecid-chess {
        height: 35px;
        max-width: 120px;
        bottom: 8px;
        left: 8px;
    }
    
    .chess-board {
        grid-template-columns: repeat(8, 42px);
        grid-template-rows: repeat(8, 42px);
    }
    
    .square {
        width: 42px;
        height: 42px;
    }
    
    .piece {
        font-size: 28px;
    }
    
    .left-coordinates {
        height: 340px;
        font-size: 12px;
    }
    
    .left-coordinates span {
        height: 42px;
    }
    
    .bottom-coordinates {
        width: 340px;
        font-size: 12px;
    }
    
    .bottom-coordinates span {
        width: 42px;
    }
    
    .game-container {
        padding: 10px;
        padding-bottom: 55px;
    }
    
    .current-player {
        font-size: 16px;
    }
    
    .mode-selection-content {
        padding: 15px;
    }
}
