/* ============ ESTILOS PARA GALERIA ============ */
.upload-gallery-area {
    background: #f8fafc;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 25px;
    border: 2px dashed var(--theme-panel-icon-bg, #cbd5e0);
    transition: all 0.3s ease;
}

.upload-gallery-area:hover {
    border-color: var(--theme-panel-icon-bg, #667eea);
    background: #edf2f7;
}

.upload-instructions {
    margin-bottom: 20px;
}

.upload-instructions i {
    font-size: 48px;
    color: var(--theme-panel-icon-bg, #667eea);
    margin-bottom: 15px;
    opacity: 0.8;
}

.upload-instructions h4 {
    color: #2d3748;
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 600;
}

.upload-instructions p {
    color: #4a5568;
    font-size: 14px;
    margin-bottom: 5px;
}

.upload-instructions small {
    color: #a0aec0;
    font-size: 12px;
}

.gallery-upload-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-text-upload-trigger {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

.gallery-text-composer {
    margin-top: 18px;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    text-align: left;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.gallery-text-composer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.gallery-text-composer-header h5 {
    margin: 0 0 4px;
    font-size: 16px;
    color: #0f172a;
}

.gallery-text-composer-header p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.gallery-text-close {
    border: none;
    background: rgba(148, 163, 184, 0.12);
    color: #334155;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gallery-text-composer-body {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.gallery-text-preview-shell {
    display: flex;
    justify-content: center;
}

.gallery-text-preview-card {
    width: min(100%, 240px);
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.gallery-text-preview-media {
    position: relative;
    aspect-ratio: 4 / 5;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-text-preview-media--story {
    aspect-ratio: auto;
    display: block;
    padding: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.gallery-text-preview-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-text-preview-media--story > .gallery-text-preview-story {
    margin: 0;
    cursor: default;
    animation: none;
}

.gallery-text-preview-placeholder {
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.gallery-text-preview-placeholder i {
    font-size: 28px;
}

.gallery-text-preview-caption {
    padding: 14px 14px 16px;
    border-top: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.gallery-text-preview-caption span {
    display: block;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-line;
    word-break: break-word;
}

.gallery-text-editor {
    min-width: 0;
}

.gallery-text-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.gallery-text-editor-shell {
}

.gallery-text-caption-input {
    width: 100%;
    min-height: 108px;
    resize: vertical;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
    background: #ffffff;
}

.gallery-text-caption-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.10);
}

.gallery-text-toolbar,
.gallery-text-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-text-toolbar {
    margin-top: 10px;
}

.gallery-text-counter {
    font-size: 12px;
    color: #64748b;
    margin-left: auto;
}

.gallery-text-note {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: #64748b;
}

.gallery-text-actions {
    margin-top: 14px;
}

.upload-limits {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.limit-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #718096;
}

.limit-info i {
    color: var(--theme-panel-icon-bg, #667eea);
    font-size: 14px;
}

/* LISTA DE FOTOS SALVAS */
.gallery-list {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e2e8f0;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.list-header h5 {
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.list-count {
    color: #718096;
    font-size: 14px;
    font-weight: 500;
}

/* NOVO LAYOUT DE LISTA DA GALERIA */
.gallery-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gallery-item-card {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 12px 14px;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: grab;
    min-width: 0;
    position: relative;
}

.gallery-item-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.gallery-item-card.dragging {
    opacity: 0.5;
    background: #f1f5f9;
    border: 2px dashed var(--primary-color);
}

.drag-handle {
    color: #94a3b8;
    cursor: grab;
    padding: 0;
    width: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 10px;
}

.item-main-content {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    flex: 1;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.item-image-wrapper {
    position: relative;
    width: 76px;
    height: 76px;
    border-radius: 16px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8fafc;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}

.item-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* ============ LIGHTBOX (TELA CHEIA NO PREVIEW) ============ */
.gallery-lightbox {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none; /* Escondido por padrão */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 30px; /* Segue o arredondamento do mockup do celular */
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.gallery-lightbox.active {
    display: flex;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.3s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

.lightbox-caption {
    color: white;
    margin-top: 20px;
    font-size: 14px;
    text-align: center;
    max-width: 80%;
    line-height: 1.4;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
    z-index: 1010;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.item-details {
    flex: 1;
    display: block;
    min-width: 0;
    position: relative;
}

.gallery-visibility-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 0;
    flex-wrap: wrap;
}

.gallery-visibility-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.gallery-visibility-badge.is-visible {
    background: #ecfdf5;
    color: #047857;
}

.gallery-visibility-badge.is-hidden {
    background: #f1f5f9;
    color: #64748b;
}

.gallery-visibility-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #dbe2ea;
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 4px 6px 4px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-visibility-toggle:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.gallery-visibility-toggle__label {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.gallery-visibility-toggle__track {
    position: relative;
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.2s ease;
}

.gallery-visibility-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s ease;
}

.gallery-visibility-toggle.is-visible .gallery-visibility-toggle__track {
    background: #10b981;
}

.gallery-visibility-toggle.is-visible .gallery-visibility-toggle__thumb {
    transform: translateX(14px);
}

.gallery-item-card--hidden {
    border-color: #dbe2ea;
    background: #f8fafc;
    opacity: 0.82;
}

.gallery-item-card--hidden:hover {
    background: #f1f5f9;
}

.item-head-row {
    display: contents;
    min-width: 0;
}

.item-copy-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    flex: 1;
    padding-right: 64px;
}

.item-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.item-type-icons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.item-type-icons--below-date {
    margin-top: 6px;
}

.item-type-icon {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex: 0 0 16px;
    aspect-ratio: 1 / 1;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    line-height: 1;
    box-sizing: border-box;
}

.item-type-icon i {
    display: block;
    line-height: 1;
}

.item-type-icon--primary {
    border-color: color-mix(in srgb, var(--theme-panel-icon-bg, #667eea) 72%, white);
    background: var(--theme-panel-icon-bg, #667eea);
    color: var(--theme-panel-icon-color, #ffffff);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--theme-panel-icon-bg, #667eea) 28%, transparent);
}

.item-caption-input {
    width: 100%;
    max-width: 100%;
    min-height: 74px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-color);
    transition: all 0.2s;
    resize: vertical;
    line-height: 1.45;
    font-family: inherit;
}

.item-caption-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.item-caption-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-caption-editor.is-disabled {
    opacity: 0.8;
}

.item-caption-tools {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
    margin-top: 8px;
    max-width: 100%;
    overflow: visible;
}

.item-meta-dot {
    display: none;
}

.item-text-summary-inline {
    color: #475569;
    font-size: 13px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-width: 0;
}

.item-text-summary-inline.is-empty {
    color: #94a3b8;
    font-style: italic;
}

.item-upload-type,
.item-caption-hint {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.item-caption-hint {
    color: #94a3b8;
}

.item-emoji-btn {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
}

.upload-date {
    font-size: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: max-content;
    line-height: 1.35;
    margin-top: 6px;
}

.upload-date-short {
    display: none;
}

.primary-image-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #8a5a00;
    background: #fff7d6;
    border: 1px solid #fde68a;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.18);
}

.gallery-item-menu {
    position: absolute;
    top: -12px;
    right: 0;
    margin: 0;
}

.gallery-item-menu summary {
    list-style: none;
}

.gallery-item-menu summary::-webkit-details-marker {
    display: none;
}

.gallery-item-menu__trigger {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: var(--theme-panel-icon-bg, #667eea);
    color: var(--theme-panel-icon-color, #ffffff);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--theme-panel-icon-bg, #667eea) 32%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item-menu__trigger i {
    font-size: 12px;
}

.item-type-icons--below-date {
    margin-top: 0;
    max-width: 100%;
}

.gallery-item-menu__trigger:hover,
.gallery-item-menu[open] .gallery-item-menu__trigger {
    background: color-mix(in srgb, var(--theme-panel-icon-bg, #667eea) 88%, white);
    color: var(--theme-panel-icon-color, #ffffff);
    box-shadow: 0 14px 28px color-mix(in srgb, var(--theme-panel-icon-bg, #667eea) 38%, transparent);
    transform: translateY(-1px);
}

.gallery-item-menu__popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 40px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(10px);
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-item-menu__action {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.gallery-item-menu__action:hover {
    background: #f8fafc;
    color: #0f172a;
}

.gallery-item-menu__action.is-danger {
    color: #dc2626;
}

.gallery-item-menu__action.is-danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.compression-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 10px;
    backdrop-filter: blur(2px);
}

.secondary-media-video-shell,
.gallery-story-media video {
    width: 100%;
    height: 100%;
    display: block;
}

.gallery-story-media video {
    pointer-events: none;
}

.secondary-media-video-shell--interactive video,
.gallery-story-card--video-inline .gallery-story-media video {
    pointer-events: auto;
}

.secondary-media-video-shell {
    position: relative;
    background: #0f172a;
    overflow: hidden;
}

.secondary-media-video-shell--interactive {
    background: #000;
}

.secondary-media-video-shell--tap-player {
    cursor: pointer;
}

.secondary-media-inline-toggle {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 74px;
    height: 74px;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.74);
    color: #ffffff;
    font-size: 24px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
    z-index: 3;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.secondary-media-inline-toggle:hover {
    background: rgba(15, 23, 42, 0.88);
    transform: translate(-50%, -50%) scale(1.04);
}

.secondary-media-video-shell--tap-player.is-playing .secondary-media-inline-toggle {
    opacity: 0;
    pointer-events: none;
}

.secondary-media-video-shell--fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    color: #ffffff;
    text-align: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.secondary-media-video-shell--fallback i {
    font-size: 26px;
}

.secondary-media-play-badge {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.secondary-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.secondary-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.secondary-gallery-header .section-title-small,
.secondary-gallery-header .section-title {
    margin: 0;
}

.secondary-gallery-view-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
}

.secondary-gallery-view-btn {
    border: none;
    background: transparent;
    color: #475569;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.secondary-gallery-view-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10);
}

.secondary-gallery-view-btn:hover {
    color: #0f172a;
    transform: translateY(-1px);
}

.secondary-gallery-thumb {
    border: 0;
    padding: 6px;
    margin: 0;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    width: 100%;
    display: block;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.secondary-gallery-thumb img,
.secondary-gallery-thumb video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 8px;
    transition: none;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.secondary-gallery-thumb__media {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 8px;
    margin: 0;
    background: transparent;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.secondary-gallery-thumb:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}

.secondary-gallery-thumb .gallery-story-media {
    width: 100%;
    height: 100%;
    padding: 0;
    background: transparent;
    overflow: hidden;
    line-height: 0;
}

.secondary-gallery-thumb .gallery-story-media img,
.secondary-gallery-thumb .gallery-story-media video,
.secondary-gallery-thumb .gallery-story-media .secondary-media-video-shell {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: transparent;
    object-fit: cover;
    max-width: none;
    max-height: none;
    margin: 0;
}

.secondary-gallery-thumb video {
    pointer-events: none;
}

.secondary-gallery-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.public-feed-image-shell {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #ffffff;
    line-height: 0;
}

.public-feed-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    margin: 0;
    background: transparent;
}

.gallery-cropped-image {
    --gallery-crop-x: 0%;
    --gallery-crop-y: 0%;
    --gallery-crop-scale-x: 1;
    --gallery-crop-scale-y: 1;
    transform: translate(var(--gallery-crop-x), var(--gallery-crop-y)) scale(var(--gallery-crop-scale-x), var(--gallery-crop-scale-y));
    transform-origin: center;
    will-change: transform;
}

.gallery-story-media,
.preview-feed-image-shell,
.public-feed-image-shell,
.secondary-gallery-thumb,
.carousel-slide-media,
.item-image-wrapper {
    overflow: hidden;
}

.preview-feed-image-shell {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #ffffff;
    line-height: 0;
}

.preview-feed-image {
    width: 100%;
    height: calc(100% + 8px);
    display: block;
    object-fit: cover;
    object-position: center top;
    margin: 0;
    background: transparent;
}

.phone-screen #secondary-gallery-preview-section {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.phone-screen #secondary-gallery-preview-section .secondary-gallery-header {
    padding-left: 0;
    padding-right: 0;
}

.phone-screen #secondary-gallery-preview-section .secondary-gallery-feed {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-card {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-text {
    position: relative;
    margin-top: 0;
    background: #ffffff;
}

.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media {
    padding: 0;
    background: #ffffff;
    line-height: 0;
    overflow: hidden;
    border-radius: 0;
}

.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media .secondary-media-video-shell,
.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media video,
.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    background: transparent;
    border-radius: 0;
    transform: none;
}

.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .preview-feed-image-shell {
    border-radius: 0;
}

.phone-screen #secondaryGalleryPreview.secondary-gallery-feed .preview-feed-image {
    height: calc(100% + 8px);
    object-position: center top;
}

.gallery-item-modal-open {
    overflow: hidden;
}

.gallery-item-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1300;
}

.gallery-item-modal__dialog {
    width: min(820px, 100%);
    max-height: 90vh;
    overflow: hidden;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
    display: flex;
    flex-direction: column;
}

.gallery-item-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.gallery-item-modal__header h3 {
    margin: 0 0 4px;
    font-size: 22px;
    color: #0f172a;
}

.gallery-item-modal__header p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.gallery-item-modal__close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 26px;
    cursor: pointer;
    flex-shrink: 0;
}

.gallery-item-modal__body {
    padding: 22px 24px;
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 18px;
    overflow-y: auto;
}

.gallery-item-modal__preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gallery-item-modal__preview > img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: contain;
    object-position: center;
    padding: 12px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    box-sizing: border-box;
}

.gallery-item-modal__preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.gallery-item-modal__date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 12px;
}

.gallery-item-modal__editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.gallery-item-modal__editor-layout {
    display: block;
}

.gallery-item-modal__editor-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gallery-item-modal__crop {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gallery-item-modal__crop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.gallery-item-modal__crop-head .toolbar-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    background: #ffffff;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gallery-item-modal__crop-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 16px;
    border: 0;
    background: transparent;
    cursor: grab;
    touch-action: none;
    user-select: none;
    position: relative;
    box-shadow: none;
}

.gallery-item-modal__crop-frame.is-dragging {
    cursor: grabbing;
}

.gallery-item-modal__crop-frame.is-resizing {
    cursor: nwse-resize;
}

.gallery-item-modal__crop-frame img {
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    display: block;
    object-fit: cover;
    pointer-events: none;
    margin: -1px;
}

.gallery-crop-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    gap: 8px;
    z-index: 6;
}

.gallery-crop-action {
    width: 38px;
    height: 38px;
    border: 2px solid rgba(15, 23, 42, 0.82);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.gallery-crop-action:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.gallery-crop-handle {
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: var(--theme-panel-icon-bg, var(--primary-color, #667eea));
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.28), 0 6px 14px rgba(15, 23, 42, 0.24);
    z-index: 5;
    cursor: nwse-resize;
}

.gallery-crop-handle--nw {
    top: 8px;
    left: 8px;
}

.gallery-crop-handle--n {
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.gallery-crop-handle--ne {
    top: 8px;
    right: 8px;
    cursor: nesw-resize;
}

.gallery-crop-handle--e {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.gallery-crop-handle--se {
    right: 8px;
    bottom: 8px;
}

.gallery-crop-handle--s {
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.gallery-crop-handle--sw {
    left: 8px;
    bottom: 8px;
    cursor: nesw-resize;
}

.gallery-crop-handle--w {
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.gallery-item-modal__crop-controls {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    color: #64748b;
}

.gallery-item-modal__crop-controls input[type="range"] {
    width: 100%;
    accent-color: var(--theme-panel-icon-bg, var(--primary-color, #667eea));
}

.gallery-item-modal__editor-shell {
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    background: #ffffff;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item-modal__editor-shell:focus-within {
    border-color: var(--theme-panel-icon-bg, var(--primary-color, #667eea));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-panel-icon-bg, var(--primary-color, #667eea)) 16%, transparent);
}

.gallery-item-modal__formatbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.gallery-item-modal__formatbar .toolbar-btn,
.gallery-item-modal__formatbar .emoji-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    background: #ffffff;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.gallery-item-modal__formatbar .toolbar-btn:hover,
.gallery-item-modal__formatbar .emoji-btn:hover {
    border-color: var(--theme-panel-icon-bg, var(--primary-color, var(--theme-primary, #667eea)));
    color: var(--theme-panel-icon-bg, var(--primary-color, var(--theme-primary, #667eea)));
    background: color-mix(in srgb, var(--theme-panel-icon-bg, var(--primary-color, var(--theme-primary, #667eea))) 12%, white);
}

.gallery-item-modal__formatbar .toolbar-btn.active,
.gallery-item-modal__formatbar .emoji-btn.active {
    border-color: var(--theme-panel-icon-bg, var(--primary-color, var(--theme-primary, #667eea)));
    background: var(--theme-panel-icon-bg, var(--primary-color, var(--theme-primary, #667eea)));
    color: var(--theme-panel-icon-color, var(--theme-primary-text, #ffffff));
    box-shadow: 0 10px 20px color-mix(in srgb, var(--theme-panel-icon-bg, var(--primary-color, var(--theme-primary, #667eea))) 22%, transparent);
}

.gallery-item-modal__formatbar-separator {
    width: 1px;
    height: 24px;
    background: #dbe2ea;
}

.gallery-item-modal__label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

.gallery-item-modal__textarea {
    width: 100%;
    min-height: 132px;
    resize: vertical;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.48;
    color: #0f172a;
    background: #ffffff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.gallery-item-modal__rich-editor {
    border: none;
    min-height: 164px;
    max-height: 280px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.gallery-item-modal__rich-editor[contenteditable="false"] {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

.gallery-item-modal__rich-editor:empty::before {
    content: attr(placeholder);
    color: #a0aec0;
    cursor: text;
}

.gallery-item-modal__textarea:disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

.gallery-item-modal__preview-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.gallery-item-modal__preview-post {
    cursor: default;
    background: #ffffff;
    zoom: 0.88;
}

.gallery-item-modal__preview-post--image-only {
    background: transparent;
    box-shadow: none;
    border-radius: 20px;
}

.gallery-item-modal__preview-post--image-only .gallery-item-modal__preview-post-head,
.gallery-item-modal__preview-post--image-only .gallery-item-modal__live-preview-caption {
    display: none;
}

.gallery-item-modal__preview-post--image-only .gallery-item-modal__preview-media-shell {
    border-radius: 20px;
    margin: 0;
}

.gallery-item-modal__preview-post-head {
    padding: 16px 16px 8px;
}

.gallery-item-modal__preview-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

.gallery-item-modal__preview-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
}

.gallery-item-modal__preview-meta-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gallery-item-modal__preview-meta-copy strong {
    color: #0f172a;
    font-size: 16px;
    line-height: 1.2;
}

.gallery-item-modal__preview-meta-copy span {
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
    margin-top: 0;
}

.gallery-item-modal__preview-media-shell {
    min-height: 0;
    padding-bottom: 0;
    box-sizing: border-box;
}

.gallery-item-modal__preview-media-shell img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    background: #ffffff;
    margin: 0 auto;
}

.gallery-item-modal__live-preview-caption {
    padding: 16px 16px 12px;
    background: transparent;
}

.gallery-item-modal__live-preview-caption-copy span {
    display: block;
    color: #334155;
    font-size: 16px;
    line-height: 1.56;
    white-space: pre-line;
    word-break: break-word;
}

.gallery-item-modal__live-preview-caption[data-align="left"],
.gallery-story-text[data-align="left"] {
    text-align: left;
}

.gallery-item-modal__live-preview-caption[data-align="center"],
.gallery-story-text[data-align="center"] {
    text-align: center;
}

.gallery-item-modal__live-preview-caption[data-align="right"],
.gallery-story-text[data-align="right"] {
    text-align: right;
}

.gallery-item-modal__live-preview-caption[data-align="justify"],
.gallery-story-text[data-align="justify"] {
    text-align: justify;
}

.gallery-item-modal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-item-modal__badge,
.gallery-item-modal__counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #475569;
}

.gallery-item-modal__badge {
    padding: 6px 10px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-weight: 700;
}

.gallery-item-modal__toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
}

.gallery-item-modal__toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--theme-panel-icon-bg, var(--primary-color, #667eea));
}

.gallery-item-modal__status {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
}

.gallery-item-modal__status[data-mode="primary"] {
    color: #b45309;
}

.gallery-item-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 24px;
    border-top: 1px solid #e2e8f0;
}

@media (max-width: 640px) {
    .gallery-upload-actions {
        flex-direction: column;
    }

    .gallery-upload-actions .btn-small {
        width: 100%;
        justify-content: center;
    }

    .gallery-text-composer {
        padding: 12px;
        border-radius: 14px;
    }

    .gallery-text-composer-body {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .gallery-text-preview-card {
        width: min(100%, 230px);
    }

    .gallery-text-caption-input {
        min-height: 96px;
        font-size: 13px;
    }

    .gallery-item-card {
        padding: 9px;
        gap: 8px;
        min-width: 0;
    }

    .item-main-content {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 8px;
        min-width: 0;
    }

    .item-image-wrapper {
        width: 64px;
        height: 64px;
        border-radius: 10px;
    }

    .item-type-icon {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
        flex-basis: 18px;
        font-size: 9px;
    }

    .item-caption-tools {
        align-items: flex-start;
        gap: 6px;
        flex-wrap: wrap;
    }

    .item-meta-dot {
        display: none;
    }

    .item-text-summary-inline {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .gallery-item-menu__popover {
        min-width: min(200px, calc(100vw - 40px));
        max-width: calc(100vw - 40px);
        right: 0;
        left: auto;
    }

    .gallery-item-modal {
        padding: 14px;
        align-items: flex-end;
    }

    .gallery-item-modal__dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 22px 22px 0 0;
    }

    .gallery-item-modal__header,
    .gallery-item-modal__body,
    .gallery-item-modal__footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .gallery-item-modal__body {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .gallery-item-modal__preview > img {
        aspect-ratio: 1 / 1;
    }

    .gallery-item-modal__footer {
        flex-direction: column-reverse;
    }

    .gallery-item-modal__footer .btn-small {
        width: 100%;
        justify-content: center;
    }

}

@media (max-width: 767px) {
    #section-gallery-secondary,
    #secondary-gallery-preview-section {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }

    #section-gallery-secondary .secondary-gallery-header,
    #secondary-gallery-preview-section .secondary-gallery-header {
        padding-left: 10px;
        padding-right: 10px;
    }

    .secondary-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .secondary-gallery-feed {
        gap: 8px;
        width: calc(100% + 20px);
        margin-left: -10px;
        margin-right: -10px;
    }

    #secondaryGalleryPreview.secondary-gallery-feed {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-left: 10px;
        padding-right: 10px;
        box-sizing: border-box;
    }

    .phone-screen #secondary-gallery-preview-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box;
    }

    .phone-screen #secondary-gallery-preview-section .secondary-gallery-header {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .phone-screen #secondaryGalleryPreview.secondary-gallery-feed {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-card {
        width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .phone-screen #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-text {
        margin-top: 0 !important;
        background: #ffffff !important;
    }

    #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media {
        padding: 0 !important;
        background: #ffffff !important;
        line-height: 0;
        overflow: hidden;
        border-radius: 0 !important;
    }

    #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media .secondary-media-video-shell,
    #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media video,
    #secondaryGalleryPreview.secondary-gallery-feed .gallery-story-media img {
        display: block;
        width: 100%;
        height: 100%;
        margin: 0;
        object-fit: cover !important;
        background: transparent !important;
        border-radius: 0 !important;
        transform: none !important;
    }

    #secondaryGalleryPreview.secondary-gallery-feed .preview-feed-image-shell {
        border-radius: 0 !important;
    }

    #secondaryGalleryPreview.secondary-gallery-feed .preview-feed-image {
        height: calc(100% + 8px) !important;
        object-position: center top !important;
    }

    .secondary-gallery-thumb {
        padding: 0;
        border-radius: 8px;
        background: #ffffff;
        box-shadow: none;
    }

    .secondary-gallery-thumb img,
    .secondary-gallery-thumb video {
        border-radius: 8px;
        object-fit: cover;
        background: #ffffff;
    }

    .gallery-story-card {
        border-radius: 14px;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
        width: 100%;
    }

    .gallery-story-head {
        gap: 8px;
        padding: 10px 10px 6px;
    }

    .gallery-story-avatar {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .gallery-story-meta strong {
        font-size: 12px;
    }

    .gallery-story-meta span {
        font-size: 10px;
    }

    .gallery-story-text {
        padding: 8px 10px 8px;
    }

    .gallery-story-text__body {
        font-size: 11px;
        line-height: 1.35;
    }

    .gallery-story-text__toggle {
        font-size: 10px;
        padding-top: 6px;
    }

    .gallery-story-media {
        padding: 0;
    }

    .gallery-story-media .secondary-media-video-shell,
    .gallery-story-media video,
    .gallery-story-media img {
        border-radius: 0;
    }

    .gallery-item-card {
        padding: 8px;
    }

    .drag-handle {
        flex-basis: 9px;
        width: 9px;
    }

    .item-main-content {
        grid-template-columns: 56px minmax(0, 1fr);
        gap: 6px;
    }

    .item-image-wrapper {
        width: 56px;
        height: 56px;
    }

    .item-copy-block {
        gap: 5px;
        padding-right: 36px;
    }

    .upload-date {
        margin-top: 4px;
        font-size: 8px;
        gap: 3px;
        min-width: 0;
    }

    .upload-date-full {
        display: none !important;
    }

    .upload-date-short {
        display: inline !important;
    }

    .item-type-icons {
        gap: 3px;
    }

    .item-type-icon {
        width: 14px;
        height: 14px;
        min-width: 14px;
        min-height: 14px;
        flex: 0 0 14px;
    }

    .item-type-icon i {
        font-size: 7px;
    }

    .gallery-item-menu {
        top: -8px;
        right: -2px;
    }

    .gallery-item-menu__trigger {
        width: 22px;
        height: 22px;
        box-shadow: 0 6px 14px color-mix(in srgb, var(--theme-panel-icon-bg, #667eea) 24%, transparent);
    }

    .gallery-item-menu__trigger i {
        font-size: 9px;
    }

    .gallery-item-menu__popover {
        min-width: min(180px, calc(100vw - 28px));
        max-width: calc(100vw - 28px);
    }
}

@media (max-width: 1024px) and (orientation: landscape) and (max-height: 540px) {
    .gallery-list {
        padding: 12px;
    }

    .gallery-item-card {
        padding: 8px 10px;
        gap: 8px;
        align-items: flex-start;
    }

    .drag-handle {
        flex-basis: 12px;
        width: 12px;
        padding-top: 18px;
    }

    .item-main-content {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 8px;
        align-items: start;
    }

    .item-image-wrapper {
        width: 52px;
        height: 52px;
        border-radius: 10px;
    }

    .item-copy-block {
        gap: 4px;
        padding-right: 38px;
    }

    .item-caption-tools {
        gap: 4px;
        margin-top: 4px;
        padding-right: 4px;
    }

    .upload-date {
        min-width: 0;
        max-width: 100%;
        font-size: 9px;
        line-height: 1.25;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .item-type-icons {
        gap: 4px;
        flex-wrap: wrap;
    }

    .item-type-icon {
        width: 18px;
        height: 18px;
        min-width: 18px;
        min-height: 18px;
        flex-basis: 18px;
        font-size: 9px;
    }

    .gallery-item-menu {
        top: 2px;
        right: 2px;
    }

    .gallery-item-menu__trigger {
        width: 24px;
        height: 24px;
    }

    .gallery-item-menu__trigger i {
        font-size: 10px;
    }
}

/* ESTILOS DE CAPTION NO PREVIEW (PHONE) */
.carousel-caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 20px 15px 10px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

#phoneGallery.has-caption-below {
    aspect-ratio: auto;
}

#phoneGallery .carousel-slide--caption-below {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    height: auto;
    background: transparent;
}

#phoneGallery .carousel-slide-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: block;
    line-height: 0;
    overflow: hidden;
}

#phoneGallery .carousel-slide--caption-below .carousel-slide-media {
    border-radius: 12px 12px 0 0;
}

#phoneGallery .carousel-slide--caption-below .carousel-slide-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

#phoneGallery .carousel-slide-caption-below {
    padding: 12px 14px 14px;
    background: #ffffff;
    color: #334155;
    text-align: center;
    border-radius: 0 0 12px 12px;
}

#phoneGallery .carousel-slide-caption-below span {
    white-space: pre-line;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 600;
}

.carousel-caption-overlay span,
.grid-caption-badge span,
.gallery-story-text__body,
.gallery-story-caption span {
    white-space: pre-line;
    word-break: break-word;
}

.grid-caption-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    background: rgba(255,255,255,0.9);
    color: #1e293b;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-gallery {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #a0aec0;
}

.empty-gallery i {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-gallery p {
    font-size: 14px;
    margin-bottom: 5px;
}

.empty-gallery small {
    font-size: 12px;
}

/* Feed vertical estilo stories no preview */
.gallery-open-feed-btn {
    border: none;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.gallery-open-feed-btn:hover {
    background: rgba(15, 23, 42, 0.14);
    transform: translateY(-1px);
}

.gallery-story-summary {
    width: 100%;
}

.gallery-story-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gallery-story-card {
    position: relative;
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    animation: galleryStoryDrop 0.32s ease;
    cursor: pointer;
}

.gallery-story-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 8px;
}

.gallery-story-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #e2e8f0;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.gallery-story-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-story-avatar-fallback {
    font-size: 16px;
}

.gallery-story-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gallery-story-meta strong {
    font-size: 13px;
    line-height: 1.2;
    color: #0f172a;
}

.gallery-story-meta span {
    font-size: 11px;
    color: #64748b;
}

.gallery-story-text {
    padding: 10px 12px 10px;
}

.gallery-story-text__body {
    color: #334155;
    font-size: 12px;
    line-height: 1.45;
}

.gallery-story-text__body > *:first-child {
    margin-top: 0;
}

.gallery-story-text__body > *:last-child {
    margin-bottom: 0;
}

.gallery-story-text__body p {
    margin: 0;
}

.gallery-story-text--collapsible .gallery-story-text__body {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-story-text--collapsible.is-collapsed .gallery-story-text__body {
    -webkit-line-clamp: 4;
}

.gallery-story-text--collapsible.is-expanded .gallery-story-text__body {
    -webkit-line-clamp: unset;
}

.gallery-story-text__toggle {
    border: none;
    background: transparent;
    padding: 8px 0 0;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.gallery-story-text__toggle i {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.gallery-story-text--collapsible.is-expanded .gallery-story-text__toggle i {
    transform: rotate(180deg);
}

.gallery-story-text__toggle-less {
    display: none;
}

.gallery-story-text--collapsible.is-expanded .gallery-story-text__toggle-more {
    display: none;
}

.gallery-story-text--collapsible.is-expanded .gallery-story-text__toggle-less {
    display: inline;
}

.gallery-story-media {
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
}

.gallery-story-media img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    background: #f8fafc;
    margin: 0 auto;
}

.gallery-story-media .secondary-media-video-shell,
.gallery-story-media video,
.gallery-story-media img {
    width: 100%;
    height: 100%;
    border-radius: 14px;
}

.gallery-story-media .secondary-media-video-shell img,
.gallery-story-media .secondary-media-video-shell video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-story-card--video-inline {
    cursor: default;
}

.gallery-story-card--video-inline .gallery-story-media {
    cursor: default;
}

.gallery-story-card--video-inline .gallery-story-media .secondary-media-video-shell {
    aspect-ratio: 9 / 16;
    background: #000;
}

.gallery-story-card--video-inline .gallery-story-media .secondary-media-video-shell video {
    object-fit: contain;
    background: #000;
}

.gallery-story-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 12px 12px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.72) 100%);
    color: #ffffff;
}

.gallery-story-caption span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.gallery-feed-modal-content {
    justify-content: flex-start;
    padding: 58px 16px 18px;
}

.gallery-feed-modal-header {
    width: 100%;
    margin-bottom: 14px;
    color: #ffffff;
}

.gallery-feed-modal-header h4,
.gallery-feed-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.gallery-feed-modal-header p {
    margin: 4px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
}

.gallery-feed-modal-scroll {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-feed-modal-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.gallery-feed-modal-scroll .gallery-story-card {
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    overflow: visible;
}

.gallery-feed-modal-scroll .gallery-story-head {
    padding: 12px 12px 8px;
}

.gallery-feed-modal-scroll .gallery-story-avatar {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
}

.gallery-feed-modal-scroll .gallery-story-meta strong {
    font-size: 13px;
}

.gallery-feed-modal-scroll .gallery-story-meta span {
    font-size: 11px;
}

.gallery-feed-modal-scroll .gallery-story-text {
    padding: 0 12px 10px;
}

.gallery-feed-modal-scroll .gallery-story-text__body {
    font-size: 12px;
    line-height: 1.45;
}

.gallery-feed-modal-scroll .gallery-story-media img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
}

.gallery-feed-modal-scroll .gallery-story-media {
    padding: 0;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    overflow: hidden;
    background: transparent;
}

.gallery-feed-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.72);
    padding: 24px 12px;
}

.gallery-feed-empty i {
    font-size: 28px;
    margin-bottom: 10px;
}

.gallery-story-media img.gallery-cropped-image,
.secondary-gallery-thumb img.gallery-cropped-image,
.secondary-gallery-thumb__media.gallery-cropped-image,
.public-feed-image.gallery-cropped-image,
.preview-feed-image.gallery-cropped-image,
.carousel-slide-media img.gallery-cropped-image,
.item-image-wrapper img.gallery-cropped-image {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    display: block;
    object-fit: cover;
    transform: translate(var(--gallery-crop-x), var(--gallery-crop-y)) scale(var(--gallery-crop-scale-x), var(--gallery-crop-scale-y));
    transform-origin: center;
}

.gallery-item-modal__preview-post--image-only .gallery-item-modal__preview-media-shell.gallery-item-modal__crop-frame,
.gallery-item-modal__preview-media-shell.gallery-item-modal__crop-frame {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    line-height: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}

.gallery-item-modal__preview-media-shell.gallery-item-modal__crop-frame img.gallery-cropped-image {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: inherit !important;
    background: transparent !important;
    object-fit: cover !important;
}

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