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

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(to right, #3b82f6, #1e3a8a);
    color: #111827;
}

/* =====================================================
   CONTENEDOR PRINCIPAL
====================================================== */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =====================================================
   SISTEMA DE NOTIFICACIONES TOAST
====================================================== */

.toast-container {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 480px;
    padding: 14px 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-success {
    border-left: 5px solid #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error {
    border-left: 5px solid #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-info {
    border-left: 5px solid #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

.toast-icon {
    font-size: 20px;
    line-height: 1;
}

.toast-message {
    flex: 1;
}

.toast-close {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #4b5563;
}

/* =====================================================
   BOTÓN VOLVER ARRIBA
====================================================== */

.back-to-top {
    position: fixed;
    right: 25px;
    bottom: 112px;
    z-index: 1500;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1d4ed8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: white;
    transform: translateY(-3px);
}

.arrow-up {
    width: 13px;
    height: 13px;
    border-top: 3px solid #1d4ed8;
    border-left: 3px solid #1d4ed8;
    transform: rotate(45deg);
    margin-top: 6px;
}

/* =====================================================
   BARRA SUPERIOR (TICKER Y RELOJ)
====================================================== */

.top-bar {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 24px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.ticker-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.ticker-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #ffffff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.4);
    flex-shrink: 0;
}

.ticker-sparkle {
    font-size: 12px;
    animation: sparklePulse 1.8s infinite ease-in-out;
}

@keyframes sparklePulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.3); opacity: 1; }
}

.ticker-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    contain: layout paint;
}

.ticker-viewport::before,
.ticker-viewport::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    z-index: 5;
    pointer-events: none;
}

.ticker-viewport::before {
    left: 0;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.85), transparent);
}

.ticker-viewport::after {
    right: 0;
    background: linear-gradient(to left, rgba(15, 23, 42, 0.85), transparent);
}

.ticker-track {
    display: inline-flex;
    white-space: nowrap;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    animation: tickerScroll 36s linear infinite;
}

@keyframes tickerScroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

.ticker-content {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    gap: 16px;
    padding-right: 16px;
    flex-shrink: 0;
}

.ticker-item {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.ticker-dot {
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
}

.top-clock-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 14px;
    min-width: 245px;
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.clock-icon {
    font-size: 13px;
}

/* =====================================================
   HEADER
====================================================== */

.app-header,
header {
    position: relative;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    gap: 20px;
    flex-wrap: wrap;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-left {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 10;
    max-width: 620px;
    padding: 4px 0;
}

.header-heart-bg {
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%) rotate(-6deg);
    width: 78px;
    height: 90px;
    object-fit: contain;
    z-index: 1;
    pointer-events: none;
    opacity: 0.95;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s ease;
}

.header-text-group {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 36px;
}

.header-title {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.4px;
    margin: 0;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 40%, #bfdbfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-description {
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.1px;
    line-height: 1.4;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
    .header-heart-bg {
        width: 64px;
        height: 74px;
        left: -8px;
    }
    .header-text-group {
        padding-left: 30px;
    }
    .header-title {
        font-size: 20px;
    }
    .header-description {
        font-size: 12px;
    }
}

/* =====================================================
   ACCIONES DEL HEADER
====================================================== */

.header-actions {
    position: relative;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =====================================================
   BOTÓN Y MENÚ MIS HISTORIAS
====================================================== */

.stories-dropdown-wrapper {
    position: relative;
    z-index: 1002;
}

.btn-stories {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-stories:hover,
.btn-stories[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.stories-btn-icon {
    font-size: 16px;
}

.stories-arrow {
    font-size: 11px;
    opacity: 0.8;
    transition: transform 0.25s ease;
}

.btn-stories[aria-expanded="true"] .stories-arrow {
    transform: rotate(180deg);
}

.stories-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 290px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
    padding: 12px;
    z-index: 9999 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.stories-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-header,
.custom-stories-header {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 8px 8px;
}

.dropdown-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.dropdown-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(99, 102, 241, 0.35));
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #ffffff;
}

.btn-pin-story {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    opacity: 0.25;
    filter: grayscale(100%);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-item:hover .btn-pin-story,
.custom-story-item:hover .btn-pin-story {
    opacity: 0.65;
    filter: grayscale(40%);
}

.btn-pin-story:hover {
    opacity: 1 !important;
    filter: grayscale(0%) !important;
    transform: scale(1.18) rotate(-12deg);
    background: rgba(245, 158, 11, 0.25);
}

.btn-pin-story.is-pinned {
    opacity: 1 !important;
    filter: grayscale(0%) !important;
    transform: scale(1.1) rotate(-15deg);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.45));
    border: 1px solid rgba(251, 191, 36, 0.7);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.btn-pin-story .pin-icon {
    font-size: 13px;
    line-height: 1;
}

.story-item-click {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.dropdown-item .item-icon {
    font-size: 15px;
}

.dropdown-item .item-label {
    flex: 1;
}

.dropdown-item .item-badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.dropdown-item .item-badge.badge-fav {
    background: linear-gradient(135deg, #ff4b72, #e11d48);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 4px;
}

.custom-stories-list {
    min-height: 35px;
    max-height: 190px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}

.custom-story-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.custom-story-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.custom-story-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(99, 102, 241, 0.35));
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #ffffff;
}

.custom-story-item .story-label {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-story-item .story-badge {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.stories-empty-msg {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-style: italic;
    padding: 8px 10px;
    text-align: center;
}

.dropdown-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-new-story {
    width: 100%;
    padding: 8px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-new-story:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
}

/* =====================================================
   BOTÓN FLOTANTE FIJO (STICKY) CARGAR FOTOS Y VIDEOS
====================================================== */

.btn-upload-floating {
    position: fixed;
    bottom: 54px;
    right: 24px;
    z-index: 1300;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 22px;
    border: 1px solid rgba(254, 240, 138, 0.7);
    border-radius: 999px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.45), 0 4px 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-upload-floating:hover {
    background: linear-gradient(135deg, #fde047 0%, #fbbf24 50%, #f59e0b 100%);
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 12px 32px rgba(245, 158, 11, 0.65), 0 6px 16px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.9);
    color: #020617;
}

.btn-upload-floating:active {
    transform: translateY(-1px) scale(0.98);
}

.upload-fab-icon {
    font-size: 15px;
    font-weight: 900;
    transition: transform 0.3s ease;
}

.btn-upload-floating:hover .upload-fab-icon {
    transform: rotate(90deg) scale(1.2);
}

@media (max-width: 640px) {
    .btn-upload-floating {
        bottom: 50px;
        right: 14px;
        padding: 9px 16px;
        font-size: 13px;
        gap: 6px;
    }
}

/* =====================================================
   BARRA FLOTANTE DE ORGANIZACIÓN Y MOVER (DOCK)
====================================================== */

.organize-dock {
    position: fixed;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1850;
    display: none;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 999px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.organize-dock.visible {
    display: flex;
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.btn-dock-move {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-dock-move:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

/* =====================================================
   BARRA CONTEXTUAL FLOTANTE DE FAVORITAS (DOCK)
====================================================== */

.favorites-dock {
    position: fixed;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1800;
    display: none;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: rgba(17, 24, 39, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.favorites-dock.visible {
    display: flex;
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.favorites-dock.stacked {
    bottom: 112px;
}

.dock-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    padding-left: 4px;
}

.dock-heart {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dock-heart-svg {
    width: 22px;
    height: 22px;
    color: #ff4b72;
    filter: drop-shadow(0 2px 8px rgba(255, 75, 114, 0.65));
    animation: heartPulse 1.5s infinite;
}

.dock-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
}

.dock-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dock-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-dock-filter {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-dock-filter:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

.btn-dock-download {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-dock-download:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

@keyframes bluePulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.6));
    }
    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.95));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.6));
    }
}

.dock-check {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dock-check-svg {
    width: 22px;
    height: 22px;
    color: #3b82f6;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.65));
    animation: bluePulse 1.6s infinite;
}

.btn-dock-clear,
.btn-dock-clear-selection {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-dock-clear:hover,
.btn-dock-clear-selection:hover {
    background: rgba(239, 68, 68, 0.35);
    color: white;
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .favorites-dock {
        bottom: 20px;
        width: calc(100% - 30px);
        max-width: 420px;
        border-radius: 20px;
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .dock-divider {
        display: none;
    }

    .dock-actions {
        width: 100%;
        justify-content: space-between;
    }

    .dock-btn {
        flex: 1;
        text-align: center;
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* =====================================================
   CONTENIDO
====================================================== */

main {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px 24px 60px;
    flex: 1;
}

/* =====================================================
   INTRO
====================================================== */

.intro {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    margin-top: 5px;
}

.heart-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 170px;
    height: auto;
    transform: translate(-50%, -50%);
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}

.title {
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
    font-size: 36px;
    line-height: 1.15;
    font-weight: 700;
    color: white;
    margin: 0;
}

.description {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 15px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.9);
    max-width: 700px;
    white-space: normal;
}

/* =====================================================
   GALERÍA
====================================================== */

.gallery-section {
    margin-top: 24px;
}

/* =====================================================
   BANNER DE HISTORIA ACTIVA
====================================================== */

.active-story-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.92), rgba(67, 56, 202, 0.92));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    padding: 12px 20px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    animation: storyBarFade 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.active-story-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.active-story-icon {
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.active-story-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.active-story-tag {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #a5b4fc;
}

.active-story-title {
    font-size: 19px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active-story-count {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

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

.btn-story-action {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-story-rename {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-story-rename:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

.btn-story-delete {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-story-delete:hover {
    background: rgba(239, 68, 68, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-story-exit {
    background: rgba(255, 255, 255, 0.92);
    color: #1e3a8a;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-story-exit:hover {
    background: #ffffff;
    transform: translateY(-1px);
}

.story-empty-gallery-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 2px dashed rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.9);
}

.story-empty-gallery-msg h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.story-empty-gallery-msg p {
    font-size: 14px;
    opacity: 0.85;
    max-width: 460px;
    margin: 0 auto;
}

.gallery-title {
    position: relative;
    z-index: 1;
    color: white;
    font-size: 26px;
    text-align: center;
    margin-bottom: 25px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.photo-card {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 14px;
    background: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.30);
}

.photo-card img,
.photo-card video,
.media-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.photo-card:hover img,
.photo-card:hover video,
.photo-card:hover .media-element {
    transform: scale(1.05);
}

.media-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 0.95);
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 5px;
    pointer-events: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    transition: all 0.3s ease;
}

.photo-card:hover .media-badge {
    transform: translate(-50%, -50%) scale(1.12);
    background: rgba(0, 0, 0, 0.55);
    border-color: rgba(255, 255, 255, 0.85);
}

/* =====================================================
   FAVORITO Y DESCARGA EN THUMBNAIL (MODERNO GLASSMORPHISM)
====================================================== */

.favorite-button,
.download-button,
.select-button {
    position: absolute;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #6b7280;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.select-button {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    color: #9ca3af;
}

.favorite-button {
    bottom: 10px;
    right: 58px;
}

.download-button {
    bottom: 10px;
    right: 10px;
    text-decoration: none;
    color: #2563eb;
}

.select-button.selected {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.55);
}

.select-button .icon-check {
    width: 18px;
    height: 18px;
}

.favorite-button:hover,
.download-button:hover {
    transform: translateY(-2px) scale(1.08);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.favorite-button.favorite {
    background: linear-gradient(135deg, #ff4b72, #e11d48);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.45);
    animation: heartPulse 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.favorite-button.favorite:hover {
    background: linear-gradient(135deg, #ff335c, #be123c);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.6);
}

.icon-heart,
.icon-download {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.favorite-button:active .icon-heart,
.download-button:active .icon-download {
    transform: scale(0.85);
}

@keyframes heartPulse {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* =====================================================
   GALERÍA VACÍA
====================================================== */

.empty-gallery {
    padding: 50px 20px;
    border: 2px dashed rgba(255, 255, 255, 0.45);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.75);
    text-align: center;
    font-size: 18px;
}

/* =====================================================
   MODAL
====================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.65);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 720px;
    background: white;
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 25px;
}

/* =====================================================
   DRAG & DROP
====================================================== */

.drop-zone {
    min-height: 250px;
    border: 2px dashed #60a5fa;
    background: #eff6ff;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    transition: 0.2s;
}

.drop-zone.dragover {
    background: #dbeafe;
    border-color: #2563eb;
}

.camera-icon {
    font-size: 55px;
    margin-bottom: 10px;
}

.drop-title {
    color: #374151;
    font-size: 19px;
    font-weight: 700;
}

.drop-description {
    margin-top: 8px;
    color: #6b7280;
    font-size: 14px;
}

.btn-browse {
    margin-top: 20px;
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.btn-browse:hover {
    background: #1d4ed8;
}

#fileInput {
    display: none;
}

/* =====================================================
   ARCHIVOS SELECCIONADOS
====================================================== */

.selected-files {
    margin-top: 18px;
    max-height: 120px;
    overflow-y: auto;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 12px;
    display: none;
}

.selected-files.active {
    display: block;
}

.selected-files-title {
    font-weight: 700;
    color: #374151;
    margin-bottom: 8px;
}

.file-item {
    font-size: 14px;
    color: #6b7280;
    padding: 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =====================================================
   FOTOS CARGADAS
====================================================== */

.uploaded-files {
    margin-top: 18px;
    max-height: 120px;
    overflow-y: auto;
    background: #ecfdf5;
    border-radius: 8px;
    padding: 12px;
    display: none;
}

.uploaded-files.active {
    display: block;
}

.uploaded-files-title {
    font-weight: 700;
    color: #166534;
    margin-bottom: 8px;
}

.uploaded-file-item {
    font-size: 14px;
    color: #15803d;
    padding: 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =====================================================
   PROGRESO
====================================================== */

.progress-container {
    margin-top: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 7px;
}

.progress-bar {
    width: 100%;
    height: 15px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: #2563eb;
    border-radius: 999px;
    transition: width 0.2s ease;
}

/* =====================================================
   BOTONES MODAL
====================================================== */

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 25px;
}

.modal-actions-right {
    display: flex;
    gap: 10px;
}

.btn-cancel {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #4b5563;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
}

.btn-cancel:hover {
    background: #f3f4f6;
}

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

.btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.btn-gallery {
    background: #2563eb;
    color: white;
}

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

.btn-modal:disabled {
    background: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
}

/* =====================================================
   ESTILOS DE MODALES DE HISTORIAS (GLASSMORPHISM)
====================================================== */

.modal-story-box {
    max-width: 490px;
    width: 92%;
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(59, 130, 246, 0.2);
    padding: 26px 28px;
    animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-story-box .modal-title {
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #ffffff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.story-input-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.story-text-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.story-text-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.story-text-input:focus {
    border-color: #60a5fa;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.story-icon-picker {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
    max-height: 160px;
    overflow-y: auto;
    padding: 6px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

@media (max-width: 500px) {
    .story-icon-picker {
        grid-template-columns: repeat(6, 1fr);
    }
}

.icon-opt {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-opt:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px) scale(1.08);
}

.icon-opt.selected {
    border-color: #60a5fa;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(99, 102, 241, 0.45));
    transform: scale(1.12);
    box-shadow: 0 0 14px rgba(96, 165, 250, 0.5);
}

.modal-actions-story {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    gap: 12px;
}

.btn-cancel-story {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.btn-cancel-story:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-save-story {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
    transition: all 0.2s;
}

.btn-save-story:hover {
    background: linear-gradient(135deg, #1d4ed8, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.btn-save-story:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.assign-intro-msg {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 14px;
    line-height: 1.45;
}

.assign-intro-msg strong {
    color: #93c5fd;
}

.assign-stories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.assign-story-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: #ffffff;
}

.assign-story-btn:hover {
    border-color: #60a5fa;
    background: rgba(59, 130, 246, 0.22);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

.assign-story-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14.5px;
    font-weight: 700;
    color: #ffffff;
}

.assign-story-badge {
    font-size: 11.5px;
    font-weight: 700;
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.25);
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(147, 197, 253, 0.25);
}

/* =====================================================
   VISOR DE FOTOS
====================================================== */

.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.90);
    padding: 40px;
}

.photo-viewer.active {
    display: flex;
}

.viewer-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.viewer-image {
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.50);
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: zoom-in;
}

.viewer-image.is-zoomed {
    cursor: grab;
}

.viewer-image.is-dragging {
    cursor: grabbing !important;
    transition: none !important;
}

.viewer-video {
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.50);
    user-select: none;
}

/* =====================================================
   CONTROLES FLOTANTES DE ZOOM (MODERNO GLASSMORPHISM)
====================================================== */

.viewer-zoom-controls {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(17, 24, 39, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    padding: 6px 14px;
    border-radius: 999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    transition: opacity 0.25s ease;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.zoom-level {
    color: white;
    font-size: 13px;
    font-weight: 700;
    min-width: 44px;
    text-align: center;
    user-select: none;
}

/* =====================================================
   CERRAR VISOR
====================================================== */

.viewer-close {
    position: absolute;
    top: 20px;
    right: 25px;
    z-index: 20;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 36px;
    line-height: 40px;
    cursor: pointer;
    transition: 0.2s;
}

.viewer-close:hover {
    background: rgba(255, 255, 255, 0.30);
}

/* =====================================================
   FLECHAS DEL VISOR
====================================================== */

.viewer-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 60px;
    height: 80px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 50px;
    line-height: 60px;
    cursor: pointer;
    transition: 0.2s;
}

.viewer-arrow:hover {
    background: rgba(255, 255, 255, 0.30);
}

.viewer-prev {
    left: 20px;
}

.viewer-next {
    right: 20px;
}

/* =====================================================
   FAVORITO Y DESCARGA EN VISOR (LIGHTBOX)
====================================================== */

.viewer-favorite,
.viewer-download {
    position: absolute;
    right: 30px;
    z-index: 20;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #6b7280;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.viewer-favorite {
    bottom: 30px;
}

.viewer-download {
    bottom: 96px;
    color: #2563eb;
    text-decoration: none;
}

.viewer-favorite:hover,
.viewer-download:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.98);
}

.viewer-favorite.favorite {
    background: linear-gradient(135deg, #ff4b72, #e11d48);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.55);
    animation: heartPulse 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.viewer-favorite .icon-heart,
.viewer-download .icon-download {
    width: 24px;
    height: 24px;
}

/* =====================================================
   CONTADOR
====================================================== */

.viewer-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    color: white;
    font-size: 15px;
    background: rgba(0, 0, 0, 0.50);
    padding: 7px 14px;
    border-radius: 20px;
}

/* =====================================================
   RESPONSIVE
====================================================== */

@media (max-width: 1200px) {
    .gallery {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
}

@media (max-width: 900px) {
    .gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .title {
        font-size: 42px;
    }
}

@media (max-width: 700px) {
    .top-bar {
        flex-direction: column;
        gap: 6px;
        padding: 8px 12px;
    }

    .top-clock-container {
        width: 100%;
        justify-content: center;
        font-size: 11px;
        padding: 3px 10px;
    }

    header {
        min-height: auto;
        padding: 12px 16px;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .logo-container {
        transform: translateY(0);
        margin: 0 auto;
    }

    .white-circle {
        display: none;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-stories,
    .btn-upload {
        flex: 1;
        min-width: 130px;
        justify-content: center;
        font-size: 12.5px;
        padding: 8px 12px;
    }

    .stories-dropdown-menu {
        right: auto;
        left: 50%;
        width: min(320px, calc(100vw - 24px));
        transform: translateX(-50%) translateY(-10px) scale(0.96);
    }

    .stories-dropdown-menu.open {
        transform: translateX(-50%) translateY(0) scale(1);
    }

    .title {
        font-size: 28px;
    }

    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .modal {
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 15px;
    }

    .modal-actions-right {
        flex-direction: column;
    }

    .btn-modal,
    .btn-cancel {
        width: 100%;
    }

    .viewer-arrow {
        width: 45px;
        height: 65px;
        font-size: 38px;
    }

    .viewer-prev {
        left: 5px;
    }

    .viewer-next {
        right: 5px;
    }

    .viewer-close {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
        font-size: 30px;
    }

    .viewer-favorite {
        right: 15px;
        bottom: 60px;
        width: 50px;
        height: 50px;
        font-size: 30px;
    }

    .viewer-download {
        right: 15px;
        bottom: 120px;
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .favorite-button {
        right: 58px;
        bottom: 8px;
    }

    .download-button {
        right: 8px;
        bottom: 8px;
    }
}

@media (max-width: 450px) {
    .title {
        font-size: 24px;
    }

    .logo {
        width: 140px;
    }

    main {
        padding-left: 12px;
        padding-right: 12px;
    }

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

/* =====================================================
   BANDEJA FLOTANTE DE LIBROS MÁGICOS (DRAG & DROP)
====================================================== */

.magic-books-dock {
    position: fixed;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%) translateY(130%);
    width: min(95%, 980px);
    background: rgba(10, 15, 30, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1.5px solid rgba(255, 215, 0, 0.4);
    border-radius: 24px;
    padding: 16px 20px 14px;
    z-index: 2300;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.65), 0 0 35px rgba(234, 179, 8, 0.25);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.magic-books-dock.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.magic-dock-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 800;
    color: #fef08a;
    text-shadow: 0 0 12px rgba(250, 204, 21, 0.6);
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.magic-sparkle-icon {
    font-size: 16px;
    animation: sparklePulse 2s ease-in-out infinite;
}

.magic-books-scroll-wrapper {
    display: flex;
    overflow-x: auto;
    padding: 10px 10px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
}

.magic-books-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0 auto;
    padding: 4px 10px 8px;
    min-height: 155px;
}

/* =====================================================
   LIBRO 3D MÁGICO (CERRADO Y TOTALMENTE ABIERTO)
====================================================== */

.magic-book {
    position: relative;
    width: 120px;
    height: 160px;
    perspective: 1000px;
    cursor: pointer;
    flex-shrink: 0;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

/* Prevenir que elementos internos disparen eventos que causen parpadeo o vibración */
.magic-book * {
    pointer-events: none !important;
}

.magic-book:hover {
    transform: translateY(-8px) scale(1.04);
}

/* Cuando se arrastra encima: el libro se abre ampliamente con gran zona de soltar */
.magic-book.drag-over {
    width: 245px;
    transform: translateY(-26px) scale(1.18);
    z-index: 500;
}

.book-body {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Contenido interior: Spread de 2 páginas abiertas */
.book-open-spread {
    position: absolute;
    inset: 0;
    display: flex;
    background: #fdfbf7;
    border-radius: 10px;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.2), 0 14px 30px rgba(0, 0, 0, 0.6), 0 0 25px rgba(251, 191, 36, 0.5);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s ease;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.magic-book.drag-over .book-open-spread {
    opacity: 1;
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px #38bdf8, 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.85);
}

/* Página Izquierda Abierta */
.book-page-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border-right: 1px solid #e2e8f0;
    text-align: center;
    gap: 6px;
}

.open-left-icon {
    font-size: 32px;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.25));
    animation: iconBounce 1.5s infinite ease-in-out;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.open-story-title {
    font-size: 11.5px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.15;
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.open-story-badge {
    font-size: 9.5px;
    font-weight: 700;
    color: #475569;
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 8px;
    border-radius: 999px;
}

/* Lomo central de unión de páginas */
.book-spine-crease {
    width: 4px;
    background: linear-gradient(to bottom, #d97706, #b45309);
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.4);
}

/* Página Derecha Abierta (Zona de soltar) */
.book-page-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    text-align: center;
}

.page-drop-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.drop-action-badge {
    background: #2563eb;
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.6);
    animation: dropBadgePulse 1s infinite alternate;
}

@keyframes dropBadgePulse {
    0% { transform: scale(0.95); }
    100% { transform: scale(1.08); }
}

.page-drop-icon {
    font-size: 26px;
    animation: dropPulse 1.2s infinite ease-in-out;
}

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

.page-drop-text {
    font-size: 10px;
    font-weight: 800;
    color: #1d4ed8;
    line-height: 1.15;
    max-width: 95px;
}

/* Tapa Frontal Cerrada */
.book-cover-front {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 4px 10px 10px 4px;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    box-shadow: 4px 6px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    gap: 6px;
    backface-visibility: hidden;
    z-index: 10;
}

.magic-book.drag-over .book-cover-front {
    transform: rotateY(-140deg);
    opacity: 0;
    pointer-events: none;
}

/* Variantes temáticas de tapas de libros */
.magic-book[data-theme="ruby"] .book-cover-front {
    background: linear-gradient(135deg, #e11d48, #9f1239);
}

.magic-book[data-theme="emerald"] .book-cover-front {
    background: linear-gradient(135deg, #10b981, #047857);
}

.magic-book[data-theme="amber"] .book-cover-front {
    background: linear-gradient(135deg, #f59e0b, #b45309);
}

.magic-book[data-theme="purple"] .book-cover-front {
    background: linear-gradient(135deg, #8b5cf6, #5b21b6);
}

.magic-book[data-theme="fav"] .book-cover-front {
    background: linear-gradient(135deg, #ff4b72, #e11d48);
}

.book-spine-decor {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: rgba(0, 0, 0, 0.25);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px 0 0 4px;
}

.book-icon {
    font-size: 30px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.book-name {
    font-size: 12px;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    line-height: 1.15;
    max-width: 98px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.book-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.35);
    color: #fef08a;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ANIMACIÓN DE ABSORCIÓN AL SOLTAR */
.magic-book.absorbed {
    animation: bookAbsorb 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bookAbsorb {
    0% { transform: translateY(-14px) scale(1.08); }
    45% { transform: translateY(-20px) scale(1.22); filter: brightness(1.5) drop-shadow(0 0 20px #fde047); }
    100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

/* ESTILOS DE ARRASTRE DE TARJETA */
.photo-card.dragging {
    opacity: 0.35;
    transform: scale(0.85);
    border: 2px dashed #3b82f6;
    filter: grayscale(0.4);
}

.photo-card {
    user-select: none;
    -webkit-user-drag: element;
}

/* Miniatura flotante pequeña del cursor de arrastre */
.drag-ghost-miniature {
    position: fixed;
    top: -9999px;
    left: -9999px;
    z-index: 99999;
    pointer-events: none;
}

.ghost-thumb-box {
    position: relative;
    width: 65px;
    height: 65px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #60a5fa;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 15px rgba(59, 130, 246, 0.5);
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ghost-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ghost-icon {
    font-size: 28px;
}

.ghost-count-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ec4899;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

@media (max-width: 700px) {
    .magic-books-dock {
        bottom: 44px;
        padding: 12px 14px 10px;
    }

    .magic-dock-header {
        font-size: 11.5px;
        margin-bottom: 8px;
    }

    .magic-book {
        width: 85px;
        height: 115px;
    }

    .magic-book.drag-over {
        width: 175px;
    }

    .book-icon {
        font-size: 20px;
    }

    .book-name {
        font-size: 9.5px;
        max-width: 72px;
    }

    .book-badge {
        font-size: 8.5px;
    }
}

/* =====================================================
   FOOTER FIJO CON LOGO OAL SYSTEM TECH
====================================================== */

.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    z-index: 1200;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
    padding: 4px 20px;
}

.footer-spacer {
    width: 110px;
    flex-shrink: 0;
}

.footer-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    flex: 1;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    flex-shrink: 0;
    width: 110px;
    justify-content: flex-end;
}

.footer-brand-label {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.footer-logo {
    height: 28px;
    width: auto;
    max-height: 32px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

@media (max-width: 768px) {
    .footer-spacer {
        display: none;
    }
    .app-footer {
        flex-direction: column;
        gap: 6px;
        padding: 8px 12px;
        height: auto;
    }
    .footer-content {
        font-size: 11px;
    }
    .footer-brand {
        width: auto;
        justify-content: center;
    }
    .footer-brand-label {
        font-size: 12px;
    }
    .footer-logo {
        height: 24px;
    }
}



