.fm {
    position: relative;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 50px 90px -80px rgba(27, 25, 22, .6);
}

.fm__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.15rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.fm__folder {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: .64rem;
    letter-spacing: .04em;
    color: var(--ink);
}
.fm__folder i { color: var(--terra); font-size: 1rem; }
.fm__folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm__count {
    padding: .15rem .45rem;
    border-radius: 999px;
    background: var(--sage-mist);
    color: var(--sage-deep);
    font-size: .55rem;
    white-space: nowrap;
}
.fm__search {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper-2);
    color: var(--muted);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.fm__search:focus-within {
    border-color: var(--terra);
    box-shadow: 0 0 0 3px rgba(169, 71, 38, .1);
}
.fm__search i { font-size: .8rem; }
.fm__search input {
    width: 170px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: .78rem;
    outline: 0;
}
.fm__search input::placeholder { color: color-mix(in srgb, var(--muted) 60%, transparent); }

.fm__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: stretch;
}
.fm__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
    align-content: start;
    padding: 1.1rem;
    max-height: 640px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}
.fm__item {
    appearance: none;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    text-align: left;
    cursor: pointer;
    transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.fm__item:hover {
    border-color: var(--sage);
    transform: translateY(-2px);
}
.fm__item.is-active {
    border-color: var(--terra);
    background: var(--terra-soft);
    box-shadow: 0 0 0 2px rgba(169, 71, 38, .12);
}
.fm__item:focus-visible {
    outline: 2px solid var(--terra);
    outline-offset: 2px;
}
.fm__thumb {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 8px;
    background: var(--paper-3);
}
.fm__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s var(--ease);
}
.fm__item:hover .fm__thumb img { transform: scale(1.045); }
.fm__meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .35rem;
    padding: 0 .15rem .15rem;
    min-width: 0;
}
.fm__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: .6rem;
    letter-spacing: .02em;
    color: var(--ink);
}
.fm__size {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: .52rem;
    color: var(--ink);
}

.fm__preview {
    padding: 1.15rem;
    background: var(--paper);
    border-left: 1px solid var(--line);
}
.fm__kicker {
    margin: 0 0 .6rem;
    font-family: var(--font-mono);
    font-size: .58rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--terra);
}
.fm__stage {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--paper-3);
}
.fm__stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.fm__zoom {
    position: absolute;
    right: .5rem;
    bottom: .5rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .5rem;
    border-radius: 999px;
    background: rgba(27, 25, 22, .72);
    backdrop-filter: blur(8px);
    color: var(--paper);
    font-family: var(--font-mono);
    font-size: .52rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.fm__stage:hover .fm__zoom,
.fm__stage:focus-visible .fm__zoom { opacity: 1; transform: none; }
.fm__title {
    margin: .85rem 0 .7rem;
    font-family: var(--font-display);
    font-size: 1.45rem;
    line-height: 1.05;
    font-weight: 400;
    overflow-wrap: anywhere;
}
.fm__data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .7rem;
    margin: 0 0 1rem;
}
.fm__data div { min-width: 0; }
.fm__data dt {
    margin: 0;
    font-family: var(--font-mono);
    font-size: .52rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.fm__data dd {
    margin: .15rem 0 0;
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--ink);
}
.fm__label {
    display: block;
    margin-bottom: .35rem;
    font-family: var(--font-mono);
    font-size: .55rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.fm__field {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    overflow: hidden;
    background: var(--paper-2);
}
.fm__field input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: .6rem .65rem;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: .62rem;
    outline: 0;
}
.fm__copy {
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-left: 1px solid var(--line);
    background: var(--paper);
    color: var(--terra);
    font-size: .85rem;
    cursor: pointer;
    transition: background .2s var(--ease), color .2s var(--ease);
}
.fm__copy:hover { background: var(--ink); color: var(--paper); }
.fm__copy.is-ok { background: var(--sage); color: var(--paper-2); }
.fm__note {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    margin: .8rem 0 0;
    font-size: .66rem;
    line-height: 1.45;
    color: var(--muted);
}
.fm__note i { color: var(--sage); margin-top: .1rem; }
.fm__empty {
    padding: 2rem 1.25rem;
    border-top: 1px solid var(--line);
    text-align: center;
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--muted);
}

.fm-how {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
}
.fm-how .values { margin-top: .5rem; }
.fm-how .value-row { padding-block: 1.25rem; }
.fm-how .value-row h3 { font-size: 1.3rem; }
.fm-how .code-card { margin-top: 0; }
.fm-how__note {
    margin-top: 1rem;
    font-family: var(--font-mono);
    font-size: .62rem;
    color: var(--muted);
}
.fm-how__note a { color: var(--terra-deep); }

@media (max-width: 1199.98px) {
    .fm__layout { grid-template-columns: minmax(0, 1fr) 320px; }
    .fm__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .fm-how { grid-template-columns: 1fr; }
}

@media (max-width: 991.98px) {
    .fm__layout { grid-template-columns: 1fr; }
    .fm__preview { border-left: 0; border-top: 1px solid var(--line); }
    .fm__grid { max-height: none; }
    .fm__stage { max-width: 520px; }
}

@media (max-width: 767.98px) {
    .fm__top { flex-direction: column; align-items: stretch; }
    .fm__search { width: 100%; }
    .fm__search input { width: 100%; }
    .fm__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .8rem; gap: .55rem; }
    .fm__name { font-size: .56rem; }
    .fm__size { display: none; }
    .fm__preview { padding: .9rem; }
    .fm__title { font-size: 1.3rem; }
    .fm__stage { max-width: none; }
}
