body {
    font-family: -apple-system, sans-serif;
    background-color: #121212;
    color: white;
    margin: 0;
    overflow-x: hidden;
    transition: background-color 0.6s ease;
}

#mainHeader {
    width: 100%;
    /* Verwendet 8% der Displayhöhe als Padding, maximal aber 30px */
    padding: clamp(10px, 4vh, 30px) 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-logo {
    /* Responsive Breite: 60% der Bildschirmbreite */
    width: 60vw; 
    /* Begrenzung: Auf großen Bildschirmen niemals breiter als 350px */
    max-width: 350px; 
    /* Höhe passt sich automatisch an, um Proportionen zu wahren */
    height: auto; 
    
    display: block;
    cursor: pointer;
    filter: drop-shadow(0 0 8px rgba(0, 242, 255, 0.2));
    transition: transform 0.3s ease;
}

/* Für sehr kleine Handys (z.B. iPhone SE) */
@media (max-width: 320px) {
    .app-logo {
        width: 75vw; /* Etwas breiter auf Kleinstgeräten */
    }
}

.app-logo:hover {
    transform: scale(1.02);
}

/* Den Hauptcontainer für Flex-Layout vorbereiten */
.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Volle Displayhöhe */
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    box-sizing: border-box;
}

.hidden { display: none !important; }

header h1 { text-align: center; letter-spacing: 5px; font-weight: 200; margin-top: 20px; font-size: 1.8rem; }

/* Scan-Bereich */
.scan-section { text-align: center; margin-top:20px; flex: 1; }

/* Der neue Record-Button Style */
#recordBtn {
    width: 35vw; 
    height: 35vw;
    max-width: 140px;
    max-height: 140px;
    border-radius: 50%;
    border: none;
    background: #00f2ff;
    box-shadow: 0 0 30px rgba(82, 171, 221, 1);
    cursor: pointer;
    
    /* Einbindung des Scan-Bildes */
    background-image: url('assets/scan.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 120%; /* Bildgröße innerhalb des Buttons */
    
    /*display: flex;*/
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

#recordBtn:active {
    transform: scale(0.92);
}

/* Pulsieren während des Scannens */
#recordBtn.recording {
    animation: pulseRecording 1.5s infinite;
    background-color: #ff00ff; /* Ändert Farbe zu Magenta beim Scannen */
    box-shadow: 0 0 40px rgba(255, 0, 255, 0.6);
}

@keyframes pulseRecording {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Zentrierung der Start-Ansicht */
#startView {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

/* Die Ergebnisseite als Flex-Center-Box */
#resultView {
    flex: 1;                /* Nutzt allen verfügbaren Platz zwischen Header und Footer */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertikale Zentrierung */
    align-items: center;     /* Horizontale Zentrierung */
    text-align: center;
    width: 100%;
    margin-top: 4rem;
    padding: 20px 0;
    animation: fadeIn 0.8s ease;
}

.res-artist { font-size: 2rem; color: #121212; margin: 0; font-weight: 600; width: 100%; }
.res-title { font-size: 2rem; color: #121212; margin: 5px 0; font-weight: 400; line-height: 1.1; width: 100%; }
.res-year { font-size: 6rem; color: #121212; margin: 5px 0; font-weight: 900; letter-spacing: -2px; }
/* Der Trennstrich zwischen Artist und Title */
.res-divider {
    width: 40%;              /* 40% der Displaybreite */
    border: none;            /* Standard-Rahmen entfernen */
    height: 2px;             /* Dicke des Strichs */
    background-color: rgba(18, 18, 18, 0.3); /* Dunkelgrau mit leichter Transparenz */
    margin: 15px 0;       /* Abstand oben/unten und horizontal zentriert */
    border-radius: 2px;      /* Abgerundete Enden für einen weicheren Look */
}

/* Button-Gruppe: Responsiv & Zentriert */
.button-group { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 12px; 
    margin-top: 20px; 
    width: 100%; 
}

.btn-rescan, .btn-listen, .donate-pill {
    width: 85%; /* Nimmt 85% der Displaybreite ein */
    max-width: 280px; /* Wird nie breiter als 280px */
    padding: 10px 0; /* Vertikales Padding für Treffsicherheit */
    border-radius: 50px;
    border: none;
    font-weight: bold;
    text-align: center;
    display: block;
    cursor: pointer;
    box-sizing: border-box;
}

.btn-rescan { background: #121212; color: white; }
.btn-listen { background: #1DB954; color: white; }
.donate-pill { 
    background: #003087; 
    color: white !important; 
    text-decoration: none; 
    font-size: 0.9rem; 
}

/* Verlauf */
.history-section { margin-top: 30px; padding-bottom: 20px; }
.history-section h3 { font-size: 0.8rem; color: #636363; text-transform: uppercase; border-bottom: 1px solid #222; margin: 15px; }
#historyList li { padding: 12px 0; border-bottom: 1px solid #1e1e1e; }
.history-link { text-decoration: none; color: #ccc; font-size: 0.9rem; display: block; }
#toggleHistory {
    display: block;         /* Erlaubt margin: auto */
    margin: 10px auto;      /* Zentriert den Button innerhalb der Sektion */
    background: none;
    border: 1px solid #333;
    color: #777;
    padding: 10px 20px;
    border-radius: 20px;
    width: auto;            /* Button ist nur so breit wie sein Text */
    min-width: 150px;       /* Sorgt für eine schöne Tipp-Fläche auf dem Handy */
    cursor: pointer;
    font-size: 0.9rem;
}

/* --- ADVERTISING FOOTER SECTION --- */
/* --- ABSOLUT SICHERER AD-FOOTER --- */

.ad-space {
    width: 100%;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent; /* Hier kannst du #1a1a1a testen, um den Bereich zu sehen */
    min-height: 50px;       /* Erzwingt eine Mindesthöhe, falls das Bild nicht lädt */
}

.ad-banner-link {
    display: block !important;
    width: 90%;             /* Nutzt fast die volle Breite des Handys */
    max-width: 350px;       /* Begrenzung für bessere Optik */
    margin: 0 auto;         /* Zentrierung */
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    background: #222;       /* Platzhalter-Farbe, falls das Bild unsichtbar bleibt */
}

.ad-full-image {
    width: 100% !important;
    height: auto !important;
    min-height: 20px;       /* Verhindert, dass das Bild auf 0px kollabiert */
    display: block !important;
    border: none;
    object-fit: contain;
}
/* Container für Label + Bild */
.ad-wrapper {
    width: 92%;              /* Gleiche Breite wie der Banner */
    max-width: 400px;        /* Begrenzung wie beim Banner */
    display: flex;
    flex-direction: column;  /* Stapelt Text über Bild */
    align-items: flex-start; /* Richtet alles linksbündig aus */
}

/* Der "ADVERTISEMENT" Hinweis */
.ad-label {
    font-size: 9px;          /* Sehr kleine Schrift */
    color: #666;             /* Dezentes Grau */
    letter-spacing: 1px;     /* Etwas Abstand zwischen den Buchstaben */
    margin-bottom: 4px;      /* Kleiner Abstand zum Bild */
    font-weight: bold;
    text-transform: uppercase;
}


/* Popup Overlay - Garantiert im Vordergrund */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* Extrem hoch, um alles zu überlagern */
    backdrop-filter: blur(5px); /* Schicker Unschärfe-Effekt im Hintergrund */
}

.popup-content {
    background: #1e1e1e;
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    width: 85%;
    max-width: 300px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.popup-content h3 {
    margin-top: 0;
    font-size: 1.2rem;
    color: #fff;
}

.popup-content button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 15px;
    border-radius: 12px;
    border: none;
    background: #333;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
}

/* Spezielle Farbe für den Schließen-Button */
.btn-close-popup {
    background: transparent !important;
    color: #ff4d4d !important;
    margin-top: 5px !important;
    font-size: 0.9rem !important;
}

/* Das "GEWUSST?" Overlay */
.quiz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4); /* Leicht transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    cursor: pointer;
}

.quiz-content {
    font-size: 8vh;
    font-weight: 900;
    color: white;
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation: pulse 1.5s infinite;
}

/* Der Blur-Effekt für die Ergebnisseite */
.blurred {
    filter: blur(25px); /* Macht den Hintergrund unkenntlich */
    pointer-events: none; /* Verhindert Klicks auf die Buttons solange es blurrig ist */
}

/* Sanfter Übergang beim Aufdecken */
#resultView {
    transition: filter 0.5s ease;
}