/**
 * ButterDuck Disposable Uploads - Styles
 * Version: 2.1.5 (2026-04-09)
 */

/* ===== Base Styles ===== */
.butterduck-uploader,
.butterduck-gallery {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.butterduck-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #1a1a1a;
}

.butterduck-card {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e5e7eb;
}

.butterduck-uploader-description {
    font-size: 15px;
    color: #4a3800;
    line-height: 1.75;
    margin: -8px 0 20px;
    padding: 14px 18px;
    background: transparent;
    border-left: 3px solid #FED03D;
    border-radius: 0 8px 8px 0;
}

/* ===== Forms & Inputs ===== */
.butterduck-card label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.butterduck-card input[type="text"],
.butterduck-card textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.butterduck-card input[type="text"]:focus,
.butterduck-card textarea:focus {
    outline: none;
    border-color: #FED03D;
    box-shadow: 0 0 0 3px rgba(254, 208, 61, 0.25);
}

.butterduck-card textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== Buttons ===== */
.butterduck-btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: #f3f4f6;
    color: #374151;
    box-sizing: border-box;
}

.butterduck-btn:hover {
    background: #e5e7eb;
}

.butterduck-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.butterduck-btn-primary {
    background: #FED03D;
    color: #1a1a1a;
}

.butterduck-btn-primary:hover {
    background: #f0c12a;
}

.butterduck-btn-download {
    background: #16a34a;
    color: white;
}

.butterduck-btn-download:hover {
    background: #15803d;
}

#butterduck-start-btn {
    margin-top: 16px;
}

/* ===== Upload Interface ===== */
.butterduck-step {
    animation: fadeIn 0.3s ease-in;
}

.butterduck-welcome {
    font-size: 18px;
    margin-bottom: 24px;
    padding: 16px;
    background: #fffbea;
    border-radius: 8px;
    color: #5a3e00;
}

.butterduck-info {
    margin-top: 16px;
    padding: 14px 4px;
    background: transparent;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.9;
}

.butterduck-upload-zone {
    margin: 24px 0;
    padding: 24px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
}

.butterduck-upload-zone.drag-over {
    border-color: #FED03D;
    background: #fffbea;
}

/* ===== File Preview Grid ===== */
.butterduck-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.butterduck-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

/* Green check for uploaded previews */
.butterduck-upload-check {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.95); /* emerald-500 */
    color: #fff;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.butterduck-preview-item.uploaded .butterduck-upload-check {
    opacity: 1;
    transform: scale(1);
}

.butterduck-preview-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.butterduck-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    box-sizing: border-box;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.9);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cline x1='1' y1='1' x2='11' y2='11' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='11' y1='1' x2='1' y2='11' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

.butterduck-remove-btn:hover {
    transform: scale(1.1);
}

.butterduck-file-name {
    padding: 8px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Progress Bar ===== */
.butterduck-progress {
    margin: 24px 0;
}

.butterduck-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.butterduck-progress-fill {
    height: 100%;
    background: #10b981;
    transition: width 0.3s ease;
}

.butterduck-progress-text {
    margin-top: 8px;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}

/* ===== Photo Grid ===== */
.butterduck-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.butterduck-photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: transform 0.2s;
}

.butterduck-photo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.butterduck-photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.butterduck-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.9);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'%3E%3C/polyline%3E%3Cpath d='M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6'%3E%3C/path%3E%3Cpath d='M10 11v6'%3E%3C/path%3E%3Cpath d='M14 11v6'%3E%3C/path%3E%3Cpath d='M9 6V4a1 1 0 011-1h4a1 1 0 011 1v2'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.butterduck-photo-item:hover .butterduck-delete-btn {
    opacity: 1;
}

/* ===== Gallery Sections ===== */
.butterduck-uploaded-section,
.butterduck-message-section,
.butterduck-messages-section {
    margin-top: 40px;
}

.butterduck-contributor-section {
    margin-top: 24px;
    padding: 20px;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.butterduck-uploaded-section h3,
.butterduck-message-section h3,
.butterduck-contributor-name,
.butterduck-messages-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
}

/* Section header row: title + action buttons side by side, wraps on small screens */
.butterduck-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.butterduck-section-header .butterduck-contributor-name,
.butterduck-section-header h3 {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.butterduck-section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

.butterduck-photo-count {
    font-size: 14px;
    font-weight: 400;
    color: #6b7280;
}

/* ===== Gallery Controls ===== */
.butterduck-gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.butterduck-gallery-controls-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.butterduck-stats {
    display: flex;
    gap: 24px;
    font-size: 14px;
    color: #6b7280;
}

.butterduck-stats strong {
    color: #1f2937;
    margin-left: 4px;
}

/* ===== Admin Controls ===== */
.butterduck-admin-controls {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.butterduck-photo-item:hover .butterduck-admin-controls {
    opacity: 1;
}

.butterduck-admin-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.butterduck-hide-btn {
    background: rgba(251, 191, 36, 0.9);
    color: white;
}

.butterduck-hide-btn:hover {
    background: rgba(245, 158, 11, 0.95);
}

.butterduck-unhide-btn {
    background: rgba(20, 184, 166, 0.9);
    color: white;
}

.butterduck-unhide-btn:hover {
    background: rgba(13, 148, 136, 0.95);
}

.butterduck-admin-controls .butterduck-delete-btn {
    position: static;
    width: auto;
    height: auto;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    opacity: 1;
}

.butterduck-admin-controls .butterduck-delete-btn:hover {
    background: rgba(220, 38, 38, 0.95);
}

/* ===== Messages ===== */
.butterduck-messages-list {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.butterduck-message {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.butterduck-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.butterduck-message-date {
    font-size: 12px;
    color: #9ca3af;
}

.butterduck-message-body {
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.butterduck-message-status {
    margin-top: 10px;
    font-size: 14px;
    color: #10b981;
}

/* ── Per-contributor messages & voice (organizer gallery) ── */
.butterduck-contributor-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.butterduck-contributor-messages .butterduck-message {
    background: #f9fafb;
}

.butterduck-contributor-voices {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.butterduck-contributor-voices .butterduck-voice-item {
    width: 100%;
    max-width: 100%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.butterduck-contributor-voices .butterduck-voice-item-audio {
    flex: 1;
    width: 100%;
    min-width: 0;
}

.butterduck-voice-admin-delete {
    flex: 0 0 auto;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.butterduck-voice-admin-delete:hover {
    background: rgba(220, 38, 38, 0.95);
}

/* ===== Lightbox progress circle ===== */
.butterduck-lb-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.butterduck-lb-progress svg {
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
}

.butterduck-lb-progress.indeterminate svg {
    animation: bd-lb-spin 1.1s linear infinite;
    transform-origin: center;
}

@keyframes bd-lb-spin {
    from { transform: rotate(0deg);   }
    to   { transform: rotate(360deg); }
}

/* ===== Likes ===== */
.butterduck-like-btn {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.52);
    border: none;
    border-radius: 20px;
    color: #fff;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
    transition: background 0.15s, transform 0.1s;
    backdrop-filter: blur(2px);
    line-height: 1.4;
}

.butterduck-like-btn:hover {
    background: rgba(0, 0, 0, 0.72);
    transform: scale(1.06);
}

.butterduck-like-heart {
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    transition: color 0.15s;
}

.butterduck-like-btn.liked .butterduck-like-heart {
    color: #f43f5e;
}

.butterduck-like-count {
    font-size: 12px;
    font-weight: 600;
}

/* ===== Gallery Tabs ===== */
.butterduck-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.butterduck-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    color: #6b7280;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    transition: color 0.15s, border-color 0.15s;
}

.butterduck-tab:hover {
    color: #111;
}

.butterduck-tab.active {
    color: #111;
    border-bottom-color: #111;
    font-weight: 700;
}

/* ===== Top Liked Grid ===== */
.butterduck-top-liked-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 4px;
}

.butterduck-top-liked-item .butterduck-top-liked-rank {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.60);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    z-index: 2;
    backdrop-filter: blur(2px);
}

.butterduck-top-liked-meta {
    position: absolute;
    bottom: 36px;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.48));
    color: #fff;
    font-size: 12px;
    text-align: center;
    pointer-events: none;
}

/* ===== Lightbox ===== */
.butterduck-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.butterduck-lightbox-content {
    position: relative;
    width: 75vw;
    height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.butterduck-lightbox img {
    width: 75vw;
    height: 75vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.butterduck-lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
    z-index: 10001;
}

.butterduck-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Lightbox prev/next nav arrows */
.butterduck-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
    user-select: none;
}
.butterduck-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}
.butterduck-lightbox-nav-prev { left: 12px; }
.butterduck-lightbox-nav-next { right: 12px; }

/* ===== Notifications ===== */
.butterduck-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 320px;
}

.butterduck-notification.show {
    transform: translateX(0);
}

.butterduck-notification-success {
    border-left: 4px solid #10b981;
    color: #065f46;
}

.butterduck-notification-error {
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.butterduck-notification-warning {
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.butterduck-notification-info {
    border-left: 4px solid #FED03D;
    color: #5a3e00;
}

/* ===== Loading States ===== */
.butterduck-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.butterduck-loading::after {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    margin-left: 12px;
    border: 3px solid #e5e7eb;
    border-top-color: #FED03D;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.butterduck-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 16px;
}

.butterduck-error {
    text-align: center;
    padding: 40px 20px;
    color: #ef4444;
    background: #fef2f2;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .butterduck-card {
        padding: 20px;
    }

    .butterduck-title {
        font-size: 24px;
    }

    .butterduck-photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .butterduck-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }

    .butterduck-gallery-controls {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .butterduck-stats {
        flex-wrap: wrap;
        gap: 16px;
    }

    /* Notification slides from top on mobile to avoid horizontal overflow */
    .butterduck-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-120%);
    }

    .butterduck-notification.show {
        transform: translateY(0);
    }

    .butterduck-lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    .butterduck-lightbox-nav-prev { left: 4px; }
    .butterduck-lightbox-nav-next { right: 4px; }

    .butterduck-lightbox-close {
        top: 8px;
        right: 8px;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    /* Main upload flow buttons: full-width block on all mobile sizes */
    #butterduck-start-btn,
    #butterduck-select-btn,
    #butterduck-upload-btn,
    #butterduck-message-btn {
        display: block;
        width: 100%;
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    .butterduck-uploader,
    .butterduck-gallery {
        padding: 10px;
    }

    .butterduck-card {
        padding: 16px;
    }

    /* 2-column grid on phones — bigger images, easier to tap */
    .butterduck-photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .butterduck-photo-item img {
        height: 160px;
    }

    /* 3-column preview grid before upload */
    .butterduck-preview-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .butterduck-preview-item img {
        height: 90px;
    }

    /* Smaller delete button so it doesn't overwhelm the image */
    .butterduck-delete-btn {
        width: 26px;
        height: 26px;
        font-size: 15px;
        top: 4px;
        right: 4px;
    }

    /* Smaller remove button in preview grid */
    .butterduck-remove-btn {
        width: 22px;
        height: 22px;
        top: 4px;
        right: 4px;
    }

    /* Compact admin buttons in gallery */
    .butterduck-admin-btn {
        font-size: 11px;
        padding: 4px 8px;
    }

    .butterduck-title {
        font-size: 20px;
    }

    .butterduck-uploaded-section h3,
    .butterduck-message-section h3,
    .butterduck-contributor-name,
    .butterduck-messages-section h3 {
        font-size: 17px;
    }
}

/* Touch devices: always show action buttons (no hover on touchscreens) */
@media (hover: none) {
    .butterduck-delete-btn {
        opacity: 1;
    }

    .butterduck-admin-controls {
        opacity: 1;
    }

    /* Disable hover lift to prevent stuck state on tap */
    .butterduck-photo-item:hover {
        transform: none;
        box-shadow: none;
    }

    /* Larger tap targets for admin buttons on touch devices */
    .butterduck-admin-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }

    /* Always show star button */
    .butterduck-star-btn {
        opacity: 1;
    }
}

/* ===== Favorites ===== */
.butterduck-favorites-section {
    border: 2px solid #fbbf24;
    border-radius: 12px;
    padding: 16px;
    background: #fffbeb;
    margin-bottom: 8px;
}

.butterduck-favorites-title {
    color: #92400e !important;
}

/* Star button — sits at top-right of each photo item */
.butterduck-star-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, color 0.15s, background 0.15s, transform 0.15s;
    z-index: 3;
    padding: 0;
    line-height: 1;
}

.butterduck-photo-item:hover .butterduck-star-btn {
    opacity: 1;
}

.butterduck-star-btn.favorited {
    opacity: 1;
    color: #fbbf24 !important;
}

.butterduck-star-btn:hover {
    background: #fbbf24 !important;
    color: #fff !important;
    transform: scale(1.15);
}


/* ===== Multi-select ===== */
.butterduck-select-label {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    line-height: 0;
    cursor: pointer;
}

.butterduck-photo-checkbox,
.butterduck-hidden-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #FED03D;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.butterduck-photo-item.butterduck-selected {
    outline: 3px solid #FED03D;
    outline-offset: 0;
}

.butterduck-selection-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: #FED03D;
    color: #1a1a1a;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}

#butterduck-selection-count {
    flex: 1;
    min-width: 100px;
    font-weight: 600;
}

.butterduck-selection-btn {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
    background: rgba(0,0,0,0.12);
    color: #1a1a1a;
}

.butterduck-selection-btn:hover {
    opacity: 0.85;
}

.butterduck-selection-btn-warning {
    background: #f59e0b;
    color: #fff;
}

.butterduck-selection-btn-danger {
    background: #ef4444;
    color: #fff;
}

.butterduck-selection-btn-cancel {
    background: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.6);
}

.butterduck-selection-btn-download {
    background: #16a34a;
    color: #fff;
}

@media (max-width: 480px) {
    .butterduck-selection-bar {
        gap: 8px;
        padding: 10px 12px;
    }
    .butterduck-selection-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    #butterduck-selection-count {
        width: 100%;
        flex: none;
    }
}

/* ===== Print Styles ===== */
@media print {
    .butterduck-gallery-controls,
    .butterduck-admin-controls,
    .butterduck-delete-btn,
    .butterduck-remove-btn,
    .butterduck-lightbox {
        display: none !important;
    }
    
    .butterduck-photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== Role Selection ===== */
.butterduck-role-screen {
    margin: 32px 0;
}

.butterduck-role-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 360px;
    margin: 0 auto;
}

/* Guest — primary, full-width prominent card */
.butterduck-role-btn {
    width: 100%;
    padding: 28px 24px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.butterduck-role-btn:hover {
    border-color: #FED03D;
    box-shadow: 0 8px 24px rgba(254, 208, 61, 0.35);
    transform: translateY(-2px);
}

.butterduck-role-btn:focus {
    outline: 2px solid #FED03D;
    outline-offset: 2px;
}

.butterduck-role-label {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
}

.butterduck-role-desc {
    display: block;
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
}

/* Organizer — small, unobtrusive text-link style */
.butterduck-role-btn-host {
    padding: 10px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
}

.butterduck-role-btn-host .butterduck-role-label {
    font-size: 13px;
    font-weight: 500;
    color: #9ca3af;
    margin-bottom: 0;
}

.butterduck-role-btn-host .butterduck-role-desc {
    display: none;
}

.butterduck-role-btn-host:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    box-shadow: none;
    transform: none;
    color: #6b7280;
}

.butterduck-role-btn-host:hover .butterduck-role-label {
    color: #6b7280;
}

/* ===== Host Password Modal ===== */
.butterduck-host-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: fadeIn 0.2s ease;
}

.butterduck-host-modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: 16px;
}

.butterduck-host-modal-box h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1f2937;
}

.butterduck-host-modal-error {
    color: #ef4444;
    font-size: 14px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #fef2f2;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.butterduck-host-modal-box input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.butterduck-host-modal-box input[type="password"]:focus {
    outline: none;
    border-color: #FED03D;
    box-shadow: 0 0 0 3px rgba(254, 208, 61, 0.25);
}

.butterduck-host-modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .butterduck-role-select {
        max-width: 100%;
    }
}

/* ===== Accessibility ===== */
.butterduck-btn:focus,
.butterduck-admin-btn:focus,
button:focus {
    outline: 2px solid #FED03D;
    outline-offset: 2px;
}

.butterduck-photo-thumb:focus {
    outline: 3px solid #FED03D;
    outline-offset: 2px;
}

/* ===== Voice Recorder ===== */
.butterduck-voice-section {
    margin-top: 40px;
}

.butterduck-voice-section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1f2937;
}

.butterduck-voice-hint {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 20px;
}

.butterduck-voice-ui {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

/* Persistent status dot */
.butterduck-voice-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #d1d5db;
    transition: background 0.3s;
}
.butterduck-voice-dot--idle      { background: #d1d5db; }
.butterduck-voice-dot--recording { background: #ef4444; animation: bd-pulse-record 1.2s ease-in-out infinite; }
.butterduck-voice-dot--saving    { background: #f59e0b; animation: bd-pulse-record 0.8s ease-in-out infinite; }
.butterduck-voice-dot--saved     { background: #10b981; }
.butterduck-voice-dot--error     { background: #ef4444; }

.butterduck-voice-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.butterduck-voice-btn-record {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.butterduck-voice-btn-record:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5);
}

.butterduck-voice-btn-stop {
    background: #374151;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    animation: bd-pulse-record 1.2s ease-in-out infinite;
}

.butterduck-voice-btn-icon {
    font-size: 12px;
}

.butterduck-voice-timer {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #ef4444;
    min-width: 48px;
}

.butterduck-voice-preview {
    margin-top: 12px;
}

.butterduck-voice-preview audio {
    width: 100%;
    margin-bottom: 12px;
}

.butterduck-voice-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.butterduck-voice-status {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

.butterduck-voice-status--success { color: #10b981; }
.butterduck-voice-status--error   { color: #ef4444; }

/* Voice message list */
.butterduck-voice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.butterduck-voice-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 10px 12px;
}

.butterduck-voice-item-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    min-width: 90px;
}

.butterduck-voice-item-audio {
    flex: 1;
    height: 32px;
    min-width: 0;
}

.butterduck-voice-item-delete {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(239,68,68,0.5);
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.butterduck-voice-item-delete:hover {
    background: rgba(239,68,68,0.35);
}

@keyframes bd-pulse-record {
    0%, 100% { box-shadow: 0 4px 14px rgba(0,0,0,0.15), 0 0 0 0 rgba(239,68,68,0); }
    50%       { box-shadow: 0 4px 14px rgba(0,0,0,0.15), 0 0 0 8px rgba(239,68,68,0.2); }
}

/* ===== Design Enhancements: Liquid Glass + Animations ===== */

/* Gradient stage so glass has colour to reflect */
.butterduck-uploader {
    background: linear-gradient(145deg, #fffce8 0%, #fff8d0 40%, #fffbea 70%, #fef6c0 100%);
    border-radius: 24px;
    padding: 32px;
    position: relative;
    overflow: hidden;
}

/* Blurred ambient blob behind the card */
.butterduck-uploader::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(254,208,61,0.28) 0%, transparent 70%);
    pointer-events: none;
    animation: bd-blob-drift 8s ease-in-out infinite alternate;
}

.butterduck-uploader::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(254,208,61,0.18) 0%, transparent 70%);
    pointer-events: none;
    animation: bd-blob-drift 11s ease-in-out infinite alternate-reverse;
}

/* Liquid-glass card */
.butterduck-uploader .butterduck-card {
    background: rgba(255, 255, 255, 0.68);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 20px;
    box-shadow:
        0 2px 0 rgba(255,255,255,0.9) inset,
        0 -1px 0 rgba(0,0,0,0.04) inset,
        0 12px 40px rgba(0, 0, 0, 0.10),
        0 4px 12px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 1;
    animation: bd-card-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Upload zone — glass inset + hover glow */
.butterduck-uploader .butterduck-upload-zone {
    background: rgba(255, 255, 255, 0.45);
    border: 2px dashed rgba(254, 208, 61, 0.5);
    border-radius: 16px;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
    position: relative;
    overflow: hidden;
}

.butterduck-uploader .butterduck-upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, transparent 60%);
    pointer-events: none;
}

.butterduck-uploader .butterduck-upload-zone:hover {
    border-color: #FED03D;
    box-shadow: 0 0 0 4px rgba(254, 208, 61, 0.15), 0 8px 24px rgba(254, 208, 61, 0.12);
    background: rgba(255, 253, 220, 0.55);
}

.butterduck-uploader .butterduck-upload-zone.drag-over {
    border-color: #f0c015;
    background: rgba(255, 251, 200, 0.65);
    box-shadow: 0 0 0 6px rgba(254, 208, 61, 0.25), 0 12px 32px rgba(254, 208, 61, 0.18);
    animation: bd-zone-pulse 0.7s ease-in-out infinite alternate;
}

/* Primary button — gradient + shimmer + lift */
.butterduck-uploader .butterduck-btn-primary {
    background: linear-gradient(135deg, #FED03D 0%, #f7c520 50%, #FED03D 100%);
    background-size: 200% auto;
    box-shadow: 0 4px 14px rgba(254, 208, 61, 0.40);
    transition: background-position 0.4s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.butterduck-uploader .butterduck-btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.butterduck-uploader .butterduck-btn-primary:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(254, 208, 61, 0.55);
}

.butterduck-uploader .butterduck-btn-primary:hover::after {
    left: 150%;
}

.butterduck-uploader .butterduck-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(254, 208, 61, 0.35);
}

/* Welcome banner — transparent, just a warm text tone */
.butterduck-uploader .butterduck-welcome {
    background: transparent;
    border: none;
    padding-left: 0;
    color: #4a3800;
    font-weight: 500;
}

/* Animated progress fill */
.butterduck-uploader .butterduck-progress-fill {
    background: linear-gradient(90deg, #FED03D 0%, #f7c520 40%, #ffe066 60%, #FED03D 100%);
    background-size: 200% auto;
    animation: bd-progress-shimmer 1.8s linear infinite;
}

/* Step entrance */
.butterduck-uploader .butterduck-step {
    animation: bd-card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Keyframes ── */

@keyframes bd-card-in {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes bd-blob-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(20px, 15px) scale(1.08); }
}

@keyframes bd-zone-pulse {
    from { box-shadow: 0 0 0 6px rgba(254,208,61,0.25), 0 12px 32px rgba(254,208,61,0.18); }
    to   { box-shadow: 0 0 0 10px rgba(254,208,61,0.12), 0 16px 40px rgba(254,208,61,0.24); }
}

@keyframes bd-progress-shimmer {
    from { background-position: 200% center; }
    to   { background-position: -200% center; }
}

/* ===== Video styles ===== */
.butterduck-video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

.butterduck-preview-item video {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

@media (max-width: 480px) {
    .butterduck-preview-item video {
        height: 90px;
    }
}

/* ===== Mobile Optimisations ===== */

/* Remove 300ms tap delay and iOS blue highlight flash on all interactive elements */
.butterduck-uploader button,
.butterduck-gallery button,
.butterduck-lightbox button,
.butterduck-like-btn,
.butterduck-tab,
.butterduck-photo-thumb,
.butterduck-role-btn,
.butterduck-voice-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Fix: the glass-design block sets .butterduck-uploader { padding: 32px } which comes
   after the responsive breakpoints in source order, overriding them on mobile.
   These rules restore the correct padding values on phones. */
@media (max-width: 768px) {
    .butterduck-uploader {
        padding: 16px;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {
    .butterduck-uploader {
        padding: 10px;
        border-radius: 12px;
    }
}

/* Larger lightbox on phones — fill more of the screen */
@media (max-width: 768px) {
    .butterduck-lightbox-content {
        width: 95vw;
        height: 85vh;
    }

    .butterduck-lightbox img {
        width: 95vw;
        height: 85vh;
    }
}

/* Larger tap targets on touch-only devices */
@media (hover: none) {
    /* Star button: up from 28×28 to 40×40 */
    .butterduck-star-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    /* Like button: taller pill */
    .butterduck-like-btn {
        padding: 6px 12px;
        font-size: 14px;
    }

    /* Lightbox close: up from 36px to 44px */
    .butterduck-lightbox-close {
        width: 44px;
        height: 44px;
    }

    /* Lightbox nav arrows */
    .butterduck-lightbox-nav {
        width: 48px;
        height: 48px;
    }

    /* Uploader delete button always visible (no hover on touch) */
    .butterduck-delete-btn {
        opacity: 1;
    }
}

/* "Not you? Start over" link next to the welcome line (2.2.0) */
.butterduck-start-over {
    background: none;
    border: 0;
    padding: 0;
    margin-left: 8px;
    font: inherit;
    font-size: 13px;
    color: inherit;
    opacity: 0.75;
    text-decoration: underline;
    cursor: pointer;
}
.butterduck-start-over:hover { opacity: 1; }

/* Guest navigation between the uploader and the gallery (2.4.2, 2.4.3).
   A small pill at the top of the tool; on phones it floats at the bottom of the
   screen so guests can always jump between "Add photos" and "Gallery". */
.bd-gnav {
    display: flex;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 28px;
    padding: 5px;
    gap: 4px;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    font-family: Inter, system-ui, sans-serif;
    position: relative;
    z-index: 50;
}
.bd-gnav-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    color: #F5F5F5 !important;
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.bd-gnav-item svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}
a.bd-gnav-item:hover { background: rgba(255, 255, 255, 0.1); }
.bd-gnav-item.is-current {
    background: #FECA76;
    color: #303030 !important;
}
.bd-gnav-next {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 12px 20px;
    border-radius: 999px;
    border: 1px solid currentColor;
    color: inherit !important;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s, color 0.2s;
}
.bd-gnav-next:hover { background: #FECA76; border-color: #FECA76; color: #303030 !important; }
@media (max-width: 767px) {
    .bd-gnav {
        position: fixed;
        left: 50%;
        bottom: calc(14px + env(safe-area-inset-bottom));
        transform: translateX(-50%);
        margin: 0;
        z-index: 9990;
    }
    .bd-gnav-item { padding: 11px 18px; }
    body:has(.bd-gnav) { padding-bottom: 84px; }
    body:has(.bd-gnav) .back-to-top { display: none !important; }
}

/* 2.5.0: demo note and the "private event" card */
.bd-demo-banner {
    margin: 0 0 18px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px dashed rgba(254, 202, 118, 0.9);
    background: rgba(254, 202, 118, 0.12);
    font-size: 15px;
    line-height: 1.5;
}
.bd-demo-banner strong { font-weight: 700; }
.bd-no-access .butterduck-card { text-align: center; }
.bd-no-access-title {
    margin: 0 0 10px;
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.2;
}
.bd-no-access p { margin: 0 0 10px; }
.bd-no-access-demo { margin-top: 18px !important; opacity: 0.85; font-size: 15px; }
.bd-no-access-demo a { text-decoration: underline; font-weight: 600; color: inherit; }

/* 2.5.1: real events stand alone (no site header, menu or footer) */
body.bd-isolated #ms-header,
body.bd-isolated .main-header,
body.bd-isolated .ms-footer,
body.bd-isolated .back-to-top { display: none !important; }
body.bd-isolated .bd-gnav { margin-top: 24px; }

/* 2.5.1: demo switch between the host's and a guest's gallery */
.bd-demo-view {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}
.bd-demo-view-label { font-size: 14px; opacity: 0.75; margin-right: 4px; }
.bd-demo-view-btn {
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.bd-demo-view-btn.is-on { background: #FECA76; border-color: #FECA76; color: #303030; }
.bd-host-tip {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(254, 202, 118, 0.12);
    font-size: 14px;
    line-height: 1.5;
}
