body {
    margin: 0;
    padding: 10px;
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: manipulation;
    user-select: none;
}

.back-button {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    padding: 8px 15px;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.back-button:hover {
    transform: translateY(-2px);
}

.game-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 95%;
    max-width: 800px;
}

.game-header {
    text-align: center;
    color: white;
    margin-bottom: 15px;
}

.game-header h1 {
    margin: 0;
    font-size: clamp(1.5em, 4vw, 2.5em);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-header p {
    font-size: clamp(0.8em, 2vw, 1.1em);
    margin: 5px 0;
}

.score-board {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    color: white;
    font-weight: bold;
    flex-wrap: wrap;
    gap: 10px;
}

.score-item {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    min-width: 80px;
    font-size: clamp(0.7em, 2vw, 0.9em);
}

.game-canvas {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.2);
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.controls {
    text-align: center;
    margin-top: 10px;
    color: white;
    font-size: clamp(0.7em, 2vw, 0.9em);
}

.controls p {
    margin: 5px 0;
}

.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 20px;
    z-index: 1000;
}

.mobile-dpad {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 5px;
    width: 150px;
    height: 150px;
}

.mobile-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    touch-action: manipulation;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-btn:active {
    background: rgba(255, 255, 255, 0.5);
}

.mobile-btn.up { grid-column: 2; grid-row: 1; }
.mobile-btn.left { grid-column: 1; grid-row: 2; }
.mobile-btn.right { grid-column: 3; grid-row: 2; }
.mobile-btn.down { grid-column: 2; grid-row: 3; }

.message-panel {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    min-height: 80px;
    max-width: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    font-size: clamp(0.8em, 2vw, 1em);
}

.freeze-indicator {
    text-align: center;
    margin: 10px 0;
    padding: 8px;
    background: rgba(135, 206, 235, 0.8);
    border-radius: 10px;
    color: white;
    font-weight: bold;
    font-size: clamp(0.8em, 2vw, 1em);
}

.game-over-panel, .start-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

.game-over-title, .start-title {
    font-size: clamp(1.5em, 4vw, 2.5em);
    margin-bottom: 15px;
    color: #333;
}

.game-over-message, .start-message {
    font-size: clamp(0.9em, 2vw, 1.2em);
    margin-bottom: 15px;
    color: #666;
    line-height: 1.5;
}

.pause-btn, .start-btn, .restart-btn {
    padding: 10px 20px;
    background: linear-gradient(45deg, #FF9800, #f57c00);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: clamp(0.8em, 2vw, 1em);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
    margin: 5px;
    touch-action: manipulation;
}

.pause-btn:hover, .start-btn:hover, .restart-btn:hover {
    transform: translateY(-2px);
}

.start-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
}

.restart-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    color: white;
    font-size: clamp(0.6em, 1.5vw, 0.8em);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.coin-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.gold { background: linear-gradient(45deg, #ffd700, #ffed4e); }
.silver { background: linear-gradient(45deg, #c0c0c0, #e8e8e8); }

.message-title {
    font-weight: bold;
    font-size: clamp(1em, 2.5vw, 1.2em);
    margin-bottom: 10px;
    color: #333;
}

.message-content {
    font-size: clamp(0.8em, 2vw, 1em);
    line-height: 1.5;
    color: #555;
}

.derecho {
    border-left: 4px solid #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.deber {
    border-left: 4px solid #c0c0c0;
    background: rgba(192, 192, 192, 0.1);
}

/* Detectar dispositivos móviles */
@media (hover: none) and (pointer: coarse) {
    .mobile-controls {
        display: block;
    }
    
    .controls p:first-child {
        display: none;
    }
}

/* Responsive para tablets y móviles */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        padding: 10px;
    }
    
    .score-board {
        gap: 5px;
    }
    
    .score-item {
        min-width: 70px;
        padding: 6px;
    }
}

@media (max-width: 480px) {
    .legend {
        gap: 10px;
        font-size: 0.6em;
    }
    
    .coin-icon {
        width: 12px;
        height: 12px;
    }
}