/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

/* Estilos para AI Poliminom */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: 
        /* Patrón de cuadrados tipo Poliminom */
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        /* Líneas sutiles tipo grilla */
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        /* Formas geométricas grandes */
        radial-gradient(ellipse at 20% 80%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 40%, rgba(69, 183, 209, 0.08) 0%, transparent 60%),
        /* Degradado base */
        linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 
        20px 20px,
        20px 20px,
        40px 40px,
        40px 40px,
        800px 800px,
        600px 600px,
        1000px 1000px,
        100% 100%;
    background-position: 
        0 0,
        10px 10px,
        0 0,
        0 0,
        0 0,
        0 0,
        0 0,
        0 0;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    animation: backgroundShift 20s ease-in-out infinite;
    position: relative;
}

/* Elementos decorativos flotantes */
body::before {
    content: '';
    position: fixed;
    top: 10%;
    left: 5%;
    width: 120px;
    height: 120px;
    background: rgba(78, 205, 196, 0.25);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
    z-index: -1;
    box-shadow: 0 0 30px rgba(78, 205, 196, 0.15);
}

body::after {
    content: '';
    position: fixed;
    bottom: 15%;
    right: 8%;
    width: 80px;
    height: 80px;
    background: rgba(255, 107, 107, 0.25);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite reverse;
    z-index: -1;
    box-shadow: 0 0 25px rgba(255, 107, 107, 0.15);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* Más elementos decorativos */
.container::before {
    content: '';
    position: absolute;
    top: 20%;
    right: 10%;
    width: 100px;
    height: 100px;
    background: rgba(69, 183, 209, 0.2);
    border-radius: 20px;
    animation: float 10s ease-in-out infinite;
    z-index: -1;
    box-shadow: 0 0 20px rgba(69, 183, 209, 0.1);
    transform: rotate(45deg);
}

.container::after {
    content: '';
    position: absolute;
    bottom: 25%;
    left: 12%;
    width: 60px;
    height: 60px;
    background: rgba(150, 206, 180, 0.2);
    border-radius: 10px;
    animation: float 7s ease-in-out infinite reverse;
    z-index: -1;
    box-shadow: 0 0 15px rgba(150, 206, 180, 0.1);
    transform: rotate(-30deg);
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-family: 'Orbitron', 'Inter', monospace;
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease-in-out infinite;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes backgroundShift {
    0%, 100% { 
        background-position: 
            0 0,
            10px 10px,
            0 0,
            0 0,
            0 0,
            0 0,
            0 0,
            0 0;
    }
    50% { 
        background-position: 
            10px 10px,
            0 0,
            20px 20px,
            20px 20px,
            -100px -100px,
            100px 100px,
            -200px 200px,
            0 0;
    }
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) scale(1);
        opacity: 0.6;
    }
    50% { 
        transform: translateY(-30px) scale(1.2);
        opacity: 0.8;
    }
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.game-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    flex-wrap: wrap;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}

.game-info > div {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

.game-info > div:hover {
    transform: translateY(-2px);
}

.game-info h3 {
    font-family: 'Orbitron', 'Inter', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Iconos sutiles para los récords */
.record-icon {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-left: 4px;
    transition: opacity 0.2s ease;
}

.game-info > div:hover .record-icon {
    opacity: 0.9;
}

/* Tooltips para récords */
.game-info > div[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: pre;
    text-align: center;
    line-height: 1.2;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
    margin-bottom: 5px;
}

.game-info > div[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 95%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    pointer-events: none;
}

.game-info div div {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffeb3b;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

/* Indicador especial para el modo AI */
#ai-mode-indicator {
    font-size: 1.2rem !important;
    color: #4ecdc4 !important;
    transition: all 0.3s ease;
}

#ai-mode-indicator.random-mode {
    color: #ff6b6b !important;
}

/* Notificación de límite de usuario */
.user-limit-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    animation: slideInRight 0.5s ease-out;
}

.notification-content {
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.95), rgba(255, 152, 0, 0.95));
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
}

.notification-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 10px;
    animation: bounce 1s infinite;
}

.notification-message h4 {
    margin: 0 0 10px 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.notification-message p {
    margin: 5px 0;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
    line-height: 1.4;
}

.notification-message small {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.notification-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-options {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: visible;
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0 5px;
    transition: all 0.2s ease;
}

.options-header:hover {
    opacity: 0.8;
}

.options-header h3 {
    margin: 0;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.options-toggle-icon {
    color: #4ecdc4;
    font-size: 1rem;
    transition: transform 0.3s ease;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.options-toggle-icon.expanded {
    transform: rotate(180deg);
}

.game-options h3 {
    margin-bottom: 15px;
}

.game-options:hover {
    transform: translateY(-2px);
}

.options-container {
    overflow: visible;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    max-height: 0;
    opacity: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.options-container.expanded {
    max-height: 300px;
    opacity: 1;
    padding: 15px 0 0 0;
}

.toggle-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    cursor: pointer;
    font-size: 0.9rem;
    position: relative;
    text-align: left;
    width: 180px;
    margin-bottom: 4px;
}

.toggle-option .option-main {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.toggle-option .option-main span {
    font-size: 0.9rem;
    color: white !important;
}

/* Asegurar que todos los spans en las opciones tengan el mismo color */
.toggle-option span {
    color: white !important;
}

/* Estilo mejorado para tooltips personalizados */
.toggle-option[data-tooltip] {
    position: relative;
}

.toggle-option[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: pre;
    text-align: center;
    line-height: 1.2;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: none;
    margin-bottom: 8px;
    max-width: 250px;
}

.toggle-option[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    pointer-events: none;
    margin-bottom: 4px;
}

.toggle-option:hover {
    opacity: 0.8;
}

.toggle-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4ecdc4;
    cursor: pointer;
}

.collection-panel {
    padding: 0px;
    text-align: center;
    margin-top: 0px;
}

.collection-panel h3 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: white;
}

.collection-info-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.pieces-count {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
}

.pieces-icon {
    font-size: 1rem;
}

.pieces-text {
    color: rgba(255, 255, 255, 0.8);
}

.pieces-number {
    font-weight: bold;
    color: #4ecdc4;
    min-width: 20px;
    text-align: center;
}

.collection-btn {
    padding: 8px 16px;
    background: rgba(78, 205, 196, 0.2);
    border: 1px solid #4ecdc4;
    border-radius: 6px;
    color: #4ecdc4;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.collection-btn:hover {
    background: rgba(78, 205, 196, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.2);
}

/* Estilos para el copyright */
.copyright {
    margin-top: 5px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    line-height: 1.2;
    opacity: 0.8;
}

.copyright div {
    margin-bottom: 1px;
}

.copyright-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}

.copyright-link:hover {
    color: rgba(255, 255, 255, 0.9);
}

.ai-poliminom-title,
.poliminom-title {
    font-family: 'Orbitron', 'Inter', monospace;
    font-weight: 700;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease-in-out infinite;
    letter-spacing: 1px;
}

.new-pieces-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(45deg, #ff6b6b, #ff4757);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.6);
    z-index: 10;
    animation: newIndicatorPulse 2s ease-in-out infinite;
}

@keyframes newIndicatorPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.collection-btn, .collection-button {
    position: relative;
}

.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.start-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    max-width: 350px;
    width: 90%;
}

.start-content h2 {
    font-family: 'Orbitron', 'Inter', monospace;
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 2rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.start-content p {
    margin-bottom: 25px;
    opacity: 0.9;
    font-size: 1.1rem;
    line-height: 1.5;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.start-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #764ba2, #667eea);
}

.start-button:active {
    transform: translateY(0);
}

.loading-info {
    margin-top: 20px;
}

.mini-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin: 10px 0;
}

.mini-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.game-canvas-container {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    background: #000;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

#gameCanvas {
    display: block;
    background: #000;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.next-piece {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.held-piece {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.side-panels {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
}

.next-piece h3, .held-piece h3 {
    font-family: 'Orbitron', 'Inter', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

#nextPieceCanvas, #heldPieceCanvas {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

#heldPieceCanvas.disabled {
    opacity: 0.5;
    border-color: rgba(255, 255, 255, 0.1);
}

.hold-instruction {
    font-size: 0.8rem;
    opacity: 0.7;
    text-align: center;
    font-style: italic;
}

.disclaimer {
    margin: 20px auto 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 800px;
    width: fit-content;
}

.disclaimer p {
    font-size: 11px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    text-align: justify;
}

/* Overlays */
.loading-overlay, .game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-content, .game-over-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    max-width: 350px;
    width: 90%;
}

.loading-content h2, .game-over-content h2 {
    font-family: 'Orbitron', 'Inter', monospace;
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 1.8rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#loading-text {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 15px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.game-over-content p {
    margin: 20px 0;
    font-size: 1.2rem;
}

.game-over-content button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.game-over-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #764ba2, #667eea);
}

.game-over-content button:active {
    transform: translateY(0);
}

/* Estilos para modal de pausa */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.pause-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    max-width: 350px;
    width: 90%;
}

.pause-content h2 {
    font-family: 'Orbitron', 'Inter', monospace;
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.8rem;
    color: #ffeb3b;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.pause-content p {
    margin-bottom: 20px;
    font-size: 1rem;
    opacity: 0.9;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.resume-button, .end-button {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.resume-button {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
}

.resume-button:hover {
    background: linear-gradient(135deg, #45a049, #3e8e41);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.end-button {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.end-button:hover {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
}

.pause-content small {
    display: block;
    opacity: 0.7;
    font-size: 0.8rem;
    font-style: italic;
}

/* Efectos especiales */
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
}

.game-canvas-container:hover {
    animation: glow 2s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .game-info {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        max-width: 400px;
    }
    
    .game-info > div {
        flex: 1;
        min-width: 100px;
    }
    
    .game-options {
        flex: 1;
        min-width: 120px;
    }
    
    .disclaimer {
        width: 100%;
        max-width: 100%;
        margin: 20px 0 0;
        padding: 12px 15px;
    }
    
    .disclaimer p {
        font-size: 10px;
        line-height: 1.3;
    }
    
    .side-panels {
        flex-direction: column;
        align-items: center;
        width: 100%;
        max-width: 400px;
        gap: 15px;
    }
    
    .held-piece, .next-piece {
        flex: none;
        width: 100%;
        max-width: 180px;
    }
    
    .collection-panel {
        width: 100%;
        max-width: 250px;
        margin-top: 0;
    }
    
    #gameCanvas {
        width: 300px;
        height: 600px;
    }
    
    #nextPieceCanvas, #heldPieceCanvas {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    #gameCanvas {
        width: 225px;
        height: 450px;
    }
    
    #nextPieceCanvas, #heldPieceCanvas {
        width: 60px;
        height: 60px;
    }
    
    .collection-panel {
        padding: 10px;
    }
    
    .collection-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .pieces-count {
        font-size: 0.8rem;
    }
    
    .loading-content, .game-over-content {
        padding: 20px;
    }
    
    .pause-content {
        padding: 20px;
        max-width: 280px;
    }
    
    .pause-content h2 {
        font-size: 1.5rem;
    }
    
    .pause-buttons {
        gap: 10px;
    }
    
    .resume-button, .end-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Estilos para el Modal de Colección */
.collection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.collection-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    border-radius: 15px;
    padding: 25px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
}

.collection-header h2 {
    font-family: 'Orbitron', 'Inter', monospace;
    font-weight: 700;
    color: white;
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: 1px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 100, 100, 0.7);
    transform: scale(1.1);
}

.collection-info {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.game-status {
    margin-top: 10px;
    padding: 8px 15px;
    background: rgba(78, 205, 196, 0.2);
    border-radius: 20px;
    border: 1px solid #4ecdc4;
    display: inline-block;
}

.usage-legend {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.legend-item {
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.7rem;
}

.pieces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
}

/* Estilos personalizados para el scrollbar del modal de colección */
.pieces-grid::-webkit-scrollbar {
    width: 12px;
}

.pieces-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pieces-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(78, 205, 196, 0.7), rgba(69, 183, 209, 0.7));
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.pieces-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(78, 205, 196, 0.9), rgba(69, 183, 209, 0.9));
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.5);
}

.pieces-grid::-webkit-scrollbar-corner {
    background: rgba(255, 255, 255, 0.1);
}

.piece-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.piece-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.piece-item.active-piece {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.2);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.4);
}

.piece-item.active-piece::before {
    content: "🎮";
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 20px;
}

.piece-item.most-used-piece {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
}

.piece-item.most-used-piece::after {
    content: "⭐";
    position: absolute;
    top: 5px;
    left: 8px;
    font-size: 16px;
}

.piece-item.frequently-used-piece {
    border-color: #ffa500;
    background: rgba(255, 165, 0, 0.1);
}

.piece-item.frequently-used-piece::after {
    content: "🔥";
    position: absolute;
    top: 5px;
    left: 8px;
    font-size: 14px;
}

.piece-item.new-piece {
    border: 2px solid #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
    animation: newPieceGlow 2s ease-in-out infinite alternate;
}

@keyframes newPieceGlow {
    from {
        box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
    }
    to {
        box-shadow: 0 0 25px rgba(255, 107, 107, 0.8);
    }
}

.new-piece-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(45deg, #ff6b6b, #ff4757);
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.6);
    z-index: 10;
    animation: newBadgePulse 1.5s ease-in-out infinite;
}

@keyframes newBadgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.piece-canvas {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
}

.piece-name {
    color: white;
    font-size: 0.8rem;
    margin-bottom: 5px;
    font-weight: 500;
}

.piece-blocks {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
}

.piece-usage {
    color: #4ecdc4;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 2px;
}

.delete-piece-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(255, 100, 100, 0.7);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.piece-item:hover .delete-piece-btn {
    opacity: 1;
}

.delete-piece-btn:hover {
    background: rgba(255, 60, 60, 0.9);
    transform: scale(1.1);
}

.deletion-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    border-radius: 15px;
}

.deletion-loading-content {
    background: rgba(102, 126, 234, 0.9);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.deletion-loading-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.deletion-loading-content p {
    margin: 0 0 15px 0;
    color: rgba(255, 255, 255, 0.8);
}

.loading-spinner {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Animación de vibración para game over */
@keyframes gameOverShake {
    0%, 100% { 
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    10% { 
        transform: translateX(-8px) translateY(2px) rotate(-1deg);
    }
    20% { 
        transform: translateX(6px) translateY(-3px) rotate(1deg);
    }
    30% { 
        transform: translateX(-4px) translateY(4px) rotate(-0.5deg);
    }
    40% { 
        transform: translateX(8px) translateY(-1px) rotate(1deg);
    }
    50% { 
        transform: translateX(-6px) translateY(3px) rotate(-1deg);
    }
    60% { 
        transform: translateX(4px) translateY(-4px) rotate(0.5deg);
    }
    70% { 
        transform: translateX(-8px) translateY(1px) rotate(-1deg);
    }
    80% { 
        transform: translateX(6px) translateY(-2px) rotate(1deg);
    }
    90% { 
        transform: translateX(-2px) translateY(2px) rotate(-0.5deg);
    }
}

/* Animaciones para efectos de level up */
@keyframes levelUpCelebration {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
    }
    25% { 
        transform: scale(1.02) rotate(1deg);
    }
    50% { 
        transform: scale(1.05) rotate(0deg);
    }
    75% { 
        transform: scale(1.02) rotate(-1deg);
    }
}

@keyframes levelUpGlow {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 215, 0, 0);
    }
    25% { 
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    }
    75% { 
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
}

/* Animaciones para sistema de alerta de peligro */
@keyframes dangerPulse {
    0%, 100% { 
        transform: scale(1);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.01);
        filter: brightness(1.1);
    }
}

@keyframes criticalShake {
    0%, 100% { 
        transform: translateX(0) translateY(0);
    }
    25% { 
        transform: translateX(-1px) translateY(1px);
    }
    50% { 
        transform: translateX(1px) translateY(-1px);
    }
    75% { 
        transform: translateX(-1px) translateY(-1px);
    }
}

/* Animaciones sincronizadas con heartbeat */
@keyframes heartbeatPulse {
    0%, 85% { 
        transform: scale(1);
        filter: brightness(1);
    }
    5% { 
        transform: scale(1.02);
        filter: brightness(1.15);
    }
    15% { 
        transform: scale(1);
        filter: brightness(1);
    }
    30% { 
        transform: scale(1.015);
        filter: brightness(1.08);
    }
    40% { 
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes heartbeatShake {
    0%, 85% { 
        transform: translateX(0) translateY(0);
        filter: brightness(1);
    }
    5% { 
        transform: translateX(2px) translateY(1px);
        filter: brightness(1.2);
    }
    15% { 
        transform: translateX(0) translateY(0);
        filter: brightness(1);
    }
    30% { 
        transform: translateX(-1px) translateY(1px);
        filter: brightness(1.1);
    }
    40% { 
        transform: translateX(0) translateY(0);
        filter: brightness(1);
    }
}

/* Modal de Confirmación de Borrado */
.delete-confirmation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3500;
}

.delete-confirmation-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    border-radius: 15px;
    padding: 25px;
    max-width: 90vw;
    width: 400px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.delete-confirmation-header h3 {
    color: white;
    margin: 0 0 20px 0;
    font-size: 1.3rem;
}

.delete-confirmation-body {
    margin-bottom: 25px;
}

.warning-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.delete-confirmation-body p {
    color: white;
    font-size: 1rem;
    margin: 0 0 20px 0;
    line-height: 1.4;
}

.piece-preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.delete-preview-canvas {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.piece-preview-info {
    text-align: left;
    color: white;
}

.delete-piece-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #4ecdc4;
}

.delete-piece-blocks {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3px;
}

.delete-piece-usage {
    font-size: 0.8rem;
    color: #4ecdc4;
    font-weight: 500;
}

.delete-warning-info {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    border-radius: 8px;
    padding: 10px;
    margin-top: 15px;
}

.delete-warning-info small {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    line-height: 1.3;
}

.delete-confirmation-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.cancel-delete-btn, .confirm-delete-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.cancel-delete-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.cancel-delete-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.confirm-delete-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff5252);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.confirm-delete-btn:hover {
    background: linear-gradient(45deg, #ff5252, #ff4444);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

/* Responsive para modal de confirmación */
@media (max-width: 480px) {
    .delete-confirmation-content {
        width: 95vw;
        padding: 20px;
    }
    
    .delete-confirmation-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .cancel-delete-btn, .confirm-delete-btn {
        width: 100%;
    }
    
    .piece-preview-container {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .piece-preview-info {
        text-align: center;
    }
    
    .delete-preview-canvas {
        width: 80px;
        height: 80px;
    }
}

.collection-button {
    background: rgba(78, 205, 196, 0.3);
    border: 1px solid #4ecdc4;
    color: #4ecdc4;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.collection-button:hover {
    background: rgba(78, 205, 196, 0.5);
    transform: translateY(-1px);
}

/* Responsive para el modal de colección */
@media (max-width: 768px) {
    .collection-content {
        width: 95vw;
        padding: 20px;
    }
    
    .pieces-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .piece-canvas {
        width: 60px;
        height: 60px;
    }
    
    .delete-piece-btn {
        width: 20px;
        height: 20px;
        font-size: 10px;
        bottom: 3px;
        right: 3px;
    }
}

/* Tooltip para piezas especiales */
.special-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ffffff;
    border-radius: 8px;
    padding: 10px;
    min-width: 200px;
    max-width: 250px;
    z-index: 9999;
    pointer-events: none;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    transition: opacity 0.2s ease;
}

.tooltip-header {
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 4px;
}

.tooltip-description {
    font-size: 12px;
    color: #cccccc;
    line-height: 1.4;
}

/* Diferentes colores para tipos de tooltip */
.special-tooltip.bomba {
    border-color: #ff4444;
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.1), rgba(0, 0, 0, 0.9));
}

.special-tooltip.ralentizadora {
    border-color: #44ff44;
    background: linear-gradient(135deg, rgba(68, 255, 68, 0.1), rgba(0, 0, 0, 0.9));
}

.special-tooltip.mareadora {
    border-color: #ff44ff;
    background: linear-gradient(135deg, rgba(255, 68, 255, 0.1), rgba(0, 0, 0, 0.9));
}

.special-tooltip.maldita {
    border-color: #8844ff;
    background: linear-gradient(135deg, rgba(136, 68, 255, 0.1), rgba(0, 0, 0, 0.9));
}

.special-tooltip.estresante {
    border-color: #ffaa00;
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.1), rgba(0, 0, 0, 0.9));
}

.special-tooltip.purgadora {
    border-color: #00ffff;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(0, 0, 0, 0.9));
}

/* Indicadores de efectos activos */
.active-effects-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 500;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 200px;
}

.effect-indicator {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    color: white;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: effectPulse 1s ease-in-out infinite;
    transition: all 0.3s ease;
    line-height: 1.2;
}

.effect-indicator.estresante {
    border-color: #ffaa00;
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

.effect-indicator.ralentizadora {
    border-color: #44ff44;
    color: #44ff44;
    background: rgba(68, 255, 68, 0.1);
}

.effect-indicator.mareadora {
    border-color: #ff44ff;
    color: #ff44ff;
    background: rgba(255, 68, 255, 0.1);
}

.effect-indicator.purgadora {
    border-color: #00ffff;
    color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
}

@keyframes effectPulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* Animación para el bonus del duende */
@keyframes duendeBonusAnimation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -70%) scale(0.8);
    }
}

/* Responsive para indicadores */
@media (max-width: 768px) {
    .active-effects-container {
        max-width: 150px;
    }
    
    .effect-indicator {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
}

/* Animación de vibración para el marcador de puntuación */
@keyframes scoreShake {
    0%, 100% {
        transform: translate(0);
    }
    10% {
        transform: translate(-2px, -1px) scale(1.05);
    }
    20% {
        transform: translate(2px, 1px) scale(1.08);
    }
    30% {
        transform: translate(-1px, 2px) scale(1.05);
    }
    40% {
        transform: translate(1px, -2px) scale(1.08);
    }
    50% {
        transform: translate(-2px, 1px) scale(1.1);
    }
    60% {
        transform: translate(2px, -1px) scale(1.08);
    }
    70% {
        transform: translate(-1px, -2px) scale(1.05);
    }
    80% {
        transform: translate(1px, 2px) scale(1.03);
    }
    90% {
        transform: translate(-1px, 1px) scale(1.01);
    }
}

.score-shake {
    animation: scoreShake 0.6s ease-out;
    color: #ffff00 !important; /* Color dorado durante la vibración */
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8) !important;
}

.lines-shake {
    animation: scoreShake 0.6s ease-out;
    color: #00ff00 !important; /* Color verde durante la vibración */
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8) !important;
}

/* Estilos para el botón "¿Cómo jugar?" */
.how-to-play-section {
    margin-top: 0px !important;
    width: 100%;
    /* Sobrescribir estilos del contenedor game-info */
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    backdrop-filter: none !important;
}

.how-to-play-section:hover {
    transform: none !important;
}

.how-to-play-button {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 8px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.how-to-play-button:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 1) 0%, rgba(118, 75, 162, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.how-to-play-button:focus {
    outline: none;
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.how-to-play-button:active {
    outline: none;
    border: none;
    transform: translateY(0);
}

.help-icon {
    font-size: 16px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Estilos para el modal "¿Cómo jugar?" */
.how-to-play-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.how-to-play-content {
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.how-to-play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.how-to-play-header h2 {
    margin: 0;
    color: white;
    font-family: 'Orbitron', monospace;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.how-to-play-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.instructions-section {
    margin-bottom: 30px;
}

.instructions-section h3 {
    color: white;
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.instructions-section p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

/* Sección de curiosidad sobre poliminos */
.curiosity-section {
    background: rgba(78, 205, 196, 0.1);
    border-left: 4px solid #4ecdc4;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.curiosity-section h3 {
    color: #4ecdc4;
}

.polyomino-types {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.polyomino-types li {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border-left: 3px solid #4ecdc4;
}

.polyomino-types li strong {
    color: #4ecdc4;
    font-weight: 600;
}

.curiosity-section em {
    color: #96ceb4;
    font-style: italic;
    font-size: 13px;
}

/* Grilla de controles */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.key {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Grilla de piezas especiales */
.special-pieces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.special-piece-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.special-piece-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.piece-icon {
    font-size: 24px;
    min-width: 30px;
    text-align: center;
}

.special-piece-item strong {
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.special-piece-item p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 0;
    line-height: 1.4;
}

/* Información del duende */
.duende-info {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 140, 0, 0.2) 100%);
    border-radius: 12px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    margin-top: 15px;
}

.duende-icon {
    font-size: 32px;
    min-width: 40px;
    text-align: center;
    animation: bounce 2s infinite;
}

/* Canvas del duende demo */
#duende-demo-canvas {
    min-width: 80px;
    width: 80px;
    height: 100px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.duende-info p {
    color: white;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.duende-info strong {
    color: #ffd700;
    font-weight: 700;
}

/* Información de puntuación */
.scoring-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
}

.score-item.highlight {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.2) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: white;
    font-weight: 600;
}

/* Lista de consejos */
.tips-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

.tips-list li {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.tips-list li::before {
    content: "💡";
    position: absolute;
    left: 0;
    top: 0;
}

/* Responsive para el modal */
@media (max-width: 768px) {
    .how-to-play-modal {
        padding: 10px;
    }
    
    .how-to-play-content {
        border-radius: 15px;
    }
    
    .how-to-play-header {
        padding: 20px;
    }
    
    .how-to-play-header h2 {
        font-size: 20px;
    }
    
    .how-to-play-body {
        padding: 20px;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .special-pieces-grid {
        grid-template-columns: 1fr;
    }
    
    .duende-info {
        flex-direction: column;
        text-align: center;
    }
    
    .polyomino-types {
        grid-template-columns: 1fr;
    }
    
    .curiosity-section {
        padding: 15px;
    }
}

/* Estilos personalizados para el scrollbar del modal "¿Cómo jugar?" */
.how-to-play-body::-webkit-scrollbar {
    width: 12px;
}

.how-to-play-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.how-to-play-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.7), rgba(118, 75, 162, 0.7));
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.how-to-play-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.5);
}

.how-to-play-body::-webkit-scrollbar-corner {
    background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   RANKING SYSTEM STYLES
   ======================================== */

/* Contenedor para botones de ranking y logros */
.secondary-buttons-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Botón Ver Ranking */
.ranking-btn {
    flex: 1;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.15) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.ranking-btn:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 165, 0, 0.25) 100%);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.trophy-icon {
    font-size: 14px;
}

/* Botón Ver Logros */
.achievements-btn {
    flex: 1;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(75, 0, 130, 0.15) 100%);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.achievements-btn:hover {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.25) 0%, rgba(75, 0, 130, 0.25) 100%);
    border-color: rgba(138, 43, 226, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}

.medal-icon {
    font-size: 14px;
}

/* Modal de Ranking */
.ranking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.ranking-content {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.95) 0%, rgba(20, 20, 40, 0.95) 100%);
    border-radius: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

.ranking-header {
    padding: 25px 30px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ranking-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.ranking-body {
    padding: 20px 30px 30px;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

/* Estados de carga/error */
.ranking-loading,
.ranking-error {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.8);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ranking-error p {
    margin-bottom: 20px;
    font-size: 16px;
}

.retry-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.6) 0%, rgba(118, 75, 162, 0.6) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    transform: translateY(-2px);
}

/* Tabla de Ranking */
.ranking-table-container {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.ranking-table thead tr {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
}

.ranking-table th {
    padding: 12px 16px;
    text-align: left;
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
}

.ranking-table th:first-child {
    border-radius: 10px 0 0 10px;
}

.ranking-table th:last-child {
    border-radius: 0 10px 10px 0;
}

.ranking-table tbody tr {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    transition: all 0.3s ease;
}

.ranking-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    transform: translateX(5px);
}

.ranking-table tbody tr.top-three {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.15) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.ranking-table tbody tr.player-score {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.2) 0%, rgba(69, 183, 209, 0.2) 100%);
    border: 2px solid rgba(78, 205, 196, 0.5);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.ranking-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    border: none;
}

.ranking-table td:first-child {
    border-radius: 10px 0 0 10px;
}

.ranking-table td:last-child {
    border-radius: 0 10px 10px 0;
}

.rank-col {
    width: 70px;
    text-align: center;
}

.name-col {
    width: auto;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.score-col {
    width: 140px;
    text-align: right;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    color: #ffd700;
}

.date-col {
    width: 120px;
    text-align: right;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 14px;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.rank-badge.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    color: #000;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #e39b5f 100%);
    color: #000;
    box-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
}

.rank-badge.regular {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* Modal de Entrada de Nombre */
.name-input-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.name-input-content {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.98) 0%, rgba(20, 20, 40, 0.98) 100%);
    border-radius: 20px;
    border: 2px solid rgba(78, 205, 196, 0.5);
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 30px rgba(78, 205, 196, 0.3);
    max-width: 500px;
    width: 100%;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.name-input-header {
    padding: 30px;
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.2) 0%, rgba(69, 183, 209, 0.2) 100%);
    border-bottom: 2px solid rgba(78, 205, 196, 0.3);
    text-align: center;
}

.name-input-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 0 15px rgba(78, 205, 196, 0.7);
}

.name-input-body {
    padding: 30px;
}

.congrats-message {
    text-align: center;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    line-height: 1.5;
}

.score-display {
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.score-display span {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.15) 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.name-input-form {
    margin-bottom: 25px;
}

.name-input-form label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    font-weight: 500;
}

#playerNameInput {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

#playerNameInput:focus {
    outline: none;
    border-color: rgba(78, 205, 196, 0.6);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
}

#playerNameInput::placeholder {
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

.name-validation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    min-height: 20px;
}

.char-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'JetBrains Mono', monospace;
}

.validation-msg {
    font-size: 12px;
    font-weight: 500;
}

.validation-msg.valid {
    color: #4ecdc4;
}

.validation-msg.invalid {
    color: #ff6b6b;
}

.name-input-buttons {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.skip-btn,
.submit-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: 'Inter', sans-serif;
}

.skip-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
}

.skip-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.submit-btn {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.6) 0%, rgba(69, 183, 209, 0.6) 100%);
    border: 1px solid rgba(78, 205, 196, 0.5);
    color: white;
}

.submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.8) 0%, rgba(69, 183, 209, 0.8) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.name-submit-error {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: 8px;
    color: #ff6b6b;
    font-size: 13px;
    text-align: center;
}

/* Scrollbar personalizado para ranking */
.ranking-body::-webkit-scrollbar {
    width: 10px;
}

.ranking-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.ranking-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.5), rgba(255, 165, 0, 0.5));
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.ranking-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.7), rgba(255, 165, 0, 0.7));
}

/* Responsive para ranking */
@media (max-width: 768px) {
    .ranking-content {
        max-width: 95%;
        max-height: 90vh;
    }
    
    .ranking-header,
    .ranking-body {
        padding: 20px;
    }
    
    .ranking-header h2 {
        font-size: 20px;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .score-col {
        width: 100px;
    }
    
    .date-col {
        display: none;
    }
    
    .name-input-content {
        max-width: 95%;
    }
    
    .name-input-header {
        padding: 20px;
    }
    
    .name-input-header h2 {
        font-size: 22px;
    }
    
    .name-input-body {
        padding: 20px;
    }
    
    .score-display {
        font-size: 24px;
    }
    
    .name-input-buttons {
        flex-direction: column;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Notificación de éxito del ranking */
.ranking-success-notification .notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-success-notification .notification-icon {
    font-size: 24px;
}

.ranking-success-notification .notification-message {
    font-size: 15px;
    font-weight: 600;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ========================================
   ACHIEVEMENTS (LOGROS) STYLES
   ======================================== */

/* Modal de Logros */
.achievements-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.achievements-modal.active {
    display: flex;
}

.achievements-content {
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.98) 0%, rgba(30, 30, 60, 0.98) 100%);
    border-radius: 20px;
    max-width: 900px;
    width: calc(100% - 40px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(138, 43, 226, 0.3);
    animation: modalSlideIn 0.4s ease-out;
    overflow: hidden;
}

.achievements-header {
    padding: 25px 30px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(75, 0, 130, 0.15) 100%);
    border-radius: 20px 20px 0 0;
    gap: 20px;
    flex-shrink: 0;
}

.achievements-header-content {
    flex: 1;
    min-width: 0;
}

.achievements-header h2 {
    margin: 0 0 12px 0;
    font-size: 28px;
    font-weight: 700;
    color: white;
    font-family: 'Orbitron', sans-serif;
    display: flex;
    align-items: center;
    gap: 12px;
}

.achievements-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.achievements-count {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.achievements-count span {
    font-weight: 700;
    color: rgba(138, 43, 226, 1);
}

.achievements-progress {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    margin-top: 5px;
}

.achievements-progress-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.achievements-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(138, 43, 226, 0.9) 0%, rgba(75, 0, 130, 0.9) 100%);
    transition: width 0.6s ease;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.achievements-close {
    background: rgba(255, 68, 68, 0.15);
    border: 2px solid rgba(255, 68, 68, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.achievements-close:hover {
    background: rgba(255, 68, 68, 0.3);
    border-color: rgba(255, 68, 68, 0.6);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.4);
}

.achievements-close:active {
    transform: rotate(90deg) scale(0.95);
}

.achievements-body {
    padding: 25px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.achievements-body::-webkit-scrollbar {
    width: 10px;
}

.achievements-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

.achievements-body::-webkit-scrollbar-thumb {
    background: rgba(138, 43, 226, 0.5);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.achievements-body::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 43, 226, 0.7);
    background-clip: padding-box;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding: 5px;
}

.achievement-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.achievement-card.unlocked {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(75, 0, 130, 0.15) 100%);
    border-color: rgba(138, 43, 226, 0.4);
}

.achievement-card.unlocked::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(70%);
}

.achievement-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.achievement-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.achievement-card.locked .achievement-icon {
    filter: grayscale(100%) opacity(0.4);
}

.achievement-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 5px;
    font-family: 'Orbitron', sans-serif;
}

.achievement-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    margin-bottom: 8px;
}

.achievement-rarity {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 5px;
}

.achievement-rarity.common {
    background: rgba(128, 128, 128, 0.2);
    color: #a0a0a0;
    border: 1px solid rgba(128, 128, 128, 0.3);
}

.achievement-rarity.rare {
    background: rgba(30, 144, 255, 0.2);
    color: #4da6ff;
    border: 1px solid rgba(30, 144, 255, 0.3);
}

.achievement-rarity.epic {
    background: rgba(138, 43, 226, 0.2);
    color: #b370ff;
    border: 1px solid rgba(138, 43, 226, 0.3);
}

.achievement-rarity.legendary {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.achievement-rarity.platinum {
    background: linear-gradient(135deg, rgba(230, 230, 250, 0.3), rgba(192, 192, 192, 0.3));
    color: #e6e6fa;
    border: 1px solid rgba(230, 230, 250, 0.5);
    box-shadow: 0 0 10px rgba(230, 230, 250, 0.3);
}

.achievement-unlocked-date {
    font-size: 8px;
    color: rgba(186, 85, 211, 1);
    background: rgba(138, 43, 226, 0.15);
    border-left: 2px solid rgba(186, 85, 211, 0.8);
    padding: 3px 6px;
    margin-top: 15px;
    font-style: normal;
    font-weight: 500;
    border-radius: 3px;
    display: inline-block;
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.achievement-card.locked .achievement-unlocked-date {
    color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(255, 255, 255, 0.2);
}

/* Estados de carga y error */
.achievements-loading,
.achievements-error {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.8);
}

.achievements-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(138, 43, 226, 0.2);
    border-top-color: rgba(138, 43, 226, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.achievements-loading p,
.achievements-error p {
    font-size: 16px;
    margin: 0;
}

.achievements-error button {
    margin-top: 20px;
    padding: 10px 24px;
    background: rgba(138, 43, 226, 0.3);
    border: 2px solid rgba(138, 43, 226, 0.5);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.achievements-error button:hover {
    background: rgba(138, 43, 226, 0.5);
    border-color: rgba(138, 43, 226, 0.8);
    transform: translateY(-2px);
}

/* Notificación de logro desbloqueado */
.achievement-unlock-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10003;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.95) 0%, rgba(75, 0, 130, 0.95) 100%);
    padding: 20px 25px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(138, 43, 226, 0.4);
    animation: slideInRight 0.5s ease, pulse 2s infinite;
    color: white;
    max-width: 350px;
    border: 2px solid rgba(138, 43, 226, 0.6);
}

.achievement-unlock-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.achievement-unlock-icon {
    font-size: 48px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.achievement-unlock-text {
    flex: 1;
}

.achievement-unlock-title {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3px;
    font-family: 'Orbitron', sans-serif;
}

.achievement-unlock-name {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin-bottom: 2px;
}

.achievement-unlock-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Responsive */
@media (max-width: 768px) {
    .achievements-content {
        max-width: calc(100% - 20px);
        max-height: 95vh;
        margin: 10px;
    }
    
    .achievements-header {
        padding: 20px 15px;
    }
    
    .achievements-header h2 {
        font-size: 22px;
    }
    
    .achievements-body {
        padding: 20px 15px;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .achievement-unlock-notification {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
    
    .achievements-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}

/* ==================== SISTEMA DE GAMEPAD ==================== */

/* Animaciones para notificaciones de gamepad */
@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100px);
        opacity: 0;
    }
}

.gamepad-notification {
    font-size: 14px;
}

.gamepad-notification .notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
}

.gamepad-notification .notification-icon {
    font-size: 24px;
}

.gamepad-notification .notification-message strong {
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
}

.gamepad-notification .notification-message small {
    font-size: 12px;
    opacity: 0.9;
}

