/* Character hub + pick modal. Does not change global .gameBody. */

html.cs-page,
html:has(body.cs-page),
html.cs-page body,
html.cs-page body.gameBody,
body.cs-page,
body.cs-page.gameBody {
    --gold: #e4c36a;
    --gold-deep: #c48c30;
    --cream: #f3e6c8;
    --muted: #cbb89a;
    height: 100vh;
    overflow: hidden !important;
    background-color: #120c08 !important;
    background-image:
        linear-gradient(180deg, rgba(8, 5, 3, .28) 0%, rgba(8, 5, 3, .12) 28%, rgba(8, 5, 3, .45) 100%),
        var(--me-bg-characters,url('../img/login/bg-login-full.jpg')) !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-attachment: scroll !important;
    background-blend-mode: normal !important;
}

body.cs-page .cs-page-wrap,
body.cs-page .cs-page-wrap *,
body.cs-page .cs-page-wrap *::before,
body.cs-page .cs-page-wrap *::after {
    box-sizing: border-box;
}

body.cs-page .cs-page-wrap {
    --gold: #e4c36a;
    --gold-deep: #c48c30;
    --cream: #f3e6c8;
    --muted: #cbb89a;
    position: relative;
    height: 100vh;
    max-height: 100dvh;
    padding: 10px 16px 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--cream);
    background-color: transparent;
    background-image: none;
}

body.cs-page .cs-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

body.cs-page .cs-particles canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    mix-blend-mode: screen;
    mix-blend-mode: plus-lighter;
}

body.cs-page .cs-shell,
body.cs-page.gameBody .cs-shell {
    position: relative;
    z-index: 1;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: stretch;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    width: 100% !important;
    max-width: 920px !important;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    margin: 0 auto !important;
    gap: 12px;
}

body.cs-page .cs-stage-focus {
    width: 100%;
    text-align: center;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0 12px;
    min-height: 0;
    gap: 22px;
}

body.cs-page .cs-stage-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 360px;
    gap: 8px;
    flex: 0 0 auto;
}

body.cs-page .cs-logo {
    display: block !important;
    width: auto;
    max-width: min(680px, 86%);
    height: auto;
    max-height: min(48vh, 340px);
    margin: 0 auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 28px rgba(0, 0, 0, .8));
    flex: 0 0 auto;
}

body.cs-page .cs-who {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: min(340px, 92%);
    height: 58px;
    margin: 0;
    padding: 8px 28px 10px;
    background: transparent url('../img/charselect/who-plaque.png') center / 100% 100% no-repeat;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .45));
}

body.cs-page .cs-who-label {
    font-family: 'TrajanPro-Regular', Georgia, serif;
    font-size: 9px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    text-shadow: 0 1px 4px rgba(0, 0, 0, .85);
    line-height: 1;
}

body.cs-page .cs-who-name {
    font-family: Roboto, "Noto Sans", "Segoe UI", Helvetica, Arial, sans-serif !important;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: none;
    color: var(--gold);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .85);
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.cs-page button.cs-enter,
body.cs-page a.cs-enter,
body.cs-page span.cs-enter,
body.cs-page .cs-enter {
    float: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: min(340px, 92%);
    height: 72px;
    margin: 0 auto !important;
    padding: 0 24px;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    background-image: url('../img/charselect/enter-button.png') !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 100% 100% !important;
    box-shadow: none !important;
    color: var(--gold) !important;
    font-family: 'TrajanPro-Regular', Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: none !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .85);
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .55));
    appearance: none !important;
    -webkit-appearance: none !important;
}

body.cs-page .cs-enter:hover { filter: brightness(1.1) drop-shadow(0 8px 16px rgba(0, 0, 0, .55)); }
body.cs-page .cs-enter.is-create { filter: grayscale(.35) drop-shadow(0 8px 16px rgba(0, 0, 0, .55)); }
body.cs-page .cs-enter.is-disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none;
}

body.cs-page .cs-hub-foot {
    flex: 0 0 auto;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

body.cs-page .cs-lang {
    flex: 0 0 auto;
    width: 100%;
    margin: 8px 0 0;
    padding: 0;
    border: 0;
}

body.cs-page .cs-lang-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

body.cs-page .cs-diamond {
    width: 6px;
    height: 6px;
    transform: rotate(45deg);
    background: var(--gold-deep);
    box-shadow: 0 0 8px rgba(228, 195, 106, .55);
    flex: 0 0 auto;
}

body.cs-page .cs-lang-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

body.cs-page .cs-lang-item,
body.cs-page .cs-lang-item.is-active {
    position: relative;
    display: flex;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 0 !important;
    flex: 0 0 auto;
    width: 44px;
    min-width: 44px;
    height: 44px;
    max-width: none;
    padding: 4px !important;
    color: var(--cream) !important;
    text-decoration: none !important;
    background: rgba(0, 0, 0, .35) !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    border-radius: 8px;
    box-shadow: none !important;
}

body.cs-page .cs-lang-item:hover {
    background: rgba(0, 0, 0, .55) !important;
    border-color: rgba(239, 173, 77, .55) !important;
}

body.cs-page .cs-lang-item:hover .cs-lang-flag {
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

body.cs-page .cs-lang-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

body.cs-page .cs-lang-item.is-active {
    background: rgba(140, 55, 12, .4) !important;
    border-color: rgba(239, 173, 77, .9) !important;
    box-shadow: none !important;
}

body.cs-page .cs-lang-item.is-active .cs-lang-flag {
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

body.cs-page .cs-lang-flag {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 30px !important;
    height: 21px !important;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 2px !important;
    background: #111;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

body.cs-page .cs-lang-flag img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}
body.cs-page .cs-lang-badge { display: none; }

body.cs-page .cs-discord-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 9px auto 0;
    border: 1px solid rgba(228, 195, 106, .75);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #46351c, #100d09 72%);
    box-shadow: inset 0 1px 3px #e4c36a55, 0 3px 10px #0008;
}
body.cs-page .cs-discord-link:hover,
body.cs-page .cs-discord-link:focus-visible { border-color: #f7d981; filter: brightness(1.15); }

body.cs-page button.cs-logout-trigger,
body.cs-page a.cs-logout-trigger,
body.cs-page .cs-logout-trigger {
    float: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: min(280px, 86%);
    height: 52px;
    margin: 0 auto;
    padding: 0 18px;
    border: 0 !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    background-image: url('../img/charselect/logout-button.png') !important;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    box-shadow: none !important;
    color: var(--gold) !important;
    font-family: 'TrajanPro-Regular', Georgia, serif !important;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: .14em;
    text-transform: uppercase;
    text-decoration: none !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .85);
    line-height: 1;
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .5));
}

body.cs-page .cs-logout-trigger:hover,
body.cs-page .cs-logout-trigger:focus {
    color: #fff !important;
    filter: brightness(1.1) drop-shadow(0 6px 12px rgba(0, 0, 0, .5));
    outline: none;
}

body.cs-page .cs-logout-trigger:active {
    filter: brightness(.92);
}

body.cs-page .cs-copy {
    margin: 0;
    font-size: 10px;
    color: #888;
    text-align: center;
}

/* —— pick modal (3-slice frame) —— */

/* Dim the scene behind hub modals. Blur the page shell — not the backdrop —
   so a full-screen backdrop-filter cannot smear the wooden frame and text. */
body.login-page .modal-backdrop,
body.cs-page .modal-backdrop {
    background: rgba(4, 2, 1, .64);
}

body.login-page .modal-backdrop.fade,
body.cs-page .modal-backdrop.fade {
    opacity: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

body.login-page .modal-backdrop.in,
body.login-page .modal-backdrop.show,
body.cs-page .modal-backdrop.in,
body.cs-page .modal-backdrop.show {
    opacity: 1;
    background: rgba(4, 2, 1, .64);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

body.login-page.modal-open .me-login,
body.cs-page.modal-open .cs-page-wrap,
body.login-page.modal-open .me-login__beta,
body.cs-page.modal-open .me-login__beta {
    filter: blur(4px) saturate(.9);
}

.cs-pick-modal.modal {
    padding: 12px !important;
    z-index: 1050;
    isolation: isolate;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    filter: none;
}

#csPendingModal.cs-pick-modal.modal,
#csBanModal.cs-pick-modal.modal {
    z-index: 1080;
}

.cs-pick-modal.modal.in,
.cs-pick-modal.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.cs-pick-modal .modal-dialog {
    width: min(440px, 94vw);
    max-width: 440px;
    margin: 0 auto;
}

.cs-pick-modal .modal-content,
#csLogoutModal.cs-pick-modal .modal-content,
#createChar.cs-pick-modal .modal-content,
#csBanModal.cs-pick-modal .modal-content,
#meBetaModal.cs-pick-modal .modal-content {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible;
}

/* Badge lives outside .me-login / .cs-page-wrap so the modal is not trapped
   under the blurred Bootstrap backdrop (parent stacking context). */
.me-login__beta {
    position: fixed !important;
    top: 10px !important;
    right: 12px !important;
    left: auto !important;
    z-index: 20;
    width: min(168px, 36vw);
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .55));
    -webkit-tap-highlight-color: transparent;
    appearance: none !important;
    -webkit-appearance: none !important;
}

@supports (top: env(safe-area-inset-top)) {
    .me-login__beta {
        top: calc(10px + env(safe-area-inset-top, 0px));
        right: calc(12px + env(safe-area-inset-right, 0px));
    }
}

.me-login__beta img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.me-login__beta:hover,
.me-login__beta:focus {
    outline: none;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .55)) brightness(1.08);
}

.me-login__beta-copy {
    padding: 4px 0 8px;
    min-width: 0;
    width: 100%;
}

.me-login__beta-copy .cs-pick-msg {
    margin: 0 0 10px;
    text-align: center;
}

.me-login__beta-copy .cs-pick-msg:last-child {
    margin-bottom: 0;
}

@media (max-width: 420px) {
    .me-login__beta {
        width: min(118px, 34vw);
        top: 6px;
        right: 8px;
    }
}

.cs-pick {
    --gold: #e4c36a;
    --gold-deep: #c48c30;
    --cream: #f3e6c8;
    --muted: #cbb89a;
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 820px);
    color: var(--cream);
}

.cs-pick-top,
.cs-pick-bot {
    flex: 0 0 auto;
    width: 100%;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    position: relative;
}

.cs-pick-top {
    aspect-ratio: 887 / 242;
    background-image: url('../img/charselect/pick-top.png');
    background-position: center top;
}

.cs-pick-bot {
    aspect-ratio: 887 / 152;
    background-image: url('../img/charselect/pick-bot.png');
    background-position: center bottom;
}

.cs-pick-title {
    position: absolute;
    left: 18%;
    right: 18%;
    top: 85%;
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(calc(-50% - 3px));
    font-family: 'TrajanPro-Regular', Georgia, serif;
    font-size: clamp(14px, 3.4vw, 18px);
    font-weight: 400;
    letter-spacing: .2em;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    color: var(--gold);
    text-shadow: 0 2px 8px rgba(0, 0, 0, .9);
    pointer-events: none;
}

.cs-pick-close {
    position: absolute;
    top: 7%;
    right: 4.5%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(196, 140, 48, .7);
    border-radius: 50%;
    background: radial-gradient(circle at 40% 32%, #3a2410, #140c06 72%);
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    color: var(--gold);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(228, 195, 106, .25);
}

.cs-pick-close:hover,
.cs-pick-close:focus {
    color: #fff;
    border-color: var(--gold);
    background: radial-gradient(circle at 40% 32%, #5a3414, #1c1008 72%);
    text-decoration: none !important;
}

.cs-pick-mid {
    flex: 1 1 auto;
    min-height: 120px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-image: url('../img/charselect/pick-mid.png');
    background-repeat: repeat-y;
    background-position: center top;
    background-size: 100% auto;
    padding: 8px 18% 12px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cs-pick-mid--form {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.cs-pick-hint {
    margin: 2px 0 10px;
    text-align: center;
    font-family: 'TrajanPro-Regular', Georgia, serif;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: .82;
    flex: 0 0 auto;
}

.cs-pick-msg {
    margin: 6px 0 14px;
    text-align: center;
    font-family: Roboto, "Noto Sans", "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.45;
    text-transform: none;
    color: var(--cream);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
}

.cs-pick-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.cs-pick-form .me-login__fields {
    width: 100%;
}

.cs-pick-form .me-login__btn.me-login__btn--register {
    flex: 0 0 auto;
    width: 100%;
    height: 52px;
    min-height: 52px;
    background-image: url('../img/login/register-button.png');
}

#registerNotice,
#createCharNotice {
    margin: 0 0 8px;
}

#registerNotice.is-ok,
#createCharNotice.is-ok {
    color: #dce8b8;
}

#registerNotice.is-err,
#createCharNotice.is-err {
    color: #f2d2a4;
}

.cs-pick-legal {
    margin: 2px 0 0;
    text-align: center;
    font-size: 11px;
    line-height: 1.45;
    color: var(--muted);
}

.cs-pick-legal a {
    color: var(--gold);
    text-decoration: underline;
}

.cs-pick-legal a:hover,
.cs-pick-legal a:focus {
    color: #f3d98a;
}

.cs-pick-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 4px 0 2px;
    flex: 0 0 auto;
    width: 100%;
}

#csLogoutModal .cs-pick-actions .cs-enter,
#csLogoutModal .cs-pick-actions .cs-logout-trigger,
#csPendingModal .cs-pick-actions .cs-enter,
#csPendingModal .cs-pick-actions .cs-logout-trigger,
#csBanModal .cs-pick-actions .cs-enter,
#csBanModal .cs-pick-actions .cs-logout-trigger,
body.cs-page #csLogoutModal .cs-pick-actions .cs-enter,
body.cs-page #csLogoutModal .cs-pick-actions .cs-logout-trigger,
body.cs-page #csPendingModal .cs-pick-actions .cs-enter,
body.cs-page #csPendingModal .cs-pick-actions .cs-logout-trigger,
body.cs-page #csBanModal .cs-pick-actions .cs-enter,
body.cs-page #csBanModal .cs-pick-actions .cs-logout-trigger {
    box-sizing: border-box;
    float: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: min(260px, 100%) !important;
    padding: 0 18px !important;
    margin: 0 !important;
}

body.cs-page #csLogoutModal .cs-pick-actions .cs-enter,
body.cs-page #csPendingModal .cs-pick-actions .cs-enter,
body.cs-page #csBanModal .cs-pick-actions .cs-enter {
    height: 56px !important;
    font-size: 14px !important;
    letter-spacing: .1em;
}

body.cs-page #csLogoutModal .cs-pick-actions .cs-logout-trigger,
body.cs-page #csPendingModal .cs-pick-actions .cs-logout-trigger,
body.cs-page #csBanModal .cs-pick-actions .cs-logout-trigger {
    width: min(240px, 92%) !important;
    height: 48px !important;
    font-size: 12px !important;
}

#csLogoutModal .cs-pick-mid,
#csPendingModal .cs-pick-mid,
#csBanModal .cs-pick-mid {
    min-height: 148px;
    justify-content: center;
    overflow: visible;
}

#csRegisterModal .cs-pick-title,
#forgotPwd .cs-pick-title,
#createChar .cs-pick-title,
#csPendingModal .cs-pick-title,
#csLogoutModal .cs-pick-title,
#csBanModal .cs-pick-title {
    letter-spacing: .08em;
    font-size: clamp(12px, 3vw, 16px);
}

.cs-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cs-create-form {
    align-items: stretch;
}

.cs-create-field input {
    width: 100%;
    height: 42px;
    padding: 8px 12px;
    border: 1px solid rgba(212, 168, 75, .55);
    border-radius: 8px;
    background: rgba(8, 5, 3, .72);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
    color: #f4ead4;
    font-size: 13px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.cs-create-field input::placeholder {
    color: #8d8273;
}

.cs-create-field input:focus {
    border-color: var(--gold);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55), 0 0 0 1px rgba(228, 195, 106, .35);
}

.cs-sex {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.cs-sex-opt {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.cs-sex-opt input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.cs-sex-opt span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid rgba(196, 140, 48, .35);
    border-radius: 8px;
    background: rgba(8, 5, 3, .55);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
    color: #9a8a70;
    font-family: 'TrajanPro-Regular', Georgia, serif;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-align: center;
}

.cs-sex-opt input:focus-visible + span {
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55), 0 0 0 1px rgba(228, 195, 106, .45);
}

.cs-sex-opt input:checked + span {
    color: #f3d98a;
    border-color: var(--gold);
    background: rgba(40, 24, 8, .88);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55), 0 0 0 1px rgba(228, 195, 106, .45), 0 0 12px rgba(196, 140, 48, .28);
}

#createChar .cs-enter.createChar,
body.cs-page #createChar .cs-enter.createChar {
    box-sizing: border-box;
    float: none !important;
    width: min(260px, 100%) !important;
    height: 56px !important;
    margin: 8px auto 0 !important;
    padding: 0 18px !important;
    font-size: 14px !important;
    letter-spacing: .1em;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .55));
}

.cs-pick-form .me-login__btn {
    margin-top: 4px;
}

.cs-pick-form .me-login__btn .fa {
    font-family: FontAwesome !important;
    font-weight: 400 !important;
    font-style: normal !important;
}

body.cs-page .cs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 2px 2px 8px;
    -webkit-overflow-scrolling: touch;
}

body.cs-page .cs-list::-webkit-scrollbar { width: 6px; }
body.cs-page .cs-list::-webkit-scrollbar-thumb { background: rgba(196, 140, 48, .45); }

body.cs-page .cs-card {
    position: relative;
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) max-content !important;
    grid-template-rows: auto !important;
    column-gap: 10px;
    row-gap: 0;
    align-items: center;
    width: 100%;
    min-height: 68px;
    margin: 0;
    padding: 8px 34px 8px 20px;
    text-align: left;
    color: #fff;
    cursor: pointer;
    border: 0 !important;
    border-radius: 0;
    background-color: transparent !important;
    background-image: url('../img/charselect/card-bar.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
    appearance: none;
    flex: 0 0 auto;
}

body.cs-page .cs-card:hover,
body.cs-page .cs-card:focus {
    filter: brightness(1.08);
}

body.cs-page .cs-card-av {
    grid-column: 1;
    grid-row: 1 !important;
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--gold-deep);
    background: #111;
    justify-self: center;
}

body.cs-page .cs-card-meta {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 3px 0 0 !important;
}

body.cs-page .cs-card-meta strong {
    font-family: Roboto, "Noto Sans", "Segoe UI", Helvetica, Arial, sans-serif !important;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: none;
    color: var(--cream) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.cs-page .cs-card-meta small {
    font-size: 10px;
    letter-spacing: .02em;
    text-transform: none;
    color: #ff5c3a !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
    font-weight: 600;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25;
    max-height: 2.5em;
}

body.cs-page .cs-card-clan {
    font-size: 10px;
    letter-spacing: .02em;
    text-transform: none;
}

body.cs-page .cs-card-lvl {
    grid-column: 3;
    grid-row: 1;
    position: static !important;
    left: auto !important;
    top: auto !important;
    z-index: auto;
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px !important;
    min-width: 36px !important;
    width: auto;
    padding: 0 8px 0 0 !important;
    margin: 0;
    line-height: 1;
    color: var(--cream);
    background: none !important;
    border: 0 !important;
}

body.cs-page .cs-card-lvl b {
    font-size: 20px;
    font-weight: 700;
    font-style: normal;
    font-variant-numeric: tabular-nums;
    color: var(--gold);
    line-height: 1;
}

body.cs-page .cs-card-lvl i {
    font-style: normal;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    opacity: 1;
}

body.cs-page .cs-card.is-pending .cs-card-clan {
    display: none;
}

body.cs-page .cs-card-eta {
    display: flex !important;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--gold) !important;
    letter-spacing: .04em !important;
    text-transform: none !important;
    font-weight: 700 !important;
    overflow: visible !important;
}

body.cs-page .cs-card-eta [data-cs-countdown] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.cs-page .cs-card-undo {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--gold);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

body.cs-page .cs-card-undo:hover,
body.cs-page .cs-card-undo:focus {
    color: #fff;
}

body.cs-page .cs-card--empty {
    grid-template-columns: 52px 1fr !important;
}

body.cs-page .cs-card--empty .cs-card-empty-mark {
    grid-column: 1;
    grid-row: 1 !important;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 300;
    color: var(--gold);
    border: 2px dashed rgba(228, 195, 106, .45);
    border-radius: 50%;
    background: rgba(0, 0, 0, .28);
}

body.cs-page .cs-card--empty.is-locked {
    cursor: default;
    opacity: .5;
    pointer-events: none;
}

@media (max-width: 767px) {
    html:has(body.cs-page) {
        height: 100%;
        overflow: hidden;
    }
    body.cs-page,
    body.cs-page.gameBody {
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
    }
    body.cs-page .cs-page-wrap {
        height: 100dvh;
        max-height: 100dvh;
        padding: max(12px, env(safe-area-inset-top, 0px)) 12px calc(16px + env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }
    body.cs-page .cs-shell,
    body.cs-page.gameBody .cs-shell {
        gap: 12px;
        justify-content: center !important;
        flex: 0 0 auto !important;
        height: auto !important;
        min-height: 0;
        margin-top: auto !important;
        margin-bottom: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    body.cs-page .cs-stage-focus {
        flex: 0 0 auto;
        justify-content: center;
        padding: 0;
        gap: 12px;
    }
    body.cs-page .cs-logo {
        display: block !important;
        max-height: min(16vh, 96px) !important;
        max-width: min(70vw, 240px) !important;
        margin: 0 auto;
    }
    body.cs-page .cs-stage-actions {
        gap: 8px;
        max-width: 320px;
    }
    body.cs-page .cs-who {
        width: min(260px, 88vw);
        height: 44px;
        padding: 4px 20px 6px;
    }
    body.cs-page .cs-who-label { font-size: 8px; }
    body.cs-page .cs-who-name { font-size: 13px; }
    body.cs-page button.cs-enter,
    body.cs-page a.cs-enter,
    body.cs-page .cs-enter {
        width: min(260px, 86vw) !important;
        height: 52px !important;
        font-size: 14px !important;
        letter-spacing: .08em;
        padding: 0 16px !important;
    }
    body.cs-page .cs-lang {
        margin: 4px 0 0;
        width: 100%;
    }
    body.cs-page .cs-lang-head {
        margin-bottom: 6px;
        font-size: 9px;
        letter-spacing: .1em;
    }
    body.cs-page .cs-lang-item,
    body.cs-page .cs-lang-item.is-active {
        width: 40px;
        min-width: 40px;
        height: 40px;
    }
    body.cs-page .cs-lang-flag {
        width: 28px !important;
        height: 20px !important;
    }
    body.cs-page .cs-hub-foot {
        gap: 8px;
        padding-bottom: 0;
        max-width: 320px;
    }
    body.cs-page button.cs-logout-trigger,
    body.cs-page a.cs-logout-trigger,
    body.cs-page .cs-logout-trigger {
        width: min(220px, 80vw) !important;
        height: 44px !important;
        font-size: 11px !important;
        letter-spacing: .1em;
        padding: 0 12px !important;
        color: var(--gold) !important;
    }
    body.cs-page .cs-copy {
        font-size: 9px;
        max-width: 90vw;
    }

    body.cs-page .cs-pick-modal.modal {
        padding: 8px !important;
        padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        align-items: center;
    }
    body.cs-page .cs-pick-modal .modal-dialog,
    .cs-pick-modal .modal-dialog {
        width: min(100%, 400px);
        max-width: calc(100vw - 16px);
        margin: 0 auto;
    }
    body.cs-page .cs-pick,
    .cs-pick {
        max-height: min(92dvh, 720px);
    }
    body.cs-page .cs-pick-top,
    .cs-pick-top {
        aspect-ratio: auto;
        height: clamp(64px, 18vw, 88px);
        flex: 0 0 auto;
    }
    body.cs-page .cs-pick-bot,
    .cs-pick-bot {
        aspect-ratio: auto;
        height: clamp(40px, 12vw, 56px);
        flex: 0 0 auto;
    }
    body.cs-page .cs-pick-title,
    .cs-pick-title {
        left: 18%;
        right: 18%;
        font-size: 12px;
        letter-spacing: .08em;
        white-space: normal;
        line-height: 1.15;
    }
    body.cs-page .cs-pick-close,
    .cs-pick-close {
        top: 8%;
        right: 3%;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    body.cs-page .cs-pick-mid,
    .cs-pick-mid {
        padding: 10px 20% 14px;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #csRegisterModal .cs-pick-mid {
        padding: 10px 13% 18px;
    }
    body.cs-page .cs-pick-msg,
    .cs-pick-msg {
        font-size: 13px;
        line-height: 1.4;
        margin: 0 0 10px;
    }
    body.cs-page .cs-pick-hint {
        margin: 0 0 8px;
        font-size: 9px;
    }
    body.cs-page .cs-pick-modal .cs-list,
    body.cs-page .cs-list {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 2px 0 10px !important;
        gap: 6px;
        min-height: 0;
        max-height: none;
    }
    body.cs-page .cs-pick-modal .cs-card,
    body.cs-page .cs-card {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        display: grid !important;
        grid-template-columns: 40px minmax(0, 1fr) max-content !important;
        grid-template-rows: auto !important;
        flex-direction: unset !important;
        align-items: center;
        justify-content: unset;
        column-gap: 8px;
        min-height: 56px;
        padding: 6px 28px 6px 14px !important;
        text-align: left;
        background-color: transparent !important;
        background-image: url('../img/charselect/card-bar.png') !important;
        background-size: 100% 100% !important;
        background-repeat: no-repeat !important;
        border: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    body.cs-page .cs-pick-modal .cs-card.is-active,
    body.cs-page .cs-card.is-active {
        background: transparent url('../img/charselect/card-bar.png') center / 100% 100% no-repeat !important;
        border: 0 !important;
        filter: brightness(1.08) !important;
        box-shadow: none !important;
    }
    body.cs-page .cs-pick-modal .cs-card-av,
    body.cs-page .cs-card-av {
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
        border-radius: 50% !important;
        order: unset;
    }
    body.cs-page .cs-pick-modal .cs-card-meta,
    body.cs-page .cs-card-meta {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start;
        text-align: left;
        width: auto;
        padding: 0 !important;
        order: unset;
    }
    body.cs-page .cs-card-meta strong { font-size: 12px; }
    body.cs-page .cs-pick-modal .cs-card-meta small,
    body.cs-page .cs-card-meta small {
        display: -webkit-box !important;
        font-size: 9px;
        letter-spacing: .02em;
        text-transform: none;
        white-space: normal;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.25;
        max-height: 2.6em;
    }
    body.cs-page .cs-pick-modal .cs-card-lvl,
    body.cs-page .cs-card-lvl {
        position: static !important;
        display: flex !important;
        flex-direction: column;
        align-items: flex-end;
        background: none !important;
        border: 0 !important;
        padding: 0 6px 0 0 !important;
        min-width: 32px !important;
        order: unset;
    }
    body.cs-page .cs-card-lvl b { font-size: 16px; }
    body.cs-page .cs-pick-modal .cs-card--empty,
    body.cs-page .cs-card--empty {
        grid-template-columns: 44px 1fr !important;
    }
    body.cs-page .cs-card--empty .cs-card-empty-mark {
        width: 40px;
        height: 40px;
        margin: 0;
    }
}

@media (max-width: 767px) and (max-height: 700px) {
    body.cs-page .cs-logo {
        max-height: min(12vh, 72px) !important;
        max-width: min(56vw, 180px) !important;
    }
    body.cs-page .cs-stage-focus { gap: 8px; }
    body.cs-page button.cs-enter,
    body.cs-page .cs-enter {
        height: 48px !important;
        font-size: 13px !important;
    }
    body.cs-page .cs-who { height: 40px; }
    body.cs-page .cs-pick-top { height: 60px; }
    body.cs-page .cs-pick-bot { height: 40px; }
}

/* Character selection: compact store access beside Discord, phone browsers only. */
body.cs-page .cs-community-links { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 9px auto 0; max-width: 100%; }
body.cs-page .cs-community-links .cs-discord-link { margin: 0; flex: 0 0 46px; }
body.cs-page .cs-play-link { display: block; padding: 9px; line-height: 0; flex: 0 0 auto; }
body.cs-page .cs-play-link img { display: block; height: 36px; width: auto; }
body.cs-page .cs-play-link:focus-visible { outline: 2px solid #e4c36a; outline-offset: 2px; border-radius: 4px; }
html.me-app body.cs-page .cs-play-link, body.cs-page.me-app .cs-play-link { display: none; }
