/* Compact catalogue, table header controls. */
#mm-catalogue-filters { width:80%; margin:0 auto .65rem; box-sizing:border-box; border:1px solid #e0e9e7; border-radius:8px; padding:8px 10px; background:#fff; color:#212529; display:flex; flex-direction:column; gap:7px; }
#mm-catalogue-filters *,#mm-catalogue-filters *::before,#mm-catalogue-filters *::after { box-sizing:border-box; }
#mm-catalogue-filters .mf-top,#mm-catalogue-filters .mf-controls,#mm-catalogue-filters .mf-bottom { display:flex; align-items:center; gap:7px 10px; flex-wrap:wrap; min-width:0; }
#mm-catalogue-filters .mf-search { position:relative; flex:1 1 180px; min-width:0; margin:0; }
#mm-catalogue-filters .mf-search i { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:#598c82; pointer-events:none; }
#mm-catalogue-filters .mf-search input { font:inherit; font-size:.9rem; width:100%; min-width:0; height:34px; padding:4px 8px 4px 30px; border:1px solid #cbd9d6; border-radius:6px; background:#fff; color:inherit; margin:0; }
#mm-catalogue-filters .mf-group { min-width:0; margin:0; padding:0; border:0; }
#mm-catalogue-filters .mf-options { display:flex; flex-wrap:wrap; gap:5px; }
#mm-catalogue-filters .mf-option { position:relative; display:inline-flex; margin:0; cursor:pointer; min-width:0; }
#mm-catalogue-filters .mf-option input,#mm-catalogue-filters .mf-sr { position:absolute; width:1px; height:1px; margin:0; padding:0; opacity:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
#mm-catalogue-filters .mf-option > span { display:flex; align-items:center; justify-content:center; gap:5px; padding:4px 8px; min-height:32px; border:1px solid #dce5e2; border-radius:6px; background:#f7f9f8; color:#263a36; font-size:.85rem; line-height:1.2; transition:background .15s,border-color .15s; }
#mm-catalogue-filters .mf-option input:checked + span { background:#d8eee8; border-color:#70a99c; color:#174d42; box-shadow:inset 0 0 0 1px #70a99c; }
#mm-catalogue-filters .mf-option input:focus-visible + span,#mm-catalogue-filters input:focus-visible,#mm-catalogue-filters select:focus-visible,#mm-catalogue-filters a:focus-visible { outline:2px solid #327a69; outline-offset:2px; }
#mm-catalogue-filters .song-png { float:none; flex:none; width:17px; height:17px; margin:0; background-size:contain; }
#mm-catalogue-filters .mf-bottom { flex:0 1 auto; }
#mm-catalogue-filters .mf-sort select { font:inherit; font-size:.85rem; color:#263a36; border:1px solid #cbd9d6; border-radius:6px; background:#fff; min-height:32px; padding:3px 6px; max-width:100%; margin:0; }
#mm-catalogue-filters .mf-footer { display:flex; align-items:center; gap:8px; border:0; padding:0; margin:0; flex:none; }
#mm-catalogue-count { font-size:.85rem; color:#596764; white-space:nowrap; }
#mm-catalogue-filters .mf-reset { display:inline-flex; align-items:center; justify-content:center; background:transparent; color:#356a60; border:1px solid #dce5e2; border-radius:6px; font:inherit; font-size:.85rem; min-height:32px; padding:3px 8px; cursor:pointer; text-decoration:none; white-space:nowrap; }
#mm-catalogue-error { color:#a23535; font-size:.9rem; margin:0; }
#mm-catalogue-empty { width:80%; margin:1em auto; color:#596764; text-align:center; }
@media (hover:hover) { #mm-catalogue-filters .mf-option:hover > span,#mm-catalogue-filters .mf-reset:hover { border-color:#70a99c; } }
@media(max-width:768px) {
 #mm-catalogue-filters { width:100%!important; padding:7px!important; margin:0 0 8px!important; display:flex!important; gap:5px; }
 #mm-catalogue-filters .mf-top { flex-wrap:nowrap; gap:5px; }
 #mm-catalogue-filters .mf-search { flex:1 1 0; min-width:0; }
 #mm-catalogue-filters .mf-search input { font-size:16px; height:44px; padding-left:26px; }
 #mm-catalogue-filters .mf-search i { left:8px; }
 #mm-catalogue-filters .mf-footer { gap:5px; }
 #mm-catalogue-count { font-size:.72rem; }
 #mm-catalogue-filters .mf-reset { min-height:44px; font-size:.8rem; padding:3px 6px; }
 #mm-catalogue-filters .mf-controls { gap:5px; }
 #mm-catalogue-filters .mf-performance { width:100%; }
 #mm-catalogue-filters .mf-types { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
 #mm-catalogue-filters .mf-types .mf-option:nth-child(4) { grid-column:span 2; }
 #mm-catalogue-filters .mf-option > span { width:100%; min-height:44px; padding:4px 5px; font-size:.82rem; overflow-wrap:anywhere; }
 #mm-catalogue-filters .mf-bottom { width:100%; gap:5px; }
 #mm-catalogue-filters .mf-bottom > .mf-group:not(.mf-sort) { flex:1 1 auto; }
 #mm-catalogue-filters .mf-bottom > .mf-group:not(.mf-sort) .mf-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
 #mm-catalogue-filters .mf-sort { flex:1 1 135px; }
 #mm-catalogue-filters .mf-sort select { width:100%; min-height:44px; font-size:16px; }
 #mm-catalogue-empty { width:100%; }
}
@media(max-width:380px) { #mm-catalogue-filters .mf-bottom > .mf-group:not(.mf-sort) { flex-basis:100%; } }
#mm-catalogue-filters ~ table.playlist[hidden],#mm-catalogue-empty[hidden],#mm-catalogue-error[hidden] { display:none!important; }
#mm-catalogue-filters ~ table.playlist { scroll-margin-top:90px; }
#mm-catalogue-pagination { display:block!important; }


#mm-catalogue-filters .mf-mobile-headers { display:none; }
#mm-catalogue-filters .mf-controls { gap:5px; }
#mm-catalogue-filters .mf-performance { flex:0 1 auto; }
.mf-head-action { display:inline-flex; align-items:center; justify-content:center; gap:4px; color:inherit!important; text-decoration:none!important; font:inherit; border:1px solid transparent; border-radius:5px; padding:2px 3px; white-space:nowrap; }
.mf-head-action .mf-arrow { color:#598c82; font-weight:normal; }
.mf-head-action.mf-active { color:#24655a!important; background:#e2f1ed; border-color:#abd6cf; }
.mf-head-action:hover,.mf-head-action:focus-visible { border-color:#70a99c; }
@media (max-width:768px) {
 #mm-catalogue-filters .mf-controls { flex-wrap:wrap; }
 #mm-catalogue-filters .mf-performance { flex:1 1 100%; }
 #mm-catalogue-filters .mf-types { display:flex; flex-wrap:wrap; gap:4px; }
 #mm-catalogue-filters .mf-types .mf-option { flex:0 1 auto; }
 #mm-catalogue-filters .mf-mobile-headers { display:flex!important; flex-wrap:wrap; gap:4px; margin:0; }
 #mm-catalogue-filters .mf-mobile-headers .mf-head-action { min-height:40px; padding:4px 7px; font-size:.8rem; border-color:#dce5e2; flex:1 1 auto; }
 #mm-catalogue-filters .mf-mobile-headers .mf-head-action.mf-active { border-color:#70a99c; }
}

/* Always-visible controls; fixed indicator width avoids layout shifts. */
.mf-head-action {
    border:1px solid #d5e1de;
    background:#f7f9f8;
    cursor:pointer;
    padding:3px 6px;
    transition:background-color .15s, border-color .15s, color .15s;
}
.mf-head-action .mf-arrow {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 1.15em;
    width:1.15em;
    line-height:1;
    font-weight:normal;
    color:#4c8579;
}
.mf-head-action[data-mf-action="world"] .mf-arrow,
.mf-head-action[data-mf-action="cosplay"] .mf-arrow {
    font-family:Arial, sans-serif;
    font-size:1em;
}
.mf-head-action.mf-active { background:#e2f1ed; border-color:#70a99c; }
.mf-head-action.mf-active .mf-arrow { color:#24655a; }
@media (hover:hover) {
    .mf-head-action:hover { background:#eaf3f0; border-color:#70a99c; }
}
.mf-head-action:focus-visible { outline:2px solid #327a69; outline-offset:2px; }
@media (max-width:768px) {
    #mm-catalogue-filters .mf-mobile-headers .mf-head-action { border-color:#d5e1de; }
    #mm-catalogue-filters .mf-mobile-headers .mf-head-action.mf-active { border-color:#70a99c; }
}
@media (prefers-reduced-motion:reduce) { .mf-head-action { transition:none; } }

/* Mobile: all six category choices in a stable, equal-width 3 x 2 grid. */
@media (max-width:768px) {
 #mm-catalogue-filters .mf-controls { display:block; }
 #mm-catalogue-filters .mf-performance { width:100%; min-width:0; }
 #mm-catalogue-filters .mf-types { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); grid-auto-rows:1fr; gap:4px; }
 #mm-catalogue-filters .mf-types .mf-option,
 #mm-catalogue-filters .mf-types .mf-option:nth-child(4) { grid-column:auto; width:100%; min-width:0; align-self:stretch; }
 #mm-catalogue-filters .mf-types .mf-option > span { width:100%; min-width:0; min-height:44px; padding:4px; gap:4px; font-size:.8rem; line-height:1.15; text-align:center; white-space:normal; overflow-wrap:anywhere; }
 #mm-catalogue-filters .mf-types .song-png { width:15px; height:15px; }
 /* Two category buttons followed by three sorting buttons: fixed tracks. */
 #mm-catalogue-filters .mf-mobile-headers { display:grid!important; grid-template-columns:repeat(6,minmax(0,1fr)); gap:4px; }
 #mm-catalogue-filters .mf-mobile-headers .mf-head-action { grid-column:span 2; min-width:0; padding:4px; gap:3px; white-space:normal; text-align:center; }
 #mm-catalogue-filters .mf-mobile-headers .mf-head-action[data-mf-action="world"],
 #mm-catalogue-filters .mf-mobile-headers .mf-head-action[data-mf-action="cosplay"] { grid-column:span 3; }
}

/* Catalogue v5: fixed desktop columns, stable title/icon pairing. */
#mm-catalogue-filters ~ table.playlist .mf-song-title {
    display: grid;
    grid-template-columns: 1.1em minmax(0, 1fr);
    align-items: start;
    column-gap: .42em;
    min-width: 0;
    max-width: 100%;
    line-height: 1.5;
}
#mm-catalogue-filters ~ table.playlist .mf-song-icon-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    height: 1.5em;
}
#mm-catalogue-filters ~ table.playlist .mf-song-icon-slot .song-icon {
    float: none !important;
    display: block;
    flex: none;
    margin: 0 !important;
    width: 1em;
    height: 1em;
    background-size: contain;
}
#mm-catalogue-filters ~ table.playlist .mf-song-name {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}
/* Desktop: reserve the actual width of the complete label + indicator. */
@media (min-width:769px) {
    #mm-catalogue-filters { width:90%; }
    #mm-catalogue-filters ~ table.playlist {
        --mf-id: 3.4em;
        --mf-play: 1.65em;
        --mf-world: 5.25em;
        --mf-cosplay: 6.7em;
        --mf-time: 5.55em;
        --mf-played: 6.7em;
        --mf-request: 5.9em;
        width:90%; table-layout:fixed; border-collapse:collapse;
    }
    .mf-catalogue-cols .mf-col-id { width:var(--mf-id); }
    .mf-catalogue-cols .mf-col-play { width:var(--mf-play); }
    .mf-catalogue-cols .mf-col-title { width:auto; }
    .mf-catalogue-cols .mf-col-artist { width:14%; }
    .mf-catalogue-cols .mf-col-game { width:auto; }
    .mf-catalogue-cols .mf-col-world { width:var(--mf-world); }
    .mf-catalogue-cols .mf-col-cosplay { width:var(--mf-cosplay); }
    .mf-catalogue-cols .mf-col-time { width:var(--mf-time); }
    .mf-catalogue-cols .mf-col-played { width:var(--mf-played); }
    .mf-catalogue-cols .mf-col-request { width:var(--mf-request); }
    #mm-catalogue-filters ~ table.playlist th,
    #mm-catalogue-filters ~ table.playlist td {
        box-sizing:border-box; padding:.75em .28em; vertical-align:top;
        line-height:1.5; white-space:normal; word-break:normal; overflow-wrap:anywhere;
    }
    #mm-catalogue-filters ~ table.playlist th { vertical-align:middle; padding-top:.5em; padding-bottom:.5em; }
    #mm-catalogue-filters ~ table.playlist th:nth-child(3) { padding-left:calc(.28em + 1.52em); }
    #mm-catalogue-filters ~ table.playlist th:first-child,
    #mm-catalogue-filters ~ table.playlist td:first-child,
    #mm-catalogue-filters ~ table.playlist td:nth-child(2),
    #mm-catalogue-filters ~ table.playlist th:nth-child(n+6):nth-child(-n+7),
    #mm-catalogue-filters ~ table.playlist td:nth-child(n+6):nth-child(-n+7) { text-align:center; }
    #mm-catalogue-filters ~ table.playlist th:nth-child(n+8):nth-child(-n+9),
    #mm-catalogue-filters ~ table.playlist td:nth-child(n+8):nth-child(-n+9),
    #mm-catalogue-filters ~ table.playlist td:last-child { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
    #mm-catalogue-filters ~ table.playlist td:last-child a { white-space:nowrap; }
    #mm-catalogue-filters ~ table.playlist th .mf-head-action {
        display:inline-grid; grid-template-columns:max-content 1.05em;
        align-items:center; justify-content:center; width:max-content; max-width:none;
        box-sizing:border-box; font-size:1em; padding:.22em .28em; gap:.3em;
        line-height:1.3; white-space:nowrap; vertical-align:middle;
    }
    #mm-catalogue-filters ~ table.playlist th .mf-head-action > span:first-child {
        display:block; min-width:max-content; white-space:nowrap; overflow-wrap:normal; word-break:normal;
    }
    #mm-catalogue-filters ~ table.playlist th .mf-head-action .mf-arrow { width:1.05em; line-height:1; }
}
@media (min-width:769px) and (max-width:1200px) {
    #mm-catalogue-filters, #mm-catalogue-filters ~ table.playlist { width:100%; }
    .mf-catalogue-cols .mf-col-artist { width:12%; }
}
@media (max-width:768px) {
    .mf-catalogue-cols { display:none !important; }
    #mm-catalogue-filters ~ table.playlist .mf-song-title { max-width:100%; text-align:left; }
    #mm-catalogue-filters ~ table.playlist td:nth-child(3) { padding-left:42% !important; }
    #mm-catalogue-filters ~ table.playlist td:nth-child(4),
    #mm-catalogue-filters ~ table.playlist td:nth-child(5) { overflow-wrap:anywhere; word-break:normal; min-width:0; }
}

/* Pagination belongs to the same catalogue, not to the full page or menu. */
#mm-catalogue-pagination {
    display:block!important; width:90%; max-width:100%; margin:.9rem auto 1.2rem;
    padding:0; box-sizing:border-box;
}
#mm-catalogue-pagination .pagination {
    display:flex!important; flex-wrap:wrap; align-items:center; justify-content:center;
    width:100%!important; gap:5px!important; padding:0!important; margin:0!important; list-style:none;
}
#mm-catalogue-pagination .pagination li { display:block!important; margin:0!important; padding:0; }
#mm-catalogue-pagination .pagination li a,
#mm-catalogue-pagination .pagination li.current {
    box-sizing:border-box!important; display:inline-flex!important; align-items:center; justify-content:center;
    min-width:36px!important; height:36px!important; padding:0 8px!important; font-size:.9rem!important;
    border:1px solid #d5e1de; border-radius:5px; background:#fff; color:#356a60;
    text-decoration:none; line-height:1; font-variant-numeric:tabular-nums;
}
#mm-catalogue-pagination .pagination li.current {
    background:#e2f1ed; color:#24655a; border-color:#70a99c; font-weight:700;
}
#mm-catalogue-pagination .pagination li a:hover,
#mm-catalogue-pagination .pagination li a:focus-visible { background:#eaf3f0; border-color:#70a99c; }
#mm-catalogue-pagination:not(:has(.pagination a)) { display:none!important; }
@media (max-width:1200px) { #mm-catalogue-pagination { width:100%; } }
@media (max-width:768px) {
    #mm-catalogue-pagination { margin:8px auto 16px; }
    #mm-catalogue-pagination .pagination li a,
    #mm-catalogue-pagination .pagination li.current { min-width:40px!important; height:40px!important; }
    #mm-catalogue-filters .mf-mobile-headers .mf-head-action { gap:6px; }
    #mm-catalogue-filters .mf-mobile-headers .mf-head-action > span:first-child { white-space:nowrap; }
}

/* v7: original catalogue typography and readable controls at tablet widths. */
@media (min-width:769px) and (max-width:1050px) {
    #mm-catalogue-filters ~ table.playlist {
        --mf-id: 2.85em; --mf-play: 1.65em; --mf-world: 3.7em;
        --mf-cosplay: 5.1em; --mf-time: 4.1em; --mf-played: 5.25em;
        --mf-request: 5.75em;
    }
    #mm-catalogue-filters ~ table.playlist th .mf-head-action {
        grid-template-columns: minmax(0,1fr); grid-auto-rows:auto;
        justify-items:center; width:100%; min-width:0; max-width:100%;
        gap:3px; padding:4px 2px;
    }
    #mm-catalogue-filters ~ table.playlist th .mf-head-action > span:first-child {
        min-width:0; max-width:100%; white-space:normal; overflow-wrap:normal;
    }
}
/* Use the normal catalogue font and comfortable navigation hit areas. */
#mm-catalogue-pagination .pagination li a,
#mm-catalogue-pagination .pagination li.current {
    font-size:1rem!important; min-width:40px!important; height:40px!important;
}
@media (max-width:768px) {
    #mm-catalogue-pagination .pagination { gap:6px!important; }
    #mm-catalogue-pagination .pagination li a,
    #mm-catalogue-pagination .pagination li.current { min-width:44px!important; height:44px!important; }
}
