* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Prevent iOS zoom on input focus */
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    background: #FAFAFA;
    color: #1C1C1E;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: hidden;
    /* Prevent pull-to-refresh and overscroll bounce */
    overscroll-behavior: none;
}

/* Prevent zoom on all inputs - iOS requires 16px minimum */
input, textarea, select {
    font-size: 16px !important;
    touch-action: manipulation;
}

/* Prevent double-tap zoom on interactive elements */
button, a, label, .challenge-option-card, .icon-option, .board-card, .cc-duration-btn {
    touch-action: manipulation;
}

/* ===============================
   IMAGE PROTECTION
   Prevent download, drag, selection
   =============================== */
.grid-item img,
.viewer-image img,
.upload-preview-container img,
#photoPreview {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
}

/* Overlay to block direct image interaction on grid */
.grid-item::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: transparent;
}

/* Screenshot protection - blur when not visible */
body.app-hidden .grid-item img,
body.app-hidden .viewer-image img {
    filter: blur(30px);
}

/* ===============================
   GATOOSO BRANDING FONT
   RL Folklor - Adobe Fonts
   =============================== */
:root {
    --font-brand: "rl-folklor", -apple-system, BlinkMacSystemFont, sans-serif;
}

.brand-text {
    font-family: var(--font-brand);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ===============================
   FLOATING HEADER
   =============================== */
.floating-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease;
}

/* LOGO — above the glass card */
.app-logo {
    height: 22px;
    width: auto;
    margin-bottom: 8px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.app-logo.logo-hidden {
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
}

/* GLASS CONTAINER */
.floating-inner {
    width: calc(100% - 24px);
    max-width: 720px;
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 20px;
    padding: 14px 16px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
}


/* ===============================
   CHALLENGE BAR
   =============================== */
.challenge-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.challenge-text {
    flex: 1;
    min-width: 0;
}

.challenge-chip {
    display: inline-block;
    background: linear-gradient(135deg, rgba(34,23,35,0.10), rgba(34,23,35,0.05));
    color: #221723;
    font-family: var(--font-brand);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 6px;
}

.challenge-title {
    font-size: 14px;
    font-weight: 700;
    color: #221723;
    line-height: 1.3;
}

.challenge-description {
    font-size: 12px;
    color: #6E6E73;
    line-height: 1.35;
    margin-top: 2px;
}

.challenge-countdown {
    background: linear-gradient(135deg, #221723 0%, #3d2a3f 100%);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(34, 23, 35, 0.25);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.challenge-countdown::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: countdown-shine 4s ease-in-out infinite;
}

@keyframes countdown-shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.challenge-countdown .divider {
    opacity: 0.5;
    margin: 0 1px;
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.2; }
}

.challenge-countdown .time {
    display: inline-block;
    min-width: 16px;
    text-align: center;
    color: #FFFFFF;
}

/* Urgent countdown (less than 1 hour) */
.challenge-countdown.countdown-urgent {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    box-shadow: 0 3px 15px rgba(220, 38, 38, 0.35);
    animation: countdown-urgent-pulse 1.5s ease-in-out infinite;
}

@keyframes countdown-urgent-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}


/* ===============================
   MEMBERS / STORIES BAR
   =============================== */
.stories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0 2px 0;
    scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }

.story {
    min-width: 50px;
    width: 50px;
    height: 50px;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #FAFAFA;
    border: 2px solid #221723;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.story img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.member-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #221723;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    overflow: hidden;
    /* Fix Safari clipping */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}
.member-avatar.has-image {
    background: transparent;
}
.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* INVITE BUTTON */
.story-invite {
    border: 2px dashed #A0A0A5;
    cursor: pointer;
    transition: border-color 0.2s ease;
}
.story-invite:active { border-color: #221723; }

.invite-icon {
    font-size: 22px;
    font-weight: 300;
    color: #6E6E73;
    line-height: 1;
}


/* ===============================
   PHOTO GRID
   =============================== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 6px;
    padding-top: 220px;
    padding-bottom: 120px;
}

.grid-item {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.grid-item:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Bottom gradient overlay */
.grid-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.45), transparent);
    pointer-events: none;
}

/* Avatar in grid item */
.grid-item-avatar {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    color: #221723;
    font-size: 10px;
    font-weight: 700;
    overflow: hidden;
    /* Fix Safari clipping */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 2;
    overflow: hidden;
}
.grid-item-avatar.has-image {
    background: transparent;
}
.grid-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Comment count badge */
.grid-item-comments {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    font-size: 11px;
    font-weight: 600;
    color: #FFFFFF;
    z-index: 2;
}
.grid-item-comments i { font-size: 12px; }

/* RATING CHIP */
.rating-chip {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 2;
}
.rating-chip .star { font-size: 12px; line-height: 1; }
.rating-chip .rating-value { color: #221723; line-height: 1; }


/* ===============================
   BOTTOM NAV — Glassmorphism
   =============================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 20;
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.nav-btn:active { opacity: 0.7; }

.nav-btn i {
    font-size: 22px;
    color: #6E6E73;
    transition: color 0.15s ease;
}
.nav-btn .nav-label {
    font-family: var(--font-brand);
    font-size: 9px;
    font-weight: 500;
    color: #6E6E73;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: color 0.15s ease;
}
.nav-btn.active i,
.nav-btn.active .nav-label {
    color: #221723;
}


/* FAB */
.fab {
    width: 56px;
    height: 56px;
    background: #221723;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-20%);
    box-shadow:
        0 8px 24px rgba(34,23,35,0.35),
        0 0 0 5px rgba(255,255,255,0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}
.fab:active {
    transform: translateY(-20%) scale(0.94);
    box-shadow:
        0 4px 16px rgba(34,23,35,0.25),
        0 0 0 4px rgba(255,255,255,0.4);
}
.fab i { font-size: 26px; color: white; }


/* ===============================
   UPLOAD MODAL
   =============================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: flex-end;
    z-index: 30;
}

.modal-content {
    background: #FFFFFF;
    width: 100%;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-content button {
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    background: #F1F1F3;
    color: #1C1C1E;
}
.modal-content .close {
    background: transparent;
    color: #6E6E73;
}

/* UPLOAD BUTTON — higher specificity to override modal-content button */
.modal-content .upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    background: #221723;
    color: #FFFFFF;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.modal-content .upload-btn:active { opacity: 0.85; }
.modal-content .upload-btn i { font-size: 20px; color: #FFFFFF; }

/* UPLOAD PREVIEW */
.upload-preview-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: #F1F1F3;
}
.upload-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* CAPTION INPUT */
.caption-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #E5E5E7;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    color: #1C1C1E;
    background: #FAFAFA;
    outline: none;
    transition: border-color 0.2s ease;
}
.caption-input:focus { border-color: #221723; }
.caption-input::placeholder { color: #A0A0A5; }

/* UPLOAD CONFIRM BUTTON — higher specificity */
.modal-content .upload-confirm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    background: #221723;
    color: #FFFFFF;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.modal-content .upload-confirm-btn:active { opacity: 0.85; }
.modal-content .upload-confirm-btn i { font-size: 18px; color: #FFFFFF; }

/* UPLOAD LOADING */
.upload-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px 0;
}
.upload-loading p { color: #6E6E73; font-size: 15px; }

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #E5E5E7;
    border-top-color: #221723;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ===============================
   EMPTY STATES
   =============================== */
.empty-state {
    grid-column: 1 / -1;
    min-height: calc(100vh - 340px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
    padding-top: 60px;
}
.empty-inner {
    max-width: 320px;
    padding: 24px;
}
.empty-inner h2 { font-size: 1.4rem; margin-bottom: 12px; color: #221723; }
.empty-inner p { opacity: 0.8; margin-bottom: 20px; line-height: 1.5; }
.empty-cta {
    padding: 12px 20px;
    border-radius: 999px;
    border: none;
    background: #221723;
    color: #fff;
    font-weight: 600;
}


/* ===============================
   BOARDS — FULLSCREEN OVERLAY
   =============================== */
.boards-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #FAFAFA;
    overflow-y: auto;
    padding: env(safe-area-inset-top, 0px) 16px env(safe-area-inset-bottom, 16px);
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
}

/* BOARDS WELCOME SECTION */
.boards-welcome {
    position: relative;
    background: #FAFAFA;
    z-index: 2;
    padding: 20px 0 24px;
    animation: welcomeFadeIn 0.5s ease-out;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin 0.3s ease;
    overflow: hidden;
}

/* Collapse welcome when form is open */
.boards-welcome.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

@keyframes welcomeFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.welcome-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #221723 0%, #4a3a4d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    box-shadow:
        0 4px 12px rgba(34, 23, 35, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    animation: avatarPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
    overflow: hidden;
    /* Fix Safari clipping */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.welcome-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

@keyframes avatarPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.welcome-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.welcome-time {
    font-size: 13px;
    font-weight: 500;
    color: #8E8E93;
    letter-spacing: 0.2px;
}

.welcome-name {
    font-family: var(--font-brand);
    font-size: 28px;
    font-weight: 700;
    color: #221723;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.1;
    margin: 0;
}

.welcome-tagline {
    margin-top: 12px;
    font-size: 14px;
    color: #6E6E73;
    line-height: 1.4;
    animation: taglineFade 0.5s ease-out 0.3s both;
}

@keyframes taglineFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.boards-close-btn {
    position: absolute;
    top: 20px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F1F1F3;
    font-size: 20px;
    color: #6E6E73;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.boards-close-btn:hover {
    background: #E5E5E7;
    color: #221723;
}

/* BOARDS GRID */
.boards-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 12px;
}
.boards-loading-state {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}
.boards-empty-state { text-align: center; padding: 48px 24px; }
.boards-empty-icon { font-size: 48px; margin-bottom: 12px; }
.boards-empty-state h3 { font-size: 18px; font-weight: 700; color: #221723; margin-bottom: 8px; }
.boards-empty-state p { font-size: 14px; color: #6E6E73; line-height: 1.5; }

/* BOARD CARD */
.board-card {
    background: #FFFFFF;
    border: 1px solid #E5E5E7;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.board-card-active {
    border-color: #221723;
    box-shadow: 0 0 0 1px #221723;
}
.board-card-top { display: flex; align-items: center; gap: 12px; }
.board-card-icon {
    font-size: 32px; width: 52px; height: 52px;
    background: #F5F3F6; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.board-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.board-card-title { font-size: 16px; font-weight: 700; color: #221723; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-card-desc { font-size: 13px; color: #6E6E73; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-card-bottom { display: flex; align-items: center; justify-content: space-between; }
.board-card-members { font-size: 13px; color: #6E6E73; }
.board-card-role { font-size: 12px; font-weight: 600; color: #221723; background: #F1F1F3; padding: 3px 10px; border-radius: 999px; }
.board-card-actions { display: flex; gap: 8px; }
.board-card-enter { flex: 1; padding: 10px; border-radius: 10px; border: none; background: #221723; color: #FFFFFF; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
.board-card-enter:active { opacity: 0.85; }
.board-card-invite { padding: 10px 16px; border-radius: 10px; border: 1px solid #E5E5E7; background: #FFFFFF; color: #221723; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.board-card-invite:active { background: #F5F3F6; }
.board-card-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #6E6E73;
    background: #F5F3F6;
    padding: 4px 10px;
    border-radius: 999px;
}

/* CREATE BOARD SECTION */
.create-board-section {
    padding: 16px 0 24px;
    position: sticky;
    bottom: 0;
    background: #FAFAFA;
    z-index: 3;
}

/* When form is open, section moves to top */
.create-board-section.form-open {
    position: relative;
    bottom: auto;
    order: -1;
    padding-top: 20px;
}

/* Hide boards list when creating */
.boards-grid.hidden {
    display: none;
}
.create-board-toggle {
    width: 100%; padding: 14px; border-radius: 14px;
    border: 2px dashed #C5C5C7; background: transparent;
    color: #221723; font-size: 15px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.create-board-toggle:active { background: #F5F3F6; border-color: #221723; }
.create-board-toggle i { font-size: 20px; }

/* CREATE FORM */
.create-board-form {
    display: flex; flex-direction: column; gap: 12px;
    padding: 16px; background: #FFFFFF; border-radius: 16px; border: 1px solid #E5E5E7;
}
.cb-input {
    width: 100%; padding: 12px 14px; border: 1px solid #E5E5E7;
    border-radius: 10px; font-size: 16px; font-family: inherit;
    color: #221723; background: #FAFAFA; outline: none; transition: border-color 0.2s;
}
.cb-input:focus { border-color: #221723; }
.cb-input::placeholder { color: #A0A0A5; }
.cb-input-light { background: #FFFFFF; }
.cb-input-small { flex: 1; }

/* CATEGORY PICKER */
.category-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.category-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 2px solid #E5E5E7;
    background: #FFFFFF;
    font-size: 13px;
    font-weight: 500;
    color: #221723;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.1s;
    touch-action: manipulation;
}
.category-chip:active {
    transform: scale(0.95);
}
.category-chip-emoji {
    font-size: 16px;
    line-height: 1;
}
.category-chip-name {
    line-height: 1;
}
.category-chip.category-selected {
    border-color: #221723;
    background: #F5F3F6;
    box-shadow: 0 0 0 1px #221723;
    font-weight: 600;
}

/* ICON PICKER */
.icon-picker { display: flex; flex-direction: column; gap: 8px; }
.icon-picker-label { font-size: 13px; font-weight: 600; color: #6E6E73; }
.icon-picker-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-option {
    width: 44px; height: 44px; border-radius: 12px;
    border: 2px solid #E5E5E7; background: #FFFFFF;
    font-size: 22px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s, transform 0.1s;
}
.icon-option:active { transform: scale(0.92); }
.icon-option.icon-selected {
    border-color: #221723; background: #F5F3F6;
    box-shadow: 0 0 0 1px #221723;
}
.icon-custom-row { display: flex; align-items: center; gap: 10px; }
.icon-preview-badge {
    width: 44px; height: 44px; border-radius: 12px;
    background: #221723; display: flex; align-items: center;
    justify-content: center; font-size: 22px; flex-shrink: 0;
}

/* FIRST CHALLENGE PICKER */
.first-challenge-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}
.challenge-option-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.challenge-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #FFFFFF;
    border: 2px solid #E5E5E7;
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.challenge-option-card:active {
    background: #F5F3F6;
}
.challenge-option-card.selected {
    border-color: #221723;
    background: #F9F8FA;
}
.challenge-option-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #F1F1F3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.challenge-option-card.selected .challenge-option-icon {
    background: #221723;
}
.challenge-option-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.challenge-option-title {
    font-size: 14px;
    font-weight: 600;
    color: #221723;
}
.challenge-option-desc {
    font-size: 12px;
    color: #6E6E73;
    line-height: 1.3;
}
.challenge-option-check {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D1D1D6;
    font-size: 20px;
    flex-shrink: 0;
}
.challenge-option-card.selected .challenge-option-check {
    color: #221723;
}
.custom-challenge-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: #F5F3F6;
    border-radius: 12px;
    margin-top: 4px;
    animation: slideDown 0.2s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.cb-textarea {
    min-height: 70px;
    resize: none;
    font-family: inherit;
}

/* SUBMIT / CANCEL */
.cb-submit {
    width: 100%; padding: 14px; border-radius: 12px; border: none;
    background: #221723; color: #FFFFFF; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: opacity 0.15s;
}
.cb-submit:active { opacity: 0.85; }
.cb-submit:disabled { opacity: 0.5; }
.cb-cancel {
    width: 100%; padding: 12px; border-radius: 12px; border: none;
    background: transparent; color: #6E6E73; font-size: 14px; cursor: pointer;
}


/* ===============================
   CHALLENGES PANEL — FULLSCREEN
   =============================== */
.challenges-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #FAFAFA;
    overflow-y: auto;
    padding: env(safe-area-inset-top, 0px) 16px env(safe-area-inset-bottom, 16px);
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
}

.challenges-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 16px;
    position: sticky;
    top: 0;
    background: #FAFAFA;
    z-index: 2;
}
.challenges-top-bar h1 {
    font-family: var(--font-brand);
    font-size: 24px;
    font-weight: 700;
    color: #221723;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.challenges-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F1F1F3;
    font-size: 20px;
    color: #6E6E73;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* SECTION LABELS */
.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-brand);
    font-size: 13px;
    font-weight: 600;
    color: #6E6E73;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}
.section-label i { font-size: 16px; }

/* ACTIVE CHALLENGE SECTION */
.active-challenge-section {
    margin-bottom: 24px;
}

.active-challenge-card {
    background: linear-gradient(135deg, #221723 0%, #3D2B40 100%);
    border-radius: 20px;
    padding: 20px;
    color: #FFFFFF;
    position: relative;
    overflow: hidden;
}
.active-challenge-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.ac-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.ac-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    flex: 1;
}
.ac-timer {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    white-space: nowrap;
    flex-shrink: 0;
}
.ac-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ac-edit-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
}
.ac-edit-btn:active {
    background: rgba(255,255,255,0.25);
}
.ac-edit-btn i {
    font-size: 16px;
}

.ac-description {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
    margin-bottom: 16px;
}

.ac-stats {
    display: flex;
    gap: 16px;
}
.ac-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}
.ac-stat i { font-size: 16px; }
.ac-stat-value {
    font-weight: 700;
    color: #FFFFFF;
}

.ac-empty {
    text-align: center;
    padding: 32px 20px;
    background: #F5F3F6;
    border-radius: 20px;
    color: #6E6E73;
}
.ac-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}
.ac-empty h3 {
    font-size: 16px;
    font-weight: 700;
    color: #221723;
    margin-bottom: 6px;
}
.ac-empty p {
    font-size: 14px;
    line-height: 1.5;
}

/* QUEUE SECTION */
.queue-section {
    margin-bottom: 24px;
}

.queue-badge {
    background: #221723;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 4px;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #FFFFFF;
    border: 1px solid #E5E5E7;
    border-radius: 14px;
    padding: 14px 16px;
}
.queue-position {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #F5F3F6;
    color: #221723;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.queue-info {
    flex: 1;
    min-width: 0;
}
.queue-title {
    font-size: 14px;
    font-weight: 600;
    color: #221723;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.queue-meta {
    font-size: 12px;
    color: #6E6E73;
    margin-top: 2px;
}
.queue-duration {
    font-size: 12px;
    font-weight: 600;
    color: #6E6E73;
    background: #F5F3F6;
    padding: 4px 10px;
    border-radius: 999px;
    flex-shrink: 0;
}
.queue-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.queue-edit-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #F1F1F3;
    color: #6E6E73;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.queue-edit-btn:hover {
    background: #221723;
    color: #FFFFFF;
}
.queue-edit-btn:active {
    transform: scale(0.95);
}
.queue-edit-btn i {
    font-size: 14px;
}

.queue-empty {
    text-align: center;
    padding: 24px;
    color: #A0A0A5;
    font-size: 14px;
}

/* CREATE CHALLENGE SECTION */
.create-challenge-section {
    padding: 16px 0 24px;
    margin-top: auto;
}

.create-challenge-toggle {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 2px dashed #C5C5C7;
    background: transparent;
    color: #221723;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.create-challenge-toggle:active {
    background: #F5F3F6;
    border-color: #221723;
}
.create-challenge-toggle i { font-size: 20px; }

.create-challenge-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #FFFFFF;
    border-radius: 16px;
    border: 1px solid #E5E5E7;
}

.cc-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #E5E5E7;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    color: #221723;
    background: #FAFAFA;
    outline: none;
    transition: border-color 0.2s;
}
.cc-input:focus { border-color: #221723; }
.cc-input::placeholder { color: #A0A0A5; }

.cc-textarea {
    min-height: 80px;
    resize: none;
}

.cc-duration-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cc-label {
    font-size: 13px;
    font-weight: 600;
    color: #6E6E73;
}
.cc-duration-options {
    display: flex;
    gap: 8px;
}
.cc-duration-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #E5E5E7;
    background: #FFFFFF;
    color: #221723;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.cc-duration-btn:active { transform: scale(0.96); }
.cc-duration-btn.active {
    border-color: #221723;
    background: #221723;
    color: #FFFFFF;
}

.cc-submit {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #221723;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.15s;
}
.cc-submit:active { opacity: 0.85; }
.cc-submit:disabled { opacity: 0.5; }
.cc-submit i { font-size: 18px; }

.cc-cancel {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #6E6E73;
    font-size: 14px;
    cursor: pointer;
}


/* ===============================
   IMAGE VIEWER — FULLSCREEN
   =============================== */
.viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.96);
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.viewer-overlay.viewer-active {
    opacity: 1;
}

.viewer-container {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 0 0 env(safe-area-inset-bottom, 16px);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* Close button */
.viewer-close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 210;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #FFFFFF;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(8px);
}
.viewer-close:active { background: rgba(255,255,255,0.2); }

/* Image */
.viewer-image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    flex-shrink: 0;
}
.viewer-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* User info bar */
.viewer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}
.viewer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    /* Fix Safari clipping */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}
.viewer-avatar.has-image {
    background: transparent;
}
.viewer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.viewer-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.viewer-user-name {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
}
.viewer-caption {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ===============================
   GAMIFIED RATING SECTION
   =============================== */
.viewer-rating {
    padding: 8px 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.vr-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-align: center;
}

/* Rating buttons row */
.vr-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.vr-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    filter: grayscale(0.6) opacity(0.5);
}
.vr-btn:active { transform: scale(0.9); }

/* Filled state (rating <= selected) */
.vr-btn-filled {
    filter: grayscale(0) opacity(1);
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.10);
}

/* The selected one gets extra glow */
.vr-btn-active {
    filter: grayscale(0) opacity(1);
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.15);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* Bounce animation on tap */
.vr-btn-pop {
    animation: vrPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes vrPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.8); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Mega pop for rating 5 */
.vr-btn-mega {
    animation: vrMega 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes vrMega {
    0%   { transform: scale(1); }
    30%  { transform: scale(2.4); }
    50%  { transform: scale(2.6) rotate(15deg); }
    70%  { transform: scale(0.85); }
    100% { transform: scale(1); }
}

/* Wave fill animation for lower buttons */
.vr-btn-wave {
    animation: vrWave 0.3s ease;
}
@keyframes vrWave {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Average rating display */
.vr-avg {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.vr-avg-visible {
    opacity: 1;
    transform: translateY(0);
}
.vr-avg-icon { font-size: 20px; }
.vr-avg-value {
    font-size: 18px;
    font-weight: 800;
    color: #FFFFFF;
}
.vr-avg-count {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
}

/* Screen shake for epic ratings */
.viewer-shake {
    animation: screenShake 0.5s ease;
}
@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-5px); }
    20% { transform: translateX(5px); }
    30% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    50% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
    70% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

/* Golden flash for rating 5 */
.viewer-flash {
    animation: goldenFlash 0.6s ease;
}
@keyframes goldenFlash {
    0%   { box-shadow: inset 0 0 0 0 transparent; }
    30%  { box-shadow: inset 0 0 80px rgba(255, 215, 0, 0.15); }
    100% { box-shadow: inset 0 0 0 0 transparent; }
}


/* ===============================
   EMOJI PARTICLES
   =============================== */
.emoji-particle {
    position: fixed;
    font-size: 24px;
    pointer-events: none;
    z-index: 9999;
    animation: particleFly 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    will-change: transform, opacity;
}
@keyframes particleFly {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--r)) scale(0.2);
        opacity: 0;
    }
}

/* Big particles for epic */
.emoji-particle-big {
    font-size: 36px;
    animation-duration: 1.1s;
}


/* ===============================
   COMMENTS SECTION
   =============================== */
.viewer-comments {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 16px 16px;
    min-height: 200px;
}

.vc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.vc-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
}
.vc-count {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.08);
    padding: 2px 8px;
    border-radius: 999px;
}

/* Comments list */
.vc-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0 12px;
    max-height: 300px;
    overflow-y: auto;
}

.vc-bubble {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.vc-bubble-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.8);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.vc-bubble-body {
    flex: 1;
    min-width: 0;
}
.vc-bubble-name {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    margin-bottom: 2px;
}
.vc-bubble-text {
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    line-height: 1.4;
    word-wrap: break-word;
}
.vc-bubble-time {
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    margin-top: 2px;
}

.vc-empty {
    text-align: center;
    padding: 20px 0;
    font-size: 13px;
    color: rgba(255,255,255,0.25);
}

/* Comment input */
.vc-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    width: 100%;
    box-sizing: border-box;
}
.vc-input-wrap input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #FFFFFF;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.vc-input-wrap input:focus { border-color: rgba(255,255,255,0.25); }
.vc-input-wrap input::placeholder { color: rgba(255,255,255,0.25); }

.vc-input-wrap button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #FFFFFF;
    color: #221723;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.vc-input-wrap button:active { opacity: 0.7; }


/* ===============================
   PWA INSTALL BANNER
   =============================== */
.install-banner {
    position: fixed;
    bottom: 100px; /* Above bottom nav */
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    z-index: 200;
    width: calc(100% - 24px);
    max-width: 420px;
    background: linear-gradient(135deg, #221723 0%, #3a2a3d 100%);
    border-radius: 20px;
    padding: 16px;
    box-shadow:
        0 20px 60px rgba(34, 23, 35, 0.35),
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: installSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 1s;
}
.install-banner.hiding {
    animation: installSlideDown 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes installSlideUp {
    from { transform: translateX(-50%) translateY(150%); }
    to { transform: translateX(-50%) translateY(0); }
}
@keyframes installSlideDown {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to { transform: translateX(-50%) translateY(150%); opacity: 0; }
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.install-icon-wrap {
    position: relative;
    flex-shrink: 0;
}
.install-app-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.install-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    font-size: 8px;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.install-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.install-text strong {
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 700;
}
.install-text span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    line-height: 1.3;
}

.install-btn {
    flex-shrink: 0;
    background: #FFFFFF;
    color: #221723;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.install-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.25);
}
.install-btn:active {
    transform: scale(0.98);
}
.install-btn i {
    font-size: 16px;
}

.install-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.install-dismiss:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

/* iOS Instructions */
.ios-instructions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}
.ios-step {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}
.ios-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ios-step i {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px;
    border-radius: 6px;
    margin: 0 2px;
}
.ios-arrow {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #3a2a3d;
}

/* When showing iOS mode, hide main install button */
.install-banner.ios-mode .install-btn {
    display: none;
}
.install-banner.ios-mode {
    bottom: 20px; /* Lower position for iOS arrow pointing down */
}

/* Pulse animation on the install button */
@keyframes installPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}
.install-btn.pulsing {
    animation: installPulse 2s ease-in-out infinite;
}


/* ===============================
   FRIENDS PANEL
   =============================== */
.friends-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #FAFAFA;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 24px);
}

.friends-header {
    position: sticky;
    top: 0;
    background: #FAFAFA;
    z-index: 2;
    padding: 20px 16px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.friends-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.friends-header h1 {
    font-family: var(--font-brand);
    font-size: 28px;
    font-weight: 700;
    color: #221723;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.friends-count {
    background: #221723;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
}

.friends-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F1F1F3;
    font-size: 20px;
    color: #6E6E73;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.friends-close-btn:hover {
    background: #E5E5E7;
    color: #221723;
}

/* Search */
.friends-search-wrap {
    position: sticky;
    top: 73px;
    background: #FAFAFA;
    z-index: 2;
    padding: 0 16px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.friends-search-wrap i {
    position: absolute;
    left: 28px;
    color: #8E8E93;
    font-size: 18px;
    pointer-events: none;
}

.friends-search {
    width: 100%;
    padding: 12px 12px 12px 42px;
    border: 1px solid #E5E5E7;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: #FFFFFF;
    color: #221723;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.friends-search:focus {
    border-color: #221723;
    box-shadow: 0 0 0 3px rgba(34, 23, 35, 0.1);
}
.friends-search::placeholder {
    color: #8E8E93;
}

/* Friends List */
.friends-list {
    flex: 1;
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friends-loading {
    display: flex;
    justify-content: center;
    padding: 48px 0;
}

.friends-empty {
    text-align: center;
    padding: 60px 24px;
}
.friends-empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.8;
}
.friends-empty h3 {
    font-size: 18px;
    font-weight: 700;
    color: #221723;
    margin-bottom: 8px;
}
.friends-empty p {
    font-size: 14px;
    color: #6E6E73;
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto;
}

/* Friend Card */
.friend-card {
    background: #FFFFFF;
    border: 1px solid #E5E5E7;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.friend-card:hover {
    border-color: #D1D1D6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.friend-card:active {
    transform: scale(0.99);
}

.friend-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #221723 0%, #4a3a4d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(34, 23, 35, 0.15);
    overflow: hidden;
    /* Fix Safari clipping */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.friend-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.friend-name {
    font-size: 16px;
    font-weight: 700;
    color: #221723;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-boards {
    font-size: 13px;
    color: #6E6E73;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-boards-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.friend-board-chip {
    background: #F5F3F6;
    color: #221723;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.friend-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.friend-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #221723;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(255, 165, 0, 0.25);
}

.friend-rating-zero {
    background: #F1F1F3;
    color: #8E8E93;
    box-shadow: none;
}

.friend-photos {
    font-size: 11px;
    color: #8E8E93;
}

/* Section dividers */
.friends-section-label {
    font-size: 12px;
    font-weight: 600;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 0 8px;
    margin-top: 8px;
}

/* Alphabet index (optional) */
.friend-letter-divider {
    font-size: 13px;
    font-weight: 700;
    color: #221723;
    padding: 12px 0 6px;
    border-bottom: 1px solid #F1F1F3;
    margin-bottom: 8px;
}


/* ===============================
   PROFILE PANEL
   =============================== */
.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #FAFAFA;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 24px);
}

.profile-header {
    position: sticky;
    top: 0;
    background: #FAFAFA;
    z-index: 2;
    padding: 20px 16px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-header h1 {
    font-family: var(--font-brand);
    font-size: 28px;
    font-weight: 700;
    color: #221723;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.profile-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F1F1F3;
    font-size: 20px;
    color: #6E6E73;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.profile-close-btn:hover {
    background: #E5E5E7;
    color: #221723;
}

/* Avatar Section - Premium Hero Card */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 40px;
    margin: 0 16px 24px;
    background: linear-gradient(145deg, #221723 0%, #3d2a3f 50%, #4a3650 100%);
    border-radius: 28px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 12px 40px rgba(34, 23, 35, 0.35),
        0 4px 12px rgba(34, 23, 35, 0.2);
}

/* Decorative elements */
.profile-avatar-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
}
.profile-avatar-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.profile-avatar-wrap {
    position: relative;
    margin-bottom: 16px;
    z-index: 1;
}

.profile-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFFFFF 0%, #E8E4EA 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    font-weight: 700;
    color: #221723;
    text-transform: uppercase;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 4px rgba(255, 255, 255, 0.15);
    overflow: hidden;
    /* Fix Safari clipping issues */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    isolation: isolate;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ensure image doesn't overflow in Safari */
    border-radius: 50%;
    display: block;
}

.profile-avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 3px solid #221723;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.profile-avatar-edit:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.profile-avatar-edit:active {
    transform: scale(0.95);
}
.profile-avatar-edit i {
    font-size: 14px;
    color: #221723;
}

.profile-avatar-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    z-index: 1;
}

/* Stats - Card Grid */
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 0 16px 28px;
}

.profile-stat {
    flex: 1;
    max-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 12px;
    background: #FFFFFF;
    border-radius: 18px;
    box-shadow:
        0 2px 8px rgba(34, 23, 35, 0.06),
        0 8px 24px rgba(34, 23, 35, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-stat:hover {
    transform: translateY(-2px);
    box-shadow:
        0 4px 12px rgba(34, 23, 35, 0.1),
        0 12px 32px rgba(34, 23, 35, 0.12);
}

.profile-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #221723;
    line-height: 1;
}

.profile-stat-label {
    font-family: var(--font-brand);
    font-size: 11px;
    color: #8E8E93;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    letter-spacing: 0.3px;
}

/* Form */
.profile-form {
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-form-title {
    font-family: var(--font-brand);
    font-size: 16px;
    font-weight: 600;
    color: #221723;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    padding-left: 4px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-label {
    font-size: 12px;
    font-weight: 700;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding-left: 4px;
}

.profile-input {
    padding: 16px 18px;
    border: 2px solid #EEEEF0;
    border-radius: 14px;
    font-size: 16px;
    font-family: inherit;
    background: #FFFFFF;
    color: #221723;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.profile-input:focus {
    border-color: #221723;
    background: #FAFAFA;
    box-shadow: 0 0 0 4px rgba(34, 23, 35, 0.08);
}
.profile-input::placeholder {
    color: #C7C7CC;
}

.profile-save-btn {
    margin-top: 12px;
    padding: 18px 24px;
    background: linear-gradient(135deg, #221723 0%, #3d2a3f 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 16px rgba(34, 23, 35, 0.25);
}
.profile-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 23, 35, 0.35);
}
.profile-save-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(34, 23, 35, 0.25);
}
.profile-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.profile-save-btn i {
    font-size: 20px;
}

/* Legal links in profile */
.profile-legal {
    padding: 0 16px 20px;
}

.profile-legal-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 12px;
    background: #FFFFFF;
    text-decoration: none;
    color: #1C1C1E;
    font-size: 15px;
    margin-bottom: 6px;
    border: 1px solid #E5E5E7;
    transition: background 0.15s ease;
}

.profile-legal-link:active {
    background: #F1F1F3;
}

.profile-legal-link i:first-child {
    font-size: 20px;
    color: #221723;
    opacity: 0.7;
}

.profile-legal-link span {
    flex: 1;
    font-weight: 500;
}

.profile-legal-arrow {
    font-size: 16px;
    color: #AEAEB2;
}

/* Actions */
.profile-actions {
    margin-top: auto;
    padding: 24px 16px 32px;
    background: #F5F3F6;
}

.profile-logout-btn {
    width: 100%;
    padding: 16px 24px;
    background: #FFFFFF;
    color: #FF3B30;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.1);
}
.profile-logout-btn:hover {
    background: #FFF5F5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.15);
}
.profile-logout-btn:active {
    transform: scale(0.98);
}
.profile-logout-btn i {
    font-size: 18px;
}

/* Loading state for avatar */
.profile-avatar.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Avatar upload success animation */
@keyframes avatarSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.profile-avatar.success {
    animation: avatarSuccess 0.3s ease;
}


/* ===============================
   BOARD MANAGEMENT MODALS
   =============================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-sheet {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: #FFFFFF;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #F1F1F3;
}

.modal-sheet-header h2 {
    font-family: var(--font-brand);
    font-size: 16px;
    font-weight: 600;
    color: #221723;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.modal-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #F1F1F3;
    font-size: 18px;
    color: #6E6E73;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.modal-sheet-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-sheet-danger {
    padding: 16px 20px 24px;
    border-top: 1px solid #F1F1F3;
    background: #FAFAFA;
}

/* Edit icon picker */
.edit-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.edit-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid #E5E5E7;
    background: #FFFFFF;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.edit-icon-btn:hover {
    border-color: #C7C7CC;
}
.edit-icon-btn.selected {
    border-color: #221723;
    background: #F5F3F6;
}

/* Danger button */
.danger-btn {
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    color: #FF3B30;
    border: 1px solid #FF3B30;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.danger-btn:hover {
    background: #FF3B30;
    color: #FFFFFF;
}
.danger-btn.full-width {
    margin-bottom: 12px;
}

.cancel-btn {
    width: 100%;
    padding: 14px 20px;
    background: #F1F1F3;
    color: #221723;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.cancel-btn:hover {
    background: #E5E5E7;
}

/* Leave board modal */
.leave-board-text {
    font-size: 15px;
    color: #6E6E73;
    line-height: 1.5;
    margin-bottom: 20px;
}

.ownership-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: #FFF3CD;
    border-radius: 12px;
    color: #856404;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 16px;
}
.ownership-warning i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Member select for ownership transfer */
.member-select-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.member-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #FAFAFA;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.member-select-item:hover {
    background: #F5F3F6;
}
.member-select-item.selected {
    border-color: #221723;
    background: #F5F3F6;
}

.member-select-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #221723;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.member-select-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-select-name {
    font-size: 15px;
    font-weight: 600;
    color: #221723;
}

.member-select-check {
    margin-left: auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #221723;
    color: #FFFFFF;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.member-select-item.selected .member-select-check {
    display: flex;
}

/* Board card actions */
.board-card-menu {
    position: relative;
}

.board-card-menu-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #8E8E93;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.board-card-menu-btn:hover {
    background: #F1F1F3;
    color: #221723;
}

.board-card-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 10;
    display: none;
}
.board-card-dropdown.show {
    display: block;
    animation: dropdownFadeIn 0.15s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-family: inherit;
    color: #221723;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.dropdown-item:hover {
    background: #F5F3F6;
}
.dropdown-item i {
    font-size: 16px;
    color: #6E6E73;
}
.dropdown-item.danger {
    color: #FF3B30;
}
.dropdown-item.danger i {
    color: #FF3B30;
}

/* ===============================
   WINNER POPUP & CONFETTI
   =============================== */
.winner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top, 0));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.winner-overlay.active {
    display: flex;
    animation: winnerFadeIn 0.4s ease;
}

@keyframes winnerFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.winner-popup {
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFA 100%);
    border-radius: 24px;
    width: 100%;
    max-width: 320px;
    padding: 28px 20px 24px;
    text-align: center;
    position: relative;
    animation: winnerBounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

@keyframes winnerBounceIn {
    0% { opacity: 0; transform: scale(0.8) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.winner-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.winner-skip {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #8E8E93;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.winner-skip:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #221723;
}

.winner-crown {
    font-size: 44px;
    margin-bottom: 6px;
    animation: crownBounce 2s ease-in-out infinite;
    line-height: 1;
}

@keyframes crownBounce {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-5px) rotate(3deg); }
}

.winner-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, #221723 0%, #3d2a3f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0 auto 14px;
    box-shadow: 0 6px 24px rgba(34, 23, 35, 0.3);
    position: relative;
    border: 4px solid #FFD700;
}
.winner-avatar::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.4);
    animation: ringPulse 2s ease-out infinite;
}

@keyframes ringPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.2); opacity: 0; }
}

.winner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.winner-name {
    font-size: 22px;
    font-weight: 800;
    color: #221723;
    margin-bottom: 4px;
    line-height: 1.2;
}

.winner-label {
    font-size: 12px;
    color: #8E8E93;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.winner-challenge {
    font-size: 14px;
    color: #221723;
    margin-bottom: 18px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 165, 0, 0.1));
    border-radius: 10px;
    display: inline-block;
    font-weight: 600;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.winner-cta-label {
    font-size: 14px;
    color: #221723;
    margin-bottom: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.winner-cta-label small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #8E8E93;
    font-weight: 400;
}

.winner-comment-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.winner-comment-input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid #E5E5EA;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #FFFFFF;
}
.winner-comment-input:focus {
    outline: none;
    border-color: #221723;
    box-shadow: 0 0 0 3px rgba(34, 23, 35, 0.1);
}
.winner-comment-input::placeholder {
    color: #C7C7CC;
}

.winner-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #221723 0%, #3d2a3f 100%);
    color: #FFFFFF;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}
.winner-send-btn:hover,
.winner-send-btn:active {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(34, 23, 35, 0.3);
}

.winner-skip-link {
    font-size: 13px;
    color: #8E8E93;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    padding: 8px 16px;
    display: inline-block;
}
.winner-skip-link:hover {
    color: #221723;
}

/* Confetti */
.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    z-index: 10000;
    pointer-events: none;
    will-change: transform;
}
.confetti.circle {
    border-radius: 50%;
}
.confetti.square {
    border-radius: 1px;
}
.confetti.strip {
    width: 3px;
    height: 12px;
    border-radius: 1px;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Small screen adjustments for winner popup */
@media (max-height: 600px) {
    .winner-popup {
        padding: 20px 16px;
    }
    .winner-crown {
        font-size: 36px;
        margin-bottom: 4px;
    }
    .winner-avatar {
        width: 70px;
        height: 70px;
        font-size: 28px;
        margin-bottom: 10px;
    }
    .winner-name {
        font-size: 18px;
    }
    .winner-challenge {
        margin-bottom: 12px;
        font-size: 13px;
    }
    .winner-cta-label {
        font-size: 12px;
        margin-bottom: 8px;
    }
}

/* ===============================
   WINNER MEDAL ON PHOTOS
   =============================== */
.grid-item-medal {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #221723 0%, #3d2a3f 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(34, 23, 35, 0.4);
    z-index: 5;
    border: 2px solid rgba(255, 215, 0, 0.8);
}

/* Subtle pulse for winning photos */
.grid-item:has(.grid-item-medal)::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.3);
    pointer-events: none;
    z-index: 3;
}

/* ===============================
   UNRATED PHOTO INDICATORS
   =============================== */

/* Badge on board cards showing unrated count */
.board-card-unrated {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #FFE4B5 0%, #FFD280 100%);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #8B4513;
    animation: unratedPulse 2s ease-in-out infinite;
}

.board-card-unrated i {
    font-size: 14px;
}

@keyframes unratedPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Reaction bubble on grid photos (LinkedIn style, top-right near rating) */
.grid-item-reactions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 3px 7px 3px 5px;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 5;
}

.rc-emoji {
    font-size: 12px;
    line-height: 1;
    margin-left: -2px;
}
.rc-emoji:first-child { margin-left: 0; }

.rc-total {
    font-size: 11px;
    font-weight: 700;
    color: #221723;
    margin-left: 3px;
    line-height: 1;
}

/* Push rating chip to left when reactions bubble is present */
.grid-item:has(.grid-item-reactions) .rating-chip {
    right: auto;
    left: 8px;
}

/* ===============================
   VIEWER — REACTION BUTTONS
   =============================== */
.viewer-reactions {
    padding: 0 20px 12px;
    text-align: center;
}

.viewer-reactions .vr-label {
    text-align: center;
}

.vreact-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    justify-content: center;
}

.vreact-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid #E5E5E7;
    background: #FFFFFF;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.vreact-btn:active {
    transform: scale(0.92);
}

.vreact-btn.vreact-active {
    border-color: #221723;
    background: #F5F3F6;
}

.vreact-count {
    font-size: 13px;
    font-weight: 600;
    color: #221723;
}

.vreact-pop {
    animation: vreactPop 0.3s ease;
}

@keyframes vreactPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* ===============================
   VIEWER — DELETE BUTTON
   =============================== */
.viewer-actions {
    padding: 8px 20px 16px;
}

.viewer-delete-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 59, 48, 0.2);
    background: rgba(255, 59, 48, 0.06);
    color: #FF3B30;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.viewer-delete-btn:active {
    background: rgba(255, 59, 48, 0.12);
}

.viewer-delete-btn i {
    font-size: 16px;
}

/* Star indicator on unrated photos in grid */
.grid-item-unrated {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.5);
    z-index: 5;
    animation: unratedBounce 1.5s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.9);
}

@keyframes unratedBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Subtle glow border for unrated photos */
.grid-item:has(.grid-item-unrated)::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.5);
    pointer-events: none;
    z-index: 4;
}