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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: black;
    color: white;
    font-family: Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}
/* =====================
CAMERA CONTAINER
===================== */
.camera-container {
    position: fixed;
    inset: 0;
    background: black;
}
/* =====================
VIDEO FULLSCREEN
===================== */
video {
    position: absolute;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    filter: grayscale(100%) contrast(120%);
    z-index: 1;
    pointer-events: none; /* 🔥 niente controlli iOS */
}
/* =====================
LOGO CAMERA (TOP CENTER)
===================== */
.camera-logo {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    height: 45px;
    z-index: 20;
    opacity: 0.95;
}
/* =====================
SNAP BUTTON (IPHONE STYLE)
===================== */
.snap-btn {
    position: fixed;
    bottom: 30px;
    bottom: calc(30px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: white;
    z-index: 10;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.25);
}
.snap-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid black;
}
/* =====================
GALLERY LINK (LEFT)
===================== */
.gallery-link {
    position: fixed;
    bottom: 45px;
    bottom: calc(45px + env(safe-area-inset-bottom));
    left: 20px;
    font-size: 14px;
    letter-spacing: 2px;
    font-weight: bold;
    color: white;
    text-decoration: none;
    z-index: 10;
    min-height: 44px;
    display: flex;
    align-items: center;
}
.gallery-link:visited,
.gallery-link:active {
    color: white;
}
/* =====================
FLIP CAMERA (RIGHT)
===================== */
#flip {
    position: fixed;
    bottom: 45px;
    bottom: calc(45px + env(safe-area-inset-bottom));
    left: 75%;
    transform: translateX(-50%);
    font-size: 28px;
    
    color: white;
    cursor: pointer;
    z-index: 10;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* =====================
LIVE HERO
===================== */
.live-hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    text-align: center;
}
.live-title {
    display: flex;
    align-items: center;
    gap: 16px;
}
.live-logo {
    height: 55px;
}
.live-text {
    font-size: 28px;
    letter-spacing: 6px;
    font-weight: bold;
}
/* =====================
LIVE BUTTON
===================== */
.live-btn {
    background: rgb(243,181,63);
    color: black;
    padding: 16px 36px;
    border-radius: 14px;
    text-decoration: none;
    letter-spacing: 2px;
    font-size: 15px;
    font-weight: bold;
}
/* =====================
GALLERY GRID (3 COLONNE)
===================== */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
    max-width: 600px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .gallery {
        grid-template-columns: repeat(4, 1fr);
        max-width: 900px;
        gap: 12px;
        padding: 20px;
    }
}

@media (min-width: 1200px) {
    .gallery {
        grid-template-columns: repeat(5, 1fr);
        max-width: 1100px;
    }
}
.gallery img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 16px;
    filter: grayscale(100%);
    display: block;
}
/* =====================
CAMERA BUTTON (GALLERY)
===================== */
.camera-btn {
    position: fixed;
    bottom: 25px;
    bottom: calc(25px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid white;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    text-decoration: none;
    z-index: 20;
}

/* =====================
RESPONSIVE MOBILE
===================== */
@media (max-width: 480px) {
    .live-text {
        font-size: 20px;
        letter-spacing: 4px;
    }

    .live-logo {
        height: 40px;
    }

    .live-btn {
        padding: 14px 28px;
        font-size: 13px;
    }

    .camera-btn {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    .camera-logo {
        height: 35px;
    }
}
.camera-btn:active {
    transform: translateX(-50%) scale(0.9);
}
/* =====================
BACK BUTTON
===================== */
.back-btn {
    position: fixed;
    bottom: 30px;
    left: 20px;
    font-size: 26px;
    color: white;
    text-decoration: none;
    z-index: 30;
}
/* =====================
IMAGE VIEWER (ZOOM)
===================== */
.viewer {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 100;
}

/* MOBILE: viewer img occupa quasi tutto lo schermo in larghezza */
.viewer img {
    width: 92vw;
    height: auto;
    flex-shrink: 0;
    border-radius: 16px;
}

/* DESKTOP: limita altezza, larghezza segue le proporzioni */
@media (min-width: 768px) {
    .viewer img {
        width: auto;
        max-height: 80vh;
        max-width: 70vw;
    }
}
/* =====================
GRAIN OVERLAY
===================== */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: url('grain.png');
    background-size: cover;
    opacity: 0.2;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 15;
}
/* =====================
HIDE iOS VIDEO UI
===================== */
video::-webkit-media-controls {
    display: none !important;
}
video::-webkit-media-controls-start-playback-button {
    display: none !important;
}
.gallery-logo {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    
    height: 45px;
    z-index: 30;
    opacity: 0.95;
}


/* contenitore bottoni */
.viewer-actions {
    margin-top: 20px;
    
    display: flex;
    gap: 14px;
}
/* base bottoni */
.viewer-actions button,
.viewer-actions a {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    border: none;
    text-decoration: none;
}
/* 🟡 DOWNLOAD (più forte) */
#downloadBtn {
    background: rgb(243,181,63);
    color: black;
    padding: 12px 20px;
    font-size: 15px;
}
/* ⚫ DELETE (più soft) */
#deleteBtn {
    background: #2a2a2a;
    color: #bbb;
    padding: 12px 20px;
    font-size: 15px;
}
.gallery-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: black;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}
.gallery-logo {
    height: 40px;
}
/* sposta la gallery sotto */
.gallery {
    margin-top: 90px;
}
/* 🟡 DOWNLOAD (PRIORITÀ) */
#downloadBtn {
    background: rgb(243,181,63);
    color: black;
    padding: 12px 20px;
    font-size: 15px;
}
/* ⚫ DELETE (secondario) */
#deleteBtn {
    background: #2a2a2a;
    color: #bbb;
    padding: 12px 20px;
    font-size: 15px;
}

/* =====================
RESPONSIVE VIEWER BUTTONS
===================== */
@media (max-width: 768px) {
    .viewer-actions button#deleteBtn,
    .viewer-actions a#downloadBtn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .viewer-actions {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .viewer-actions button#deleteBtn,
    .viewer-actions a#downloadBtn {
        padding: 9px 14px;
        font-size: 13px;
        border-radius: 8px;
    }

    .viewer-actions {
        gap: 8px;
    }
}
