/* General Layout */
html {
    height: 100%;
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-color: #e0e0e0; /* Fondo gris claro para contraste del marco */
    display: flex;
    justify-content: center; /* Centra el marco horizontalmente */
    align-items: flex-start; /* Alinea el marco arriba */
    padding-top: 15px; /* Espacio sobre el marco */
    padding-bottom: 15px; /* Espacio debajo del marco */
}

#app-container {
    width: 96%; /* Ancho del marco */
    max-width: 2300px; /* Ancho máximo opcional */
    height: calc(100vh - 30px); /* Altura calculada menos padding del body */
    background-color: #f8f8f8; /* Fondo del marco */
    border: 1px solid #b0b0b0; /* Borde del marco */
    box-shadow: 0 3px 12px rgba(0,0,0,0.15); /* Sombra del marco */
    border-radius: 8px;
    padding: 15px; /* Padding interno del marco */
    display: flex;
    flex-direction: column; /* Ordena elementos verticalmente */
    overflow: hidden; /* Evita que el marco se desborde */
}


h1 {
    color: blue;
    text-align: center;
    margin: 0 0 10px 0;
    font-size: 1.6em;
    flex-shrink: 0; /* No se encoge */
}

h2 {
    color: grey;
    text-align: center;
    margin: 0 0 10px 0;
    font-size: 1.4em;
    flex-shrink: 0; /* No se encoge */
}

#timeline-controls {
    text-align: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

#timeline-controls button {
    padding: 5px 10px;
    font-size: 0.9em;
    cursor: pointer;
    margin: 0 4px;
}

/* Timeline Container */
#timeline {
    width: 100%;
    flex-grow: 1; /* Ocupa el espacio vertical restante */
    border: 1px solid #ccc; /* Borde más claro dentro del marco */
    background-color: #fff;
    position: relative; /* Para la línea de tiempo actual */
    min-height: 250px; /* Altura mínima */
}

/* Timeline Items (Barras) */
.vis-item {
    border-color: #66BB6A; /* Verde */
    background-color: #E8F5E9; /* Verde muy claro */
    color: #1B5E20; /* Texto verde oscuro */
    font-size: 15px; /* <<< Tamaño de fuente legible */
    border-radius: 8px; /* <<< Bordes redondeados */
    padding: 1px 6px;  /* <<< Padding mínimo vertical, más horizontal */
    cursor: pointer;
    overflow: visible !important; /* <<< PERMITE DESBORDAMIENTO DE TEXTO */
    white-space: nowrap; /* Evita salto de línea del nombre */
    box-sizing: border-box;
    /* No fijar altura, dejar que el padding y font-size definan */
    line-height: 0.7; /* Ajusta para centrado vertical y legibilidad */
    z-index: 1; /* Base z-index */
}

/* Contenido interno del item */
.vis-item .vis-item-content {
    padding: 0; /* Sin padding extra aquí */
    overflow: visible !important; /* Asegura desbordamiento */
    display: block; /* Comportamiento predecible */
}

/* Item seleccionado */
.vis-item.vis-selected {
    border-color: #FFA726; /* Naranja */
    background-color: #FFF3E0; /* Naranja muy claro */
    z-index: 3 !important; /* Traer al frente */
}

/* Indicadores de fechas inciertas */
.vis-item.uncertain-start .vis-item-content::before {
    content: "?";
    /* font-weight: bold; */
    color: grey; /* #E53935 Rojo */
    margin-right: 6px;
    margin-left: -6px;
    display: inline-block;
}
.vis-item.uncertain-end .vis-item-content::after {
    content: "?";
    /* font-weight: bold; */
    color: grey; /* #E53935 Rojo */
    /*margin-right: 6px;*/
    text-align: right;
    margin-left: 10px;
    display: inline-block;
}

/* Estilo compositor vivo */
.vis-item.living {
     border-right-style: dashed;
     border-right-width: 1px;
     border-color: #66BB6A #E53935 #66BB6A #66BB6A; /* Borde derecho rojo */
}

/* Línea Vertical Año Actual */
.vis-custom-time.current-year-marker {
    border-left: 1px solid #42A5F5; /* Azul fino */
    width: 0px; /* La línea es el borde */
    z-index: 10; /* Por encima de los items base */
    pointer-events: none; /* No interfiere con clics */
}
.vis-custom-time.current-year-marker::before {
    content: "Ahora"; /* Etiqueta corta */
    position: absolute;
    top: 3px;
    left: 4px;
    background-color: rgba(66, 165, 245, 0.8); /* Fondo semitransparente azul */
    color: white;
    padding: 1px 4px;
    font-size: 10px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Área de Búsqueda */
#search-area {
    margin: 10px 0 0 0; /* Margen superior */
    padding: 12px 0; /* Padding vertical */
    text-align: center;
    width: 100%; /* Ancho completo dentro del marco */
    max-width: 950px; /* Ancho máximo razonable */
    margin-left: auto; /* Centrado */
    margin-right: auto; /* Centrado */
    display: flex;
    align-items: center;
    gap: 10px; /* Espacio entre elementos */
    box-sizing: border-box;
    flex-shrink: 0; /* No se encoge */
    border-top: 1px solid #eee; /* Línea separadora */
}

#search-input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1.1em;
    flex-grow: 1; /* Ocupa espacio */
}

#clear-search {
    padding: 8px 10px;
    background-color: grey; 
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
}
#clear-search:hover {
    background-color: #E53935; /* Rojo más oscuro */
}

#composer-count {
    font-style: italic;
    color: #555;
    min-width: 180px; /* Espacio reservado */
    text-align: left;
    white-space: nowrap;
    font-size: 1.2em;
}

/* Popup de Detalles */
#details-popup {
    display: none; /* Oculto por defecto */
    position: fixed; /* Fijo en pantalla */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* Centrado */
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* Sombra más pronunciada */
    padding: 25px; /* Más padding */
    z-index: 1000; /* Por encima de todo */
    max-width: 90%;
    width: 750px; /* Ancho aumentado */
    border-radius: 6px;
    max-height: 85vh; /* Altura máxima */
    overflow-y: auto; /* Scroll si es necesario */
}

#details-popup h3 {
    margin-top: 0;
    margin-bottom: 18px; /* Más espacio */
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
    font-size: 1.3em; /* Título más grande */
}

#details-popup p {
    margin: 10px 0; /* Más espacio entre párrafos */
    line-height: 1.6;
    color: #444; /* Texto un poco más oscuro */
    font-size: 1em; /* Tamaño de fuente base */
}
#details-popup p strong {
    color: #222; /* Títulos de campo más oscuros */
    min-width: 120px; /* Alinear dos puntos */
    display: inline-block;
    margin-right: 5px;
}
/* Estilo específico para descripción */
#details-popup p.description-label {
     margin-bottom: 5px; /* Menos espacio antes de la descripción */
}
#details-popup p.description-text {
    margin-top: 0;
    margin-left: 15px; /* Indentación leve */
    white-space: pre-wrap; /* Respeta saltos de línea */
}


#close-popup {
    position: absolute;
    top: 12px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.6em; /* Botón de cierre más grande */
    cursor: pointer;
    color: #aaa;
    padding: 0;
    line-height: 1;
}
#close-popup:hover {
    color: #333;
}

/* Overlay para cerrar popup */
#popup-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Overlay más oscuro */
    z-index: 999; /* Debajo del popup */
}
.view-header {
    position: relative;
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0 1rem;
}

#switch-view { cursor: pointer; }

#list-view {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: white;
    border: 1px solid #ccc;
}

#composer-list { margin: 0; padding: .4rem 1rem .4rem 2rem; }
#composer-list li + li { border-top: 1px solid #eee; }
#composer-list button {
    width: 100%;
    padding: .45rem .15rem;
    border: 0;
    background: transparent;
    text-align: left;
    color: #174b80;
    font: inherit;
    cursor: pointer;
}
#composer-list button:hover { text-decoration: underline; }
#list-empty { padding: 0 1rem; }
#timeline[hidden], #timeline-controls[hidden], #list-view[hidden] { display: none; }

/* La búsqueda permanece al pie en escritorio y pasa a la cabecera en móvil. */
#search-area { order: 1; }
#mobile-count { display: none; }
#mobile-period {
    width: clamp(105px, 15vw, 190px); height: 34px;
    padding-inline: 6px; border: 1px solid #bbb; border-radius: 4px; background: #fff;
}

@media (max-width: 767px), (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    body { display: block; padding: 0; background: #fff; }
    #app-container {
        width: 100%; height: 100vh; height: 100dvh; max-width: none;
        padding: max(5px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right))
                 max(5px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
        border: 0; border-radius: 0; box-shadow: none; background: #fff;
    }
    #app-container h1 { margin: 0; color: #21513c; font-size: 17px; }
    .view-header { align-items: center; justify-content: space-between; gap: 5px; flex: none; }
    #app-container > h1 { align-self: start; }
    #view-title { font-size: 14px; margin: 0; color: #41584c; }
    #switch-view, #timeline-controls button, #clear-search {
        min-width: 42px; min-height: 40px; margin: 0; padding: 3px 7px;
        border: 1px solid #afc2b6; border-radius: 6px;
        background: #eff5f0; color: #204331; font-size: 14px;
    }
    #search-area {
        order: 0; margin: 4px 0; border: 0; padding: 0;
        display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 4px;
    }
    #search-input { width: 100%; min-width: 0; height: 40px; padding: 5px 7px; font-size: 16px; }
    #mobile-period {
        display: block; width: 93px; max-width: 28vw; height: 40px;
        border: 1px solid #afc2b6; border-radius: 6px; background: #fff;
        color: #204331; font: 13px system-ui;
    }
    #composer-count { grid-column: 1 / -1; min-width: 0; font: 12px system-ui; }
    #timeline-controls { display: flex; justify-content: flex-end; gap: 4px; margin: 0 0 4px; }
    #timeline { min-height: 0; flex: 1 1 0; }
    #timeline-help { display: none; }
    .vis-item.composer-item {
        font-size: 13px; line-height: 1.15; padding: 3px 5px;
        border-radius: 5px; min-width: max-content;
    }
    .vis-item.uncertain-start .vis-item-content::before { margin-left: 0; margin-right: 3px; }
    .vis-item.uncertain-end .vis-item-content::after { margin-left: 4px; }
    #list-view { border-inline: 0; }
    #composer-list { list-style: none; padding: 0; }
    #composer-list button { min-height: 48px; padding: 7px 5px; font-size: 16px; }
    #details-popup {
        inset: auto 0 0; transform: none; width: 100%; max-width: none;
        max-height: 78dvh; padding: 13px 16px max(16px, env(safe-area-inset-bottom));
        border-radius: 14px 14px 0 0; overflow-y: auto;
    }
    #details-popup h3 { padding-right: 40px; }
    #close-popup { min-width: 44px; min-height: 44px; top: 4px; right: 5px; }
}
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #app-container { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto minmax(0, 1fr); gap: 4px 6px; }
    #app-container > h1 { grid-column: 1; align-self: center; text-align: left; }
    .view-header { grid-column: 2; grid-row: 1; }
    #view-title { display: none; }
    #search-area { grid-column: 1; grid-row: 2; margin: 0; grid-template-columns: minmax(0,1fr) auto auto; }
    #composer-count { grid-column: auto; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    #timeline-controls { grid-column: 2; grid-row: 2; margin: 0; }
    #timeline, #list-view { grid-column: 1 / -1; grid-row: 3; min-height: 0; }
}

#mobile-timeline { display: none; }
@media (max-width: 767px), (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #timeline { display: none; }
    #mobile-timeline:not([hidden]) {
        display: block; flex: 1 1 0; min-height: 0; width: 100%; overflow: auto;
        overscroll-behavior: contain; border: 1px solid #d4ded6; border-radius: 4px;
        background: #fcfdfb; touch-action: none; user-select: none;
    }
    .mobile-axis { height: 24px; position: sticky; top: 0; z-index: 2; background: #edf4ef; color: #40574b; font: 12px system-ui; }
    .mobile-axis span { position: absolute; padding: 4px 3px; }
    .mobile-tracks { min-height: 100px; padding: 1px 0; background-image: linear-gradient(to right,#e3ebe5 1px,transparent 1px); }
    .mobile-lane { height: 30px; position: relative; }
    .mobile-bar {
        position: absolute; top: 1px; height: var(--composer-bar-height); padding: 0 6px; overflow: hidden; text-overflow: ellipsis;
        border: 1px solid #709c82; border-radius: 5px; background: #e4f0e7; color: #1e4a33;
        font: 600 13px system-ui; text-align: left; white-space: nowrap; cursor: pointer;
    }
    .mobile-activity { border-style: dashed; }
    .mobile-bar:focus-visible { outline: 2px solid #235943; outline-offset: -2px; }
    .mobile-empty { position: sticky; left: 4px; margin: 8px; width: min(260px, 80vw); }
}
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #mobile-timeline { grid-column: 1 / -1; grid-row: 3; }
}

/* En apaisado, título, filtros y acciones comparten una sola fila. */
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #app-container {
        grid-template-columns: max-content minmax(0, 1fr) max-content max-content;
        grid-template-rows: auto minmax(0, 1fr);
        align-items: center;
        align-content: stretch;
    }
    #app-container > h1 { grid-column: 1; grid-row: 1; white-space: nowrap; font-size: clamp(12px, 2.15vw, 16px); }
    #search-area { grid-column: 2; grid-row: 1; grid-template-columns: minmax(0, 1fr) auto auto; min-width: 0; max-width: 270px; justify-self: start; }
    #search-input { height: 34px; padding-inline: 5px; }
    #mobile-period { width: clamp(52px, 12vw, 83px); height: 34px; }
    #timeline-controls { grid-column: 3; grid-row: 1; justify-self: end; }
    .view-header { grid-column: 4; grid-row: 1; justify-self: end; }
    #switch-view, #timeline-controls button, #clear-search {
        min-width: 34px; min-height: 34px; padding: 2px 5px; font-size: 12px; white-space: nowrap;
    }
    #timeline, #mobile-timeline, #list-view { grid-row: 2; align-self: stretch; }
}

#app-container > h1 { position: relative; }
.app-logo {
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 54px; height: auto; vertical-align: middle;
}
@media (max-width: 767px), (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #app-container > h1 { display: flex; align-items: center; gap: 5px; }
    .app-logo { position: static; transform: none; width: 42px; flex: none; }
}
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    .app-logo { width: clamp(29px, 5vw, 40px); }
}

.contribute-link {
    display: inline-flex; align-items: center; min-height: 34px; padding: 3px 7px;
    border: 1px solid #afc2b6; border-radius: 6px; background: #eff5f0; color: #204331;
    text-decoration: none; white-space: nowrap; font-size: 14px;
}
.contribute-mobile { display: none; }
@media (max-width: 767px), (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    .contribute-desktop { display: none; }
    .contribute-mobile { display: inline; }
    .contribute-link { margin-left: auto; }
}
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    .view-header { flex-wrap: nowrap; }
    .contribute-link { font-size: 12px; padding-inline: 4px; }
}
@media (max-width: 680px) and (max-height: 560px) and (orientation: landscape) {
    #app-container > h1 > span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
}

/* La etiqueta se recorta sin alterar la duración representada por la barra. */
@media (max-width: 767px), (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    .mobile-bar {
        display: block; padding: 0; border: 0;
        box-shadow: inset 0 0 0 1px #709c82;
    }
    .mobile-bar > span { display: block; margin-inline: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mobile-bar.mobile-activity { box-shadow: none; outline: 1px dashed #709c82; outline-offset: -1px; }
    .mobile-bar.mobile-activity:focus-visible { outline: 2px solid #235943; outline-offset: -2px; }
}
@media (min-width: 768px) and (min-height: 561px), (min-width: 1101px) {
    #app-container {
        display: grid;
        grid-template-columns: minmax(0, 1fr) max-content minmax(122px, .5fr) max-content;
        grid-template-rows: auto auto auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 8px;
    }
    #app-container > h1 { grid-area: 1 / 1 / 2 / -1; }
    .view-header { display: contents; }
    #view-title { grid-area: 2 / 1 / 3 / -1; margin-bottom: 4px; }
    #search-area {
        grid-area: 3 / 1; order: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 5px; margin: 0; padding: 0; min-width: 0; max-width: none; border: 0;
    }
    #search-input { width: 100%; min-width: 0; min-height: 34px; padding: 4px 7px; font-size: 14px; }
    #composer-count { min-width: 0; font-size: 13px; }
    #timeline-controls { grid-area: 3 / 2; margin: 0; display: flex; gap: 4px; align-items: center; }
    #timeline-controls button { min-height: 34px; padding: 4px 7px; margin: 0; font-size: 13px; }
    #switch-view {
        grid-area: 3 / 3; justify-self: start; margin-left: clamp(22px, 4vw, 70px);
        min-height: 42px; padding: 4px 11px; font-size: 16px; white-space: nowrap;
    }
    .contribute-link { grid-area: 3 / 4; justify-self: end; min-height: 34px; font-size: 13px; }
    #timeline, #list-view { grid-area: 4 / 1 / 5 / -1; align-self: stretch; min-height: 0; margin-top: 5px; }
    #timeline-help { grid-area: 5 / 1 / 6 / -1; }
}

@media (min-width: 768px) and (max-width: 900px) and (min-height: 561px) {
    #app-container { grid-template-columns: minmax(0,1fr) max-content 108px max-content; column-gap: 6px; }
    #search-area { gap: 4px; }
    #composer-count { font-size: 12px; }
    #clear-search { padding: 6px 5px; }
    #timeline-controls button { padding-inline: 5px; }
    #switch-view { margin-left: 17px; padding-inline: 8px; }
    .contribute-link { font-size: 12px; padding-inline: 5px; }
}
/* El logo queda fuera del flujo vertical de la cabecera. */
#app-container { position: relative; }
#app-container > .app-logo {
    position: absolute; top: 12px; left: 14px; width: 52px; height: auto; transform: none;

}
@media (max-width: 767px), (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #app-container > .app-logo { top: max(7px, env(safe-area-inset-top)); left: max(7px, env(safe-area-inset-left)); width: 35px; }
    #app-container > h1 { padding-inline-start: 42px; }
}
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #app-container > .app-logo { top: max(7px, env(safe-area-inset-top)); width: clamp(29px, 5vw, 40px); }
    #app-container > h1 { padding-inline-start: calc(clamp(29px, 5vw, 40px) + 5px); }
}

@media (min-width: 768px) and (min-height: 561px), (min-width: 1101px) {
    #app-container > .app-logo { width: clamp(110px, 11vw, 142px); }
}
/* Las acciones de cabecera comparten altura en cada diseño. */
#switch-view, .contribute-link { height: 34px; min-height: 34px; }
@media (max-width: 767px) {
    #switch-view, .contribute-link { height: 40px; min-height: 40px; }
}
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #switch-view, .contribute-link { height: 34px; min-height: 34px; }
}
@media (max-width: 767px) and (orientation: portrait) {
    #app-container > .app-logo { width: clamp(66px, 20vw, 78px); }
    #app-container > h1 {
        align-self: stretch; justify-content: center; padding-inline-start: 0;
        text-align: center; font-size: clamp(14px, 4.35vw, 17px); line-height: 20px;
    }
}
@media (max-width: 1100px) and (max-height: 560px) and (orientation: landscape) {
    #app-container > .app-logo { width: clamp(70px, 10vw, 82px); }
    #app-container > h1 { padding-inline-start: calc(clamp(70px, 10vw, 82px) + 5px); }
}
@media (min-width: 768px) and (min-height: 561px), (min-width: 1101px) {
    #view-title { justify-self: center; }
}
#app-container { --composer-bar-height: 28px; }
#app-container > .app-logo { display: block; z-index: 11; }
.app-logo > img { display: block; width: 100%; height: auto; }
.app-logo:focus-visible { outline: 2px solid #235943; outline-offset: 3px; }

@media (max-width: 767px) and (orientation: portrait) {
    .view-header { min-height: 40px; }
    #switch-view, .contribute-link {
        height: var(--composer-bar-height);
        min-height: var(--composer-bar-height);
    }
}
mark { background: #ffe66d; color: #222; }

.composer-overview { display: flex; align-items: stretch; gap: clamp(12px, 3vw, 24px); }
.composer-portrait { align-self: flex-start; flex: none; width: clamp(152px, 40vw, 240px); height: auto; border-radius: 4px; }
.composer-fields { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow-wrap: anywhere; gap: 8px; }
#details-popup .composer-fields p { margin: 0; line-height: 1.5; }
#details-popup .composer-portrait + .composer-fields p {
    display: grid;
    grid-template-columns: minmax(105px, 125px) minmax(0, 1fr);
    column-gap: 5px;
}
.composer-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
#details-popup .circle-button {
    flex: none;
    min-height: 32px;
    padding: 4px 12px;
    border: 1px solid #527664;
    border-radius: 6px;
    background: #edf4ef;
    color: #254b3a;
    font: inherit;
    cursor: pointer;
}
.composer-sources { font-size: 0.8rem; line-height: 1.45; overflow-wrap: anywhere; }
.composer-sources h4 { margin: 1rem 0 0.35rem; }
.composer-sources ul { margin: 0; padding-inline-start: 1.25rem; }
@media (max-width: 540px) {
    #details-popup .composer-portrait + .composer-fields p { grid-template-columns: 1fr; }
    #details-popup .composer-fields p strong { min-width: 0; }
}
#details-popup .composer-fields p.composer-genres { display: block; }
#details-popup .composer-fields:first-child .composer-genres strong { display: inline-block; min-width: 120px; }
#details-popup .composer-fields .composer-actions { margin-top: auto; }
@media (min-width: 541px) {
    #details-popup .composer-portrait + .composer-fields .composer-genres strong {
        display: inline-block;
        width: 130px;
        margin-inline-end: -0.278em;
    }
}
@media (max-width: 540px) { #details-popup .composer-portrait + .composer-fields .composer-genres strong { display: block; } }

.composer-overview:has(> .composer-portrait) { display: block; }
.composer-overview > .composer-portrait {
    float: left;
    margin-inline-end: clamp(12px, 3vw, 24px);
    margin-block-end: 8px;
}
.composer-overview:has(> .composer-portrait) .composer-fields { overflow: hidden; }
.composer-sources { clear: both; }
#details-popup:has(.composer-portrait) p.description-text { padding-inline-start: 0; margin-inline-start: 0; }

.composer-footer {
    clear: both;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.composer-footer .composer-sources { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.composer-footer .composer-actions { flex: none; margin-left: auto; white-space: nowrap; }
.vis-item.composer-item, .mobile-bar { --thumbnail-width: 18px; }
.mobile-bar { --thumbnail-width: calc(var(--composer-bar-height) - 4px); }
.vis-item-content > span:has(> .timeline-portrait),
.mobile-bar > span:has(> .timeline-portrait) {
    padding-inline-start: calc(var(--thumbnail-width) + 3px);
}
.timeline-portrait {
    position: absolute;
    inset-block-start: 1px;
    inset-inline-start: 2px;
    width: var(--thumbnail-width);
    height: calc(100% - 2px);
    object-fit: cover;
    object-position: center 25%;
    border-radius: 2px;
    pointer-events: none;
}
.mobile-bar .timeline-portrait {
    inset-block-start: 2px;
    inset-inline-start: 2px;
    height: calc(100% - 4px);
}
/* Anclar la imagen a la barra, también cuando vis desplaza el texto. */
.vis-item.composer-item:has(.timeline-portrait) {
    padding-inline-start: 1px;
}
.vis-item.composer-item:has(.timeline-portrait) .vis-item-overflow,
.vis-item.composer-item:has(.timeline-portrait) .vis-item-content,
.vis-item.composer-item:has(.timeline-portrait) .vis-item-content > span {
    position: static;
}
.vis-item.composer-item .timeline-portrait {
    inset-inline-start: 1px;
}
.period-control { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
#period-help {
    flex: none; min-width: 28px; min-height: 30px; padding: 0 6px;
    border: 1px solid #afc2b6; border-radius: 5px; background: #eff5f0; color: #204331;
    font: inherit; cursor: pointer;
}
#period-guide {
    box-sizing: border-box; width: min(92vw, 48rem); max-height: 86dvh; overflow: auto;
    padding: 18px; border: 1px solid #afc2b6; border-radius: 8px;
    background: white; color: #20372b; text-align: left;
}
#period-guide::backdrop { background: rgb(0 0 0 / 45%); }
#period-guide form { float: right; margin: 0 0 8px 12px; }
#period-guide h2 { margin: 0 0 14px; font-size: 1.1rem; color: inherit; text-align: left; }
#period-guide dt { font-weight: 700; margin-top: 12px; }
#period-guide dt span { font-weight: 400; }
#period-guide dd { margin: 4px 0 0; line-height: 1.45; }

#mobile-period, #mobile-period option { font-weight: 400; }
