        :root {
            --bg-color:    #ffffff;
            --text-color:  #333333;
            --header-bg:   #f8f9fa44;
            --footer-bg:   #ffffff;
            --footer-text: #ffffff;
            
            --font-family: sans-serif;
            
            --gap: 12px;
            --ideal-height: 200px;
            --round: 2px;
            
        }

        [data-theme="dark"] {
            --bg-color:    #1a1a1a;
            --text-color:  #f1f1f1;
            --header-bg:   #33333399; 
            --footer-bg:   #000000;
            --footer-text: #cccccc;
        }

        /* Courier (Monospace) */
        body.font-courier {
            font-family: "berkeley mono", Courier, monospace !important;
        }
        
        /* Arial / Sans-Serif) */
        body.font-arial {
            font-family: Arial, Helvetica, sans-serif !important;
        }

        /* Times New Roman (Serif) */
        body.font-times {
            font-family: "Times New Roman", Times, serif !important;
        }
                
        /* Biztosítjuk, hogy a kódblokkok megőrizzék a saját betűtípusukat */
        body.font-arial code, body.font-times code, body.font-courier code {
            font-family: monospace !important;
        }
        
        /* A TRÜKK: A html és body legyen 100% magas */
        html, body {
            height: 100%;
            margin: 0;
        }

        body {
            display: flex;
            flex-direction: column;
            font-family: var(--font-family);
            background-color: var(--bg-color);
            color: var(--text-color);
            transition: background-color 0.3s;
        }

        /* FEJLÉC */
        header {
            width: 100%;
            background-color: var(--header-bg);
            padding: 15px 0;
            position: fixed;
            top: 0;
            z-index: 1000;
            #transition: opacity 0.8s, visibility 0.8s;
            #box-shadow: 0 5px 5px rgba(0,0,0,0.1);
        }
        
        /* A fejléc (header) maradjon fixen Arial vagy Sans-Serif, hogy ne ugráljon */
        #main-header {
            font-family: Arial, sans-serif !important;
            font-size: 18px;
        }

        .header-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            #max-width: 950px;
            margin: 0 auto;
            padding: 0 20px;
        }
        
        /* Amikor rejtve van */
        .header-hidden {
            opacity: 0;
            /* A translateY sort töröltük, így nem mozdul el felfelé */
            //pointer-events: none; 
        }
        
        #main-header {
            /* Csak az opacity (átlátszóság) változzon, a mozgás ne */
            transition: opacity 0.5s ease-in-out; 
            position: fixed; 
            top: 0;
            width: 100%;
            z-index: 1000;
            font-family: Arial, sans-serif !important;
        }
        
        /* Amikor a fejléc el van rejtve (pl. egy .hidden class-szal), 
           de az egér felette van, kényszerítsük a megjelenést */
        /* #main-header:hover {
            transform: translateY(0) !important;
            opacity: 1 !important;
            transition: transform 1.2s ease-out, opacity 1.2s ease-out !important;
        } */ */
        
        /* Amikor a hamburgerrel kényszerítjük a megjelenítést */
        #main-header.force-show {
            transform: translateY(0) !important;
            opacity: 1 !important;
            visibility: visible !important;
            transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
        }
        
        /* Egér föléhúzás (hover) kezelése */
        /* #main-header:hover {
            transform: translateY(0) !important;
            opacity: 1 !important;
            transition: transform 0.8s ease-in-out;
        } */
        
        /* Alap transition, hogy a scroll is lassú legyen */
        #main-header {
            transition: transform 0.8s ease-in-out, opacity 0.8s ease-in-out;
        }
        
        /* HAMBURGER - bal oldalon */
        #hamburger {
            position: fixed;
            top: 0px;
            left: 3px;
            font-size: 32px;
            cursor: pointer;
            z-index: 1001;
            #display: none; /* Alapból rejtve, amíg a fejléc látszik */
            #background: var(--header-bg);
            padding: 5px 10px;
            border-radius: 0px;
            border: 0px solid #ccc;
        }
        
        nav ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; margin-left: 30px; }
        nav a { text-decoration: none; color: var(--text-color); font-weight: bold; }

        #theme-toggle {
            cursor: pointer;
            #padding: 5px 15px;
            #border-radius: 15px;
            #border: 1px solid var(--text-color);
            #background: transparent;
            #color: var(--text-color);
            #left: -20px;
        }

        #font-toggle {
            cursor: pointer;
            #padding: 5px 15px;
            #border-radius: 15px;
            #border: 1px solid var(--text-color);
            #background: transparent;
            #color: var(--text-color);
            #left: -20px;
        }
        
        #justy-toggle {
            cursor: pointer;
            #padding: 5px 15px;
            #border-radius: 15px;
            #border: 1px solid var(--text-color);
            #background: transparent;
            #color: var(--text-color);
            #left: -20px;
        }
        
        #debug-toggle {
            cursor: pointer;
        }
        
        #size-toggle {
            cursor: pointer;
        }
        
        /* .fade-out { 
            transform: translateY(0) !important;
            opacity: 0 !important;
            transition: transform 1.2s ease-out, opacity 1.2s ease-out !important; 
            #visibility: hidden; 
        } */

        /* Alapértelmezett (világos) kódblokk háttér */
        .highlighter-rouge .highlight, 
        .highlighter-rouge pre {
            background-color: #f6f8fa !important; /* Világosszürke */
            color: #24292e;
            transition: background-color 0.5s ease, color 0.5s ease;
        }
        
        /* Éjszakai mód kódblokk háttér */
        /* Feltételezve, hogy a body megkapja a 'night-mode' osztályt */
        body.night-mode .highlighter-rouge .highlight,
        body.night-mode .highlighter-rouge pre,
        body.night-mode code {
            background-color: #1e1e1e !important; /* Sötétszürke/Fekete */
            color: #d4d4d4 !important;            /* Világos szöveg */
            border: 1px solid #333;               /* Finom keret, hogy elváljon */
        }
        
        /* A syntax highlight színeinek finomítása sötét módban (opcionális) */
        body.night-mode .highlight .nt { color: #569cd6; } /* Tag-ek */
        body.night-mode .highlight .s  { color: #ce9178; } /* Stringek */
        body.night-mode .highlight .cp { color: #808080; } /* Commentek */

        /* Specifikus korrekció a betűtípusokhoz (ha szükséges) */
        body.font-courier main {
            font-size: 1.1rem;       /* A Courier néha szélesebb, itt picit finomíthatunk rajta */
        }

        /* TARTALOM - Ez tölti ki a maradék helyet */
        main {
            flex: 1 0 auto; /* Ez engedi, hogy nőjön, de ne menjen össze */
            max-width: 950px;
            width: min(950px, 100%);
            margin: 30px auto 0 auto;
            padding: 20px;
            padding-top: 0px;
            padding-bottom: 0px;
            #box-sizing: border-box;
            #border: 2px solid #ccc;
        }
        
        main a:link {
          color: red;
          background-color: transparent;
          text-decoration: none;
        }
        
        main a:visited {
          color: red;
          background-color: transparent;
          text-decoration: none;
        }
        
        main a:hover {
          color: red;
          background-color: transparent;
          text-decoration: underline;
        }
        
        main a:active {
          color: red;
          font-weight: bold;
          background-color: transparent;
        }

       footer a:link {
          color: red;
          background-color: transparent;
          text-decoration: none;
        }
        
       footer a:visited {
          color: red;
          background-color: transparent;
          text-decoration: none;
        }
        
       footer a:hover {
          color: red;
          background-color: transparent;
          text-decoration: underline;
        }
        
       footer a:active {
          color: red;
          background-color: transparent;
          text-decoration: underline;
        }
        
        /* Csak akkor lesz sorkizárt, ha az osztály aktív */
        main.justify-text p, main.justify-text ul {
            text-align: justify;
            hyphens: auto; /* Opcionális: segít a szavak elválasztásában */
        }
                
        /* A fő tartalom és a lábléc betűméretének növelése */
        main, footer {
            font-size: 1.25rem;      /* Az alapméret 125%-a (kb. 18.5px) */
            line-height: 1.6;        /* Növeljük a sorközt is a jobb olvashatóságért */
        }
        
        /* A címek (h1, h2) arányos igazítása */
        main h1 {
            font-size: 2.5rem;
        }
        
        main h2 {
            font-size: 1.8rem;
            margin-top: 1.5em;
        }
        
        .image-container {
            position: relative; /* Ez kell, hogy a felirat ehhez viszonyítson */
            width: 100%;
        }
        
        .image-container img {
            display: block;
            object-fit: cover;
        }
        
        .image-caption {
            position: absolute;
            bottom: -35px; /* Kicsit feljebb a kép aljától a negatív margó miatt */
            right: 20px;   /* Távolság a jobb széltől */
            background-color: rgba(0, 0, 0, 0.5); /* Félig átlátszó háttér a olvashatóságért */
            color: white;
            padding: 5px 10px;
            font-size: 12px;
            border-radius: 3px;
        }
        
        .image-caption a {
            color: #ff0000; /* Piros link, hogy passzoljon az oldaladhoz */
            text-decoration: none;
        }
        .image-caption a:hover {
            color: #ffffff; 
            text-decoration: none;
        }
 
        .video-container {
            position: relative;
            padding-bottom: 56.25%; /* 16:9 képarány (9 / 16 = 0.5625) */
            height: 0;
            overflow: hidden;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); /* Vízszintes, függőleges, elmosódás, szín */
            border-radius: 5px; /* Opcionális: lekerekítés, hogy illeszkedjen a képhez */
        }
        
        .video-container iframe {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: 0;
        }
                
        /* A teljes lábjegyzet rész betűméretének csökkentése */
         .footnotes {
            margin-top: 30px;
            padding-top: 3px;
            font-size: 0.85em;
            position: relative; /* Ez kell az álelem pozicionálásához */
        }
        
        /* Ez hozza létre a 40%-os vonalat */
        .footnotes::before {
            content: "";         /* Kötelező, hogy megjelenjen */
            position: absolute;
            top: 0;
            left: 0;
            width: 40%;          /* Itt állítod be a vonal hosszát */
            border-top: 1px solid #ccc; /* Maga a vonal */
        }

        /* Ha biztosra akarsz menni, hogy a benne lévő bekezdés is kisebb legyen */
        .footnotes p {
            margin-bottom: 5px;
            line-height: 1.4;
        }
        
        /* LÁBLÉC - Mindig az alján */
        footer {
            flex-shrink: 0; /* Megakadályozza, hogy összenyomódjon */
            width: 100%;
            background-color: var(--footer-bg);
            color: var(--footer-text);
            padding: 20px 0;
            text-align: center;
        }
        
        .container { max-width: 1400px; margin: 0 auto; padding: 0px 0px; }
        section { margin-bottom: 60px; }
        
        /* --- JUSTIFIED GRID ANIMÁCIÓVAL --- */
        .justified-gallery {
            display: flex;
            flex-wrap: wrap;
            gap: var(--gap);
            transition: all .5s ease;
        }

        .gallery-item {
            position: relative;
            flex-grow: 1;
            height: var(--ideal-height);
            overflow: hidden;
            border-radius: var(--round);
            background-color: #e0e0e0;
            cursor: pointer;
            opacity: 0; /* JS-ig rejtve, hogy ne ugráljon */
         
            transition: opacity 0.5s ease;   
            /* Animáció az átméretezéshez (Unite Gallery stílus) */
            /* transition: flex-basis 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                        flex-grow 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                        height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                        opacity 0.5s ease; */
        }
        
        .gallery-item img {
            width: 100%; height: 100%;
            object-fit: cover;
            display: block;
            border-radius: var(--round);
            transition: transform 1.5s ease;
        }

        .gallery-item:hover img { transform: scale(1.08); }

        /* --- FULL SCREEN LIGHTBOX --- */
        .lightbox {
            display: none;
            position: fixed;
            inset: 0;
            background: #000;
            z-index: 9999;
            overflow-y: auto;
            justify-content: center;
            align-items: flex-start;
        }

        .lightbox-content {
            display: block;
            width: 100%; height: auto;
            max-width: 100%; max-height: 100vh;
            object-fit: contain;
            margin: auto;
            transition: opacity 0.3s ease;
        }

        /* Landscape mód: kényszerített szélesség */
        .lightbox.landscape-mode .lightbox-content {
            width: 100vw;
            max-height: none;
        }

        /* Lebegő gombok a képen */
        .ui-overlay {
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 10000;
        }

        .ui-overlay button { pointer-events: auto; cursor: pointer; }

        .close-btn {
            position: absolute; top: 20px; right: 20px;
            font-size: 45px; color: white; background: rgba(0,0,0,0.3);
            border: none; border-radius: 50%; width: 60px; height: 60px;
            display: flex; align-items: center; justify-content: center;
            transition: 0.3s;
        }

        .nav-btn {
            position: absolute; top: 50%; transform: translateY(-50%);
            background: rgba(0,0,0,0.4); color: white; border: none;
            width: 50px; height: 80px; font-size: 30px;
            transition: 0.3s;
        }
        .nav-btn:hover { background: rgba(0,0,0,0.7); }
        .prev { left: 0; border-radius: 0 10px 10px 0; }
        .next { right: 0; border-radius: 10px 0 0 10px; }

        .caption-bar {
            position: fixed; bottom: 0; left: 0; right: 0;
            //background: linear-gradient(transparent, rgba(0,0,0,0.8));
            padding: 50px 20px 20px; text-align: center;
            color: white; font-size: 1.2rem; pointer-events: none;
        }
        
        /* A felirat sávjának alaphelyzete */
        .caption-bar {
        //    background: none !important; /* Töröljük a teljes szélességű sötét sávot */
            bottom: 25px; /* Kicsit feljebb emeljük a kép aljától */
            pointer-events: none; /* Ne zavarja a kattintást */
        }

        /* Maga a szöveg stílusa */
        #caption {
            color: #ffffff;
            font-weight: 600;
            /* Többrétegű fekete árnyék a betűk köré */
            text-shadow: 
                -1px -1px 0 #000,  
                 1px -1px 0 #000,
                -1px  1px 0 #000,
                 1px  1px 0 #000,
                 0px  0px 8px rgba(0,0,0,0.8);
            font-size: 1.6em;
        }

        @media (max-width: 768px) {
            .gallery-item { height: 160px; }
            .nav-btn { width: 40px; height: 60px; font-size: 20px; }
        }
        
        /* Gomb elhelyezése a jobb alsó sarokba */
        .fit-toggle-btn {
            position: absolute; bottom: 20px; right: 20px;
            pointer-events: auto;
            cursor: pointer;
            background: rgba(0,0,0,0.3); color: white; border: none;
            #padding: 10px;
            #border-radius: 5px;
            display: flex; align-items: center; justify-content: center;
            transition: 0.3s;
            z-index: 10001;
        }
        
        .fit-toggle-btn:hover { background: rgba(0,0,0,0.7); }
        
        /* Amikor aktív a "Fit" (illesztés) mód, a kép ne vágódjon le */
        .lightbox.fit-mode .lightbox-content {
            width: auto !important;
            height: auto !important;
            max-width: 100vw !important;
            max-height: 100vh !important;
            object-fit: contain !important;
        }
        
        .tableofcontents {
            column-gap:    50px; 
            column-rule:    2px solid lightgrey;
            column-width: 350px; /* Az oszlopok minimum 400px szélesek lesznek */
            column-fill: balance;
        }
        
        .tableofcontents li {
            break-inside: avoid-column;
        }
        
        .tableofcontents a:link, .tableofcontents a:visited {
            color: var(--text-color);
        }
        
        /* A syntax highlight konténer és a pre elem kezelése */
        .highlighter-rouge, 
        .highlight pre, 
        code {
            white-space: pre-wrap !important; /* Megtartja a szóközöket, de tördeli a sort */
            word-break: break-all;           /* Ha túl hosszú egy szó (pl. URL), ott is eltöri */
            overflow-wrap: break-word;       /* Biztosítja, hogy ne lógjon ki a keretből */
        }
        
        /* Opcionális: a vízszintes görgetősáv eltüntetése, ha már nem szükséges */
        .highlight pre {
            overflow-x: hidden; 
        }
