/* The roster is measured in the client's 1920x1080 design coordinates.
   applyClientResolutionScaling() is its only viewport scaling mechanism. */
#client-scale-root .client-app .content-area:has(.character-roster) {
    position: absolute;
    inset: 50px calc(var(--client-gutter-x, 0px) + 380px) 50px calc(var(--client-gutter-x, 0px) + 420px);
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
}

#client-scale-root .character-roster {
    --roster-ink: #080e16;
    --roster-text: #e8e4dc;
    --roster-muted: #8f969d;
    --roster-gold: #c6a573;
    --roster-gap: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 26px 28px 18px;
    overflow: hidden;
    color: var(--roster-text);
    background: var(--roster-ink);
    border: 1px solid #514736;
    border-top: 2px solid var(--roster-gold);
    border-radius: 4px;
    box-shadow: 0 28px 80px #0009;
    font-family: 'Exo 2', sans-serif;
}

.character-roster *, .character-roster *::before, .character-roster *::after {
    box-sizing: border-box;
}

.character-roster__header {
    display: flex;
    align-items: center;
    flex: 0 0 62px;
    gap: 20px;
}

.character-roster__heading {
    display: flex;
    align-items: baseline;
    gap: 20px;
    min-width: 0;
    margin-right: auto;
}

.character-roster__title {
    margin: 0;
    color: var(--roster-text);
    font: 600 36px/1.15 'Exo 2', sans-serif;
    letter-spacing: -0.6px;
    text-transform: none;
}

.character-roster__count {
    color: var(--roster-gold);
    font: 400 16px/1.3 'Exo 2', sans-serif;
    white-space: nowrap;
}

.character-roster__search {
    position: relative;
    display: flex;
    align-items: center;
    width: 330px;
    flex: 0 0 330px;
}

.character-roster__search > svg {
    position: absolute;
    left: 14px;
    width: 21px;
    height: 21px;
    color: var(--roster-muted);
    pointer-events: none;
}

.character-roster__search input {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 12px 0 44px;
    color: var(--roster-text);
    background: transparent;
    border: 1px solid #343b42;
    border-radius: 2px;
    font: 400 16px/1.3 'Exo 2', sans-serif;
    outline: none;
}

.character-roster__search input::placeholder { color: var(--roster-muted); }
.character-roster__search input:focus { border-color: var(--roster-gold); }

.character-roster__close {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--roster-gold);
    border: 0;
    border-radius: 2px;
    background: transparent;
    cursor: pointer;
}

.character-roster__close svg { width: 26px; height: 26px; }
.character-roster__close:hover { background: #c6a57312; }
.character-roster :is(button, input):focus-visible { outline: 2px solid var(--roster-gold); outline-offset: 3px; }

#character-grid-client.character-roster__grid {
    display: grid;
    grid-template-columns: repeat(var(--roster-columns, 7), var(--roster-card-width, 138px));
    grid-auto-rows: var(--roster-card-height, 138px);
    gap: var(--roster-gap);
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 4px;
    align-content: start;
    justify-content: center;
    overflow: hidden;
    position: relative;
    opacity: 0;
}

#character-grid-client.character-roster__grid[data-layout-ready="true"] { opacity: 1; }

#character-grid-client .character-roster__card {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    aspect-ratio: auto;
    color: var(--roster-text);
    background: #0a1016;
    border: 1px solid #3c3d37;
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    opacity: 1;
    transform: none;
    animation: none;
    filter: none;
    will-change: auto;
    box-shadow: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

#character-grid-client .character-roster__card:hover,
#character-grid-client .character-roster__card:focus-visible {
    border-color: var(--roster-gold);
    box-shadow: inset 0 0 0 1px var(--roster-gold);
    transform: none;
}

#character-grid-client .character-roster__card.hidden { display: none; }

.character-roster__portrait {
    position: relative;
    flex: 0 0 100%;
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #141d26;
}

.character-roster__portrait > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.character-roster__card.locked .character-roster__portrait > img { filter: saturate(.4) brightness(.67); }

.character-roster__name {
    position: absolute;
    inset: auto 0 0;
    height: 32px;
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 9px 4px 0;
    color: var(--roster-text);
    background: linear-gradient(transparent, rgba(3, 7, 11, .92) 45%);
    font: 500 14px/1.15 'Exo 2', sans-serif;
    white-space: nowrap;
}

.character-roster__portrait .character-level {
    position: absolute;
    inset: 5px auto auto 5px;
    padding: 3px 6px;
    color: #f3cf88;
    background: #080e16ce;
    border: 0;
    border-radius: 0;
    font: 500 12px/1.1 'Exo 2', sans-serif;
    backdrop-filter: none;
}

.character-roster__lock {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 26px;
    color: #d1ccbf;
    background: #080e16a6;
    border-radius: 2px;
}

.character-roster__lock svg { width: 15px; height: 18px; }

.character-roster__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex: 0 0 34px;
    margin-top: 12px;
    color: var(--roster-muted);
    font: 400 15px/1.3 'Exo 2', sans-serif;
}

.character-roster__owned strong { color: var(--roster-gold); font-weight: 500; }
.character-roster__empty {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    margin: 0;
    color: var(--roster-muted);
    font: 400 19px/1.4 'Exo 2', sans-serif;
}
.character-roster__empty.visible { display: grid; }
.character-roster__loading { display: grid; place-items: center; flex: 1; color: var(--roster-muted); }

@media (prefers-reduced-motion: reduce) {
    .character-roster * { transition: none !important; }
}
