* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'Museum';
    src: url('fonts/Museum-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Museum';
    src: url('fonts/Museum-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


body {
    font-family: 'Museum', sans-serif;
    background-color: #ffffff;
    background-image: radial-gradient(#C9C9C9, 1px, transparent 0);
    background-size: 20px 20px;
    background-position: 0 0;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;

    height: auto;                     /* Allows the page depth to grow dynamically */
    overflow-y: auto;                 /* Normal scrolling kicks in when needed */
    padding-bottom: 140px;
   
    padding-bottom: 180px;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
    touch-action: pan-y;
    

    }

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
    border-bottom: none;
    background-color: transparent;
    gap: 16px;
}

.title-section {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    cursor: pointer;
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 500;
    color: #493F3F;
}

.divider {
    height: 50px;
    border-left: 2px solid #493F3F;
    opacity: 0.3;
}

#subtitle-text {
    font-size: 14px;
    font-weight: 500;
    color: #493F3F;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 16px;
    font-weight: 600;
    color: #493F3F;
    margin-left: auto;
    flex-shrink: 0;
}

.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    color: #999;
    transition: color 0.3s ease;
    padding: 0 8px;
}

.language-switcher .divider {
    width: 1px;
    height: 14px;
    background-color: #493F3F;
    opacity: 0.35;
}

.lang-btn.active {
    color: #493F3F;
}

.lang-btn:hover {
    color: #493F3F;
}

.card-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px 20px;
    min-height: 0;
    height: 100%;
}

#card-stack {
    position: relative;
    width: min(92vw, 420px);
    max-width: 420px;
    min-height: 520px;
    height: 520px;
    aspect-ratio: auto;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-500px) scale(0.7) rotate(calc(var(--card-rotation) + 15deg));
    }
    to {
        transform: translateX(0) scale(1) rotate(var(--card-rotation));
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0) scale(1) rotate(var(--card-rotation));
    }
    to {
        transform: translateX(500px) scale(0.7) rotate(calc(var(--card-rotation) + 15deg));
    }
}

.card {
    position: absolute;
    width: 100%;
    height:fit-content;
    min-height: 400px;
    background: #F9F9F9;
    border-radius: 10px;
    border: 1px solid #C9C9C9;
    box-shadow: 0 4px 10px rgba(73, 63, 63, 0.1);
    display: flex;
    flex-direction: column;
    overflow: visible;
    cursor: grab;
    padding: 0px 20px 20px 20px;
    --card-rotation: calc(var(--random-rotation) * 0.5deg);
    user-select: none; 
    -webkit-user-select: none;
}

.card.entering {
    animation: slideInLeft 0.5s ease-out forwards;
}

.card.exiting {
    animation: slideOutRight 0.5s ease-in forwards;
}

.card:active {
    cursor: grabbing;
}

.card-image {
    position: absolute;
    object-fit: contain;
    pointer-events: none;
    z-index: 10;
    /* 1. Make all images black & white by default */
    filter: grayscale(100%) brightness(140%) contrast(110%);
    
    /* 2. Add a smooth transition for the filter effect */
    transition: filter 0.4s ease-in-out;

    
}

/* 3. Bring back the full color when the card is on top */
.card.top .card-image {
    filter: grayscale(0%) brightness(100%) contrast(100%);
}
.card.top .card-content {
    opacity: 1;
}

.card-content {
    position: relative;
    padding-top: 80px;
    padding-bottom: 40px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: auto;
    overflow: visible;
    opacity: 0.2; /* Dim the text for background cards */
    transition: opacity 0.4s ease-in-out; /* Smoothly fade the text in/out */
   
}

.card-title {
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.2;
    color: #493F3F;
}

.card-text {
    font-size: 16px;
    line-height: 1.6;
    color: #493F3F;
    font-weight: 400;
    flex-grow: 1;
    overflow: visible;
    max-height: none;
}

.card-text-small {
    font-size: 13px; /* Oder ein anderer Wert, der für dich passt */
    display: block;  /* Sorgt dafür, dass die Zeile einen eigenen Absatz bildet */
    margin-top: 5px; /* Optional: Ein bisschen Abstand nach oben */
    opacity: 0.8;    /* Optional: Macht den Text leicht unaufdringlicher */
}

/* Control buttons */
.controls {
    position: fixed;
    bottom: 0;
    left: 50%;                  /* Setzt den Startpunkt genau in die horizontale Mitte */
    transform: translateX(-50%); /* Verschiebt den Container um exakt die Hälfte seiner eigenen Breite nach links -> perfekte Zentrierung */
    width: 100%;                /* Nutzt die volle Breite für das Zentrieren */
    max-width: 420px;           /* Passt sich perfekt an die maximale Breite deines #card-stack an */
    
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;    /* Zentriert die Buttons innerhalb des Containers */
    align-items: center;
    gap: 20px;
    padding: 16px 20px 30px;
    z-index: 100;
    background: linear-gradient(to top, rgba(255,255,255,0.95), rgba(255,255,255,0.75) 60%, transparent);
}

.buttons-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
}



.control-btn {
    border: 1px solid #493F3F;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display:flex; 
    align-items: center;
    gap: 10px;
    background: white;
    color: #493F3F;
}

.undo-btn {
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    flex-shrink: 0;
}

.undo-btn:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.undo-btn:active {
    transform: scale(0.95);
}

.next-btn {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    white-space: nowrap;
    background: #493F3F;
    color: white;
    border-color: #493F3F;
}

.next-btn:hover {
    background: #5a4f4f;
    border-color: #5a4f4f;
    transform: scale(1.02);
}

.next-btn:active {
    transform: scale(0.98);
}

.undo-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Container für die Buttons auf dem Endscreen */
.end-actions-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
}

/* Setzt das Margin des Buttons zurück, damit Flexbox greift */
.end-actions-wrapper .next-btn {
    margin: 0 !important;
}

/* Runder Info-Button direkt neben dem Restart-Button */
.info-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 400;
    background: white;
    border: 1px solid #493F3F;
    color: #493F3F;
    cursor: pointer;
    transition: all 0.3s ease;
    
}

.info-btn:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.info-btn:active {
    transform: scale(0.95);
}


/* Scrollbar styling for card text */
.card-text::-webkit-scrollbar {
    width: 6px;
}

.card-text::-webkit-scrollbar-track {
    background: transparent;
}

.card-text::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.card-text::-webkit-scrollbar-thumb:hover {
    background: #999;
}

@media (max-width: 640px) {
    .header {
        padding: 18px 16px;
        align-items: flex-start;
    }

    .title-section {
        flex: 1 1 auto;
        min-width: 0;
    }

    .language-switcher {
        margin-left: auto;
        align-self: flex-start;
    }

    .logo {
        height: 48px;
    }

     .info-btn {
        bottom: 20px;
        right: 20px;
    }

    .card-container {
        padding: 80px 10px 10px; 
    }
}

.end-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: left;
    text-align: left;
    height: 100%;
    width: 100%;
    padding: 40px;
    color: #493F3F;
}

.end-text {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.end-title {
    font-size: 22px; 
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.2;
    color: #493F3F;
}

.end-link {
    color: #493F3F;
    font-weight: 700;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.end-link:hover {
    opacity: 0.7;
}


/* Das Modale Fenster */

.modal {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal.show {
    display: flex;
    opacity: 1;
}


.modal-content {
    background: #F9F9F9;
    border: 1px solid #C9C9C9;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(73, 63, 63, 0.309);
    padding: 40px 30px 30px;
    width: 100%;
    max-width: 380px;
    position: relative;
    color: #493F3F;
    transform: scale(0.9) rotate(3deg);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1) rotate(2deg);
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #493F3F;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close-btn svg {
    pointer-events: none;
}

.modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

/* Styling für die Links im Modal */
.modal-body a {
    color: #493F3F;
    font-weight: 700;
    text-decoration: underline;
}

