/* Importação da Fonte Kathen Local */
        @font-face {
            font-family: 'Kathen';
            src: url('/assets/fonts/KathenFont.otf') format('opentype');
            font-weight: normal;
            font-style: normal;
        }

        :root {
            --primary-blue: #002b5c; 
            --orange-brand: #e66400; 
            --teal-bg: #007c6f; 
            --teal-dark: #005a50; 
            --btn-light-bg: #d6efeb; 
            --btn-light-text: #002b5c;
        }

        body {
            font-family: 'Montserrat', sans-serif;
            background-color: #f1f5f9;
            margin: 0;
            overflow: hidden;
            height: 100dvh; /* Forza l'altezza dinamica scuntendu a barra di navigazione */
            width: 100vw;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #app-container {
            width: 100%;
            max-width: 560px; /* Stilu tabletta verticale */
            height: 100dvh; 
            max-height: 920px;
            position: relative;
            background-color: var(--teal-bg);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
            border-radius: 36px;
            border: 8px solid #1e293b;
        }

        @media (max-height: 920px), (max-width: 560px) {
            #app-container {
                max-height: 100dvh;
                border-radius: 0;
                border: none;
            }
        }

        #app-background {
            position: absolute;
            inset: 0;
            background-size: cover;
            background-position: center;
            z-index: 1;
        }

        #app-background::after {
            content: '';
            position: absolute;
            inset: 0;
            background: rgba(0, 124, 111, 0.88);
        }

        .title-impact {
            font-family: 'Oswald', sans-serif;
            text-transform: uppercase;
            letter-spacing: -0.5px;
            font-weight: 700;
            line-height: 1.1;
        }

        .glass-box {
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 28px;
        }

        .btn-pill-light {
            background-color: var(--btn-light-bg);
            color: var(--btn-light-text);
            font-weight: 800;
            text-transform: uppercase;
            border-radius: 9999px;
            font-size: 0.9rem;
            letter-spacing: 0.5px;
            transition: all 0.2s ease-in-out;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }
        .btn-pill-light:active { transform: scale(0.97); background-color: #ffffff; }

        .btn-pill-orange {
            background-color: var(--orange-brand);
            color: white;
            font-weight: 800;
            text-transform: uppercase;
            border-radius: 9999px;
            font-size: 0.9rem;
            letter-spacing: 0.5px;
            transition: all 0.2s ease-in-out;
            box-shadow: 0 4px 15px rgba(230, 100, 0, 0.4);
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .btn-pill-orange:active { transform: scale(0.97); background-color: #cc5800; }

        .btn-pill-dark {
            background-color: var(--primary-blue);
            color: white;
            font-weight: 800;
            text-transform: uppercase;
            border-radius: 9999px;
            font-size: 0.9rem;
            letter-spacing: 0.5px;
            transition: all 0.2s ease-in-out;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .btn-pill-dark:active { transform: scale(0.97); }

        .orange-close-btn {
            position: absolute;
            top: 0;
            left: 0;
            background-color: var(--orange-brand);
            color: white;
            width: 44px;
            height: 44px;
            border-radius: 0 0 16px 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 1.5rem;
            z-index: 100;
            cursor: pointer;
            box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
            border: none;
            transition: background-color 0.2s;
        }
        .orange-close-btn:active { background-color: #cc5800; }

        .acc-circle-btn {
            background-color: var(--primary-blue);
            color: white;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
            transition: all 0.2s;
            border: none;
        }
        .acc-circle-btn:active { transform: scale(0.9); }
        .acc-circle-btn.active {
            background-color: #0ea5e9;
            animation: pulse-ring 2s infinite;
        }
        @keyframes pulse-ring {
            0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.6); }
            70% { box-shadow: 0 0 0 8px rgba(14, 165, 233, 0); }
            100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
        }

        #page-loader {
            position: absolute; inset: 0; background-color: var(--teal-bg); z-index: 999;
            display: flex; align-items: center; justify-content: center; flex-direction: column;
            transition: opacity 0.5s ease;
        }

        .screen-overlay {
            position: absolute;
            inset: 0;
            z-index: 50;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.3s ease, visibility 0.3s ease;
            display: flex;
            flex-direction: column;
            background-color: rgba(0, 90, 80, 0.55);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
        }
        .screen-overlay.active { opacity: 1; visibility: visible; }
        .screen-overlay.immersive-dark {
            background-color: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
        }

        /* A capsula di u logò ancurata in fondu cù guaranzia di ùn rimpicciulisce micca */
        .bottom-logo-capsule {
            background-color: white;
            padding: 8px 18px;
            border-radius: 20px 20px 0 0;
            box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.15);
            display: flex;
            align-items: center;
            justify-content: center;
            width: 220px;
            height: 54px;
            z-index: 40;
        }

        .reading-now {
            background-color: rgba(255, 255, 255, 0.7) !important;
            color: var(--orange-brand) !important;
            border-radius: 4px;
            outline: 3px dashed rgba(255, 255, 255, 0.6);
            outline-offset: 3px;
            transition: all 0.2s ease;
            position: relative;
            z-index: 10;
        }
        
        body.tts-active .paragraph-tts { cursor: pointer !important; }
        body.tts-active .paragraph-tts:hover {
            outline: 2px dashed rgba(255, 255, 255, 0.5);
            outline-offset: 4px;
            border-radius: 4px;
        }

        /* Modale Basa */
        #modals-layer {
            pointer-events: none;
        }
        #modals-layer .custom-modal.active,
        #modals-layer .custom-backdrop.active {
            pointer-events: auto;
        }
        .custom-modal {
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9);
            width: 90%; max-width: 380px; z-index: 200; opacity: 0; visibility: hidden;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            pointer-events: none;
        }
        .custom-modal.active { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
        .custom-backdrop {
            position: absolute; inset: 0; background: rgba(0, 43, 92, 0.6); backdrop-filter: blur(8px);
            z-index: 199; opacity: 0; visibility: hidden; transition: opacity 0.3s ease;
            pointer-events: none;
        }
        .custom-backdrop.active { opacity: 1; visibility: visible; pointer-events: auto; }

        .sticker-captured { position: absolute; cursor: move; user-select: none; }

        /* ALTU CUNSTRASTU (Mudellu Neri, Biancu è Ghjallu di a Merria) */
        body.high-contrast { filter: none !important; background-color: #000 !important; }
        body.high-contrast #app-container { background-color: #000 !important; border-color: #FFD700 !important; }
        body.high-contrast #app-background { display: none !important; } /* Caccia u fondu verde */
        
        body.high-contrast .glass-box, 
        body.high-contrast .bg-white, 
        body.high-contrast .screen-overlay,
        body.high-contrast .custom-modal { 
            background: #000 !important; 
            background-color: #000 !important;
            border: 2px solid #FFD700 !important; 
            backdrop-filter: none !important; 
            -webkit-backdrop-filter: none !important;
        }
        
        body.high-contrast *, body.high-contrast p, body.high-contrast div, body.high-contrast span, body.high-contrast li { 
            color: #FFF !important; text-shadow: none !important; 
        }
        
        /* Tituli è evidenze in Ghjallu */
        body.high-contrast h1, body.high-contrast h2, body.high-contrast h3, body.high-contrast .title-impact, body.high-contrast strong { 
            color: #FFD700 !important; 
        }
        
        body.high-contrast .bg-\[var\(--primary-blue\)\] { 
            background-color: #000 !important; color: #FFD700 !important; border-bottom: 2px solid #FFD700 !important; 
        }
        
        body.high-contrast .btn-pill-light, body.high-contrast .btn-pill-orange, body.high-contrast .btn-pill-dark { 
            background-color: #000 !important; color: #FFD700 !important; border: 2px solid #FFD700 !important; box-shadow: none !important; 
        }
        body.high-contrast .btn-pill-light:active, body.high-contrast .btn-pill-orange:active, body.high-contrast .btn-pill-dark:active { 
            background-color: #FFD700 !important; color: #000 !important; 
        }
        
        /* Imaghjini in tonalità di grisgiu/neru è biancu */
        body.high-contrast img, body.high-contrast video, body.high-contrast canvas { 
            filter: grayscale(100%) contrast(150%) !important; 
        }
        
        body.high-contrast .acc-circle-btn, body.high-contrast .orange-close-btn { 
            background-color: #000 !important; color: #FFD700 !important; border: 2px solid #FFD700 !important; box-shadow: none !important; 
        }
        body.high-contrast .orange-close-btn:active { background-color: #FFD700 !important; color: #000 !important; }
        
        body.high-contrast .bottom-logo-capsule { 
            background-color: #000 !important; border: 2px solid #FFD700 !important; border-bottom: none !important; box-shadow: none !important; 
        }
        
        body.high-contrast .reading-now { background-color: rgba(255, 215, 0, 0.2) !important; color: #FFD700 !important; outline: 3px dashed #FFD700 !important; }
        body.high-contrast svg { fill: #FFD700 !important; color: #FFD700 !important; }
        
        /* Lingua Attiva in Altu Cuntrastu */
        body.high-contrast .lang-active { border-color: #FFD700 !important; background-color: #FFD700 !important; color: #000 !important; font-weight: bold !important;}
        
        /* ELEMENTU DI LINGUA ATTIVU PREDEFINITU */
        .lang-active { border-color: var(--orange-brand) !important; color: var(--orange-brand) !important; font-weight: 900 !important; background-color: #fff !important; opacity: 1 !important;}