#app {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

#app.ready {
    opacity: 1;
}

header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--accent-gold);
    padding-bottom: 30px;
    position: relative;
}

header::after {
    content: "✦";
    color: var(--accent-gold);
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-color-dark);
    padding: 0 10px;
}

nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: nowrap;
    /* Force single row */
    margin-top: 25px;
    padding: 10px 0;
    position: relative;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
}

nav .btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 8px 15px !important;
    font-size: 1rem !important;
    letter-spacing: 2px;
    color: rgba(var(--accent-gold-rgb), 0.8) !important;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    min-width: auto !important;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    /* Prevent text wrapping inside buttons */
}

nav .btn::before {
    display: none !important;
}

/* Runic Underline Animation */
nav .btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15px;
    right: 15px;
    height: 1px;
    background: var(--accent-gold);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(var(--accent-gold-rgb), 0.6);
}

nav .btn:hover:not(:disabled) {
    color: var(--accent-gold-active) !important;
    transform: translateY(-2px) !important;
}

nav .btn:hover:not(:disabled)::after {
    transform: scaleX(1);
}

nav .btn i {
    font-size: 0.85rem;
    opacity: 0.6;
    transition: all 0.4s ease;
}

nav .btn:hover i {
    opacity: 1;
    transform: scale(1.1) rotate(-5deg);
    color: var(--accent-gold-active);
}


.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--accent-gold);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    z-index: var(--z-index-nav);
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    color: var(--accent-gold-active);
    text-shadow: 0 0 10px rgba(var(--accent-gold-rgb), 0.5);
}

/* --- Standalone Search Styling (Modern Eldritch) --- */
.search-container {
    max-width: 600px;
    margin: 20px auto 30px auto;
    position: relative;
    z-index: var(--z-index-ui);
    transition: all 0.4s ease;
    padding: 0 15px;
}

.search-wrapper {
    position: relative;
    background: rgba(20, 18, 16, 0.6);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid rgba(197, 160, 89, 0.2);
    padding: 12px 20px;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.search-wrapper:focus-within {
    background: rgba(30, 27, 24, 0.8);
    border-bottom-color: var(--accent-gold);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(var(--accent-gold-rgb), 0.2);
}

.search-icon {
    color: var(--accent-gold);
    font-size: 1.1rem;
    margin-right: 15px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.search-wrapper:focus-within .search-icon {
    opacity: 1;
    text-shadow: 0 0 8px rgba(var(--accent-gold-rgb), 0.5);
}

.search-input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    color: var(--text-color-light) !important;
    font-family: var(--font-body) !important;
    font-size: 1.1rem !important;
    outline: none !important;
    padding: 0 !important;
}

.search-input::placeholder {
    font-family: var(--font-heading);
    color: var(--text-muted);
    opacity: 0.4;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.search-results {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: rgba(15, 13, 12, 0.98);
    backdrop-filter: blur(15px);
    border: 1px solid var(--accent-gold);
    border-top: none;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    z-index: 1000;
    /* Extremely high to stay on top */
}

.search-result-item {
    padding: 12px 20px;
    text-align: left;
    /* Keep text left-aligned */
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(197, 160, 89, 0.1);
}

.search-result-item:hover {
    background: rgba(197, 160, 89, 0.1);
    color: var(--accent-gold);
}

.search-container.hidden {
    display: none;
}

/* Mobile Search Adjustments */
@media screen and (max-width: 600px) {
    .search-container {
        margin: 10px auto 20px auto;
    }

    .search-wrapper {
        padding: 8px 15px;
    }
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: var(--z-index-modal);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    position: relative;
    max-width: 800px;
    width: 100%;
    margin: auto;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: #ffd782;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 0 0 10px rgba(197, 160, 89, 0.5);
    transition: color 0.3s, transform 0.3s;
    z-index: var(--z-index-modal-close);
}

.close-modal:hover {
    color: #fff;
    transform: scale(1.1);
}

/* Mobile Modals */
@media screen and (max-width: 600px) {
    .modal {
        align-items: flex-start;
        padding: 40px 15px;
    }

    .modal-content {
        margin: 0 auto !important;
    }

    .close-modal {
        top: 5px !important;
        right: 15px !important;
        font-size: 32px !important;
    }
}

/* --- Responsive Layout (Mobile / Tablet) --- */
@media screen and (max-width: 1100px) {
    header {
        position: relative;
        padding-top: 15px;
    }

    h1 {
        font-size: 1.4rem;
        margin-bottom: 0;
    }

    #top-nav {
        display: none !important;
    }

    #hamburger-toggle {
        display: flex !important;
        position: absolute;
        top: 15px;
        right: 15px;
    }

    /* Atmospheric Mobile Menu Overlay */
    #mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(10, 9, 8, 0.85) !important; /* Dark semi-transparent mask */
        backdrop-filter: blur(5px);
        z-index: 2000;
        display: flex;
        justify-content: flex-end; /* Align content panel to the right */
        align-items: stretch;
        transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden !important;
    }

    #mobile-menu::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 35%;
        height: 100%;
        background-image: url('https://www.transparenttextures.com/patterns/dark-leather.png'), 
                          linear-gradient(to right, rgba(0,0,0,0.4) 0%, transparent 100%);
        border-right: none !important;
        z-index: 1;
        pointer-events: none;
    }

    #mobile-menu.hidden {
        opacity: 0;
        visibility: hidden;
        transform: scale(1.05);
        pointer-events: none;
    }

    .mobile-menu-content {
        width: 65%; /* The "rechten teil" as requested */
        height: 100%;
        padding: 60px 0;
        display: flex;
        flex-direction: column;
        align-items: center; /* Center items horizontally within the right panel */
        justify-content: center; /* Center items vertically */
        position: relative;
        background-color: var(--bg-color-dark) !important; /* Sync with main app */
        background-image:
            radial-gradient(circle at center, rgba(30, 27, 24, 0.8) 0%, rgba(10, 9, 8, 0.95) 100%),
            url('../assets/black-paper.png') !important;
        background-attachment: fixed !important;
        border-left: 1px solid var(--accent-gold) !important;
        box-shadow: none !important;
        z-index: 2;
        overflow-y: auto;
        overflow-x: hidden !important;
    }

    .menu-title {
        font-family: 'Cinzel', serif;
        font-size: 2.2rem;
        color: var(--accent-gold);
        letter-spacing: 5px;
        margin-bottom: 40px;
        text-transform: uppercase;
        position: relative;
        text-shadow: 0 0 15px rgba(var(--accent-gold-rgb), 0.4);
        text-align: center;
    }

    .menu-title::after {
        content: '✦';
        position: absolute;
        bottom: -25px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 1rem;
        opacity: 0.6;
    }

    .close-menu-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        /* Restored to right as requested */
        left: auto;
        background: transparent;
        border: none;
        color: var(--accent-gold);
        font-size: 2.5rem;
        cursor: pointer;
        opacity: 0.7;
        transition: all 0.3s ease;
        z-index: 10;
    }

    .close-menu-btn:hover {
        opacity: 1;
        transform: rotate(90deg);
        color: var(--accent-gold-active);
    }

    #mobile-nav-buttons {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        /* Take full available width */
        min-width: 0 !important;
        /* Remove restrictive min-width */
        align-items: flex-start !important;
        /* Truly left-aligned navigation as requested */
        padding-left: 5px !important;
        /* Shifted even further left as requested */
    }

    #mobile-nav-buttons .btn {
        display: flex !important;
        width: 100% !important;
        justify-content: flex-start !important;
        padding: 15px 5px !important;
        /* Minimal padding to maximize space */
        background: transparent !important;
        background-image: none !important;
        border: none !important;
        box-shadow: none !important;
        color: rgba(var(--accent-gold-rgb), 0.8) !important;
        font-family: 'Cinzel', serif !important;
        font-size: 0.95rem !important;
        /* Slightly reduced for better fit */
        letter-spacing: 1px !important;
        /* Reduced for better fit */
        text-transform: uppercase !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8) !important;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: relative !important;
        overflow: visible !important;
        white-space: nowrap !important;
        margin: 0 !important;
        /* Left-aligned as requested */
    }

    #mobile-nav-buttons .btn::before {
        display: none !important;
    }

    #mobile-nav-buttons .btn i {
        font-size: 0.9rem !important;
        opacity: 0.7 !important;
        margin-right: 15px !important;
    }

    #mobile-nav-buttons .btn:hover,
    #mobile-nav-buttons .btn:active {
        background: transparent !important;
        color: var(--accent-gold-active) !important;
        transform: translateX(5px) !important;
    }

    /* Mobile Runic Underline - spanning icon and text as requested */
    #mobile-nav-buttons .btn::after {
        content: '';
        position: absolute;
        bottom: 8px;
        /* Positioned below icon/text */
        left: 0;
        width: 90%;
        /* Covers icon and text */
        height: 1px;
        background: var(--accent-gold);
        transform: scaleX(0);
        transform-origin: left;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 0 10px rgba(var(--accent-gold-rgb), 0.5);
    }

    #mobile-nav-buttons .btn:hover::after,
    #mobile-nav-buttons .btn:active::after {
        transform: scaleX(1);
    }
}

/* --- Footer --- */
#app-footer {
    text-align: center;
    margin: 40px auto 20px auto;
    padding: 15px;
    border-top: 1px solid rgba(197, 160, 89, 0.2);
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 400px;
}

#app-footer:hover {
    color: var(--accent-gold);
    border-top-color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(197, 160, 89, 0.4);
}

#app-footer i {
    margin-right: 8px;
    font-size: 0.9rem;
}

/* --- Credits Modal Content --- */
.credits-body {
    background-color: var(--panel-bg);
    background-image: url('../assets/black-paper.png');
    border: 1px solid var(--border-color);
    border-top: 5px solid var(--accent-gold);
    border-radius: 4px;
    padding: 60px 40px;
    box-shadow: var(--shadow-depth);
    color: var(--text-color);
    font-family: 'Playfair Display', serif;
    line-height: 1.8;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    /* Center everything */
}

.credits-wrapper h2 {
    font-size: 2.2rem;
    margin: 0;
    letter-spacing: 3px;
}

.credits-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.credits-text strong {
    color: var(--accent-gold);
    font-weight: 700;
}

.credits-text ul li {
    margin-bottom: 10px;
    font-size: 1rem;
}

/* Mobile Adjustments for Footer & Credits */
@media screen and (max-width: 600px) {
    #app-footer {
        margin-top: 20px;
        font-size: 0.75rem;
        padding: 20px 10px;
    }

    .credits-body {
        padding: 30px 20px;
    }

    .credits-text p {
        font-size: 1rem;
    }
}
