:root {
    /* Dark Theme */
    --bg: #0b0b15;
    --fg: #f5f5f5;
    --accent: #c9a86a;
    --accent-soft: #e6c98f;
    --box-bg: rgba(255,255,255,0.05);
    --letter-bg: #fff;
    --letter-fg: #333;
}

body.light-theme {
    /* Light Theme */
    --bg: #f5f5f5;
    --fg: #000;
    --accent: #c9a86a;
    --accent-soft: #e6c98f;
    --box-bg: rgba(0,0,0,0.05);
    --letter-bg: #fff;
    --letter-fg: #333;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: "Georgia", serif;
    text-align: center;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease; /* Smooth transition for theme change */
}
.hidden { display: none; }

.box {
    border: 2px solid var(--accent);
    padding: 20px;
    margin: 20px auto;
    width: 90%;
    max-width: 600px;
    background: var(--box-bg);
    border-radius: 10px;
}

input, textarea {
    padding: 10px;
    border-radius: 5px;
    border: none;
    margin-top: 10px;
    width: 80%;
    max-width: 250px;
    text-align: center;
    background: var(--fg); /* Use foreground color for input background */
    color: var(--bg); /* Use background color for input text */
}

button {
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
    color: #000;
}
button:hover {
    background: var(--accent-soft);
}

/* Navigation */
.main-nav {
    background: var(--box-bg);
    padding: 10px 20px; /* Add horizontal padding */
    border-bottom: 1px solid var(--accent);
    margin-bottom: 20px;
    display: flex; /* Use flexbox for alignment */
    justify-content: space-between; /* Space out items */
    align-items: center; /* Vertically align items */
    position: relative; /* For absolute positioning of nav-links */
}

.main-nav .nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 20px;
}

.main-nav a {
    color: var(--fg);
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.1);
}

/* Hamburger Menu */
.hamburger-menu {
    display: none; /* Hidden by default on larger screens */
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
    z-index: 100; /* Ensure it's above other content */
}

.hamburger-menu .bar {
    width: 25px;
    height: 3px;
    background-color: var(--fg);
    margin: 4px 0;
    transition: 0.4s;
}

/* Responsive Navigation */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: row; /* Keep row direction for icon and title */
        justify-content: space-between;
    }

    .hamburger-menu {
        display: flex; /* Show hamburger on smaller screens */
    }

    .main-nav .nav-links {
        display: none; /* Hide nav links by default */
        flex-direction: column;
        position: absolute;
        top: 100%; /* Position below the nav bar */
        left: 0;
        width: 100%;
        background: var(--box-bg);
        border-top: 1px solid var(--accent);
        padding: 10px 0;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        z-index: 99;
    }

    .main-nav .nav-links.active {
        display: flex; /* Show nav links when active */
    }

    .main-nav .nav-links li {
        text-align: center;
        margin: 5px 0;
    }
}

/* Fortschrittsleiste */
.progress-container {
    width: 90%;
    max-width: 600px;
    margin: 10px auto;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    border: 1px solid var(--accent);
    overflow: hidden;
}
.progress-bar {
    height: 14px;
    background: linear-gradient(90deg, #c9a86a, #e6c98f);
    width: 0%;
    transition: width 0.3s;
}

/* Briefumschlag */
.intro-envelope {
    position: relative;
    width: 300px; /* Larger width */
    height: 200px; /* Larger height */
    margin: 0 auto 20px;
    perspective: 1000px; /* For 3D effect */
}

.envelope-body {
    width: 100%;
    height: 100%;
    background: #f5f5dc;
    border-radius: 5px;
    border: 2px solid var(--accent);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e6d8a8;
    clip-path: polygon(0 0, 50% 60%, 100% 0);
    transform-origin: top;
    transition: transform 0.8s ease-in-out;
    z-index: 2;
}

.open .envelope-flap {
    transform: rotateX(180deg);
}

.letter-paper {
    position: absolute;
    top: 100%; /* Start completely below the envelope */
    left: 5%;
    width: 90%;
    height: 90%;
    background: var(--letter-bg); /* Use variable */
    border: 1px solid #ccc;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
    padding: 15px; /* Slightly more padding */
    box-sizing: border-box;
    transform: translateY(0); /* Initial state, will be animated */
    transition: transform 1.2s ease-out; /* Slower animation */
    z-index: 0; /* Behind the flap initially */
    color: var(--letter-fg); /* Use variable */
    text-align: left;
    font-size: 1em; /* Slightly larger font */
    display: flex; /* Use flexbox for content alignment */
    flex-direction: column;
    justify-content: space-between; /* Push button to bottom */
}

.letter-paper p {
    margin-bottom: 8px;
}

.letter-paper .tip-hint {
    font-size: 0.9em;
    color: #a00;
    font-weight: bold;
    margin-top: 15px;
}

.open .letter-paper {
    transform: translateY(-95%); /* Pull up significantly */
    z-index: 3; /* Above the flap when open */
}

.sparkle::after {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffeaa7;
    box-shadow:
        0 0 8px #ffeaa7,
        -10px -5px 4px rgba(255,255,255,0.4),
        10px -3px 4px rgba(255,255,255,0.3);
    animation: sparkle 0.7s ease-out forwards;
}

@keyframes sparkle {
    from { opacity: 1; transform: translate(-50%, 0) scale(1); }
    to   { opacity: 0; transform: translate(-50%, -15px) scale(0.5); }
}

/* loesungen.html */
.loesungen-list .box {
    background: var(--box-bg);
    border-left: 4px solid var(--accent);
    border: none;
}

/* vorschlag.html & admin.html */
/* Removed specific light-theme overrides as they will be handled by the body.light-theme class */

textarea {
    resize: vertical;
    font-family: Arial, sans-serif;
}

label {
    display: block;
    margin-top: 15px;
    text-align: left;
    font-weight: bold;
}

/* admin.html */
.box strong {
    display: block;
    margin-bottom: 10px;
}