:root {
            --bg-color: #07070a;
            --bg-accent: #0f0f15;
            --card-bg: rgba(18, 18, 26, 0.85);
            --gold: #d4af37;
            --gold-light: #f3e5ab;
            --gold-glow: rgba(212, 175, 55, 0.25);
            --text-primary: #f0f0f5;
            --text-secondary: #a0a0b0;
            --text-muted: #62627a;
            --border-color: #222232;
            
            /* Colores de las Direcciones Cardinales Mayas */
            --color-east: #ff4d4d;      /* Rojo - Oriente / Iniciación */
            --color-north: #ffffff;     /* Blanco - Norte / Sabiduría */
            --color-west: #8e8eb2;      /* Negro/Gris - Poniente / Transformación */
            --color-south: #ffcc00;     /* Amarillo - Sur / Cosecha */
            --color-center: #2d7a4f;    /* Verde Jade - Corazón / Equilibrio */
        }

        * {
            box-sizing: border-box;
            scroll-behavior: smooth;
        }

        body {
            background-color: var(--bg-color);
            background-image: 
                radial-gradient(circle at center, rgba(7, 7, 10, 0.7) 0%, var(--bg-color) 100%),
                url('../images/mayan_cosmic_bg.png');
            background-size: cover;
            background-position: center;
            background-attachment: fixed;
            background-blend-mode: multiply;
            color: var(--text-primary);
            font-family: 'Outfit', 'Segoe UI', Roboto, sans-serif;
            min-height: 100vh;
            margin: 0;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .container {
            width: 100%;
            max-width: 800px;
            background: rgba(8, 8, 12, 0.93);
            border: 1px solid var(--border-color);
            border-radius: 24px;
            box-shadow: 0 20px 45px rgba(0,0,0,0.9);
            padding: 40px 25px;
            margin-top: 10px;
            position: relative;
            overflow: visible;
            backdrop-filter: blur(15px);
        }

        /* Efecto decorativo místico superior */
        .container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(90deg, var(--color-east), var(--color-north), var(--color-west), var(--color-south));
        }

        header {
            text-align: center;
            margin-bottom: 30px;
        }

        h1 {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 2.3rem;
            font-weight: 900;
            letter-spacing: 3px;
            margin: 0 0 10px 0;
            text-shadow: 0 2px 12px rgba(212, 175, 55, 0.35);
            text-transform: uppercase;
        }

        .subtitle {
            font-size: 0.95rem;
            color: var(--text-secondary);
            letter-spacing: 2px;
            text-transform: uppercase;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .subtitle::before, .subtitle::after {
            content: '';
            display: inline-block;
            width: 30px;
            height: 1px;
            background: var(--text-muted);
        }

        /* SECCIÓN INTRODUCTORIA Y EDUCATIVA ACCORDION */
        .intro-accordion {
            background: var(--bg-accent);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            margin-bottom: 30px;
            overflow: visible;
        }

        .accordion-header {
            padding: 15px 20px;
            background: rgba(20, 20, 28, 0.7);
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            user-select: none;
            transition: background 0.3s;
        }

        .accordion-header:hover {
            background: rgba(20, 20, 28, 0.95);
        }

        .accordion-title {
            font-family: 'Cinzel', serif;
            color: var(--gold-light);
            font-size: 0.9rem;
            font-weight: 700;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .accordion-icon {
            font-size: 0.8rem;
            color: var(--gold);
            transition: transform 0.3s ease;
        }

        .accordion-content {
            display: none;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
            padding: 0 20px;
            background: rgba(10, 10, 14, 0.4);
        }

        .accordion-content.open {
            display: block;
            max-height: none;
            overflow: visible;
            padding: 20px;
            border-top: 1px solid var(--border-color);
            transition: none;
        }

        .accordion-content p {
            font-size: 0.9rem;
            line-height: 1.6;
            color: var(--text-secondary);
            margin: 0 0 15px 0;
        }

        .accordion-content p:last-child {
            margin-bottom: 0;
        }

        .accordion-content b {
            color: var(--text-primary);
        }

        /* FORMULARIO DE ENTRADA */
        .input-card {
            background: var(--bg-accent);
            border: 1px solid var(--border-color);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 35px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 15px;
            box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
        }

        .input-card-title {
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 1.5px;
            color: var(--text-secondary);
            font-weight: 600;
        }

        .input-row {
            display: flex;
            gap: 15px;
            width: 100%;
            justify-content: center;
            align-items: center;
            flex-wrap: wrap;
        }

        input[type="date"] {
            background: #12121a;
            color: #fff;
            border: 1px solid #333348;
            padding: 12px 18px;
            border-radius: 8px;
            outline: none;
            font-size: 1.05rem;
            font-family: 'Outfit', sans-serif;
            transition: all 0.3s;
            box-shadow: 0 4px 6px rgba(0,0,0,0.3);
            min-width: 220px;
            width: min(100%, 280px);
            text-align: center;
        }

        input[type="date"]:focus {
            border-color: var(--gold);
            box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
        }

        .btn {
            background: linear-gradient(135deg, #d4af37 0%, #b8972c 100%);
            color: #000;
            border: none;
            padding: 12px 30px;
            border-radius: 8px;
            font-weight: 700;
            cursor: pointer;
            font-size: 1.05rem;
            font-family: 'Outfit', sans-serif;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            box-shadow: 0 4px 15px rgba(212, 175, 55, 0.35);
            display: inline-flex;
            align-items: center;
            gap: 10px;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(212, 175, 55, 0.55);
            background: linear-gradient(135deg, #e6c14a 0%, #d4af37 100%);
        }

        .btn:active {
            transform: translateY(1px);
        }

        .btn-secondary {
            background: transparent;
            color: var(--text-secondary);
            border: 1px solid var(--border-color);
            box-shadow: none;
        }

        .btn-secondary:hover {
            background: rgba(255, 255, 255, 0.05);
            border-color: var(--text-secondary);
            color: var(--text-primary);
            box-shadow: none;
        }

        /* ANIMACIÓN DE RUEDA SOLAR MAYA */
        .solar-loader-container {
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            margin: 30px 0;
            animation: fadeIn 0.4s ease;
        }

        .solar-wheel {
            width: 80px;
            height: 80px;
            color: var(--gold);
            animation: spin 3s linear infinite;
        }

        .loader-text {
            margin-top: 15px;
            font-size: 0.85rem;
            color: var(--gold-light);
            letter-spacing: 2px;
            text-transform: uppercase;
            font-weight: 500;
            animation: pulse 1.5s ease-in-out infinite;
        }

        /* DISEÑO VISUAL DE LA CRUZ */
        .cross-container {
            display: none;
            flex-direction: column;
            align-items: center;
            margin: 40px 0;
            position: relative;
            z-index: 5;
            padding: 35px 20px;
            background: radial-gradient(circle at center, rgba(22, 22, 32, 0.98) 0%, rgba(7, 7, 10, 0.99) 78%);
            border: 1px solid var(--border-color);
            border-radius: 30px;
            box-shadow: inset 0 0 25px rgba(0,0,0,0.85);
            animation: scaleIn 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
        }

        /* Líneas místicas de conexión */
        .cross-lines {
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: 1;
            pointer-events: none;
        }

        .cross-grid {
            display: grid;
            grid-template-columns: 118px 148px 118px;
            grid-template-rows: 172px 205px 172px;
            gap: 20px;
            align-items: center;
            justify-content: center;
            position: relative;
            z-index: 2;
        }

        .node {
            width: 118px;
            height: 172px;
            background: rgba(15, 15, 24, 0.92);
            border: 1px solid var(--border-color);
            border-radius: 18px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            text-align: center;
            position: relative;
            padding: 8px 4px;
            cursor: pointer;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
            transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
            user-select: none;
        }

        .node:hover {
            transform: translateY(-4px) scale(1.05);
            background: rgba(22, 22, 35, 0.97);
            box-shadow: 0 12px 28px rgba(0, 0, 0, 0.75);
        }

        .node.center {
            grid-column: 2;
            grid-row: 2;
            width: 148px;
            height: 205px;
            border: 2px solid var(--gold);
            background: rgba(25, 25, 38, 0.97);
            z-index: 10;
            padding: 10px 4px;
            box-shadow: 0 0 25px rgba(212, 175, 55, 0.2);
        }

        .node.center:hover {
            box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
        }

        .node.top { grid-column: 2; grid-row: 1; }
        .node.bottom { grid-column: 2; grid-row: 3; }
        .node.left { grid-column: 1; grid-row: 2; }
        .node.right { grid-column: 3; grid-row: 2; }

        /* Clases de bordes direccionales interactivos */
        .node.border-rojo { border-color: var(--color-east); box-shadow: 0 0 15px rgba(255, 77, 77, 0.15); }
        .node.border-blanco { border-color: var(--color-north); box-shadow: 0 0 15px rgba(255, 255, 255, 0.15); }
        .node.border-negro { border-color: var(--color-west); box-shadow: 0 0 15px rgba(142, 142, 178, 0.15); }
        .node.border-amarillo { border-color: var(--color-south); box-shadow: 0 0 15px rgba(255, 204, 0, 0.15); }

        .node.border-rojo:hover { box-shadow: 0 0 25px rgba(255, 77, 77, 0.45); }
        .node.border-blanco:hover { box-shadow: 0 0 25px rgba(255, 255, 255, 0.45); }
        .node.border-negro:hover { box-shadow: 0 0 25px rgba(142, 142, 178, 0.45); }
        .node.border-amarillo:hover { box-shadow: 0 0 25px rgba(255, 204, 0, 0.45); }

        .node-label {
            font-size: 0.58rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 1px;
        }

        .node-num-container {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 1px;
            margin: 0;
            color: var(--gold);
        }

        .node-arabic-num {
            font-family: 'Outfit', sans-serif;
            font-weight: 800;
            font-size: 0.95rem;
        }

        .center .node-arabic-num {
            font-size: 1.15rem;
        }

        /* Contenedor del Glifo Vectorial */
        .node-glyph-container {
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--gold-light);
            margin: 2px 0;
            filter: drop-shadow(0 0 4px rgba(243, 229, 171, 0.15));
            transition: transform 0.3s ease;
        }
        
        .node:hover .node-glyph-container {
            transform: scale(1.1);
            color: #fff;
            filter: drop-shadow(0 0 8px var(--gold-glow));
        }

        .center .node-glyph-container {
            width: 62px;
            height: 62px;
            color: var(--gold);
        }

        .nawal-glyph-3d {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
            filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 7px rgba(212, 175, 55, 0.16));
            transform: translateZ(0);
        }

        .card-glyph-container .nawal-glyph-3d,
        .codex-item-glyph .nawal-glyph-3d {
            width: 92%;
            height: 92%;
        }

        .node-name {
            font-family: 'Cinzel', serif;
            font-size: 0.78rem;
            font-weight: 700;
            color: #fff;
            letter-spacing: 0.3px;
            line-height: 1.05;
            max-width: 100%;
            overflow-wrap: anywhere;
        }

        .node-animal {
            color: var(--text-secondary);
            font-size: 0.52rem;
            font-weight: 600;
            line-height: 1.05;
            max-width: 100%;
            padding: 0 2px;
            overflow-wrap: anywhere;
        }

        .center .node-name {
            font-size: 0.9rem;
            color: var(--gold-light);
        }

        .center .node-animal {
            color: var(--gold-light);
            font-size: 0.56rem;
        }

        .center .node-label {
            color: var(--gold);
        }

        /* Estilo para los SVG de números mayas */
        .mayan-number-svg {
            color: var(--gold-light);
            display: block;
        }

        /* PANELES DE EXPLICACIÓN */
        .influence-section {
            display: none;
            margin-top: 20px;
        }

        .influence-title {
            font-family: 'Cinzel', serif;
            font-size: 1.25rem;
            color: var(--gold);
            text-align: center;
            margin-bottom: 25px;
            letter-spacing: 2px;
            text-transform: uppercase;
        }

        .card {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-left: 6px solid var(--text-secondary);
            border-radius: 16px;
            padding: 24px;
            margin-bottom: 25px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
            animation: fadeInUp 0.6s ease;
            backdrop-filter: blur(10px);
            transition: transform 0.3s, box-shadow 0.3s;
        }

        .card:hover {
            transform: translateY(-2px);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
        }

        .card-header-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--border-color);
            padding-bottom: 15px;
            margin-bottom: 15px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .card-title-block {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .card-glyph-container {
            width: 54px;
            height: 54px;
            background: rgba(0, 0, 0, 0.3);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--gold);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        }

        .card-meta-title {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .card h3 {
            margin: 0;
            font-family: 'Cinzel', serif;
            font-size: 1.15rem;
            color: var(--gold);
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .card-subtitle {
            font-size: 0.8rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 500;
        }

        .card-badges {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .badge {
            font-size: 0.75rem;
            font-weight: 600;
            padding: 4px 10px;
            border-radius: 20px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-color);
        }

        /* Tarjeta específica para cada posición en la cruz */
        .card.pos-concepcion { border-left-color: var(--color-east); }
        .card.pos-nacimiento { border-left-color: var(--gold); }
        .card.pos-destino { border-left-color: var(--color-west); }
        .card.pos-derecha { border-left-color: var(--color-south); }
        .card.pos-izquierda { border-left-color: var(--color-north); }

        /* Colores dinámicos de insignias direccionales */
        .badge.bg-rojo { border-color: rgba(255, 77, 77, 0.4); color: var(--color-east); background: rgba(255, 77, 77, 0.08); }
        .badge.bg-blanco { border-color: rgba(255, 255, 255, 0.4); color: #fff; background: rgba(255, 255, 255, 0.08); }
        .badge.bg-negro { border-color: rgba(142, 142, 178, 0.5); color: #c0c0d8; background: rgba(142, 142, 178, 0.08); }
        .badge.bg-amarillo { border-color: rgba(255, 204, 0, 0.4); color: var(--color-south); background: rgba(255, 204, 0, 0.08); }

        .card-content {
            font-size: 0.95rem;
            line-height: 1.6;
            color: #ddd;
        }

        .card-desc-p {
            margin: 0 0 15px 0;
            text-align: justify;
        }

        .card-desc-p b {
            color: #fff;
            font-size: 1.05rem;
        }

        .bullets-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px dashed rgba(255, 255, 255, 0.08);
        }

        @media (max-width: 600px) {
            .bullets-container {
                grid-template-columns: 1fr;
            }
        }

        .bullet-list {
            margin: 0;
            padding-left: 20px;
        }

        .bullet-list li {
            font-size: 0.88rem;
            color: var(--text-secondary);
            margin-bottom: 6px;
        }

        .bullet-list li b {
            color: var(--text-primary);
        }

        .advice-box {
            background: rgba(212, 175, 55, 0.04);
            border: 1px solid rgba(212, 175, 55, 0.15);
            border-radius: 8px;
            padding: 12px 16px;
            margin-top: 15px;
            font-size: 0.9rem;
            font-style: italic;
            color: var(--gold-light);
            display: flex;
            gap: 10px;
            align-items: flex-start;
        }

        .advice-box::before {
            content: '✦';
            color: var(--gold);
            font-weight: bold;
            font-style: normal;
        }

        /* ACCIONES EXTRA */
        .actions-area {
            display: none;
            justify-content: center;
            gap: 15px;
            margin-top: 30px;
        }

        /* PIE DE PÁGINA Y CRÉDITOS */
        footer {
            margin-top: 50px;
            border-top: 1px solid var(--border-color);
            padding-top: 25px;
            text-align: center;
            font-size: 0.85rem;
            color: var(--text-muted);
            width: 100%;
        }

        .author-box {
            background: var(--bg-accent);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 15px 25px;
            display: inline-flex;
            flex-direction: column;
            gap: 5px;
            align-items: center;
            margin-bottom: 15px;
        }

        .author-box span {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
        }

        .author-link {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            text-decoration: none;
            font-weight: 700;
            font-size: 1.05rem;
            letter-spacing: 0.5px;
            transition: color 0.2s;
        }
        
        .author-link:hover {
            color: var(--gold-light);
        }

        .author-email {
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 0.85rem;
            transition: color 0.2s;
        }

        .author-email:hover {
            color: #fff;
        }

        .copyright {
            margin-top: 10px;
            font-size: 0.75rem;
            letter-spacing: 0.5px;
        }

        /* ANIMACIONES PERSONALIZADAS */
        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        @keyframes pulse {
            0%, 100% { opacity: 0.6; }
            50% { opacity: 1; }
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes fadeInUp {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes scaleIn {
            from { opacity: 0; transform: scale(0.95); }
            to { opacity: 1; transform: scale(1); }
        }

        /* ESTILOS DE IMPRESIÓN EXCEPCIONALES (PDF) */
        @media print {
            body {
                background: #fff !important;
                color: #000 !important;
                padding: 0 !important;
            }

            .container {
                box-shadow: none !important;
                border: none !important;
                background: #fff !important;
                max-width: 100% !important;
                padding: 0 !important;
                margin: 0 !important;
                backdrop-filter: none !important;
            }

            .codex-section,
            .container::before, 
            .input-card, 
            .intro-accordion, 
            .actions-area, 
            .solar-loader-container,
            .accordion-header {
                display: none !important;
            }

            h1 {
                color: #000 !important;
                text-shadow: none !important;
                font-size: 2rem !important;
                margin-top: 20px !important;
            }

            .subtitle {
                color: #555 !important;
            }

            .subtitle::before, .subtitle::after {
                background: #555 !important;
            }

            .cross-container {
                display: flex !important;
                background: none !important;
                border: 2px solid #000 !important;
                border-radius: 20px !important;
                box-shadow: none !important;
                margin: 30px auto !important;
                page-break-after: always;
            }

            .node {
                background: #fff !important;
                border: 2px solid #000 !important;
                box-shadow: none !important;
                color: #000 !important;
                height: 120px !important;
            }

            .node-name {
                color: #000 !important;
            }

            .node-label {
                color: #333 !important;
            }

            .node-arabic-num {
                color: #000 !important;
            }

            .mayan-number-svg {
                color: #000 !important;
            }
            
            .node-glyph-container {
                color: #000 !important;
                filter: none !important;
            }

            .influence-section {
                display: block !important;
            }

            .influence-title {
                color: #000 !important;
                margin-top: 40px !important;
                page-break-before: always;
            }

            .card {
                background: #fff !important;
                border: 1px solid #ccc !important;
                border-left: 8px solid #000 !important;
                box-shadow: none !important;
                color: #000 !important;
                page-break-inside: avoid;
                margin-bottom: 20px !important;
                padding: 15px !important;
            }

            .card h3 {
                color: #000 !important;
            }

            .card-subtitle {
                color: #555 !important;
            }

            .card-glyph-container {
                background: #fff !important;
                border: 1px solid #000 !important;
                color: #000 !important;
                box-shadow: none !important;
            }

            .badge {
                border: 1px solid #777 !important;
                color: #000 !important;
                background: none !important;
            }

            .card-content {
                color: #000 !important;
            }

            .card-desc-p b {
                color: #000 !important;
            }

            .bullet-list li {
                color: #333 !important;
            }

            .bullet-list li b {
                color: #000 !important;
            }

            .advice-box {
                background: #fdfdfd !important;
                border: 1px solid #ddd !important;
                color: #333 !important;
            }

            footer {
                margin-top: 30px !important;
                border-top: 2px solid #000 !important;
                color: #555 !important;
            }

            .author-box {
                border: 1px solid #ccc !important;
                background: #fff !important;
            }

            .author-link, .author-email {
                color: #000 !important;
            }
        }

        /* ==========================================================================
           SECCIÓN DEL CÓDICE SAGRADO DE LOS 20 NAHUALES
           ========================================================================== */
        .codex-section {
            margin-top: 50px;
            background: rgba(10, 10, 15, 0.85);
            border: 1px solid var(--border-color);
            border-radius: 24px;
            padding: 30px 20px;
            box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            animation: scaleIn 0.5s ease;
        }

        .codex-title {
            font-family: 'Cinzel', serif;
            color: var(--gold);
            font-size: 1.6rem;
            text-align: center;
            letter-spacing: 2px;
            text-transform: uppercase;
            margin: 0 0 10px 0;
            text-shadow: 0 2px 10px rgba(212, 175, 55, 0.25);
        }

        .codex-intro {
            font-size: 0.9rem;
            color: var(--text-secondary);
            text-align: center;
            max-width: 600px;
            margin: 0 auto 25px auto;
            line-height: 1.5;
        }

        .codex-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
            gap: 15px;
            justify-content: center;
        }

        .codex-item {
            background: rgba(15, 15, 24, 0.85);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            padding: 12px 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
            user-select: none;
        }

        .codex-item:hover {
            transform: translateY(-4px) scale(1.03);
            background: rgba(22, 22, 35, 0.95);
        }

        /* Colores dinámicos del códice para hover en base a las direcciones */
        .codex-item.border-rojo:hover { border-color: var(--color-east); box-shadow: 0 0 15px rgba(255, 77, 77, 0.3); }
        .codex-item.border-blanco:hover { border-color: var(--color-north); box-shadow: 0 0 15px rgba(255, 255, 255, 0.3); }
        .codex-item.border-negro:hover { border-color: var(--color-west); box-shadow: 0 0 15px rgba(142, 142, 178, 0.3); }
        .codex-item.border-amarillo:hover { border-color: var(--color-south); box-shadow: 0 0 15px rgba(255, 204, 0, 0.3); }

        .codex-item-glyph {
            width: 44px;
            height: 44px;
            color: var(--gold-light);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .codex-item:hover .codex-item-glyph {
            transform: scale(1.1);
            color: #fff;
            filter: drop-shadow(0 0 5px var(--gold));
        }

        .codex-item-name {
            font-family: 'Cinzel', serif;
            font-size: 0.85rem;
            font-weight: 700;
            color: #fff;
            letter-spacing: 0.5px;
        }

        .codex-item-animal {
            font-size: 0.65rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: visible;
            text-overflow: ellipsis;
            width: 100%;
        }

        /* Contenedor del panel de lectura detallada */
        .codex-detail-container {
            max-height: 0;
            overflow: visible;
            transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
            opacity: 0;
            margin-top: 0;
        }

        .codex-detail-container.open {
            max-height: 1200px;
            opacity: 1;
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px dashed var(--border-color);
        }

        /* Mapeos de bordes de dirección para el panel detallado del códice */
        .card.pos-rojo { border-left-color: var(--color-east); }
        .card.pos-blanco { border-left-color: var(--color-north); }
        .card.pos-negro { border-left-color: var(--color-west); }
        .card.pos-amarillo { border-left-color: var(--color-south); }

/* Mejoras de accesibilidad e integración tras separar archivos */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: visible;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.accordion-header,
.node,
.codex-item,
.btn {
    font: inherit;
}

.accordion-header {
    width: 100%;
    border: 0;
    color: inherit;
}

.node,
.codex-item {
    appearance: none;
}

.accordion-header:focus-visible,
.node:focus-visible,
.codex-item:focus-visible,
.codex-close-btn:focus-visible,
.btn:focus-visible,
input[type="date"]:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 3px;
}

.codex-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.codex-close-btn:hover {
    color: #fff;
}



        /* Ajustes Android / pantallas angostas: evita recortes y nombres encimados */
        @media (max-width: 900px) {
            body {
                padding: 10px;
            }

            .container {
                max-width: 100%;
                padding: 24px 12px;
                border-radius: 16px;
            }

            .input-card {
                padding: 16px 12px;
            }

            .input-card-title {
                text-align: center;
                font-size: 0.78rem;
                line-height: 1.25;
            }

            .input-row {
                gap: 10px;
                justify-content: center;
            }

            input[type="date"] {
                flex: 1 1 220px;
                min-width: 220px;
                max-width: 320px;
                font-size: 1rem;
                padding: 12px 14px;
            }

            .btn {
                flex: 1 1 230px;
                max-width: 360px;
                justify-content: center;
                padding: 12px 16px;
                font-size: 0.95rem;
                letter-spacing: 0.5px;
                white-space: nowrap;
            }

            .cross-container {
                width: 100%;
                margin: 28px auto;
                padding: 28px 10px;
                overflow: visible;
            }

            .cross-lines {
                opacity: 0.65;
            }

            .cross-grid {
                width: min(100%, 450px);
                grid-template-columns: minmax(104px, 1fr) minmax(132px, 1.18fr) minmax(104px, 1fr);
                grid-template-rows: 188px 220px 188px;
                gap: 12px;
            }

            .node {
                width: 100%;
                height: 186px;
                min-width: 0;
                justify-content: flex-start;
                gap: 5px;
                padding: 9px 5px 8px;
                border-radius: 15px;
                overflow: visible;
            }

            .node.center {
                width: 100%;
                height: 218px;
                padding: 10px 6px 9px;
            }

            .node-label {
                font-size: 0.56rem;
                letter-spacing: 0.35px;
                line-height: 1;
                white-space: nowrap;
            }

            .node-num-container {
                gap: 0;
            }

            .mayan-number-svg {
                width: 42px;
                height: 20px;
            }

            .node-arabic-num {
                font-size: 1rem;
                line-height: 1;
            }

            .center .node-arabic-num {
                font-size: 1.15rem;
            }

            .node-glyph-container {
                width: 48px;
                height: 48px;
                margin: 0;
                flex: 0 0 auto;
            }

            .center .node-glyph-container {
                width: 60px;
                height: 60px;
            }

            .node-name {
                font-size: 0.78rem;
                line-height: 1;
            }

            .center .node-name {
                font-size: 0.9rem;
            }

            .node-animal {
                font-size: 0.5rem;
                line-height: 1.05;
            }

            .center .node-animal {
                font-size: 0.56rem;
            }
        }

        @media (max-width: 520px) {
            .input-row {
                flex-direction: column;
                align-items: stretch;
            }

            input[type="date"],
            .btn {
                width: 100%;
                max-width: none;
            }

            .cross-grid {
                width: min(100%, 420px);
                grid-template-columns: minmax(96px, 1fr) minmax(122px, 1.16fr) minmax(96px, 1fr);
                grid-template-rows: 172px 205px 172px;
                gap: 10px;
            }

            .node {
                height: 176px;
            }

            .node.center {
                height: 208px;
            }

            .node-glyph-container {
                width: 44px;
                height: 44px;
            }

            .center .node-glyph-container {
                width: 56px;
                height: 56px;
            }
        }


/* Corrección final Android: nombres K'iche' visibles y glifos más grandes */
@media (max-width: 900px) {
    .cross-container {
        padding: 30px 10px 34px;
        overflow: visible;
    }

    .cross-grid {
        width: min(100%, 450px);
        grid-template-columns: minmax(104px, 1fr) minmax(132px, 1.18fr) minmax(104px, 1fr);
        grid-template-rows: 190px 224px 190px;
        gap: 12px;
    }

    .node {
        height: 188px;
        gap: 6px;
        padding: 10px 6px 10px;
        overflow: visible;
    }

    .node.center {
        height: 222px;
        padding: 11px 7px 11px;
    }

    .node-glyph-container {
        width: 58px;
        height: 58px;
    }

    .center .node-glyph-container {
        width: 74px;
        height: 74px;
    }

    .node-name {
        font-size: 0.9rem;
        line-height: 1.08;
        min-height: 1.05em;
    }

    .center .node-name {
        font-size: 1.06rem;
    }

    .node-animal {
        font-size: 0.54rem;
        line-height: 1.08;
    }

    .center .node-animal {
        font-size: 0.58rem;
    }
}

@media (max-width: 520px) {
    .cross-container {
        padding: 30px 8px 36px;
    }

    .cross-grid {
        width: min(100%, 420px);
        grid-template-columns: minmax(96px, 1fr) minmax(124px, 1.16fr) minmax(96px, 1fr);
        grid-template-rows: 184px 218px 184px;
        gap: 10px;
    }

    .node {
        height: 182px;
        padding: 10px 5px;
    }

    .node.center {
        height: 216px;
    }

    .node-glyph-container {
        width: 56px;
        height: 56px;
    }

    .center .node-glyph-container {
        width: 72px;
        height: 72px;
    }

    .node-name {
        font-size: 0.86rem;
    }

    .center .node-name {
        font-size: 1rem;
    }
}


.intro-list {
    margin: 0 0 15px 0;
    padding-left: 1.1rem;
    color: var(--text-secondary);
}

.intro-list li {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

.intro-list b {
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .accordion-content.open {
        max-height: none;
        overflow: visible;
        padding: 16px;
    }

    .accordion-content p,
    .intro-list li {
        font-size: 0.84rem;
        line-height: 1.5;
    }
}


/* Cruz ampliada 3x3 basada en las láminas de referencia */
.cross-grid-nine .node.top-left { grid-column: 1; grid-row: 1; }
.cross-grid-nine .node.top { grid-column: 2; grid-row: 1; }
.cross-grid-nine .node.top-right { grid-column: 3; grid-row: 1; }
.cross-grid-nine .node.left { grid-column: 1; grid-row: 2; }
.cross-grid-nine .node.center { grid-column: 2; grid-row: 2; }
.cross-grid-nine .node.right { grid-column: 3; grid-row: 2; }
.cross-grid-nine .node.bottom-left { grid-column: 1; grid-row: 3; }
.cross-grid-nine .node.bottom { grid-column: 2; grid-row: 3; }
.cross-grid-nine .node.bottom-right { grid-column: 3; grid-row: 3; }

.cross-grid-nine {
    grid-template-columns: 118px 148px 118px;
    grid-template-rows: 172px 205px 172px;
    gap: 16px;
}

.cross-grid-nine .node-name {
    color: var(--gold-light);
}

@media (max-width: 900px) {
    .cross-grid-nine {
        width: min(100%, 468px);
        grid-template-columns: minmax(104px, 1fr) minmax(132px, 1.18fr) minmax(104px, 1fr);
        grid-template-rows: 188px 222px 188px;
        gap: 12px;
    }
}

@media (max-width: 520px) {
    .cross-grid-nine {
        width: min(100%, 428px);
        grid-template-columns: minmax(98px, 1fr) minmax(124px, 1.16fr) minmax(98px, 1fr);
        grid-template-rows: 182px 216px 182px;
        gap: 10px;
    }
}


/* Ajuste final: cruz 3x3 legible en Android/movil */
.cross-grid-nine {
    align-items: stretch;
    justify-items: stretch;
}

.cross-grid-nine .node,
.cross-grid-nine .node.center {
    width: 100%;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
    justify-content: flex-start;
    gap: 4px;
    overflow: hidden;
}

.cross-grid-nine .node-label,
.cross-grid-nine .node-name,
.cross-grid-nine .node-animal {
    display: block;
    width: 100%;
    text-align: center;
}

.cross-grid-nine .node-label {
    line-height: 1.05;
    white-space: normal;
}

.cross-grid-nine .node-name {
    line-height: 1;
    white-space: normal;
    overflow-wrap: anywhere;
    margin-top: 2px;
}

.cross-grid-nine .node-animal {
    line-height: 1.12;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    max-height: none;
    overflow: visible;
    padding-bottom: 2px;
}

.back-to-top {
    position: fixed;
    right: 18px;
    bottom: 22px;
    z-index: 1200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.75);
    background: rgba(12, 12, 18, 0.92);
    color: var(--gold-light);
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.24), 0 8px 20px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .cross-container {
        min-height: 850px;
        padding: 26px 10px;
    }

    .cross-grid-nine {
        width: min(100%, 500px);
        grid-template-columns: minmax(112px, 1fr) minmax(136px, 1.12fr) minmax(112px, 1fr);
        grid-template-rows: 264px 286px 252px;
        gap: 12px;
    }

    .cross-grid-nine .node,
    .cross-grid-nine .node.center {
        padding: 13px 8px 14px;
    }

    .cross-grid-nine .node-label {
        font-size: 0.72rem;
    }

    .cross-grid-nine .node-arabic-num {
        font-size: 1.28rem;
    }

    .cross-grid-nine .center .node-arabic-num {
        font-size: 1.5rem;
    }

    .cross-grid-nine .node-glyph-container {
        width: 64px;
        height: 64px;
        margin: 4px 0;
    }

    .cross-grid-nine .center .node-glyph-container {
        width: 78px;
        height: 78px;
    }

    .cross-grid-nine .node-name {
        font-size: 1.02rem;
    }

    .cross-grid-nine .center .node-name {
        font-size: 1.2rem;
    }

    .cross-grid-nine .node-animal {
        font-size: 0.72rem;
    }

    .cross-grid-nine .center .node-animal {
        font-size: 0.78rem;
    }
}

@media (max-width: 520px) {
    .cross-container {
        min-height: 840px;
        padding: 24px 8px;
    }

    .cross-grid-nine {
        width: min(100%, 390px);
        grid-template-columns: minmax(104px, 1fr) minmax(122px, 1.12fr) minmax(104px, 1fr);
        grid-template-rows: 256px 276px 246px;
        gap: 9px;
    }

    .cross-grid-nine .node,
    .cross-grid-nine .node.center {
        padding: 12px 6px 14px;
        border-radius: 16px;
    }

    .cross-grid-nine .node-label {
        font-size: 0.66rem;
        letter-spacing: 0.2px;
    }

    .cross-grid-nine .node-num-container {
        gap: 0;
    }

    .cross-grid-nine .node-arabic-num {
        font-size: 1.18rem;
    }

    .cross-grid-nine .center .node-arabic-num {
        font-size: 1.36rem;
    }

    .cross-grid-nine .node-glyph-container {
        width: 58px;
        height: 58px;
        margin: 3px 0;
    }

    .cross-grid-nine .center .node-glyph-container {
        width: 70px;
        height: 70px;
    }

    .cross-grid-nine .node-name {
        font-size: 0.94rem;
    }

    .cross-grid-nine .center .node-name {
        font-size: 1.08rem;
    }

    .cross-grid-nine .node-animal {
        font-size: 0.66rem;
    }

    .cross-grid-nine .center .node-animal {
        font-size: 0.7rem;
    }

    .back-to-top {
        right: 14px;
        bottom: 18px;
        width: 44px;
        height: 44px;
        font-size: 1.45rem;
    }
}


/* Ajuste de legibilidad: evita que los subtitulos de la fila superior se oculten. */
.cross-grid-nine .node.top-left,
.cross-grid-nine .node.top,
.cross-grid-nine .node.top-right {
    padding-bottom: 18px;
}

.cross-grid-nine .node.top-left .node-animal,
.cross-grid-nine .node.top .node-animal,
.cross-grid-nine .node.top-right .node-animal {
    min-height: 2.4em;
}

@media (max-width: 520px) {
    .cross-grid-nine .node.top-left,
    .cross-grid-nine .node.top,
    .cross-grid-nine .node.top-right {
        padding-bottom: 20px;
    }
}


/* Resumen visible del Ri MAM / Cargador del Año */
.mam-summary {
    display: none;
    align-items: center;
    gap: 18px;
    margin: 22px auto 34px;
    padding: 18px 20px;
    max-width: 760px;
    background: linear-gradient(135deg, rgba(18, 18, 28, 0.96), rgba(10, 10, 16, 0.98));
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-left: 6px solid var(--gold);
    border-radius: 18px;
    box-shadow: 0 0 24px rgba(212, 175, 55, 0.16), 0 12px 28px rgba(0, 0, 0, 0.45);
    position: relative;
    z-index: 6;
}

.mam-summary-glyph {
    width: 74px;
    height: 74px;
    flex: 0 0 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.45);
    background: rgba(0, 0, 0, 0.28);
    color: var(--gold-light);
    box-shadow: inset 0 0 14px rgba(212, 175, 55, 0.12);
}

.mam-summary-copy {
    min-width: 0;
}

.mam-summary-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--gold-light);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.mam-summary h2 {
    margin: 0 0 6px;
    font-family: 'Cinzel', serif;
    color: var(--text-primary);
    font-size: 1.24rem;
    letter-spacing: 0;
}

.mam-summary p {
    margin: 3px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.35;
}

.mam-summary b {
    color: var(--gold-light);
}

@media (max-width: 520px) {
    .mam-summary {
        align-items: flex-start;
        gap: 12px;
        margin: 18px 4px 28px;
        padding: 15px 13px;
        border-radius: 15px;
    }

    .mam-summary-glyph {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
    }

    .mam-summary h2 {
        font-size: 1rem;
        line-height: 1.15;
    }

    .mam-summary p {
        font-size: 0.78rem;
    }
}
