/* style.css - Versión 36 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a3a, #0d1b2a);
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: manipulation;
}

/* Pantallas */
.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Pantalla de conexión */
.connect-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
    padding: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.connect-container h1 {
    font-size: 2.5rem;
    color: #ffd700;
    margin-bottom: 10px;
}

.subtitle {
    color: #aaa;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.input-group input {
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    text-align: center;
}

.input-group input::placeholder {
    color: #aaa;
}

button {
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #ffd700, #ffaa00);
    color: #1a2a3a;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:active {
    transform: scale(0.98);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

/* Pantalla de espera */
.waiting-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
    padding: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.waiting-container h2 {
    color: #ffd700;
    margin-bottom: 30px;
}

.loading {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 215, 0, 0.3);
    border-top: 5px solid #ffd700;
    border-radius: 50%;
    margin: 0 auto 30px;
    animation: spin 1s linear infinite;
}

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

.player-count {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* Pantalla de juego */
#game-screen {
    padding: 10px;
    justify-content: space-between;
}

/* Header del juego */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    margin-bottom: 15px;
}

.player-stats, .opponent-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: #aaa;
    text-align: center;
}

.health-bar, .energy-bar {
    width: 100px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.health-fill, .energy-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.health-fill {
    background: linear-gradient(to right, #ff416c, #ff4b2b);
}

.energy-fill {
    background: linear-gradient(to right, #00b4db, #0083b0);
}

.game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
}

.status-text {
    font-size: 0.9rem;
    color: #aaa;
}

/* Arena */
.arena-container {
    position: relative;
    width: 100%;
    height: 60vh;
    background: linear-gradient(to bottom, #8b7355, #a1886f);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
    margin-bottom: 15px;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.arena-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.arena-divider {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 215, 0, 0.5);
    transform: translateY(-50%);
}

.arena-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    font-size: 0.8rem;
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.arena-label.top {
    top: 10%;
}

.arena-label.bottom {
    bottom: 10%;
}

/* Panel de cartas - POSICIONADO BAJO LA ARENA */
.cards-panel {
    position: relative;
    width: 100%;
    margin-top: -50px; /* Para que las cartas queden parcialmente bajo la arena */
    z-index: 1;
}

.cards-hand {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;
}

.card {
    width: 140px;
    height: 190px;
    flex-shrink: 0;
    background: linear-gradient(145deg, #2c3e50, #1a2530);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 215, 0, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
    z-index: 1;
}

.card:active {
    transform: translateY(-10px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.7);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2;
    position: relative;
}

.card-icon {
    font-size: 20px;
    color: #ffd700;
}

.card-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: #e0e0e0;
    text-align: center;
    flex-grow: 1;
}

.card-content {
    text-align: center;
    z-index: 2;
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-name {
    font-size: 1rem;
    font-weight: bold;
    color: #ffd700;
}

.card-footer {
    display: flex;
    justify-content: center;
    z-index: 2;
    position: relative;
}

.card-cost {
    background: rgba(255, 215, 0, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

/* Panel de información */
.info-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    margin-top: 15px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CAF50;
}

.connection-dot.disconnected {
    background: #f44336;
}

.connection-text {
    font-size: 0.9rem;
}

.small {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* Efecto de arena sobre las cartas */
.arena-sand-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to top, #8b7355, transparent);
    z-index: 3;
    pointer-events: none;
}

/* Efectos de partículas de arena */
.sand-particle {
    position: absolute;
    background: rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    z-index: 2;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    50% { opacity: 0.7; }
    100% { transform: translateY(-400px) rotate(360deg); opacity: 0; }
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .player-stats, .opponent-stats {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .cards-hand {
        gap: 8px;
        padding: 5px;
    }
    
    .card {
        width: 120px;
        height: 170px;
        padding: 10px;
    }
    
    .card-name {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .card {
        width: 110px;
        height: 160px;
    }
    
    .card-name {
        font-size: 0.85rem;
    }
    
    .cards-hand {
        gap: 5px;
    }
}
