* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    cursor: none;
    margin: 0;
    padding: 0;
    /* Safe area for notches and rounded corners */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body.show-cursor {
    cursor: default;
}

#photo-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#current-photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    padding: 80px 50px 60px;
    padding-bottom: max(60px, calc(env(safe-area-inset-bottom) + 40px));
    padding-left: max(50px, calc(env(safe-area-inset-left) + 30px));
    padding-right: max(50px, calc(env(safe-area-inset-right) + 30px));
    pointer-events: none;
}

#clock-container {
    max-width: 600px;
}

#time {
    font-size: 72px;
    font-weight: 200;
    letter-spacing: -2px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

#date {
    font-size: 28px;
    font-weight: 300;
    margin-top: 8px;
    opacity: 0.9;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

#photo-info {
    font-size: 16px;
    margin-top: 20px;
    opacity: 0.7;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

#controls {
    position: fixed !important;
    bottom: 100px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex;
    gap: 15px;
    opacity: 1 !important;
    pointer-events: all;
    z-index: 99999 !important;
}

/* Always show controls on touch devices */
@media (hover: none) {
    #controls {
        opacity: 1 !important;
        bottom: 80px !important;
    }
}

body.show-cursor #controls {
    opacity: 1;
}

#controls button {
    background: rgba(255,255,255,0.4);
    border: 3px solid rgba(255,255,255,0.7);
    color: #fff;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    font-size: 32px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
}

#controls button:hover {
    background: rgba(255,255,255,0.5);
    transform: scale(1.1);
}

#controls button:active {
    transform: scale(0.95);
}

#auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#auth-screen.hidden {
    display: none;
}

#setup-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#setup-screen.hidden {
    display: none;
}

#setup-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

#setup-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

#setup-content p {
    font-size: 18px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

#album-url {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #fff;
}

#album-url::placeholder {
    color: rgba(255,255,255,0.6);
}

#upload-btn {
    background: #fff;
    color: #667eea;
    border: none;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    margin: 20px 0;
}

#upload-btn:hover {
    transform: scale(1.05);
}

.upload-area {
    margin: 20px 0;
}

#load-btn {
    background: #fff;
    color: #667eea;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

#load-btn:hover {
    transform: scale(1.05);
}

.instructions {
    text-align: left;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 8px;
}

.instructions h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.instructions ol {
    margin-left: 20px;
    font-size: 14px;
    line-height: 1.6;
}

#settings-btn {
    font-size: 20px;
}

#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    opacity: 0.7;
    display: none;
}

#loading.show {
    display: block;
}

#error {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 38, 38, 0.9);
    padding: 16px 24px;
    border-radius: 8px;
    display: none;
}

#error.show {
    display: block;
}

body.night-mode #overlay {
    opacity: 0.6;
}

@media (max-width: 768px) {
    #time {
        font-size: 48px;
    }
    
    #date {
        font-size: 20px;
    }
    
    #overlay {
        padding: 40px 20px 20px;
    }
    
    #controls {
        bottom: 20px;
        right: 20px;
        gap: 8px;
    }
    
    #controls button {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
}

/* Portrait mode - center controls at bottom */
@media (max-width: 768px) and (orientation: portrait) {
    #controls {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        bottom: 100px !important;
        gap: 20px;
    }
    
    #controls button {
        width: 80px !important;
        height: 80px !important;
        font-size: 36px !important;
        border: 4px solid rgba(255,255,255,0.9) !important;
        background: rgba(255,255,255,0.5) !important;
    }
    
    #overlay {
        padding: 40px 30px 220px;
        padding-bottom: max(220px, calc(env(safe-area-inset-bottom) + 200px));
        padding-left: max(30px, calc(env(safe-area-inset-left) + 10px));
        padding-right: max(30px, calc(env(safe-area-inset-right) + 10px));
    }
    
    #clock-container {
        max-width: 100%;
    }
    
    #time {
        font-size: 64px;
    }
    
    #date {
        font-size: 24px;
    }
    
    #photo-info {
        font-size: 16px;
        margin-top: 15px;
    }
}

.note {
    font-size: 14px;
    opacity: 0.7;
    margin-top: 20px;
}

#refresh-btn {
    font-size: 20px;
}


#weather {
    font-size: 32px;
    margin: 10px 0;
    font-weight: 300;
}

#photo-description {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 14px;
    opacity: 0.85;
    font-weight: 500;
    text-align: right;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 16px;
    border-radius: 8px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

