/* ========== Variables y Reset ========== */
:root {
    --color-sala1: #00d9ff;
    --color-sala2: #ff0055;
    --color-bg: #0a0e27;
    --color-bg-light: #151933;
    --color-text: #e0e6ff;
    --color-success: #00ff88;
    --color-error: #ff0044;
    --color-warning: #ffaa00;
    --color-node: #1e2749;
    --color-node-active: #2a3a6b;
    --font-main: 'Rajdhani', sans-serif;
    --font-title: 'Orbitron', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
    color: var(--color-text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========== Pantalla de Login ========== */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #1a1f3a 0%, #0a0e27 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 217, 255, 0.03) 2px, rgba(0, 217, 255, 0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255, 0, 85, 0.03) 2px, rgba(255, 0, 85, 0.03) 4px);
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.login-container {
    background: rgba(21, 25, 51, 0.8);
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow: 
        0 0 60px rgba(0, 217, 255, 0.3),
        inset 0 0 30px rgba(0, 217, 255, 0.05);
    backdrop-filter: blur(10px);
    text-align: center;
    max-width: 500px;
    width: 90%;
    z-index: 10;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-title {
    font-family: var(--font-title);
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.glitch {
    position: relative;
    color: var(--color-sala1);
    text-shadow: 
        0 0 10px var(--color-sala1),
        0 0 20px var(--color-sala1),
        0 0 30px var(--color-sala1);
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 10px var(--color-sala1), 0 0 20px var(--color-sala1); }
    50% { text-shadow: 0 0 20px var(--color-sala1), 0 0 40px var(--color-sala1), 0 0 60px var(--color-sala1); }
}

.game-subtitle {
    font-size: 1.2rem;
    color: rgba(224, 230, 255, 0.7);
    margin-bottom: 2rem;
}

.login-form input {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-family: var(--font-main);
    background: rgba(30, 39, 73, 0.6);
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 10px;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-sala1);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.4);
}

.room-selection {
    display: flex;
    gap: 1rem;
}

.room-btn {
    flex: 1;
    padding: 1.5rem 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-title);
    border: 3px solid;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(30, 39, 73, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.sala1-btn {
    border-color: var(--color-sala1);
    color: var(--color-sala1);
}

.sala1-btn:hover {
    background: var(--color-sala1);
    color: var(--color-bg);
    box-shadow: 0 0 30px var(--color-sala1);
    transform: translateY(-5px);
}

.sala2-btn {
    border-color: var(--color-sala2);
    color: var(--color-sala2);
}

.sala2-btn:hover {
    background: var(--color-sala2);
    color: var(--color-bg);
    box-shadow: 0 0 30px var(--color-sala2);
    transform: translateY(-5px);
}

.room-icon {
    font-size: 2rem;
}

.waiting-message {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 170, 0, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 170, 0, 0.3);
    border-top-color: var(--color-warning);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Pantalla de Juego ========== */
.game-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(21, 25, 51, 0.9);
    border-bottom: 2px solid rgba(0, 217, 255, 0.2);
    backdrop-filter: blur(10px);
}

.header-section {
    flex: 1;
    text-align: center;
}

.header-section h2 {
    font-family: var(--font-title);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.score {
    font-size: 1.8rem;
    font-weight: 700;
}

.header-center {
    flex: 1;
}

.game-status {
    font-size: 1.3rem;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid var(--color-success);
    border-radius: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ========== Pantalla Dividida ========== */
.split-screen {
    display: flex;
    flex: 1;
    position: relative;
}

.room-side {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
}

.sala1-side {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.05) 0%, transparent 100%);
    border-right: 1px solid rgba(0, 217, 255, 0.2);
}

.sala2-side {
    background: linear-gradient(135deg, rgba(255, 0, 85, 0.05) 0%, transparent 100%);
    border-left: 1px solid rgba(255, 0, 85, 0.2);
}

.room-header h3 {
    font-family: var(--font-title);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

/* ========== Pipeline ========== */
.pipeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.pipeline-node {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-node);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.pipeline-node::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.pipeline-node:hover::before {
    left: 100%;
}

.node-icon {
    font-size: 2.5rem;
    filter: grayscale(100%);
    transition: all 0.4s ease;
}

.node-content {
    flex: 1;
}

.node-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.node-status {
    font-size: 0.9rem;
    color: rgba(224, 230, 255, 0.6);
}

.node-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.4s ease;
}

/* Estados del nodo */
.pipeline-node.active {
    background: var(--color-node-active);
    border-color: var(--color-warning);
    box-shadow: 0 0 30px rgba(255, 170, 0, 0.3);
}

.pipeline-node.active .node-icon {
    filter: grayscale(0%);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pipeline-node.completed {
    background: rgba(0, 255, 136, 0.15);
    border-color: var(--color-success);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

.pipeline-node.completed .node-icon {
    filter: grayscale(0%);
}

.pipeline-node.completed .node-indicator {
    background: var(--color-success);
    box-shadow: 0 0 15px var(--color-success);
    animation: checkPulse 0.6s ease-out;
}

@keyframes checkPulse {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.pipeline-node.failed {
    background: rgba(255, 0, 68, 0.15);
    border-color: var(--color-error);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ========== Divisor Central ========== */
.divider {
    width: 4px;
    background: linear-gradient(to bottom, var(--color-sala1), var(--color-sala2));
    position: relative;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
}

.vs-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: var(--color-bg);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 900;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========== Lista de Jugadores ========== */
.players-list {
    background: rgba(30, 39, 73, 0.5);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: auto;
}

.players-list h4 {
    font-family: var(--font-title);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.players-list ul {
    list-style: none;
}

.players-list li {
    padding: 0.8rem;
    background: rgba(42, 58, 107, 0.5);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.players-list li:hover {
    background: rgba(42, 58, 107, 0.8);
    transform: translateX(5px);
}

/* ========== Panel de Preguntas ========== */
.question-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(21, 25, 51, 0.98);
    border-top: 3px solid var(--color-sala1);
    padding: 2rem;
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 100;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.question-tool {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-warning);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.question-timer {
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-error);
    background: rgba(255, 0, 68, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 10px;
    min-width: 80px;
    text-align: center;
    animation: timerPulse 1s ease-in-out infinite;
}

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

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.question-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.option-btn {
    padding: 1.2rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-main);
    background: rgba(42, 58, 107, 0.6);
    border: 2px solid rgba(0, 217, 255, 0.3);
    border-radius: 12px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.option-btn:hover:not(:disabled) {
    background: rgba(0, 217, 255, 0.2);
    border-color: var(--color-sala1);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
    transform: translateY(-3px);
}

.option-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.option-btn.correct {
    background: rgba(0, 255, 136, 0.3);
    border-color: var(--color-success);
    box-shadow: 0 0 20px var(--color-success);
}

.option-btn.incorrect {
    background: rgba(255, 0, 68, 0.3);
    border-color: var(--color-error);
    animation: shake 0.5s ease-in-out;
}

.next-question-btn {
    grid-column: 1 / -1;
    padding: 1.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: var(--font-title);
    background: linear-gradient(135deg, var(--color-success), var(--color-sala1));
    border: none;
    border-radius: 15px;
    color: var(--color-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.next-question-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 40px rgba(0, 255, 136, 0.5);
}

.next-question-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    animation: none;
}

.question-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

.question-feedback.success {
    background: rgba(0, 255, 136, 0.2);
    border: 2px solid var(--color-success);
    color: var(--color-success);
}

.question-feedback.error {
    background: rgba(255, 0, 68, 0.2);
    border: 2px solid var(--color-error);
    color: var(--color-error);
}

/* ========== Pantalla de Victoria ========== */
.victory-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.victory-content {
    text-align: center;
    max-width: 600px;
    padding: 3rem;
}

.trophy-animation {
    font-size: 8rem;
    animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

.victory-title {
    font-family: var(--font-title);
    font-size: 3rem;
    font-weight: 900;
    margin: 1rem 0;
    text-transform: uppercase;
    background: linear-gradient(45deg, var(--color-sala1), var(--color-success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
}

.victory-subtitle {
    font-size: 1.5rem;
    color: rgba(224, 230, 255, 0.8);
    margin-bottom: 2rem;
}

.final-scores {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin: 2rem 0;
}

.final-score {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.final-score-label {
    font-size: 1.2rem;
    font-weight: 600;
}

.final-score-value {
    font-family: var(--font-title);
    font-size: 3rem;
    font-weight: 900;
}

.restart-btn {
    padding: 1.2rem 3rem;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: var(--font-title);
    background: linear-gradient(135deg, var(--color-sala1), var(--color-success));
    border: none;
    border-radius: 50px;
    color: var(--color-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.restart-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px var(--color-success);
}

/* ========== Canvas de Partículas ========== */
#particlesCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
}

/* ========== Controles de Administrador ========== */
.admin-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 150;
}

.admin-reset-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-title);
    background: linear-gradient(135deg, rgba(255, 0, 68, 0.9), rgba(180, 0, 40, 0.9));
    border: 2px solid var(--color-error);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(255, 0, 68, 0.4);
    backdrop-filter: blur(10px);
}

.admin-reset-btn:hover {
    background: linear-gradient(135deg, rgba(255, 0, 68, 1), rgba(200, 0, 50, 1));
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 0, 68, 0.6);
}

.admin-reset-btn:active {
    transform: translateY(0) scale(1);
}

.admin-reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Responsive ========== */
@media (max-width: 1200px) {
    .split-screen {
        flex-direction: column;
    }
    
    .divider {
        width: 100%;
        height: 4px;
    }
    
    .vs-indicator {
        top: 0;
        left: 50%;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .question-options {
        grid-template-columns: 1fr;
    }
    
    .game-title {
        font-size: 2rem;
    }
}

