.page-list .list-container,
.page-list .level-container,
.page-list .meta-container {
    padding-block: 2rem;
}
.page-list .list-container {
    padding-inline: 1rem;
}
.page-list .meta-container {
    padding-right: 2rem;
}

.page-list .list {
    table-layout: auto;
}
.page-list .list .rank {
    text-align: start;
    padding-right: 1rem;
    vertical-align: middle;
}
.page-list .list .level {
    width: 100%;
    vertical-align: middle;
}
.page-list .list tr {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 0;
}

.page-list .list .level button {
    background-color: var(--color-background);
    color: var(--color-on-background);
    border: none;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: start;
    word-break: normal;
    overflow-wrap: normal;
    cursor: pointer;
}
.page-list .list .level.error button {
    color: var(--color-error);
    cursor: not-allowed;
    text-decoration: line-through;
}
.page-list .list .level button:hover {
    background-color: var(--color-background-hover);
    color: var(--color-on-background-hover);
}
.page-list .list .level.active button {
    background-color: var(--color-primary);
    color: var(--color-on-primary);
}
.page-list .level-container .level {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-right: 2rem;
    max-width: 48rem;
}

.page-list .level-container > .level-empty-state {
    height: auto;
    min-height: 0;
}
.page-list .level-container .level .level-authors {
    display: grid;
    grid-template-columns: max-content 1fr;
    grid-auto-rows: max-content;
    gap: 1rem;
}
.page-list .level-container .level .video {
    aspect-ratio: 16/9;
}
.page-list .level-container .level .stats {
    display: flex;
    justify-content: space-evenly;
    text-align: center;
    gap: 2rem;
}
.page-list .level-container .level .stats li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.page-list .level-container .level .records {
    table-layout: fixed;
}
.page-list .level-container .level .records tr td:not(:last-child) {
    padding-right: 1rem;
}
.page-list .level-container .level .records .percent,
.page-list .level-container .level .records .user,
.page-list .level-container .level .records .hz {
    padding-block: 1rem;
}
.page-list .level-container .level .records .user {
    width: 100%;
}
.page-list .level-container .level .records .percent,
.page-list .level-container .level .records .hz {
    text-align: end;
}
.page-list .meta-container .og a:hover,
.page-list .level-container .level .records a:hover {
    text-decoration: underline;
}
.page-list .meta {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.page-list .meta .errors {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.page-list .meta .errors .error {
    padding: 1rem;
    background-color: var(--color-error);
    color: var(--color-on-error);
    border-radius: 0.5rem;
}
.page-list .meta .editors {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.page-list .meta .editors li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.page-list .meta .editors li img {
    height: 1.25rem;
}
.page-list .meta .editors li a:hover {
    text-decoration: underline;
}



/* ========================================================= */
/* LEVEL DESCRIPTION DROPDOWN                                */
/* ========================================================= */

.page-list .level-container .level .level-description {
    position: relative;

    /* Stay completely inside the level container */
    width: 100%;
    margin: 0;

    box-sizing: border-box;

    /* The actual background */
    background-color: var(--color-background-hover);

    /* REAL rounded corners on the actual element */
    border-radius: 0.75rem;

    /* Clip the background to all four rounded corners */
    overflow: hidden;
}


/* ========================================================= */
/* DESCRIPTION HEADING                                       */
/* ========================================================= */

.page-list .level-container .level .level-description summary {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    box-sizing: border-box;

    /*
     * Left/right breathing room.
     * The text remains visually aligned with Records.
     */
    padding: 1rem 1.5rem 1rem 1rem;

    color: var(--color-on-background);

    cursor: pointer;
    user-select: none;

    font-family: "Lexend Deca", sans-serif;
    font-size: 28px;
    line-height: 34px;
    font-weight: 700;
    letter-spacing: -1px;

    -webkit-font-smoothing: subpixel-antialiased;

    list-style: none;

    background: transparent;
    border: none;
    outline: none;
}


/* ========================================================= */
/* MATCH H2 TYPOGRAPHY                                       */
/* ========================================================= */

.page-list .level-container .level .level-description summary::before {
    content: "";
    margin-bottom: -0.2583333333em;
    display: table;
}

.page-list .level-container .level .level-description summary::after {
    content: "";
    margin-top: -0.2083333333em;
    display: table;
}


/* ========================================================= */
/* REMOVE DEFAULT BROWSER TRIANGLE                            */
/* ========================================================= */

.page-list .level-container .level .level-description summary::-webkit-details-marker {
    display: none;
}

.page-list .level-container .level .level-description summary::marker {
    display: none;
    content: "";
}


/* ========================================================= */
/* TRIANGLE                                                  */
/* ========================================================= */

.page-list .level-container .level .description-arrow {
    display: inline-block;

    margin-left: auto;

    font-family: sans-serif;
    font-size: 0.8rem;
    line-height: 1;

    letter-spacing: normal;

    transform: rotate(0deg);
    transition: transform 0.2s ease;
}


/* Closed = ▼ */
/* Open = ▲ */
.page-list .level-container .level .level-description[open] .description-arrow {
    transform: rotate(180deg);
}


/* ========================================================= */
/* HOVER                                                     */
/* ========================================================= */

.page-list .level-container .level .level-description summary:hover {
    background: transparent;
}


/* ========================================================= */
/* DESCRIPTION BODY                                          */
/* ========================================================= */

.page-list .level-container .level .description-content {
    position: relative;

    width: 100%;
    box-sizing: border-box;

    /*
     * Same left/right breathing room as the heading.
     */
    padding: 0 1.5rem 1rem 1rem;

    background: transparent;

    color: var(--color-on-background);

    font-family: "Lexend Deca", sans-serif;
    font-size: 17.1428571429px;
    line-height: 28px;
    font-weight: 500;

    -webkit-font-smoothing: subpixel-antialiased;

    /* Paste paragraphs normally */
    white-space: pre-wrap;
}





/* ========================================================= */
/* FILTER BUTTON                                             */
/* ========================================================= */

.filter-controls {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.filter-button {
    border: none;
    background: var(--color-background-hover);
    color: var(--color-on-background);
    cursor: pointer;
    border-radius: 6px;
    padding: 10px 16px;
    font-weight: bold;
}

.filter-button:hover {
    background: var(--color-primary);
    color: var(--color-on-primary);
}




/* ========================================================= */
/* FILTER BUTTON / EMPTY STATE LAYOUT FIX                   */
/* ========================================================= */

/* Keep the filter controls in normal document flow */
.page-list .level-container > .filter-controls {
    position: relative;
    z-index: 2;
    width: 100%;
    box-sizing: border-box;
}

/* Keep the button itself above the level content */
.page-list .level-container > .filter-controls .filter-button {
    position: relative;
    z-index: 3;
}

/*
 * The empty/error level is a sibling BELOW the filter controls.
 * Do not let its inherited .level sizing create an overlapping
 * click area.
 */
.page-list .level-container > .level-empty-state {
    position: relative;
    z-index: 1;
    height: auto;
    min-height: 0;
    pointer-events: none;
}




/* ========================================================= */
/* FILTER MODAL OVERLAY                                      */
/* ========================================================= */

.filter-modal-overlay {
    position: fixed !important;
    inset: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    background: rgba(0, 0, 0, 0.65);

    z-index: 9999;
}


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

.filter-modal {
    width: min(90%, 480px);
    max-height: 85vh;

    overflow-y: auto;

    background: var(--color-background);
    color: var(--color-on-background);

    border-radius: 12px;

    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);

    padding: 1.5rem;

    box-sizing: border-box;
}


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

.filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 1.5rem;
}

.filter-modal-header h2 {
    margin: 0;
}

.filter-modal-close {
    border: none;
    background: transparent;

    color: var(--color-on-background);

    font-size: 2rem;
    line-height: 1;

    cursor: pointer;

    padding: 0.25rem 0.5rem;
}

.filter-modal-close:hover {
    color: var(--color-primary);
}


/* ========================================================= */
/* FILTER OPTIONS / SECTIONS                                 */
/* ========================================================= */

.filter-section {
margin: 0;
border-radius: 8px;
}

.filter-section + .filter-section {
margin-top: 0.5rem;
}

/* Remove the browser's default left-hand triangle */
.filter-section summary {
list-style: none;
cursor: pointer;


display: flex;
align-items: center;
justify-content: space-between;

width: 100%;
box-sizing: border-box;

padding: 0.75rem 0.5rem;

color: var(--color-on-background);

/* Match the site's normal typography */
font-family: "Lexend Deca", sans-serif;
font-size: 17.1428571429px;
line-height: 20px;
font-weight: 500;

-webkit-font-smoothing: subpixel-antialiased;

user-select: none;


}

.filter-section summary::-webkit-details-marker {
display: none;
}

.filter-section summary::marker {
display: none;
content: "";
}

/* Make the entire filter heading clearly clickable */
.filter-section summary:hover {
background: var(--color-background-hover);
border-radius: 6px;
}

/* Right-hand triangle */
.filter-section .filter-chevron {
display: inline-block;


margin-left: auto;

font-family: sans-serif;
font-size: 0.75rem;
line-height: 1;

transform: rotate(0deg);
transition: transform 0.2s ease;

pointer-events: none;


}

/* Closed = ▼ / Open = ▲ */
.filter-section[open] .filter-chevron {
transform: rotate(180deg);
}

/* ========================================================= */
/* FILTER SECTION CONTENT                                    */
/* ========================================================= */

.filter-section-content {
display: flex;
flex-direction: column;
gap: 0.25rem;


padding: 0.25rem 0.5rem 0.75rem;


}

/* ========================================================= */
/* RADIO OPTIONS                                             */
/* ========================================================= */

.filter-option {
display: flex;
align-items: center;
gap: 0.75rem;


cursor: pointer;

padding: 0.5rem;

border-radius: 6px;

color: var(--color-on-background);

/* Exact site label typography */
font-family: "Lexend Deca", sans-serif;
font-size: 17.1428571429px;
line-height: 20px;
font-weight: 500;

-webkit-font-smoothing: subpixel-antialiased;


}

.filter-option:hover {
background: var(--color-background-hover);
}

.filter-option input {
width: 18px;
height: 18px;


cursor: pointer;

flex-shrink: 0;


}

/* ========================================================= */
/* NUMBER FILTERS                                            */
/* ========================================================= */

.filter-number {
display: flex;
align-items: center;
gap: 0.5rem;


width: 100%;
box-sizing: border-box;

padding: 0.35rem 0;

color: var(--color-on-background);

/* Exact site label typography */
font-family: "Lexend Deca", sans-serif;
font-size: 17.1428571429px;
line-height: 20px;
font-weight: 500;

-webkit-font-smoothing: subpixel-antialiased;


}

.filter-number > span:first-child {
min-width: 70px;
}

.filter-number > span:last-child {
flex-shrink: 0;
}

.filter-number input {
flex: 1;


min-width: 0;

box-sizing: border-box;

padding: 0.5rem 0.6rem;

border: 1px solid var(--color-background-hover);
border-radius: 6px;

background: var(--color-background);
color: var(--color-on-background);

/* Match site's input typography */
font-family: "Lexend Deca", sans-serif;
font-size: 17.1428571429px;
line-height: 20px;
font-weight: 500;

-webkit-font-smoothing: subpixel-antialiased;

cursor: text;


}

.filter-number input:focus {
outline: 2px solid var(--color-primary);
outline-offset: 1px;
}

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

.filter-modal-actions {
display: flex;
justify-content: flex-end;
gap: 0.75rem;


margin-top: 1.5rem;


}

.filter-clear,
.filter-apply {
border: none;
border-radius: 6px;


padding: 0.7rem 1.2rem;

cursor: pointer;

font-family: "Lexend Deca", sans-serif;
font-size: 17.1428571429px;
line-height: 20px;
font-weight: 500;

-webkit-font-smoothing: subpixel-antialiased;


}

.filter-clear {
background: var(--color-background-hover);
color: var(--color-on-background);
}

.filter-apply {
background: var(--color-primary);
color: var(--color-on-primary);
}

.filter-clear:hover,
.filter-apply:hover {
opacity: 0.85;
}





.page-list .level-container .level .level-title-with-demon {
    width: 100%;
}

.page-list .level-container .level .level-title-with-demon h1 {
    margin: 0;
    line-height: 1.2;
}

.page-list .level-container .level .level-demon-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;

    display: inline-block;
    vertical-align: middle;

    margin-left: 12px;
}








/* MASTER DEMONLIST MOBILE RESPONSIVENESS FIX */
@media (max-width: 768px) {
    /* Fix the layout wrapper so things stack vertically */
    .root, #app, main, .page-list {
        display: flex !important;
        flex-direction: column !important;
        padding: 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Force the main welcome/level panels to expand to full phone width */
    .g-layout, .panel, .surface, .main-content, div[style*="max-width: 1000px"] {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px 0 !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    /* Complete mobile navigation layout override */
    .nav, nav, .header, .nav-bar, .nav__actions, .nav-content, [class*="nav"] {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        height: auto !important;
        min-height: unset !important;
        max-height: unset !important;
        padding: 10px 5px !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        float: none !important;
    }

    /* Force the list title and buttons to sit inside the row flow */
    .nav__title, .nav__logo, [class*="logo"], [class*="title"] {
        position: relative !important;
        margin: 5px auto !important;
        text-align: center !important;
        width: 100% !important;
        display: block !important;
    }

    /* Clean uniform sizing for all menu and action buttons */
    .nav a, nav a, .nav__link, .button, .submit-record-btn, [class*="link"], [class*="btn"] {
        font-size: 0.7rem !important;
        padding: 5px 8px !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 2px !important;
        border-radius: 4px !important;
        height: auto !important;
        width: auto !important;
        position: relative !important;
        transform: none !important;
    }

    /* Fix the overlapping lists sub-menu buttons */
    .nav nav, 
    .nav__sub, 
    div[style*="grid"], 
    .nav-bar ul {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 10px 0 !important;
        padding: 0 !important;
        position: relative !important;
        height: auto !important;
    }

    /* Ensure individual sub-menu buttons have breathing room */
    .nav nav a, 
    .nav__sub a {
        margin: 4px !important;
        font-size: 0.75rem !important;
        z-index: 5 !important;
    }

    /* Un-fix the desktop header tracking block so it flows normally and frees the viewport scroll gestures */
    header, .header, nav, .nav, .nav-bar, .nav-container {
        position: relative !important;
        position: static !important; /* Forces it to fall completely out of fixed/sticky mode */
        height: auto !important;
        max-height: unset !important;
        min-height: unset !important;
        pointer-events: auto !important; /* Ensures buttons stay clickable */
    }

    /* Target the main content layout scroll panel wrapper */
    .root, #app, main, .page-list, .main-content, .content, .g-layout {
        position: relative !important;
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: visible !important; /* Explicitly grants permission to scroll normally anywhere */
    }

        /* Do not override fixed/absolute positioning globally.
       The filter modal and other overlays need their positioning. */

        /* LEADERBOARD MOBILE PANEL FIX */
    .page-leaderboard, 
    div[v-if="selected !== null"],
    .player-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: unset !important;
        margin: 15px 0 !important;
        box-sizing: border-box !important;
    }

    /* Force the right-hand level list panel to be completely visible when stacked below */
    .player-details, 
    .right-panel,
    div[style*="flex-grow"] {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        margin-top: 25px !important; /* Adds breathing room right above the player stats */
        padding: 15px !important;
        box-sizing: border-box !important;
        height: auto !important;
    }

    
        /* ROULETTE MOBILE PANEL FIX */
    .page-roulette,
    div[v-if="view == 'roulette'"],
    div[style*="grid-template-columns"],
    .roulette-container {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        box-sizing: border-box !important;
    }

    /* Force the active level guessing card to open wide below your buttons */
    .roulette-card,
    .level-card,
    div[v-if="started"] {
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 30px !important; /* Pushes card cleanly below Import/Export */
        padding: 15px !important;
        box-sizing: border-box !important;
        height: auto !important;
    }

        /* Keep the roulette input text boxes and buttons neatly stacked on phone screens */
    .roulette-buttons, 
    .roulette-inputs {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
        width: 100% !important;
    }

    
    /* Force global horizontal overflow protection */
    body, html {
        overflow-x: hidden !important;
        width: 100% !important;
    }

    /* ======================================================= */
    /* INSERTED HERE: CONSTRAIN LEVEL LIST TO A SCROLLABLE BOX */
    /* ======================================================= */
        .page-list .list-container {
        max-height: 35vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        padding-right: 5px !important;
        box-sizing: border-box !important;
    }

    .page-list .list {
        max-height: none !important;
        overflow: visible !important;
    }

    .g-layout > div:first-child::-webkit-scrollbar,
    .list-container::-webkit-scrollbar,
    .list::-webkit-scrollbar {
        width: 6px;
    }
    .g-layout > div:first-child::-webkit-scrollbar-thumb,
    .list-container::-webkit-scrollbar-thumb,
    .list::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }


        /* ======================================================= */
    /* FILTER MODAL MOBILE FIX                                */
    /* ======================================================= */

    .page-list .filter-controls {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 12px;
    }

    .page-list .filter-button {
        width: 100%;
        min-height: 44px;
        font-size: 1rem;
    }

    .page-list .filter-modal-overlay {
        position: fixed !important;
        inset: 0 !important;

        display: flex !important;
        align-items: center !important;
        justify-content: center !important;

        padding: 12px !important;
        box-sizing: border-box !important;

        z-index: 9999 !important;
    }

    .page-list .filter-modal {
        width: 100% !important;
        max-width: 480px !important;
        max-height: 90vh !important;

        overflow-y: auto !important;
        overflow-x: hidden !important;

        padding: 1rem !important;
        box-sizing: border-box !important;

        border-radius: 12px !important;
    }

    .page-list .filter-modal-header {
        margin-bottom: 1rem !important;
    }

    .page-list .filter-modal-header h2 {
        font-size: 1.4rem;
    }

    .page-list .filter-modal-close {
        min-width: 44px;
        min-height: 44px;
    }

    .page-list .filter-section-content {
        width: 100%;
        box-sizing: border-box;
    }

    .page-list .filter-number {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
    }

    .page-list .filter-number input {
        flex: 1;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
        min-height: 40px;
    }

    .page-list .filter-modal-actions {
        position: sticky;
        bottom: 0;

        display: flex;
        gap: 8px;

        padding-top: 12px;
        margin-top: 1rem;

        background: var(--color-background);
    }

    .page-list .filter-clear,
    .page-list .filter-apply {
        flex: 1;
        min-height: 44px;
    }
}
