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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    animation: comicBounce 2s ease-in-out;
}

/* Comic loading effect */
@keyframes comicBounce {
    0% {
        transform: scale(0.8) rotate(-5deg);
        opacity: 0;
    }
    25% {
        transform: scale(1.1) rotate(2deg);
        opacity: 0.7;
    }
    50% {
        transform: scale(0.95) rotate(-1deg);
        opacity: 0.9;
    }
    75% {
        transform: scale(1.05) rotate(1deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

header h1 {
    color: white;
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: titleWiggle 3s ease-in-out infinite;
    transform-origin: center;
}

header h1 .home-link {
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

header h1 .home-link:hover {
    color: #ffd700;
    text-shadow: 2px 2px 8px rgba(255, 215, 0, 0.5);
    transform: scale(1.05);
}

/* Comic title effect */
@keyframes titleWiggle {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(1deg) scale(1.02);
    }
    50% {
        transform: rotate(0deg) scale(1);
    }
    75% {
        transform: rotate(-1deg) scale(1.02);
    }
}

.game-info {
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.1em;
    text-align: center;
    min-height: 60px;
}

.player-info, .game-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(5px);
}

main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    align-items: start;
}

.game-area {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    position: relative;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
    gap: 0;
    grid-gap: 0;
    border: 3px solid #8B4513;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: boardGlow 4s ease-in-out infinite;
    background: #8B4513;
}

/* Efecto de ondas en el tablero */
@keyframes boardGlow {
    0%, 100% {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 30px rgba(118, 75, 162, 0.5);
    }
}

.cell {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    box-sizing: border-box;
}

.cell.light {
    background-color: #F0D9B5 !important;
}

.cell.dark {
    background-color: #B58863 !important;
}

.cell:hover {
    background-color: #FFD700 !important;
    transform: scale(1.05);
    animation: cellPulse 0.6s ease-in-out;
}

/* Comic cell effect */
@keyframes cellPulse {
    0% { transform: scale(1.05); }
    25% { transform: scale(1.1); }
    50% { transform: scale(1.05); }
    75% { transform: scale(1.08); }
    100% { transform: scale(1.05); }
}

.cell.selected {
    background-color: #32CD32 !important;
    box-shadow: inset 0 0 0 3px #228B22;
}

.cell.possible-move {
    background-color: #87CEEB !important;
    animation: pulse 1s infinite;
}

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

.piece {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Comic effects for pieces */
.piece.capturing {
    animation: captureExplosion 0.8s ease-out forwards;
}

.piece.promoting {
    animation: promotionCelebration 1.5s ease-out forwards;
}

.piece.moving {
    animation: pieceMove 0.5s ease-in-out;
}

/* Explosion animation when capturing */
@keyframes captureExplosion {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.3) rotate(180deg);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.5) rotate(360deg);
        opacity: 0.6;
    }
    75% {
        transform: scale(1.2) rotate(540deg);
        opacity: 0.3;
    }
    100% {
        transform: scale(0) rotate(720deg);
        opacity: 0;
    }
}

/* Celebration animation when promoting */
@keyframes promotionCelebration {
    0% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }
    25% {
        transform: scale(1.4) rotate(90deg);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.6) rotate(180deg);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }
    75% {
        transform: scale(1.4) rotate(270deg);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }
    100% {
        transform: scale(1.2) rotate(360deg);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    }
}

/* Movement animation */
@keyframes pieceMove {
    0% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1); }
}

/* Particle effects for captures */
.piece::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.3s ease;
}

.piece.capturing::before {
    animation: particleExplosion 0.8s ease-out forwards;
}

@keyframes particleExplosion {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    50% {
        width: 100px;
        height: 100px;
        opacity: 0.8;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Efecto de brillo para damas */
.piece.queen {
    position: relative;
    overflow: visible;
}

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

.piece.black {
    background: linear-gradient(135deg, #2C2C2C, #000);
    color: white;
}

.piece.white {
    background: linear-gradient(135deg, #F5F5F5, #E0E0E0);
    color: #333;
}

.piece.queen {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.game-controls {
    text-align: center;
}

.players {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    min-width: 150px;
}

.player-piece {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-bottom: 10px;
    border: 2px solid #333;
}

.player-piece.black {
    background: linear-gradient(135deg, #2C2C2C, #000);
}

.player-piece.white {
    background: linear-gradient(135deg, #F5F5F5, #E0E0E0);
}

.captured-pieces {
    background: #FF6B6B;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-weight: bold;
    margin-top: 5px;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    animation: buttonWiggle 0.5s ease-in-out;
}

/* Comic button effect */
@keyframes buttonWiggle {
    0% { transform: translateY(-2px) scale(1.05) rotate(0deg); }
    25% { transform: translateY(-2px) scale(1.05) rotate(2deg); }
    50% { transform: translateY(-2px) scale(1.05) rotate(0deg); }
    75% { transform: translateY(-2px) scale(1.05) rotate(-2deg); }
    100% { transform: translateY(-2px) scale(1.05) rotate(0deg); }
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

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

.chat-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: 500px;
    overflow: hidden;
}


.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 30% auto;
    padding: 20px 20px 0px 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-content h2 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    font-size: 1.4em;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body input {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}

.modal-body input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: -30px;
}

/* Board overlay for inactive player */
.board-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(128, 128, 128, 0.3);
    pointer-events: none;
    z-index: 10;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.board-overlay.active {
    background: rgba(128, 128, 128, 0.1);
}

.board-overlay.inactive {
    background: rgba(128, 128, 128, 0.5);
    pointer-events: all;
}

/* Home page styles */
.home-area .game-info p {
    color: #e0e0e0;
    font-size: 1.1rem;
}
.home-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.welcome-section {
    text-align: center;
    margin-bottom: 50px;
}

.welcome-section h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.welcome-section p {
    font-size: 1.2rem;
    color: #e0e0e0;
    max-width: 600px;
    margin: 0 auto;
}

.game-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    width: 100%;
    max-width: 1000px;
}

.option-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.option-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.option-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #ffffff;
}

.option-card p {
    color: #e0e0e0;
    margin-bottom: 25px;
    line-height: 1.6;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #007bff);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 1.1rem;
}

/* Waiting spinner styles */
.waiting-content {
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.game-code-display {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px 25px;
    border-radius: 15px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    margin: 10px 0;
}

.game-code {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Home page responsive styles */
    .home-area {
        padding: 20px 15px;
    }
    
    .welcome-section {
        margin-bottom: 30px;
    }
    
    .welcome-section h2 {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .welcome-section p {
        font-size: 1rem;
        padding: 0 10px;
    }
    
    .game-options {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
    }
    
    .option-card {
        padding: 20px;
        margin: 0 10px;
    }
    
    .option-card h3 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    .option-card p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 1.1rem;
    }
    
    /* Modal responsive */
    .modal-content {
        margin: 15px;
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 30px);
        padding: 15px 15px 10px 15px;
    }
    
    .waiting-content {
        padding: 30px 20px;
    }
    
    .spinner {
        width: 50px;
        height: 50px;
    }
    
    .game-code {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .home-area {
        padding: 30px 20px;
    }
    
    .welcome-section h2 {
        font-size: 2.2rem;
    }
    
    .game-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .option-card {
        padding: 25px;
    }
    
    .option-card h3 {
        font-size: 1.4rem;
    }
    
    .modal-content {
        margin: 30px;
        max-width: 500px;
    }
}
    
    .board {
        grid-template-columns: repeat(8, 45px);
        grid-template-rows: repeat(8, 45px);
    }
    
    .cell {
        width: 45px;
        height: 45px;
    }
    
    .piece {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .players {
        flex-direction: column;
        gap: 10px;
    }
    
    .player {
        flex-direction: row;
        justify-content: space-between;
        min-width: auto;
    }
    
    .chat-area {
        height: 300px;
    }
    
    .modal-content {
        margin: 15% auto;
        padding: 15px 15px 10px 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        justify-content: center;
        align-items: center;
        text-align: center;
        min-height: 80px;
    }
    
    .board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }
    
    .cell {
        width: 40px;
        height: 40px;
    }
    
    .piece {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}

/* Estilos para mensajes informativos */
.game-message {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    padding: 10px 20px !important;
    border-radius: 20px !important;
    font-weight: bold !important;
    font-size: 1em !important;
    z-index: 1 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
    animation: slideInDown 0.3s ease-out !important;
    max-width: 100% !important;
    text-align: center !important;
    margin: 5px 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.game-message.error {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52) !important;
    color: white !important;
    border: 2px solid #ff5252 !important;
}

.game-message.info {
    background: linear-gradient(135deg, #4ecdc4, #44a08d) !important;
    color: white !important;
    border: 2px solid #26a69a !important;
}

.game-message.success {
    background: linear-gradient(135deg, #45b7d1, #96c93d) !important;
    color: white !important;
    border: 2px solid #4caf50 !important;
}

.game-message.warning {
    background: linear-gradient(135deg, #feca57, #ff9ff3) !important;
    color: white !important;
    border: 2px solid #ff9800 !important;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation to hide message */
.game-message.fadeOut {
    animation: fadeOut 0.3s ease-in forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}