:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-radius: 12px;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E"),
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.08), transparent 40%);
    background-attachment: scroll;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 30px;
}

/* Capa superior para dar un blur extra uniforme al fondo */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: -1;
    pointer-events: none;
}

header {
    text-align: center;
    margin-top: 15vh;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    color: var(--text-primary);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #a855f7, #6366f1, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.search-container {
    max-width: 600px;
    margin: 0 auto 12px auto;
    position: relative;
    animation: fadeIn 1s ease-out;
}

@property --border-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    min-height: 60px;
    /* match previous height roughly */
    border-radius: 30px;
    border: 2px solid transparent;
    background:
        linear-gradient(var(--surface-color), var(--surface-color)) padding-box,
        conic-gradient(from var(--border-angle),
            #334155 0deg,
            rgba(168, 85, 247, 0.4) 180deg,
            #334155 360deg) border-box;
    background-color: #334155;
    animation: rotateBorderBeam 8s linear infinite;
    transition: var(--transition), background 0.3s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.search-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background:
        linear-gradient(var(--surface-color), var(--surface-color)) padding-box,
        conic-gradient(from var(--border-angle),
            var(--primary-color) 0deg,
            rgba(168, 85, 247, 0.8) 180deg,
            var(--primary-color) 360deg) border-box;
    background-color: var(--primary-color);
}

#selectedTagsContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.search-selected-tag {
    background-color: rgba(168, 85, 247, 0.15);
    color: #d8b4fe;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(168, 85, 247, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-selected-tag span {
    cursor: pointer;
    font-weight: 800;
}

.search-selected-tag span:hover {
    color: #f87171;
}

#searchInput {
    flex-grow: 1;
    min-width: 150px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    outline: none;
    padding: 6px 8px;
    /* Reducido ya que el wrapper hace el padding */
}

@keyframes rotateBorderBeam {
    to {
        --border-angle: 360deg;
    }
}

#searchInput::placeholder {
    color: transparent;
}

/* --- Placeholder animado --- */
.search-placeholder {
    position: absolute;
    left: 32px;
    /* 16px (wrapper left padding) + 8px (input left padding) + 8px extra visual margin */
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 1.1rem;
    font-weight: 700;
    color: #64748b;
    display: flex;
    align-items: baseline;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.search-placeholder-static {
    white-space: pre;
    /* preserva el espacio final */
}

.search-placeholder-word {
    display: inline-block;
    transition: opacity 0.4s ease, transform 0.4s ease;
    background: linear-gradient(135deg, #a855f7, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.search-placeholder-word.fade-out {
    opacity: 0;
    transform: translateY(-6px);

}

.search-placeholder-word.fade-in-prep {
    opacity: 0;
    transform: translateY(6px);
    /* Starts below the baseline */

    transition: none !important;
    /* Prevent animating the reset */
}

.search-placeholder.hidden {
    opacity: 0;
}

/* --- Autocomplete --- */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid #334155;
    border-radius: 12px;
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    z-index: 200;
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.5);
    scrollbar-width: none;
}

.autocomplete-list.open {
    display: block;
}

.autocomplete-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.autocomplete-item .ac-type {
    font-size: 0.7rem;
    color: #64748b;
    margin-left: auto;
}

.catalog-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Botones de filtro debajo del buscador --- */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto 8vh auto;
    position: relative;
    padding: 0;
    animation: fadeIn 0.8s ease-out 0.3s both;
    z-index: 50;
}

.filter-toggle-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 20px;
    border: 1px solid #334155;
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

/* Colores individuales sutiles estáticos */
.filter-toggle-btn:nth-child(1) {
    border-color: rgba(234, 179, 8, 0.4);
}

/* Etiquetas: Amarillo */
.filter-toggle-btn:nth-child(2) {
    border-color: rgba(239, 68, 68, 0.4);
}

/* Colecciones: Rojo */
.filter-toggle-btn:nth-child(3) {
    border-color: rgba(59, 130, 246, 0.4);
}

/* Sugerencias: Azul */

@media (hover: hover) {
    .filter-toggle-btn:nth-child(1):hover {
        border-color: #eab308;
        color: var(--text-primary);
    }

    .filter-toggle-btn:nth-child(2):hover {
        border-color: #ef4444;
        color: var(--text-primary);
    }

    .filter-toggle-btn:nth-child(3):hover {
        border-color: #3b82f6;
        color: var(--text-primary);
    }
}

.filter-toggle-btn:nth-child(1).active {
    border-color: #eab308;
    color: var(--text-primary);
    background: rgba(234, 179, 8, 0.1);
}

.filter-toggle-btn:nth-child(2).active {
    border-color: #ef4444;
    color: var(--text-primary);
    background: rgba(239, 68, 68, 0.1);
}

/* --- Dropdown flotante --- */
.floating-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface-color);
    border: 1px solid #334155;
    border-radius: var(--border-radius);
    padding: 20px;
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    width: 90vw;
    max-width: 700px;
    max-height: 55vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 40px -8px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
    scrollbar-width: thin;
}

.floating-dropdown.open {
    display: flex;
}

.dropdown-search {
    width: 100%;
    padding: 8px 14px;
    border-radius: 16px;
    border: 1px solid #334155;
    background-color: rgba(15, 23, 42, 0.8);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.dropdown-search:focus {
    border-color: var(--primary-color);
}

.dropdown-search::placeholder {
    color: #475569;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #334155;
    background-color: rgba(15, 23, 42, 0.6);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.filter-chip:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.filter-chip.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(168, 85, 247, 0.3));
    border-color: var(--primary-color);
    color: var(--text-primary);
    font-weight: 600;
}

.collection-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #334155;
    background-color: rgba(15, 23, 42, 0.6);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.collection-chip:hover {
    border-color: #ec4899;
    color: var(--text-primary);
}

.collection-chip.active {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(168, 85, 247, 0.2));
    border-color: #ec4899;
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Banner estacional --- */
.seasonal-banner {
    max-width: 900px;
    margin: 0 auto 25px auto;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    text-align: center;
    animation: fadeIn 0.8s ease-out;
    display: none;
}

.seasonal-banner h3 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.seasonal-banner p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 20px;
}

.card {
    background-color: rgba(30, 41, 59, 0.65);
    /* var(--surface-color) tintado */
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    height: 255px;
    /* Altura dictada estrictamente por el póster (150px * 1.5 + paddings) para evitar asimetrías */
    contain: content;
    /* Isolation de layout: el navegador no recalcula el DOM externo al redibujar una card */

    /* Animación Secuencial Base */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card.is-visible {
    opacity: 1;
    transform: translateY(0);
    will-change: auto;
}

.card::before {
    content: '';
    position: absolute;
    top: -25px;
    left: -25px;
    right: -25px;
    bottom: -25px;
    /* Expansión reducida para menor consumo GPU */
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(20px) brightness(0.4);
    z-index: 0;
    opacity: 0.5;
    pointer-events: none;
    /* transition removido — evita re-composición GPU en hover */
}

.card>* {
    position: relative;
    z-index: 1;
}

.ranking-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    z-index: 10;
    border: 2px solid var(--surface-color);
}

@media (hover: hover) {
    .card.is-visible:hover {
        transform: translateY(-8px);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.15);
        transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    }

    .card:hover::before {
        opacity: 0.8;
        filter: blur(30px) brightness(0.5);
    }
}

.card-img-container {
    width: 170px;
    min-width: 170px;
    height: 100%;
    /* Altura completa heredada */
    background-color: transparent;
    position: relative;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Recorta conservando centro si hay desajuste */
    border-radius: 12px 0 0 12px;
    /* Radios solo a la izquierda */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    transition: transform 0.5s ease;
}

@media (hover: hover) {
    .card:hover .card-img {
        transform: scale(1.03);
    }
}

.card-content {
    padding: 25px;
    /* Padding estandarizado para permitir el autocentrado interno */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.card-info-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Auto-centra verticalmente en el sobrante */
    flex-grow: 1;
    padding-bottom: 10px;
    /* Respiro menor, empaque ajustado */
    overflow: hidden;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--text-primary);
    line-height: 1.2;

    /* Truncamiento para títulos largos */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-original-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    /* Reducido porque el año va debajo */
    font-style: italic;

    /* Truncamiento para títulos originales largos */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}


.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tag {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 500;
}

.card-badges {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.year-badge {
    display: inline-block;
    color: rgba(255, 255, 255, 0.60);
    /* Grisáceo elegante sin perder negritas */
    font-weight: 800;
    /* Mayor peso tipográfico */
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    width: fit-content;
}

.type-badge {
    display: inline-block;
    color: rgba(255, 255, 255, 0.5);
    /* Menos resaltante */
    font-weight: 600;
    font-size: 0.55rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    width: fit-content;
}

.badge-separator {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.55rem;
    user-select: none;
}

.mi-calificacion {
    display: inline-flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.15);
    /* Base translúcida */
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: auto;
    align-self: flex-end;
    /* Alineado a la derecha */
    /* backdrop-filter removido por rendimiento — sustituido por fondo sólido */
    background-color: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    width: fit-content;
}

.new-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 2;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.85);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .new-badge {
        font-size: 0.45rem;
        padding: 1px 4px;
        top: 4px;
        right: 4px;
    }
}

.card-comment {
    font-style: italic;
    color: #cbd5e1;
    margin-bottom: 16px;
    font-size: 0.95rem;
    border-left: 3px solid var(--primary-color);
    background-color: rgba(99, 102, 241, 0.1);
    padding: 10px 12px;
    border-radius: 0 6px 6px 0;
}

.card-synopsis {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex-grow: 1;
}

.ratings {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background-color: #0f172a;
    padding: 12px;
    border-radius: 8px;
}

.rating-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.rating-source {
    color: var(--text-secondary);
    font-weight: 500;
}

.rating-value {
    background-color: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.8rem;
}

/* --- Estilos para el Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--surface-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    /* Esto forzará que todos sus hijos (img) respeten el borde curvo principal */
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: row;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(15, 23, 42, 0.5);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.8);
}

.modal-img-container {
    width: 450px;
    /* Portada agrandada para dominar la pantalla */
    min-width: 450px;
    padding: 40px 0 40px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    position: relative;
}

.modal-img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none;
    /* Firefox */
}

.modal-body::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Edge */
}

.modal-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 5px;
    line-height: 1.2;
}

.modal-synopsis {
    font-size: 1.1rem;
    color: #cbd5e1;
    line-height: 1.7;
    margin: 25px 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-share-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #334155;
    background-color: rgba(15, 23, 42, 0.6);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.share-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
}

.share-feedback {
    color: #34d399;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.share-feedback.visible {
    opacity: 1;
    transform: translateX(0);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1.3rem;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px dashed #475569;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
    }

    header {
        margin-top: 15vh;
    }

    .search-container {
        margin-bottom: 10px;
    }

    .filter-buttons {
        margin-bottom: 6vh;
    }

    .floating-dropdown {
        min-width: 240px;
        max-width: 90vw;
    }

    .items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px 15px;
    }

    .card {
        flex-direction: row;
        /* Cambia a lista horizontal mini */
        height: 150px;
        /* Altura inamovible (100x150 = ratio 2:3) */
    }

    .card-img-container {
        width: 100px;
        min-width: 100px;
        height: 100%;
        /* Completamente atado a los 150px de altura */
    }

    .card-content {
        padding: 12px;
        /* Más apretado para ganar los píxeles de texto */
        flex-grow: 1;
    }

    .card-title {
        font-size: 0.95rem;
        margin-bottom: 2px;
        line-height: 1.15;
    }

    .type-badge {
        font-size: 0.5rem;
        margin: 0;
    }

    .mi-calificacion {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    .card-original-title {
        font-size: 0.75rem;
        margin-bottom: 4px;
        /* Línea única forzada en móviles */
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }

    .card-img {
        width: 100%;
        height: 100%;
        border-radius: 6px 0 0 6px;
        object-fit: cover;
        /* Rellena todo el lado invariablemente */
        object-position: top;
        /* Si recorta por texto largo, recorta de abajo, nunca caras */
    }

    .modal-content {
        flex-direction: column;
        overflow-y: auto;
        scrollbar-width: none;
        /* Firefox */
    }

    .modal-img-container {
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 25px 25px 0 25px;
        /* Enmarcado superior y lateral para el celular */
    }

    .modal-img {
        border-radius: 12px;
        aspect-ratio: 2 / 3;
    }

    .modal-body {
        padding: 25px;
        overflow-y: visible;
        /* En móvil scroll general en modal-content */
    }

    body {
        padding: 15px;
    }
}

@media (max-width: 320px) {

    /* Pantallas extremadamente pequeñas (<320px) */
    .card {
        flex-direction: column;
        height: auto;
        min-height: unset;
        /* Libera el alto estricto horizontal */
    }

    .card-img-container {
        width: 100%;
        min-width: unset;
        height: auto;
    }

    .card-img {
        width: 100%;
        height: auto;
        aspect-ratio: 2/3;
        border-radius: 8px;
        /* Radio simétrico porque ya no es "parte izquierda" */
        object-fit: cover;
        object-position: center;
    }

    .card-content {
        display: none !important;
        /* Ocultar toda la información textual agresivamente */
    }
}

/* --- Footer Estilo usaElMalditoGoogle --- */
.footer {
    text-align: center;
    padding: 40px 20px 20px;
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #818cf8;
    /* indigo-400 */
    text-decoration: underline;
}

/* --- Sugerencias CTA y Modal --- */
.suggestion-cta {
    text-align: center;
    padding: 40px 20px;
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.suggestion-cta a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.suggestion-cta a:hover {
    color: #818cf8;
    text-decoration: underline;
}

.suggestion-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 20px;
}

.suggestion-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.suggestion-modal-card {
    background-color: var(--surface-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 550px;
    max-height: 85vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.suggestion-modal-overlay.active .suggestion-modal-card {
    transform: scale(1) translateY(0);
}

.suggestion-modal-header {
    padding: 24px 50px 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.suggestion-modal-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.suggestion-modal-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.suggestion-modal-body {
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: none;
}

.suggestion-modal-body::-webkit-scrollbar,
.suggestion-modal-card::-webkit-scrollbar {
    display: none;
}

.suggestion-modal-body iframe {
    width: 100%;
    height: 400px;
    border: none;
    border-radius: 0 0 16px 16px;
}

.suggestion-modal-close {
    position: absolute;
    top: 15px;
    right: 16px;
    background: rgba(15, 23, 42, 0.5);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s ease;
}

.suggestion-modal-close:hover {
    background: rgba(239, 68, 68, 0.8);
}