:root {
    --color-bg-dark: #0a0612;
    --color-bg-medium: #1a0b2e;
    --color-bg-light: #2d1b4e;
    --color-accent: #e74c3c;
    --color-accent-hover: #c0392b;
    --color-gold: #f39c12;
    --color-gold-light: #f1c40f;
    --color-text: #ecf0f1;
    --color-text-dim: #95a5a6;
    --color-success: #27ae60;
    --color-error: #e74c3c;
    --shadow-glow: 0 0 20px rgba(243, 156, 18, 0.3);
    --shadow-deep: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Raleway', sans-serif;
    background: linear-gradient(135deg, var(--color-bg-dark) 0%, var(--color-bg-medium) 50%, var(--color-bg-light) 100%);
    color: var(--color-text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(243, 156, 18, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(231, 76, 60, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Efecto de niebla animada */
.fog-layer {
    position: fixed;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle, rgba(243, 156, 18, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.fog-1 {
    animation: fogDrift1 40s ease-in-out infinite;
}

.fog-2 {
    animation: fogDrift2 30s ease-in-out infinite reverse;
    background: radial-gradient(circle, rgba(231, 76, 60, 0.03) 0%, transparent 70%);
}

@keyframes fogDrift1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-10%, 10%) rotate(5deg); }
}

@keyframes fogDrift2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(10%, -10%) rotate(-5deg); }
}

/* Pantallas */
.screen {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.screen.active {
    display: flex;
}

/* Contenedores */
.welcome-container,
.login-container,
.game-container,
.ranking-container {
    max-width: 800px;
    width: 100%;
    background: rgba(26, 11, 46, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-deep), 0 0 0 1px rgba(243, 156, 18, 0.2);
    animation: fadeInUp 0.8s ease;
}

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

/* Logo */
.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(243, 156, 18, 0.4));
    animation: logoFloat 3s ease-in-out infinite;
}

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

.logo-container-small {
    text-align: center;
    margin-bottom: 20px;
}

.logo-small {
    max-width: 120px;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(243, 156, 18, 0.3));
}

.logo-tiny {
    max-width: 50px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(243, 156, 18, 0.3));
}

/* Títulos */
.main-title {
    font-family: 'Creepster', cursive;
    font-size: 3rem;
    text-align: center;
    margin-bottom: 30px;
    color: var(--color-gold);
    text-shadow: 0 0 20px rgba(243, 156, 18, 0.5),
                 0 0 40px rgba(243, 156, 18, 0.3);
    letter-spacing: 3px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 20px rgba(243, 156, 18, 0.5), 0 0 40px rgba(243, 156, 18, 0.3); }
    to { text-shadow: 0 0 30px rgba(243, 156, 18, 0.7), 0 0 60px rgba(243, 156, 18, 0.5); }
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 30px;
    color: var(--color-gold-light);
    letter-spacing: 2px;
}

/* Historia */
.story-box {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
}

.story-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    text-align: justify;
    color: var(--color-text);
}

.story-text.highlight {
    font-weight: 600;
    color: var(--color-gold-light);
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 0;
}

/* Formularios */
.login-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 1rem;
    font-family: 'Raleway', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.3);
}

/* Botones */
.btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-family: 'Cinzel', serif;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-accent) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(243, 156, 18, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    border: 2px solid rgba(243, 156, 18, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-gold);
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.2rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    width: auto;
    margin: 0;
}

.btn-logout {
    background: rgba(231, 76, 60, 0.2);
    border: 2px solid rgba(231, 76, 60, 0.4);
}

.btn-logout:hover {
    background: rgba(231, 76, 60, 0.3);
    border-color: var(--color-accent);
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Errores */
.error-message {
    color: var(--color-error);
    font-size: 0.9rem;
    margin-top: 10px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.5s;
}

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

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(243, 156, 18, 0.2);
}

.team-info {
    text-align: center;
    flex: 1;
}

.team-info h3 {
    font-family: 'Cinzel', serif;
    color: var(--color-gold);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.timer {
    font-family: 'Courier New', monospace;
    font-size: 1.8rem;
    color: var(--color-text);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

/* Pre-game */
.pre-game {
    text-align: center;
}

.game-instructions {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 30px;
    color: var(--color-text-dim);
}

.game-instructions strong {
    color: var(--color-gold);
    font-size: 1.3rem;
}

/* Progress Bar */
.progress-bar {
    position: relative;
    height: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    margin-bottom: 30px;
    overflow: hidden;
    border: 2px solid rgba(243, 156, 18, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-gold) 0%, var(--color-accent) 100%);
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: white;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

/* Clues */
.clues-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.clue-card {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
}

.clue-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.clue-card.solved {
    border-color: var(--color-success);
    background: rgba(39, 174, 96, 0.1);
}

.clue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.clue-number {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--color-gold);
    font-weight: 600;
}

.clue-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.clue-status.locked {
    background: rgba(149, 165, 166, 0.3);
    color: var(--color-text-dim);
}

.clue-status.active {
    background: rgba(243, 156, 18, 0.3);
    color: var(--color-gold);
}

.clue-status.solved {
    background: rgba(39, 174, 96, 0.3);
    color: var(--color-success);
}

.clue-description {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--color-text);
}

.clue-input-group {
    display: flex;
    gap: 10px;
}

.clue-input-group input {
    flex: 1;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 1rem;
    text-transform: uppercase;
}

.clue-input-group input:focus {
    outline: none;
    border-color: var(--color-gold);
}

.clue-input-group button {
    padding: 12px 24px;
    width: auto;
    margin: 0;
}

.clue-error {
    color: var(--color-error);
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

.clue-error.show {
    display: block;
}

/* Game Complete */
.game-complete {
    text-align: center;
}

.complete-title {
    font-family: 'Creepster', cursive;
    font-size: 3rem;
    color: var(--color-gold);
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(243, 156, 18, 0.7);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

.complete-message {
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: var(--color-text);
}

.complete-time {
    font-size: 2rem;
    font-family: 'Courier New', monospace;
    color: var(--color-gold-light);
    margin-bottom: 40px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 2px solid rgba(243, 156, 18, 0.3);
}

/* Ranking */
.ranking-list {
    margin: 30px 0;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.ranking-item:hover {
    transform: translateX(5px);
    border-color: var(--color-gold);
}

.ranking-item.podium-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(243, 156, 18, 0.2) 100%);
    border-color: var(--color-gold);
}

.ranking-item.podium-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(149, 165, 166, 0.2) 100%);
    border-color: #bdc3c7;
}

.ranking-item.podium-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(230, 126, 34, 0.2) 100%);
    border-color: #e67e22;
}

.ranking-position {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: bold;
    width: 60px;
    text-align: center;
    color: var(--color-gold);
}

.podium-1 .ranking-position {
    color: #f1c40f;
    font-size: 2.5rem;
}

.podium-2 .ranking-position {
    color: #bdc3c7;
}

.podium-3 .ranking-position {
    color: #e67e22;
}

.ranking-info {
    flex: 1;
}

.ranking-team {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--color-text);
    margin-bottom: 5px;
}

.ranking-time {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--color-gold);
}

.empty-ranking {
    text-align: center;
    padding: 40px;
    color: var(--color-text-dim);
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-title {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .welcome-container,
    .login-container,
    .game-container,
    .ranking-container {
        padding: 25px;
    }

    .game-header {
        flex-direction: column;
        gap: 15px;
    }

    .clue-input-group {
        flex-direction: column;
    }

    .ranking-position {
        font-size: 1.5rem;
        width: 50px;
    }

    .ranking-team {
        font-size: 1.1rem;
    }

    .complete-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .story-text {
        font-size: 1rem;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .timer {
        font-size: 1.4rem;
    }
}
