/* ==========================================================================
   Gusa Events — Online Photobooth (guest-facing, mobile-first)
   ========================================================================== */

:root {
    --pb-primary: #e11975;
    --pb-primary-dark: #b0105a;
    --pb-gold: #f59e0b;
    --pb-ink: #1e293b;
    --pb-ink-muted: #64748b;
    --pb-bg: #faf7f9;
    --pb-card: #ffffff;
    --pb-border: #eef0f4;
    --pb-radius: 16px;
    --pb-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.pb-page {
    font-family: var(--pb-font);
    background: var(--pb-bg);
    color: var(--pb-ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.pb-page * {
    box-sizing: border-box;
}

.pb-page img {
    max-width: 100%;
    display: block;
}

.pb-container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 18px;
}

/* ---------------- Gate (PIN + name entry) ---------------- */
.pb-gate-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 18px;
    background: linear-gradient(160deg, #1e0e18 0%, #2b0f22 40%, #0f172a 100%);
}

.pb-gate-card {
    width: 100%;
    max-width: 400px;
    background: var(--pb-card);
    border-radius: 24px;
    padding: 36px 28px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.pb-gate-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px auto;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-gold));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
}

.pb-gate-card h1 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 0 6px 0;
    color: var(--pb-ink);
}

.pb-gate-card .pb-event-name {
    color: var(--pb-primary);
}

.pb-gate-card p.pb-sub {
    color: var(--pb-ink-muted);
    font-size: 0.92rem;
    margin-bottom: 26px;
    line-height: 1.55;
}

.pb-form-group {
    text-align: left;
    margin-bottom: 16px;
}

.pb-form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--pb-ink-muted);
    margin-bottom: 7px;
}

.pb-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: var(--pb-font);
    border: 1.5px solid var(--pb-border);
    background: #f8fafc;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.pb-input:focus {
    outline: none;
    border-color: var(--pb-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(225, 25, 117, 0.1);
}

.pb-input-pin {
    text-align: center;
    letter-spacing: 8px;
    font-size: 1.5rem;
    font-weight: 700;
}

.pb-gate-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(225, 25, 117, 0.35);
    transition: transform 0.2s ease;
}

.pb-gate-btn:active {
    transform: scale(0.98);
}

.pb-error {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: left;
}

.pb-gate-footer {
    margin-top: 22px;
    font-size: 0.78rem;
    color: #94a3b8;
}

/* ---------------- Gallery App Shell ---------------- */
.pb-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(120deg, #1e0e18 0%, #3a1230 55%, #1e0e18 100%);
    background-size: 200% 100%;
    animation: pb-topbar-drift 12s ease infinite;
    backdrop-filter: blur(10px);
    color: #fff;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 16px 0;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}

@keyframes pb-topbar-drift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.pb-topbar::after {
    content: '';
    display: block;
    height: 3px;
    margin-top: 12px;
    background: linear-gradient(90deg, transparent, var(--pb-primary), var(--pb-gold), var(--pb-primary), transparent);
    background-size: 200% 100%;
    animation: pb-topbar-drift 5s linear infinite;
    opacity: 0.85;
}

.pb-topbar-inner {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pb-topbar-event-row {
    width: 100%;
    min-width: 0;
}

.pb-topbar h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.2px;
    margin: 0;
    line-height: 1.28;
    color: #fff;
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pb-topbar-subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.pb-topbar-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    flex-shrink: 0;
}

.pb-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pb-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: pb-live-pulse 1.8s ease-out infinite;
    flex-shrink: 0;
}

@keyframes pb-live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.pb-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pb-action-pill:hover {
    background: var(--pb-primary);
    border-color: transparent;
    color: #fff;
    transform: translateY(-1px);
}

.pb-host-badge {
    background: var(--pb-gold);
    color: #1e0e18;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 999px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.pb-share-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.pb-share-btn:hover {
    background: var(--pb-primary);
    border-color: transparent;
}

/* ---------------- Photo Grid ---------------- */
.pb-feed {
    padding: 18px 0 120px 0;
}

.pb-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--pb-ink-muted);
}

.pb-empty i {
    font-size: 2.5rem;
    color: #e2b6ce;
    margin-bottom: 14px;
    display: block;
}

.pb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pb-card {
    background: var(--pb-card);
    border-radius: var(--pb-radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(30, 15, 24, 0.06);
    border: 1px solid var(--pb-border);
}

.pb-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f1f1f4;
    cursor: pointer;
}

.pb-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pb-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
}

.pb-card-badge.is-private {
    background: rgba(30, 41, 59, 0.85);
}

.pb-card-body {
    padding: 10px 10px 12px 10px;
}

.pb-card-guest {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--pb-ink);
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pb-card-caption {
    font-size: 0.75rem;
    color: var(--pb-ink-muted);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pb-card-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pb-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--pb-ink-muted);
    cursor: pointer;
}

.pb-action-btn i {
    font-size: 15px;
}

.pb-action-btn.pb-like.is-liked {
    color: var(--pb-primary);
}

.pb-action-btn.pb-like.is-liked i {
    animation: pb-pop 0.35s ease;
}

@keyframes pb-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.pb-card-more {
    margin-left: auto;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 15px;
}

/* ---------------- Instagram-style Bottom App Nav ---------------- */
.pb-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(20, 10, 16, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px) 10px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
}

.pb-bn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 6px 18px;
    cursor: pointer;
    transition: color 0.2s ease;
    flex: 1;
    max-width: 110px;
}

.pb-bn-item i {
    font-size: 21px;
    transition: transform 0.2s ease;
}

.pb-bn-item.is-active {
    color: #fff;
}

.pb-bn-item.is-active i {
    color: var(--pb-primary);
    transform: translateY(-1px) scale(1.08);
}

.pb-bn-camera-wrap {
    position: relative;
    flex: 0 0 auto;
    width: 62px;
    height: 62px;
    margin-top: -30px;
}

.pb-bn-camera-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--pb-primary);
    animation: pb-fab-ripple 2.4s ease-out infinite;
    pointer-events: none;
}

.pb-bn-camera-ring:nth-child(2) {
    animation-delay: 0.8s;
}

@keyframes pb-fab-ripple {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.9); opacity: 0; }
}

.pb-bn-camera {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-gold));
    color: #fff;
    border: 4px solid #14090f;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(225, 25, 117, 0.5);
    cursor: pointer;
    z-index: 2;
    animation: pb-fab-bob 2.6s ease-in-out infinite;
}

.pb-bn-camera i {
    animation: pb-fab-flash 3.4s ease-in-out infinite;
}

@keyframes pb-fab-bob {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.05); }
}

@keyframes pb-fab-flash {
    0%, 92%, 100% { transform: scale(1); }
    95% { transform: scale(1.25); }
}

.pb-bn-hint {
    position: absolute;
    bottom: 78px;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #1e0e18;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    animation: pb-hint-fade 5s ease forwards;
    pointer-events: none;
    z-index: 39;
}

.pb-bn-hint::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e0e18;
}

@keyframes pb-hint-fade {
    0%, 12% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    22%, 78% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(0); }
}

.pb-host-pill {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: rgba(20, 10, 16, 0.92);
    backdrop-filter: blur(14px);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 40;
}

/* ---------------- Bottom Sheets (Upload / Photo / Comments) ---------------- */
.pb-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 12, 16, 0.55);
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.pb-sheet-overlay[hidden] {
    display: none;
}

.pb-sheet {
    background: #fff;
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
    padding: 20px 20px 28px 20px;
    animation: pb-sheet-up 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pb-sheet-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pb-sheet-handle {
    width: 40px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 999px;
    margin: 0 auto 16px auto;
}

.pb-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pb-sheet-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.pb-sheet-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
}

.pb-upload-drop {
    border: 2px dashed #e2b6ce;
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    background: #fff7fb;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}

.pb-upload-drop:hover {
    border-color: var(--pb-primary);
    background: #fff0f7;
}

.pb-upload-drop i {
    font-size: 2rem;
    color: var(--pb-primary);
    margin-bottom: 6px;
    display: block;
}

.pb-upload-drop span {
    font-size: 0.84rem;
    color: var(--pb-ink-muted);
    font-weight: 600;
}

.pb-upload-source-btns {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.pb-source-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1.5px solid var(--pb-border);
    background: #f8fafc;
    color: var(--pb-ink);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pb-source-btn i {
    font-size: 1.15rem;
    color: var(--pb-primary);
}

.pb-source-btn:hover, .pb-source-btn:focus {
    background: #fff;
    border-color: var(--pb-primary);
    color: var(--pb-primary);
}

.pb-source-btn.pb-source-camera {
    background: #fff5fa;
    border-color: #fbcfe8;
    color: var(--pb-primary-dark);
}

.pb-upload-preview {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 12px;
    transition: filter 0.25s ease;
}

/* Filter presets on preview */
.pb-upload-preview.filter-warm { filter: sepia(0.25) saturate(1.3) brightness(1.05); }
.pb-upload-preview.filter-bw { filter: grayscale(1) contrast(1.15); }
.pb-upload-preview.filter-vibrant { filter: saturate(1.6) contrast(1.1); }
.pb-upload-preview.filter-vintage { filter: sepia(0.4) contrast(0.95) brightness(0.95); }

.pb-filter-group {
    margin-bottom: 14px;
}

.pb-filters-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pb-filters-scroll::-webkit-scrollbar {
    display: none;
}

.pb-filter-btn {
    flex: 0 0 auto;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--pb-border);
    background: #f8fafc;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--pb-ink-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pb-filter-btn.is-active, .pb-filter-btn:hover {
    border-color: var(--pb-primary);
    background: rgba(225, 25, 117, 0.08);
    color: var(--pb-primary);
}

.pb-visibility-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.pb-visibility-option {
    flex: 1;
    border: 1.5px solid var(--pb-border);
    border-radius: 12px;
    padding: 12px 10px;
    text-align: center;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--pb-ink-muted);
}

.pb-visibility-option i {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
}

.pb-visibility-option.is-selected {
    border-color: var(--pb-primary);
    background: rgba(225, 25, 117, 0.06);
    color: var(--pb-primary);
}

/* ---------------- Instagram-Style Photo Modal ---------------- */
.pb-modal-overlay {
    align-items: center;
    padding: 16px;
    background: rgba(10, 6, 12, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pb-insta-modal {
    position: relative;
    max-width: 960px;
    width: 100%;
    max-height: 90vh;
    padding: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
    background: #fff;
    display: flex;
    flex-direction: column;
}

.pb-insta-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 70;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.2s ease, transform 0.15s ease;
}

.pb-insta-close:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.08);
}

/* Instagram Topbar (Author, Event, Timestamp) */
.pb-insta-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
    flex-shrink: 0;
    z-index: 20;
}

.pb-insta-author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.pb-author-meta {
    min-width: 0;
}

.pb-author-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.pb-insta-author-name {
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0;
    color: var(--pb-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-timestamp-bullet {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1;
}

.pb-insta-time-pill {
    font-size: 0.76rem;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}

.pb-insta-event-tag {
    font-size: 0.72rem;
    color: var(--pb-ink-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-top: 1px;
}

.pb-insta-owner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-right: 36px; /* space for close X button */
}

.pb-insta-owner-actions .pb-action-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Layout Split */
.pb-insta-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    height: 100%;
    max-height: calc(90vh - 60px);
    min-height: 480px;
}

/* Media Section (Wide, Immersive, Edge-to-Edge) */
.pb-insta-media {
    background: #0a060a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    user-select: none;
    touch-action: pan-y;
}

.pb-zoom-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.pb-zoom-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: zoom-in;
}

.pb-zoom-container.is-zoomed {
    cursor: grab;
}

.pb-zoom-container.is-dragging {
    cursor: grabbing;
    transition: none !important;
}

.pb-zoom-container img {
    max-height: calc(90vh - 60px);
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 0;
    -webkit-user-drag: none;
    image-rendering: -webkit-optimize-contrast;
}

/* Floating Zoom Toggle Button */
.pb-zoom-toggle-btn {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 15;
    background: rgba(18, 12, 18, 0.72);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.pb-zoom-toggle-btn:hover {
    background: rgba(18, 12, 18, 0.95);
    transform: scale(1.08);
    border-color: rgba(255, 255, 255, 0.45);
}

.pb-doubletap-heart {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 5.5rem;
    color: #ff2d60;
    text-shadow: 0 4px 30px rgba(255, 45, 96, 0.95);
    pointer-events: none;
    opacity: 0;
    z-index: 25;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.pb-doubletap-heart.is-active {
    transform: translate(-50%, -50%) scale(1.25);
    opacity: 1;
}

/* Instagram Sidebar */
.pb-insta-sidebar {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-left: 1px solid #f1f5f9;
    height: 100%;
    overflow: hidden;
}

/* Actions Bar directly beneath media */
.pb-insta-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px 16px;
    background: #ffffff;
    flex-shrink: 0;
}

.pb-insta-action-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pb-insta-action-group .pb-action-btn {
    background: none;
    border: none;
    padding: 4px;
    font-size: 1.35rem;
    color: #1e293b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, color 0.15s ease;
}

.pb-insta-action-group .pb-action-btn:hover {
    color: #0f172a;
    transform: scale(1.12);
}

.pb-insta-action-group .pb-action-btn.pb-like.is-liked {
    color: #e11975;
}

.pb-insta-action-group .pb-action-btn.pb-like.is-liked i {
    animation: pb-heart-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pb-heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* Likes Counter */
.pb-insta-likes-row {
    padding: 2px 16px 6px 16px;
    flex-shrink: 0;
}

.pb-insta-like-count {
    font-size: 0.88rem;
    font-weight: 500;
    color: #0f172a;
}

.pb-insta-like-count strong {
    font-weight: 700;
}

/* Caption Row */
.pb-insta-caption-row {
    padding: 0 16px 4px 16px;
    font-size: 0.86rem;
    line-height: 1.45;
    flex-shrink: 0;
}

.pb-caption-author {
    font-weight: 700;
    color: #0f172a;
    margin-right: 6px;
}

.pb-caption-text {
    color: #1e293b;
    word-break: break-word;
}

/* Post Date Timestamp (under caption, Instagram style) */
.pb-insta-post-date {
    padding: 2px 16px 10px 16px;
    font-size: 0.72rem;
    color: #8e8e8e;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
    flex-shrink: 0;
}

.pb-insta-comment-pill-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    transition: all 0.2s ease;
}

.pb-insta-comment-pill-btn:hover {
    color: var(--pb-primary);
    background: rgba(235, 16, 126, 0.08);
}

/* Scrollable Comments */
.pb-insta-comments-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid #f1f5f9;
}

.pb-comments-heading {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.pb-comments-empty-notice {
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 14px 0;
    text-align: center;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px dashed #e2e8f0;
    margin: 4px 0;
}

.pb-comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.pb-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pb-primary), var(--pb-gold));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pb-comment-body {
    flex: 1;
    min-width: 0;
}

.pb-comment-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.pb-comment-body strong {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--pb-ink);
}

.pb-comment-time {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 400;
}

.pb-comment-body span {
    font-size: 0.85rem;
    color: var(--pb-ink);
    word-break: break-word;
    line-height: 1.4;
}

.pb-souvenir-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.pb-souvenir-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1.5px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(225, 25, 117, 0.08));
    color: #b45309;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pb-souvenir-btn:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.pb-souvenir-btn.pb-btn-clean {
    border-color: var(--pb-border);
    background: #f8fafc;
    color: var(--pb-ink-muted);
    padding: 6px 10px;
}

.pb-souvenir-btn.pb-btn-clean:hover {
    background: #e2e8f0;
    color: var(--pb-ink);
}

.pb-quick-reactions {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 14px 6px 14px;
    background: #fff;
    border-top: 1px solid #f8fafc;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
}

.pb-quick-reactions::-webkit-scrollbar {
    display: none;
}

.pb-qr-pill {
    flex: 0 0 auto;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid #eef0f4;
    background: #f8fafc;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pb-ink);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pb-qr-pill:hover, .pb-qr-pill:active {
    background: #fff0f7;
    border-color: var(--pb-primary);
    color: var(--pb-primary);
    transform: scale(1.05);
}

.pb-insta-comment-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.pb-insta-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-family: var(--pb-font);
    background: #f8fafc;
    transition: all 0.2s ease;
}

.pb-insta-input:focus {
    outline: none;
    border-color: var(--pb-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(225, 25, 117, 0.1);
}

.pb-insta-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--pb-primary);
    color: #fff;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.pb-insta-send-btn:active {
    transform: scale(0.92);
}

/* Mobile optimizations (< 768px): Wide, Immersive Instagram Feed View */
@media (max-width: 768px) {
    .pb-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .pb-insta-modal {
        width: 100%;
        max-width: 100%;
        max-height: 94vh;
        border-radius: 20px 20px 0 0;
        animation: pb-sheet-up 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
    }

    .pb-insta-close {
        top: 8px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .pb-insta-topbar {
        padding: 10px 12px;
    }

    .pb-insta-owner-actions {
        margin-right: 32px;
    }

    .pb-insta-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: calc(94vh - 54px);
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Wide edge-to-edge media on mobile */
    .pb-insta-media {
        width: 100%;
        max-height: 56vh;
        min-height: 240px;
        flex-shrink: 0;
        background: #080407;
    }

    .pb-zoom-container img {
        max-height: 56vh;
        width: 100%;
        object-fit: contain;
    }

    .pb-zoom-toggle-btn {
        bottom: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .pb-insta-sidebar {
        border-left: none;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .pb-insta-actions-bar {
        padding: 10px 12px 6px 12px;
    }

    .pb-insta-action-group {
        gap: 14px;
    }

    .pb-insta-likes-row,
    .pb-insta-caption-row,
    .pb-insta-post-date {
        padding-left: 12px;
        padding-right: 12px;
    }

    .pb-insta-comments-scroll {
        flex: 1;
        max-height: 22vh;
        min-height: 70px;
        padding: 8px 12px;
    }

    .pb-insta-comment-form {
        padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 8px) 12px;
    }
}

.pb-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1e0e18;
    color: #fff;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.pb-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (min-width: 480px) {
    .pb-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (min-width: 640px) {
    .pb-container {
        padding: 0 24px;
    }
}

/* Floating Emoji Particle Layer */
.pb-particle-box {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.pb-floating-emoji {
    position: absolute;
    font-size: 2.2rem;
    animation: pbFloatUp 1.8s ease-out forwards;
    pointer-events: none;
    user-select: none;
}

@keyframes pbFloatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(0.6) rotate(0deg);
    }
    50% {
        opacity: 0.95;
        transform: translateY(-130px) scale(1.25) rotate(18deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-260px) scale(0.9) rotate(-18deg);
    }
}

/* ---------------- Header User Nickname Chip ---------------- */
.pb-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 999px;
    padding: 3px 10px 3px 4px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 170px;
    white-space: nowrap;
}

.pb-user-chip:hover {
    background: rgba(245, 158, 11, 0.16);
    border-color: #fbbf24;
    transform: translateY(-1px);
}

.pb-user-chip-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #e11d48);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pb-user-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fbbf24;
    max-width: 105px;
}

.pb-user-chip-edit {
    font-size: 0.65rem;
    opacity: 0.75;
    color: #fef08a;
    margin-left: 1px;
}

@media (max-width: 576px) {
    .pb-user-chip {
        max-width: 165px;
        padding: 3px 8px 3px 3px;
    }
    .pb-user-chip-name {
        max-width: 100px;
    }
}

