:root {
    --cryo-primary: #0a1628;
    --cryo-secondary: #1a1a2e;
    --cryo-dark: #050d1a;
    --cryo-gold: #d4af37;
    --cryo-gold-light: #f0d060;
    --cryo-cyan: #00d4ff;
    --cryo-cyan-dark: #0099cc;
    --cryo-text: #ffffff;
    --cryo-text-muted: #b8c5d6;
    --cryo-border: rgba(212, 175, 55, 0.3);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--cryo-primary);
    color: var(--cryo-text);
    overflow-x: hidden;
}

/* ===== MENÚ DE NAVEGACIÓN ===== */
.navbar {
    background: rgba(10, 22, 40, 0.85);
    backdrop-filter: blur(10px);
    padding: 0.75rem 0;
    transition: all 0.3s ease;
    z-index: 1040;
}

.navbar-scrolled {
    background: rgba(5, 13, 26, 0.95);
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.3rem;
}

.nav-logo {
    height: 35px;
    width: auto;
}

.brand-text {
    background: linear-gradient(135deg, var(--cryo-gold), var(--cryo-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-link {
    color: var(--cryo-text-muted) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--cryo-gold) !important;
}

.navbar-toggler {
    border: 1px solid var(--cryo-gold);
}

/* ===== HERO SECTION (Pantalla dividida) ===== */
.hero-section {
    padding-top: 60px;
}

.container-fluid.vh-100 {
    min-height: calc(100vh - 60px);
    height: auto;
}

/* Resetear h-100 de Bootstrap en la fila del hero */
.hero-section .row.h-100 {
    height: auto;
    min-height: calc(100vh - 60px);
}

.left-panel {
    background: 
        radial-gradient(ellipse at top left, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
        linear-gradient(160deg, var(--cryo-primary) 0%, var(--cryo-secondary) 100%);
    color: var(--cryo-text);
    min-height: calc(100vh - 60px);
    position: relative;
}

.logo {
    max-width: 150px;
    height: auto;
    filter: drop-shadow(0 4px 20px rgba(212, 175, 55, 0.3));
}

.brand-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--cryo-gold), var(--cryo-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
}

.brand-description {
    max-width: 450px;
    opacity: 0.95;
    color: var(--cryo-text-muted);
    line-height: 1.6;
    font-size: 1rem;
}

.services-title {
    color: var(--cryo-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    margin-top: 2rem;
}

.services-list {
    margin-top: 1rem;
    max-width: 400px;
}

.services-list li {
    padding: 0.5rem 0;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--cryo-text-muted);
    justify-content: center;
}

@media (min-width: 992px) {
    .services-list li {
        justify-content: flex-start;
    }
}

.service-icon {
    color: var(--cryo-cyan);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.btn-gold {
    background: linear-gradient(135deg, var(--cryo-gold), var(--cryo-gold-light));
    border: none;
    color: var(--cryo-primary);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
    background: linear-gradient(135deg, var(--cryo-gold-light), var(--cryo-gold));
    color: var(--cryo-primary);
}

.right-panel {
    background: 
        radial-gradient(ellipse at top right, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
        linear-gradient(160deg, var(--cryo-secondary) 0%, var(--cryo-dark) 100%);
    color: var(--cryo-text);
    min-height: calc(100vh - 60px);
}

.game-title {
    color: var(--cryo-gold);
    font-weight: 700;
    letter-spacing: 1px;
}

.game-instructions {
    opacity: 0.85;
    color: var(--cryo-text-muted);
}

.game-hud .badge {
    font-size: 0.85rem;
    padding: 0.4em 0.7em;
    font-weight: 600;
}

.game-hud .bg-primary {
    background: linear-gradient(135deg, var(--cryo-cyan-dark), var(--cryo-cyan)) !important;
}

.game-hud .bg-danger {
    background: linear-gradient(135deg, #c0392b, #e74c3c) !important;
}

.game-hud .bg-success {
    background: linear-gradient(135deg, var(--cryo-gold), var(--cryo-gold-light)) !important;
    color: var(--cryo-primary) !important;
}

.game-wrapper {
    position: relative;
    width: 100%;
    max-width: 450px;
    aspect-ratio: 5 / 4;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: var(--cryo-dark);
    border: 1px solid var(--cryo-border);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.game-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 22, 40, 0.92);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
    padding: 2rem;
}

.game-overlay.d-none { display: none !important; }

.game-overlay h3 {
    color: var(--cryo-gold);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.game-overlay p {
    color: var(--cryo-text-muted);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.game-overlay .btn {
    background: linear-gradient(135deg, var(--cryo-gold), var(--cryo-gold-light));
    color: var(--cryo-primary);
    border: none;
    padding: 0.6rem 1.5rem;
    font-weight: 700;
    border-radius: 8px;
}

/* ===== SECCIÓN CONTACTO ===== */
.contact-section {
    padding: 5rem 0 3rem;
    background: linear-gradient(180deg, var(--cryo-dark) 0%, var(--cryo-primary) 100%);
    position: relative;
    z-index: 1;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--cryo-gold), var(--cryo-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--cryo-text-muted);
}

.contact-wrapper {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.6), rgba(10, 22, 40, 0.6));
    border: 1px solid var(--cryo-border);
    border-radius: 16px;
    padding: 2.5rem;
}

.contact-form .form-label {
    color: var(--cryo-text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.contact-form .form-control,
.contact-form .form-select {
    background: rgba(10, 22, 40, 0.5);
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: var(--cryo-text);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.contact-form .form-control:focus,
.contact-form .form-select:focus {
    background: rgba(10, 22, 40, 0.8);
    border-color: var(--cryo-gold);
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.1);
    color: var(--cryo-text);
}

.contact-form .form-control::placeholder {
    color: rgba(184, 197, 214, 0.5);
}

.contact-form .form-check-label {
    color: var(--cryo-text-muted);
    font-size: 0.85rem;
}

.contact-form .form-check-input {
    background-color: rgba(10, 22, 40, 0.5);
    border-color: rgba(212, 175, 55, 0.3);
}

.contact-form .form-check-input:checked {
    background-color: var(--cryo-gold);
    border-color: var(--cryo-gold);
}

.contact-form .btn-gold {
    background: linear-gradient(135deg, var(--cryo-gold), var(--cryo-gold-light));
    border: none;
    color: var(--cryo-primary);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.contact-form .btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
    color: var(--cryo-primary);
}

.contact-info {
    color: var(--cryo-text-muted);
    font-size: 0.95rem;
}

.contact-info strong {
    color: var(--cryo-gold);
}

/* ===== ALERTAS ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(46, 204, 113, 0.15);
    border-color: rgba(46, 204, 113, 0.3);
    color: #2ecc71;
}

.alert-danger {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

/* ===== ENLACE POLÍTICA ===== */
.privacy-link {
    color: var(--cryo-gold);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: all 0.3s ease;
}

.privacy-link:hover {
    color: var(--cryo-gold-light);
    text-decoration: none;
}

/* ===== RESPONSIVE: CORRECCIÓN DE SOLAPAMIENTO ===== */
@media (max-width: 991.98px) {
    .hero-section {
        padding-top: 50px;
    }
    
    /* CRÍTICO: Resetear alturas fijas para que el contenido fluya */
    .container-fluid.vh-100 {
        min-height: auto;
        height: auto;
    }
    
    .hero-section .row.h-100 {
        height: auto;
        min-height: auto;
    }
    
    .left-panel, .right-panel {
        min-height: auto;
        height: auto;
        padding: 3rem 1.5rem;
    }
    
    /* Asegurar que las columnas no tengan altura forzada */
    .hero-section .col-12.col-lg-6 {
        height: auto;
        flex: 0 0 auto;
    }
    
    .brand-title {
        font-size: 2rem;
    }
    
    .brand-description {
        font-size: 0.95rem;
    }
    
    .services-list {
        font-size: 0.9rem;
    }
    
    .game-wrapper {
        max-width: 100%;
    }
    
    .contact-section {
        padding: 3rem 0 2rem;
    }
    
    .contact-wrapper {
        padding: 2rem 1.5rem;
    }

    .projects-section {
        padding: 3rem 0;
    }
    
    .project-card {
        max-width: 500px;
        margin: 0 auto;
    }

}

@media (max-width: 575.98px) {
    .hero-section {
        padding-top: 50px;
    }
    
    /* Refuerzo para móviles pequeños */
    .container-fluid.vh-100,
    .hero-section .row.h-100 {
        height: auto !important;
        min-height: auto !important;
    }
    
    .left-panel, .right-panel {
        min-height: auto !important;
        height: auto !important;
        padding: 2rem 1rem;
    }
    
    .brand-title {
        font-size: 1.6rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .services-list li {
        font-size: 0.85rem;
    }
    
    .contact-section {
        padding: 2rem 0 1rem;
    }
    
    .contact-wrapper {
        padding: 1.5rem 1rem;
    }

    .projects-section {
        padding: 2rem 0;
    }
    
    .project-content {
        padding: 1rem;
    }
    
    .project-title {
        font-size: 1rem;
    }
    
    .project-description {
        font-size: 0.85rem;
    }

}

/* ===== CAPTCHA MATEMÁTICO ===== */
.captcha-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(10, 22, 40, 0.4);
    border: 1px solid var(--cryo-border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.captcha-question {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
    border-radius: 6px;
    border-left: 3px solid var(--cryo-gold);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--cryo-text);
}

.captcha-icon {
    font-size: 1.3rem;
}

.captcha-input {
    max-width: 200px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
}

.captcha-input:focus {
    border-color: var(--cryo-gold) !important;
    box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.2) !important;
}

.form-text.text-muted {
    color: var(--cryo-text-muted) !important;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

@media (max-width: 575.98px) {
    .captcha-container {
        padding: 0.75rem;
    }
    
    .captcha-question {
        font-size: 1rem;
        padding: 0.6rem 0.8rem;
    }
    
    .captcha-input {
        max-width: 100%;
    }
}

/* ===== SECCIÓN PROYECTOS ===== */
.projects-section {
    padding: 5rem 0;
    background: linear-gradient(180deg, var(--cryo-primary) 0%, var(--cryo-dark) 50%, var(--cryo-primary) 100%);
    position: relative;
}

.projects-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cryo-border), transparent);
}

/* ===== FICHA DE PROYECTO (TAMAÑO FIJO) ===== */
.project-card {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.6), rgba(10, 22, 40, 0.6));
    border: 1px solid var(--cryo-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s ease;
    height: 420px; /* Altura fija */
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(212, 175, 55, 0.15);
    border-color: var(--cryo-gold);
}

/* ===== CARRUSEL (TAMAÑO FIJO) ===== */
.project-carousel {
    position: relative;
    width: 100%;
    height: 220px; /* Altura fija */
    overflow: hidden;
    background: var(--cryo-dark);
    flex-shrink: 0;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* La imagen se recorta para llenar el espacio */
    object-position: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.project-image:hover {
    transform: scale(1.05);
}

/* Indicadores personalizados */
.project-carousel .carousel-indicators {
    bottom: 8px;
    margin-bottom: 0;
    z-index: 5;
}

.project-carousel .carousel-indicators [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    margin: 0 3px;
}

.project-carousel .carousel-indicators .active {
    background-color: var(--cryo-gold);
    transform: scale(1.3);
}

/* Controles de navegación */
.project-carousel .carousel-control-prev,
.project-carousel .carousel-control-next {
    width: 35px;
    height: 35px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    background: rgba(10, 22, 40, 0.7);
    border: 1px solid var(--cryo-border);
    border-radius: 50%;
    opacity: 0;
    transition: all 0.3s ease;
}

.project-carousel .carousel-control-prev { left: 10px; }
.project-carousel .carousel-control-next { right: 10px; }

.project-card:hover .carousel-control-prev,
.project-card:hover .carousel-control-next {
    opacity: 1;
}

.project-carousel .carousel-control-prev:hover,
.project-carousel .carousel-control-next:hover {
    background: rgba(212, 175, 55, 0.8);
    border-color: var(--cryo-gold);
}

.project-carousel .carousel-control-prev-icon,
.project-carousel .carousel-control-next-icon {
    width: 14px;
    height: 14px;
}

/* Contador de fotos */
.carousel-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(10, 22, 40, 0.8);
    border: 1px solid var(--cryo-border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cryo-text-muted);
    z-index: 5;
    letter-spacing: 1px;
}

.carousel-counter .counter-current {
    color: var(--cryo-gold);
}

/* Icono de zoom */
.carousel-zoom-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(10, 22, 40, 0.8);
    border: 1px solid var(--cryo-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cryo-gold);
    z-index: 5;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.project-card:hover .carousel-zoom-icon {
    opacity: 1;
}

/* ===== CONTENIDO DE LA FICHA ===== */
.project-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.project-number {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--cryo-gold);
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.6;
}

.project-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cryo-text);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-description {
    font-size: 0.85rem;
    color: var(--cryo-text-muted);
    line-height: 1.5;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== MODAL LIGHTBOX ===== */
.lightbox-content {
    background: var(--cryo-dark);
    border: 1px solid var(--cryo-border);
    border-radius: 12px;
    overflow: hidden;
}

.lightbox-header {
    background: rgba(10, 22, 40, 0.95);
    border-bottom: 1px solid var(--cryo-border);
    padding: 1rem 1.5rem;
}

.lightbox-header .modal-title {
    color: var(--cryo-gold);
    font-size: 1.1rem;
    font-weight: 600;
}

.lightbox-header .btn-close {
    opacity: 0.8;
}

.lightbox-header .btn-close:hover {
    opacity: 1;
}

.lightbox-body {
    padding: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cryo-dark);
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(10, 22, 40, 0.9);
    border: 1px solid var(--cryo-border);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cryo-gold);
    letter-spacing: 1px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .projects-section {
        padding: 3rem 0;
    }

    .project-card {
        max-width: 500px;
        margin: 0 auto;
    }

    .project-carousel .carousel-control-prev,
    .project-carousel .carousel-control-next {
        opacity: 1;
    }

    .carousel-zoom-icon {
        opacity: 1;
    }
}

@media (max-width: 575.98px) {
    .projects-section {
        padding: 2rem 0;
    }

    .project-card {
        height: 400px;
    }

    .project-carousel {
        height: 200px;
    }

    .project-content {
        padding: 1rem;
    }

    .project-title {
        font-size: 1rem;
    }

    .project-description {
        font-size: 0.82rem;
    }

    .project-number {
        font-size: 1.2rem;
    }

    .lightbox-image {
        max-height: 70vh;
    }
}

/* Centrar las últimas 2 tarjetas en desktop */
@media (min-width: 992px) {
    .projects-section .row > .col-lg-4:nth-child(4) {
        margin-left: auto;
    }
    .projects-section .row > .col-lg-4:nth-child(5) {
        margin-right: auto;
    }
}