body {
    margin: 0;
    padding: 0;
    /* WICHTIG: Fallback-Farbe, damit weisser Text auf schwarzem Grund sichtbar ist, 
       bevor das Bild geladen ist */
    background-color: black; 
    background-image: url('../img/bg.webp');
    background-size: cover;
    background-position: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: white;
    height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    height: 100svh; 
    
    /* TRICK: Wir machen den Inhalt minimal grösser, um Scrollen zu erlauben */
    min-height: 100.1vh; 
    
    /* Wichtig: Das Hintergrundbild muss fixiert sein, damit es nicht mitscrollt */
    background-attachment: fixed;
}

#container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    /* Wichtig: Padding für die Notch */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
}

.top-section {
    text-align: center;
    margin-top: 10px;
    /* Die Magie des Glassmorphismus: */
    background: rgba(80, 80, 80, 0.25);
    /* Dunklerer, sehr transparenter Hintergrund */
    backdrop-filter: blur(20px) saturate(180%);
    /* Starker Weichzeichner + Sättigung für "Vibrancy" */
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    /* ZWINGEND für Safari/iOS */
    padding: 20px 30px;
    /* Abstand innen, damit es wie ein Kasten wirkt */
    border-radius: 25px;
    /* Stark abgerundete Ecken wie bei iOS Widgets */
    border: 1px solid rgba(255, 255, 255, 0.15);
    /* Ein hauchdünner heller Rand */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    /* Leichter Schlagschatten für Tiefe */
    /* Damit der Kasten nicht breiter als der Bildschirm wird */
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

#date {
    font-size: 1.2rem;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 5px;
    /* Etwas Abstand zum Schloss-Icon */
}

#time {
    font-size: 5.5rem;
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1;
    /* Schatten etwas reduziert, da der Glaskasten jetzt hilft */
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
}

.bottom-section {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

.circle-btn {
    width: 50px;
    height: 50px;
    background: rgba(30, 30, 30, 0.6);
    /* Halbtransparenter Hintergrund */
    backdrop-filter: blur(10px);
    /* Der "Milchglas"-Effekt */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-bar {
    width: 140px;
    height: 5px;
    background: white;
    border-radius: 10px;
    margin-bottom: 5px;
}

/* --- Styling für den Swipe-Effekt --- */

/* Der Container hält beide Bildschirme übereinander */
#container {
    position: relative;
    overflow: hidden;
}

#lock-screen {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Damit es animiert werden kann */
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
    position: absolute;
    top: 0;
    left: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
    z-index: 2; /* Liegt oben */
}

/* Der Code-Screen wartet unten */
#passcode-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Glassmorphismus für den gesamten Screen */
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    background: rgba(0, 0, 0, 0.2); 
    
    /* Startposition: Unsichtbar und verschoben */
    transform: translateY(100%); 
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 3;
    
    padding-top: 50px; /* Platz oben */
}

/* --- Aktivierter Zustand (per JS hinzugefügt) --- */
body.unlocking #lock-screen {
    transform: translateY(-20%) scale(0.9); /* Schiebt sich leicht weg und wird kleiner */
    opacity: 0;
}

body.unlocking #passcode-screen {
    transform: translateY(0); /* Fährt hoch */
}

/* --- Keypad Design --- */
.passcode-instruction {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.dots-container {
    display: flex;
    gap: 15px;
    margin-bottom: 50px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid white;
    background: transparent;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 30px;
    row-gap: 20px;
}

.key {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15); /* Transparente Tasten */
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 400;
    transition: background 0.2s;
}

.key:active {
    background: rgba(255, 255, 255, 0.4); /* Aufleuchten beim Tippen */
}

.key.empty {
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
}

/* Neuer Status für gefüllte Punkte */
.dot.filled {
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5); /* Kleiner Glow-Effekt */
}