body { background: #0a0a14; color: #e8ecff; }
.card { background: rgba(22, 27, 46, 0.85); border: 1px solid #2a3048; border-radius: 8px; }
.loading-overlay { display: none !important; }

/* Modal popup styles for image enlargement */
#imageModal .modal-content {
    background-color: #1a1a2e !important;
    border: 2px solid #4f7cff;
    border-radius: 12px;
}

#imageModal .modal-header {
    border-bottom: 1px solid #4f7cff;
    background: linear-gradient(45deg, #2a2a5e, #4f7cff);
}

#imageModal .modal-footer {
    border-top: 1px solid #4f7cff;
}

#imageModal #modalImage {
    box-shadow: 0 8px 32px rgba(79, 124, 255, 0.3);
    transition: transform 0.3s ease;
}

/* Hover effect rimosso per evitare spostamenti */

/* Container per gli elementi geometrici del modal */
#modalImageContainer {
    position: relative;
    display: inline-block;
    width: 400px;
    height: 400px;
    margin: 20px;
    background: white;
    border-radius: 12px;
}

/* Sfondo geometrico perfetto */
.geometric-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    background-image: url('/static/images/triplodec_1754239027432.png');
    background-size: 80%;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
    z-index: 1;
}

/* Immagine centrata nel modal - dimensioni diverse per Qseed e mandala */
.modal-center-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    border-radius: 4px;
}

/* Qseed piccolo sopra i decagoni */
.modal-center-image.qseed-image {
    max-width: 120px;
    max-height: 120px;
}

/* Mandala a dimensione piena */
.modal-center-image.mandala-image {
    max-width: 380px;
    max-height: 380px;
}

/* Clickable image styles */
img[style*="cursor: pointer"] {
    transition: all 0.3s ease;
    border-radius: 8px !important;
}

img[style*="cursor: pointer"]:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(79, 124, 255, 0.4);
    border-color: #4f7cff !important;
}

/* Qseed image specific styling */
img[alt*="Qseed"]:hover {
    box-shadow: 0 4px 20px rgba(103, 58, 183, 0.5) !important;
    border-color: #673ab7 !important;
}

/* Mandala image specific styling */
img[alt*="Mandala"]:not([alt*="Crono"]):hover {
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.5) !important;
    border-color: #4caf50 !important;
}

/* CronoMandala image specific styling */
img[alt*="CronoMandala"]:hover {
    box-shadow: 0 4px 20px rgba(255, 193, 7, 0.5) !important;
    border-color: #ffc107 !important;
}

/* ===== MODAL ATTIVAZIONE CIRCUITO - CSS ESSENZIALE ===== */

/* Header modal */
.circuit-modal-header {
    top: 0;
    left: 0;
    right: 0;
    z-index: 1065;
    background: rgba(10, 10, 20, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin: 20px;
}

/* Body modal */
.circuit-modal-body {
    padding-top: 4rem;
    padding-bottom: 96px;
}

/* Controlli sotto il circuito */
.circuit-activation-controls {
    bottom: 24px;
    left: 0;
    right: 0;
    z-index: 1060;
}

/* Immagine circuito - riempie il container quadrato */
.circuit-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* LAYER RADIONICI SEPARATI - Simulazione fisica radionica Adael */

/* Layer Stack - Container dedicato per stacking layer radionici */
.layer-stack {
    position: relative;
    width: 100%;
    padding-bottom: 100%; /* Aspect ratio 1:1 trick - height = width */
    background-color: white; /* Sfondo bianco per PNG trasparenti */
    overflow: hidden;
}

/* Background Radionico Layer - Circuito base COMPLETAMENTE OPACO (nessuna trasparenza) */
.background-radionic-layer {
    inset: 0; /* top:0, right:0, bottom:0, left:0 */
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1.0;
    z-index: 1;
    pointer-events: none;
}

/* QR Witness Layer - Testimone digitale semi-trasparente sopra circuito base */
.qr-witness-layer {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.65;
    z-index: 10;
    pointer-events: none;
}

/* Symbol/Rune Layer - Simbolo/Runa SOPRA il QR witness */
.symbol-rune-layer {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1.0;
    z-index: 20;
    pointer-events: none;
}

/* Circuit Container - NO background, solo dimensioni */
.circuit-container {
    position: relative;
    width: 100%;
    /* Rimosso background-color - ora è sul layer-stack interno */
}

/* Overlay animazioni */
.radiation-overlay {
    position: absolute;
    inset: 0;
    display: none;
    pointer-events: none;
    z-index: 1050;
}

.radiation-overlay.active {
    display: block;
}

/* Anelli di radiazione */
.radiation-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22%;
    height: 22%;
    border: 3px solid rgba(34, 197, 94, 0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
}

/* Animazione attivata solo quando .active */
.radiation-overlay.active .radiation-ring {
    opacity: 1;
}

/* ANELLI INTERNI 1-2: Frequenza base 8.6373 Hz (da 69.0984 Hz ÷ 8) = φ 1.618s (sezione aurea) */
.radiation-overlay.active .radiation-ring-1,
.radiation-overlay.active .radiation-ring-2 {
    animation: scalarWaveInner 1.618s linear infinite;
}

/* ANELLI MEDI 3-4: Armonica superiore (1.5×) = 2.427s */
.radiation-overlay.active .radiation-ring-3,
.radiation-overlay.active .radiation-ring-4 {
    animation: scalarWaveMid 2.427s linear infinite;
}

/* ANELLI ESTERNI 5-6: Armonica suprema (2.25×) = 3.641s */
.radiation-overlay.active .radiation-ring-5,
.radiation-overlay.active .radiation-ring-6 {
    animation: scalarWaveOuter 3.641s linear infinite;
}

/* ===== ANIMAZIONI RADIONICA GUSTAVO ROL ===== */
/* Triade manifestazione: VERDE (manifestazione) + ROSSO (calore) + QUINTA MUSICALE (frequenza) */

/* ANELLI INTERNI 1-2: ROSSO→VERDE (calore che alimenta manifestazione) 
   Frequenza base 8.6373 Hz (da 69.0984 Hz ÷ 8) → periodo 0.1158s × 14 cicli = 1.618s (φ sezione aurea) */
@keyframes scalarWaveInner {
    0% {
        transform: translate(-50%, -50%) scale(0.4);
        opacity: 0.95;
        border-color: rgba(239, 68, 68, 0.9); /* Rosso intenso - calore */
    }
    25% {
        border-color: rgba(249, 115, 22, 0.9); /* Arancio - transizione termica */
        opacity: 0.9;
    }
    50% {
        border-color: rgba(234, 179, 8, 0.85); /* Giallo-oro - energia */
        opacity: 0.85;
    }
    75% {
        border-color: rgba(34, 197, 94, 0.8); /* Verde - manifestazione emerge */
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(5.5);
        opacity: 0;
        border-color: rgba(77, 247, 184, 0); /* Verde brillante trasparente */
    }
}

/* ANELLI MEDI 3-4: ARANCIO→VERDE (transizione termica)
   Armonica superiore: 1.618s × 1.5 = 2.427s */
@keyframes scalarWaveMid {
    0% {
        transform: translate(-50%, -50%) scale(0.4);
        opacity: 0.95;
        border-color: rgba(249, 115, 22, 0.9); /* Arancio - calore moderato */
    }
    30% {
        border-color: rgba(234, 179, 8, 0.9); /* Giallo-oro */
        opacity: 0.9;
    }
    60% {
        border-color: rgba(34, 197, 94, 0.85); /* Verde intenso */
        opacity: 0.85;
    }
    100% {
        transform: translate(-50%, -50%) scale(5.5);
        opacity: 0;
        border-color: rgba(77, 247, 184, 0); /* Verde brillante trasparente */
    }
}

/* ANELLI ESTERNI 5-6: VERDE PURO (manifestazione completa)
   Armonica suprema: 1.618s × 2.25 = 3.641s */
@keyframes scalarWaveOuter {
    0% {
        transform: translate(-50%, -50%) scale(0.4);
        opacity: 0.95;
        border-color: rgba(77, 247, 184, 0.9); /* Verde brillante */
    }
    20% {
        border-color: rgba(16, 185, 129, 0.9); /* Verde smeraldo */
        opacity: 0.9;
    }
    40% {
        border-color: rgba(34, 197, 94, 0.85); /* Verde intenso */
        opacity: 0.85;
    }
    60% {
        border-color: rgba(110, 231, 183, 0.8); /* Verde chiaro */
        opacity: 0.8;
    }
    80% {
        border-color: rgba(20, 184, 166, 0.7); /* Verde acqua */
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(5.5);
        opacity: 0;
        border-color: rgba(77, 247, 184, 0); /* Verde trasparente */
    }
}

/* Delay specifici per ogni anello */
/* Delay con specificità alta per non essere sovrascritti */
.radiation-overlay.active .radiation-ring-1 {
    animation-delay: 0s !important;
    border-width: 3px;
}

.radiation-overlay.active .radiation-ring-2 {
    animation-delay: -0.8s !important;
    border-width: 2px;
}

.radiation-overlay.active .radiation-ring-3 {
    animation-delay: -1.6s !important;
    border-width: 1px;
}

.radiation-overlay.active .radiation-ring-4 {
    animation-delay: 0s !important;
    border-width: 2px;
}

.radiation-overlay.active .radiation-ring-5 {
    animation-delay: -0.8s !important;
    border-width: 1px;
}

.radiation-overlay.active .radiation-ring-6 {
    animation-delay: -1.6s !important;
    border-width: 3px;
}

.radiation-overlay.active .radiation-ring-7 {
    animation-delay: -2.4s !important;
    border-width: 2px;
}

/* ===== DESIGN OTTIMIZZATO MODAL v1.3.1 - NO BORDER ===== */
/* VERSION: 1.3.1 - Rimosso bordo azzurro rounded, padding ottimizzato */

/* Box circuito QUADRATO ridotto del 20% (era 70vh, ora 56vh) */
.circuit-container {
    width: min(56vh, 90vw, 800px);
    height: min(56vh, 90vw, 800px);
    aspect-ratio: 1 / 1;
    box-shadow: 0 0 40px rgba(79, 124, 255, 0.3);
    border: 2px solid rgba(79, 124, 255, 0.2);
}

/* Plancia operativa futuristica compatta */
.circuit-controls-container {
    background: linear-gradient(135deg, rgba(13, 15, 26, 0.95) 0%, rgba(22, 27, 46, 0.95) 100%);
    border: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.25rem 1.75rem;
    min-width: 320px;
    max-width: 95vw;
    border-radius: 0;
}

/* Toggle switch */
.circuit-activation-switch {
    width: 60px;
    height: 30px;
    cursor: pointer;
    border: 2px solid rgba(79, 124, 255, 0.5);
}

.circuit-activation-switch:checked {
    background-color: #4f7cff;
    border-color: #4f7cff;
    box-shadow: 0 0 12px rgba(79, 124, 255, 0.6);
}

.circuit-activation-label {
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(79, 124, 255, 0.4);
}

/* Status icon */
.circuit-status-icon {
    font-size: 0.7rem;
    filter: drop-shadow(0 0 4px currentColor);
}

/* Timer display */
.circuit-activation-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(23, 193, 255, 0.6);
    letter-spacing: 2px;
}

/* Timer selector */
.timer-selector-container {
    padding: 0.75rem 0 0.75rem 0;
    margin: 0.75rem 0 0 0;
    border-top: 1px solid rgba(79, 124, 255, 0.3);
}

/* Bottoni timer compatti */
.timer-option-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border: 1.5px solid rgba(79, 124, 255, 0.5);
    background: rgba(79, 124, 255, 0.1);
    color: #e8ecff;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
    min-width: 80px;
}

.timer-option-btn:hover {
    background: rgba(79, 124, 255, 0.3);
    border-color: #4f7cff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 124, 255, 0.4);
    color: #fff;
}

.timer-option-btn:active {
    transform: translateY(0);
}

.timer-option-btn .fas {
    font-size: 0.75rem;
}

/* Bottone Continuo gold */
.btn-outline-warning.timer-option-btn {
    border-color: rgba(255, 193, 7, 0.6);
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.btn-outline-warning.timer-option-btn:hover {
    background: rgba(255, 193, 7, 0.3);
    border-color: #ffc107;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    color: #fff;
}

/* Responsive mobile - mantiene aspect ratio quadrato */
@media (max-width: 768px) {
    .circuit-container { 
        width: min(50vh, 95vw);
        height: min(50vh, 95vw);
    }
    .circuit-controls-container { min-width: 280px; padding: 0.75rem 1rem; }
    .timer-option-btn { font-size: 0.75rem; padding: 0.35rem 0.6rem; min-width: 70px; }
    .circuit-activation-timer { font-size: 1rem; }
}

@media (max-width: 576px) {
    .circuit-container { 
        width: min(45vh, 95vw);
        height: min(45vh, 95vw);
    }
    .timer-option-btn { font-size: 0.7rem; padding: 0.3rem 0.5rem; min-width: 65px; }
}

/* ===== PENDOLO RADIESTESICO - Simulazione lavoro radiestesista ===== */
.pendulum-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 120 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.pendulum-overlay.active {
    opacity: 1;
}

.pendulum-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
}

/* Rotazione oraria continua - Periodo φ×2 = 3.236s (sezione aurea doppia) */
.pendulum-overlay.active .pendulum-container {
    animation: pendulumRotation 3.236s linear infinite;
}

.pendulum-arm {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 20%;
    background: linear-gradient(180deg, 
        rgba(234, 179, 8, 0.7) 0%,
        rgba(234, 179, 8, 1) 100%);
    transform-origin: top center;
    transform: translate(-50%, 0%);
    clip-path: polygon(0% 0%, 100% 0%, 56% 100%, 44% 100%);
    box-shadow: 
        0 0 12px rgba(234, 179, 8, 0.9),
        0 0 20px rgba(255, 215, 0, 0.5);
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25));
}

.pendulum-bob {
    position: absolute;
    top: calc(50% + 20% - 12px);
    left: 50%;
    width: 24px;
    height: 24px;
    background: radial-gradient(circle, 
        rgba(255, 223, 0, 1) 0%,
        rgba(234, 179, 8, 1) 40%,
        rgba(139, 69, 19, 0.7) 100%);
    border-radius: 50%;
    transform: translateX(-50%);
    border: 2px solid rgba(255, 215, 0, 0.6);
    box-shadow: 
        0 3px 10px rgba(0, 0, 0, 0.6),
        inset 0 -3px 6px rgba(0, 0, 0, 0.3);
}

.pendulum-bob::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    filter: blur(1px);
}

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

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

.pendulum-overlay.active.counterclockwise .pendulum-container {
    animation: pendulumRotationCounterClockwise 3.236s linear infinite;
}

/* ========== TAVOLA ADAEL - COSMIC BACKGROUND ========== */
/* Sfondo cosmico per fullscreen activation modal */

/* Rimuovi bg-dark dal modal-content */
#circuitActivationModal.modal .modal-dialog .modal-content {
    background-color: #000000 !important;
    background-image: url('/static/images/adael-background.jpg?v=4') !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    position: relative !important;
}

/* Overlay scuro semi-trasparente per leggibilità controlli - sopra sfondo */
#circuitActivationModal .modal-content::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(5, 5, 15, 0.35) !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

/* Assicura che header, body, footer siano sopra l'overlay */
#circuitActivationModal .modal-header,
#circuitActivationModal .modal-body,
#circuitActivationModal .modal-footer {
    position: relative !important;
    z-index: 1 !important;
}

/* ========== OTTIMIZZAZIONE MOBILE - SFONDO ADAEL ========== */
/* Su dispositivi mobili, usa cover per riempire tutto lo schermo in altezza */
@media (max-width: 768px) {
    #circuitActivationModal.modal .modal-dialog .modal-content {
        background-size: cover !important;
    }
}

/* ========== CAESAR DRESSING - FONT NORRENO PER TITOLI ========== */
/* Font stile runico/vichingo per le sezioni Biblioteca Norrena e Rune */

.norse-title,
.rune-title {
    font-family: 'Caesar Dressing', cursive !important;
    letter-spacing: 0.05em;
}

/* Titoli H1-H6 nelle pagine rune e biblioteca norrena */
.biblioteca-norrena h1, .biblioteca-norrena h2, .biblioteca-norrena h3,
.biblioteca-norrena h4, .biblioteca-norrena h5, .biblioteca-norrena h6,
.rune-section h1, .rune-section h2, .rune-section h3,
.rune-section h4, .rune-section h5, .rune-section h6,
.norse-content h1, .norse-content h2, .norse-content h3,
.norse-content h4, .norse-content h5, .norse-content h6 {
    font-family: 'Caesar Dressing', cursive !important;
    letter-spacing: 0.03em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Dimensioni specifiche per ogni livello */
.biblioteca-norrena h1, .rune-section h1, .norse-content h1 {
    font-size: 2.5rem;
    color: #c9a35c;
}

.biblioteca-norrena h2, .rune-section h2, .norse-content h2 {
    font-size: 2rem;
    color: #d4af37;
}

.biblioteca-norrena h3, .rune-section h3, .norse-content h3 {
    font-size: 1.75rem;
    color: #e8c872;
}

.biblioteca-norrena h4, .rune-section h4, .norse-content h4 {
    font-size: 1.5rem;
    color: #f0d890;
}

.biblioteca-norrena h5, .rune-section h5, .norse-content h5 {
    font-size: 1.25rem;
    color: #f5e0a0;
}

.biblioteca-norrena h6, .rune-section h6, .norse-content h6 {
    font-size: 1.1rem;
    color: #f8e8b0;
}

/* Responsive - dimensioni ridotte su mobile */
@media (max-width: 768px) {
    .biblioteca-norrena h1, .rune-section h1, .norse-content h1 {
        font-size: 1.8rem;
    }
    .biblioteca-norrena h2, .rune-section h2, .norse-content h2 {
        font-size: 1.5rem;
    }
    .biblioteca-norrena h3, .rune-section h3, .norse-content h3 {
        font-size: 1.3rem;
    }
}


/* Biblioteca Radionica B/W overrides */
.page-content .btn-radionica,
.stat-card .btn-radionica {
    background: #000 !important;
    border: 3px solid #000 !important;
    color: #fff !important;
    text-transform: uppercase;
    font-weight: 700;
    border-radius: 0 !important;
}

.page-content .btn-radionica:hover,
.stat-card .btn-radionica:hover {
    background: #fff !important;
    color: #000 !important;
}
