* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

/* Fix háttér – külön layer, ugyanaz a kinézet, de nem lagol görgetéskor */
.page-background {
    position: fixed;
    inset: 0;
    z-index: -3;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(101, 67, 33, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(80, 52, 28, 0.2) 0%, transparent 45%),
        linear-gradient(135deg, rgba(61, 44, 30, 0.75) 0%, rgba(70, 50, 35, 0.7) 100%),
        url('../img/wallpaper.jpg');
    background-size: cover;
    background-position: center;
    pointer-events: none;
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    background: transparent;
    color: #e8e0d0;
    padding-top: 72px;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    z-index: -2;
    pointer-events: none;
    opacity: 1;
}

/* Fényeffekt - középről induló finom fény, statikus (nincs szakadozás) */
.glow-container {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: 100vh;
    z-index: -1;
    pointer-events: none;
    /* Radális fény középről, sima */
    background: radial-gradient(
        ellipse 100% 80% at 50% 40%,
        rgba(160, 120, 70, 0.08) 0%,
        rgba(139, 90, 43, 0.04) 50%,
        transparent 100%
    );
    opacity: 0.95;
}

/* Header – fix pozíció, solid háttér (backdrop-filter lagot okozott) */
.header {
    padding: 1.5rem 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(50, 36, 24, 0.98);
    border-bottom: 2px solid rgba(139, 90, 43, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e8e0d0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-img {
    height: 0;
    opacity: 0;
    transition: all 0.4s ease;
    filter: drop-shadow(0 2px 8px rgba(232, 224, 208, 0.4));
}

.logo-img.visible {
    height: 40px;
    opacity: 1;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: #e8e0d0;
    text-decoration: none;
    padding: 0.7rem 1.2rem;
    transition: all 0.2s;
    font-size: 0.95rem;
    background: rgba(61, 44, 30, 0.85);
    border: 1px solid rgba(139, 90, 43, 0.45);
    border-radius: 8px;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(80, 55, 35, 0.7);
    border-color: rgba(139, 90, 43, 0.6);
}

.nav-link.active {
    background: rgba(101, 67, 33, 0.6);
    border-color: rgba(160, 120, 70, 0.5);
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    background: rgba(61, 44, 30, 0.85);
    border: 1px solid rgba(139, 90, 43, 0.45);
    color: #e8e0d0;
    padding: 0.7rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    border-radius: 8px;
}

.lang-btn:hover {
    background: rgba(80, 55, 35, 0.7);
    border-color: rgba(139, 90, 43, 0.6);
}

.lang-btn.active {
    background: rgba(101, 67, 33, 0.6);
    border-color: rgba(160, 120, 70, 0.5);
}

/* Statisztikák sor */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 2rem 0;
    padding: 1.25rem 2rem;
}
.stat-item {
    text-align: center;
    min-width: 100px;
}
.stat-number {
    display: block;
    font-size: 1.75rem;
    font-weight: bold;
    color: #3d2c1e;
    font-family: Georgia, serif;
}
.stat-label {
    font-size: 0.85rem;
    color: #4a3728;
}

/* Main Content */
.content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem 1.5rem 2rem;
}

#page-content {
    opacity: 0;
}
#page-content.content-loaded {
    animation: contentFadeIn 0.5s ease-out forwards;
}
@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Content Sections – solid háttér (backdrop-filter lagot okozott) */
.hero-section,
.stats-row,
.enigma-quote,
.card {
    background: rgba(235, 228, 216, 0.95);
    border: 1px solid rgba(139, 90, 43, 0.28);
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.hero-section {
    text-align: center;
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #3d2c1e;
}

.hero-section p {
    font-size: 1.1rem;
    color: #4a3728;
    max-width: 700px;
    margin: 0 auto;
}

/* Cím animáció: fentről be, alul ki */
.hero-title-morse .char-wrap {
    display: inline-block;
    position: relative;
    overflow: hidden;
    height: 1.35em;
    vertical-align: top;
}

.hero-title-morse .char-size {
    visibility: hidden;
    display: inline-block;
    height: 1.35em;
    line-height: 1.35em;
}

.hero-title-morse .char-old,
.hero-title-morse .char-new {
    position: absolute;
    left: 0;
    right: 0;
    display: block;
    text-align: center;
    line-height: 1.35em;
    backface-visibility: hidden;
}

.hero-title-morse .char-old {
    top: 0;
    z-index: 1;
    transform: translateY(0);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-title-morse .char-new {
    top: 0;
    z-index: 2;
    transform: translateY(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0.25s;
}

.hero-title-morse .char-wrap.char-revealed .char-old {
    transform: translateY(100%);
}

.hero-title-morse .char-wrap.char-revealed .char-new {
    transform: translateY(0);
}

/* Idézet blokk */
.enigma-quote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    font-style: italic;
}
.enigma-quote p {
    margin: 0 0 0.5rem 0;
    color: #3d2c1e;
    font-size: 1.1rem;
}
.enigma-quote cite {
    font-size: 0.9rem;
    color: #5a4535;
}

/* Kártyák */
.card {
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.25s ease;
}
.card:hover {
    box-shadow: 0 4px 20px rgba(101, 67, 33, 0.15);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #3d2c1e;
}

.card p {
    color: #4a3728;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.card p:last-child {
    margin-bottom: 0;
}

.card strong {
    color: #3d2c1e;
}

/* Enigma Showcase */
.enigma-showcase {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 2rem 1rem 2rem;
    margin: 0 0 0.5rem 0;
    min-height: 220px;
    overflow: hidden;
}

.enigma-image {
    position: relative;
    max-width: 350px;
    width: 100%;
    height: auto;
    z-index: 2;
    filter: drop-shadow(0 20px 60px rgba(0, 0, 0, 0.4));
    transition: opacity 0.5s ease;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(40, 28, 20, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 90, 43, 0.4);
    border-top-color: #e8e0d0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Következő oldal navigáció */
.page-nav-next {
    margin-top: 1.25rem;
    padding: 0.75rem 0;
    text-align: center;
}
.page-nav-next-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.75rem;
    background: rgba(61, 44, 30, 0.92);
    border: 1px solid rgba(139, 90, 43, 0.4);
    border-radius: 8px;
    color: #e8e0d0;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.page-nav-next-link:hover {
    background: rgba(80, 55, 35, 0.95);
    border-color: rgba(160, 120, 70, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.page-nav-next-label {
    font-size: 0.8rem;
    color: rgba(232, 224, 208, 0.75);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.page-nav-next-title {
    font-weight: 600;
}
.page-nav-next-arrow {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Footer */
.footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 1.25rem 2rem;
    background: rgba(50, 36, 24, 0.98);
    border-top: 1px solid rgba(139, 90, 43, 0.4);
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.footer-copy {
    font-size: 0.9rem;
    color: rgba(232, 224, 208, 0.85);
    margin: 0;
}
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}
.footer-link {
    color: rgba(232, 224, 208, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    white-space: nowrap;
}
.footer-link:hover {
    color: #e8e0d0;
}

/* Responsive */
@media (max-width: 1200px) {
    .nav-link {
        font-size: 0.85rem;
        padding: 0.6rem 0.9rem;
    }
}

@media (max-width: 1024px) {
    body {
        padding-top: 100px;
    }
    .header {
        padding: 1rem;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .nav-link {
        font-size: 0.8rem;
        padding: 0.5rem 0.7rem;
    }

    .footer {
        padding: 1rem;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    .footer-nav {
        gap: 0.75rem;
    }

    .content {
        padding: 2rem 1rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .enigma-showcase {
        padding: 0.5rem 1rem 1rem 1rem;
        min-height: 200px;
    }

    .enigma-image {
        max-width: 350px;
    }
}

/* Morse szimulátor */
.morse-simulator {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.morse-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: Georgia, serif;
    border: 1px solid rgba(139, 90, 43, 0.35);
    border-radius: 6px;
    background: rgba(255, 252, 248, 0.9);
    color: #3d2c1e;
    resize: vertical;
}
.morse-input:focus {
    outline: none;
    border-color: rgba(139, 90, 43, 0.6);
}
.morse-output {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    background: rgba(61, 44, 30, 0.15);
    border-radius: 6px;
    color: #3d2c1e;
    letter-spacing: 0.12em;
    min-height: 2.5rem;
    line-height: 1.8;
}
.morse-sym {
    display: inline-block;
    padding: 0.15em 0.2em;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}
.morse-sym-active {
    background: rgba(139, 90, 43, 0.55);
    color: #fff;
}
.morse-sym-done {
    background: rgba(139, 90, 43, 0.22);
    color: #4a3728;
}
.morse-actions {
    display: flex;
    gap: 0.75rem;
}
.morse-btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    border: 1px solid rgba(139, 90, 43, 0.4);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.morse-btn-play {
    background: rgba(61, 44, 30, 0.8);
    color: #e8e0d0;
}
.morse-btn-play:hover {
    background: rgba(80, 55, 35, 0.9);
}
.morse-btn-stop {
    background: rgba(139, 90, 43, 0.2);
    color: #3d2c1e;
}
.morse-btn-stop:hover {
    background: rgba(139, 90, 43, 0.35);
}

/* Klikkelhető kifejezések */
.term {
    cursor: help;
    border-bottom: 1px dotted rgba(139, 90, 43, 0.5);
    padding: 0 0.1em;
}
.term:hover {
    border-bottom-color: rgba(139, 90, 43, 0.8);
}
.term-tooltip {
    position: fixed;
    z-index: 1000;
    max-width: 320px;
    padding: 0.75rem 1rem;
    background: rgba(61, 44, 30, 0.95);
    color: #e8e0d0;
    font-size: 0.9rem;
    line-height: 1.4;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 90, 43, 0.4);
    pointer-events: none;
}

/* Enigma szimulátor */
.enigma-emulator-card {
    overflow: visible;
}

.enigma-simulator {
    margin-top: 1rem;
    padding: 1.25rem;
    background: rgba(40, 30, 22, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(139, 90, 43, 0.4);
}

.enigma-settings {
    background: rgba(61, 44, 30, 0.9);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid rgba(139, 90, 43, 0.5);
}

.enigma-settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.enigma-settings-row label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #e8e0d0;
    font-size: 0.9rem;
}

.enigma-settings-row select {
    padding: 0.3rem 0.5rem;
    background: rgba(61, 44, 30, 0.8);
    border: 1px solid rgba(139, 90, 43, 0.5);
    border-radius: 4px;
    color: #e8e0d0;
    font-size: 0.85rem;
}

.enigma-settings-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.enigma-machine {
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 2px solid #444;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.enigma-rotors {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    cursor: pointer;
    user-select: none;
}

.enigma-rotors:hover {
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
}

.enigma-rotor {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    padding: 0.15rem;
    border: 3px solid #333;
    border-radius: 4px;
    background: linear-gradient(180deg, #1a1a1a 0%, #3a3a3a 50%, #1a1a1a 100%);
}

.enigma-rotor-prev, .enigma-rotor-next {
    font-size: 0.75rem;
    color: #888;
    min-height: 1.2em;
}

.enigma-rotor-curr {
    font-size: 1.1rem;
    font-weight: bold;
    color: #f8b500;
    padding: 0.2em 0;
}

.enigma-lampboard, .enigma-keyboard, .enigma-plugboard {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.1rem 0.5rem;
    padding: 0.75rem;
}

.enigma-light, .enigma-key, .enigma-plug {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 50%;
    user-select: none;
}

.enigma-light {
    background: #000;
    color: #555;
    border: 2px solid #222;
    transition: background 0.15s, color 0.15s;
}

.enigma-light-on {
    background: linear-gradient(135deg, #fceabb 0%, #f8b500 100%);
    color: #333;
    border-color: #c99400;
}

.enigma-key {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    color: #ddd;
    border: 2px solid #555;
    cursor: pointer;
    transition: all 0.1s;
}

.enigma-key:hover {
    background: linear-gradient(180deg, #5a5a5a 0%, #3a3a3a 100%);
}

.enigma-key-down {
    background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 100%);
    transform: scale(0.95);
}

.enigma-plug {
    background: #1a1a1a;
    color: #888;
    border: 2px solid #333;
    cursor: pointer;
    transition: all 0.15s;
}

.enigma-plug:hover {
    border-color: #555;
    color: #aaa;
}

.enigma-text-panel {
    background: rgba(61, 44, 30, 0.7);
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid rgba(139, 90, 43, 0.5);
}

.enigma-text-row {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.enigma-field-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d2118;
}

.enigma-field {
    min-height: 2.2rem;
    padding: 0.6rem 0.9rem;
    background: rgba(255, 250, 245, 0.95);
    border: 1px solid rgba(139, 90, 43, 0.4);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    letter-spacing: 0.12em;
    color: #2d2118;
}

.enigma-field span {
    min-height: 1.2em;
    display: inline-block;
}

.enigma-mode-btns {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.enigma-btn {
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.enigma-btn-encrypt {
    background: #5a4030;
    color: #fff;
    border: 1px solid #4a3528;
}

.enigma-btn-encrypt:hover {
    background: #6b4d3a;
}

.enigma-btn-decrypt {
    background: #8b6914;
    color: #fff;
    border: 1px solid #6b5010;
}

.enigma-btn-decrypt:hover {
    background: #9d7818;
}

.enigma-btn-clear {
    background: rgba(255, 250, 245, 0.9);
    color: #3d2c1e;
    border: 1px solid rgba(139, 90, 43, 0.5);
}

.enigma-btn-clear:hover {
    background: rgba(255, 250, 245, 1);
}

@media (max-width: 768px) {
    .enigma-light, .enigma-key, .enigma-plug {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    .enigma-settings-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
