/* Screen management */
.screen {
    display: none;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: var(--real-100vh, 100vh);
    /* JS-computed actual height for iOS Safari */
    height: 100dvh;
    /* iOS 16+: dynamic viewport height - excludes browser chrome */
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Auth Screen Background */
#auth-screen,
#loading-screen {
    position: relative;
    overflow: hidden;
    background-color: #000;
}

#auth-screen::before,
#loading-screen::before {
    content: none;
}

.screen-bg-video {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    object-fit: cover;
    z-index: 0;
    animation: backgroundMove 30s ease-in-out infinite;
}

/* Mobile: Video background vừa với màn hình */
@media (max-width: 768px) {
    /* Kept base screen-bg-video style for infinite animation */
}

/* Mobile Landscape: Video background vừa với chiều dọc ngắn */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    #auth-screen,
    #loading-screen {
        overflow: hidden;
    }
}

@keyframes backgroundMove {

    0%,
    100% {
        transform: translate(0%, 0%) scale(1);
    }

    25% {
        transform: translate(-5%, 0%) scale(1.05);
    }

    50% {
        transform: translate(0%, -5%) scale(1.08);
    }

    75% {
        transform: translate(-3%, -3%) scale(1.05);
    }
}

#auth-screen::after,
#loading-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.25);
    z-index: 1;
}

#auth-screen .auth-container,
#loading-screen .loading-container {
    position: relative;
    z-index: 2;
}

/* Character Creation Screen */
#character-creation-screen {
    position: relative;
    overflow: hidden;
    background-color: #000;
    background-image: url('../assets/icon/taonhanvat/hinhnentaonhanvat.webp');
    background-size: cover;
    background-position: center;
}

#character-creation-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(7, 6, 22, 0.7);
    backdrop-filter: blur(1px);
}

.character-creation-wrapper {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 100%;
    height: 100%;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    overflow: visible !important;
}

/* Character Selection UI */
.character-selection-wrapper {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    box-sizing: border-box;
}

.character-selection-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(255, 177, 85, 0.4), 0 2px 4px rgba(0, 0, 0, 0.8);
    font-family: sans-serif;
    margin-bottom: 10px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        text-shadow: 0 0 10px rgba(255, 177, 85, 0.4), 0 2px 4px rgba(0, 0, 0, 0.8);
    }

    to {
        text-shadow: 0 0 20px rgba(255, 177, 85, 0.8), 0 2px 8px rgba(0, 0, 0, 0.9);
    }
}

.character-slots-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 800px;
}

.character-slot {
    width: 180px;
    height: 280px;
    background: rgba(15, 12, 30, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.02);
    overflow: visible;
}

.character-slot:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 177, 85, 0.4);
    box-shadow: 0 15px 35px rgba(255, 177, 85, 0.15), 0 8px 32px rgba(0, 0, 0, 0.5);
}

.character-slot.selected {
    border-color: #ffb155;
    box-shadow: 0 0 30px rgba(255, 177, 85, 0.35), inset 0 0 15px rgba(255, 177, 85, 0.1);
    background: rgba(255, 177, 85, 0.05);
}

.character-slot.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.character-slot.locked:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.slot-create-btn {
    width: 68px;
    height: 68px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
    transition: transform 0.2s ease;
}

.character-slot:not(.locked):hover .slot-create-btn {
    transform: scale(1.12);
}

.slot-lock-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.slot-char-preview {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-top: 15px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
    animation: previewFloat 4s ease-in-out infinite;
}

.slot-char-level {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 177, 85, 0.22);
    border: 1.5px solid rgba(255, 177, 85, 0.55);
    color: #ffb155;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 10;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
}

.slot-spine-container {
    position: absolute;
    inset: 0;
    bottom: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
    pointer-events: none;
}

.slot-spine-canvas {
    width: 300px;
    height: 400px;
    object-fit: contain;
    transform: translateY(0);
    animation: previewFloat 4s ease-in-out infinite;
}

@keyframes previewFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

.slot-char-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
}

.slot-char-name {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-char-race {
    color: #ffb155;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.enter-game-btn {
    width: 194px;
    height: 60px;
    background: url('../assets/icon/taonhanvat/buttonchontoc.webp') center/contain no-repeat;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
    margin-top: 10px;

    /* Text styling */
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 177, 85, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 2px;
}

.enter-game-btn:hover {
    transform: translateY(-2px) scale(1.05);
    filter: brightness(1.1) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.7));
}

.enter-game-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Hide wrappers smoothly */
.character-selection-wrapper,
.character-creation-wrapper {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: none !important;
}

.character-selection-wrapper.active,
.character-creation-wrapper.active {
    opacity: 1;
    pointer-events: auto;
    display: flex !important;
}

@media (max-width: 768px) {
    .character-selection-title {
        font-size: 1.6rem;
        letter-spacing: 2px;
        margin-bottom: 5px;
    }

    .character-slots-container {
        gap: 15px;
    }

    .character-slot {
        width: 130px;
        height: 200px;
        border-radius: 12px;
    }

    .slot-create-btn {
        width: 50px;
        height: 50px;
    }

    .slot-lock-icon {
        width: 36px;
        height: 36px;
    }

    .slot-char-preview {
        width: 90px;
        height: 90px;
        margin-top: 10px;
    }

    .slot-char-info {
        padding: 8px 6px;
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
    }

    .slot-spine-canvas {
        width: 200px;
        height: 266px;
    }

    .slot-char-name {
        font-size: 0.9rem;
    }

    .slot-char-race {
        font-size: 0.75rem;
    }

    .enter-game-btn {
        width: 150px;
        height: 46px;
        font-size: 0.8rem;
        letter-spacing: 1px;
    }
}

.character-creation-panel {
    width: min(360px, 82vw);
    aspect-ratio: 3 / 5;
    background: url('../assets/icon/taonhanvat/khungtaonhanvat.webp') no-repeat center;
    background-size: contain;
    border: none;
    padding: 0;
    box-shadow: none;
    position: relative;
    color: #fff;
}

.character-creation-content {
    width: 100%;
    height: 100%;
    position: relative;
}

.character-creation-header h1 {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 1px;
    text-align: center;
}

.character-creation-header p {
    margin-top: 0.75rem;
    color: #d2d2d2;
    font-size: 0.95rem;
}

.character-preview-section {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    width: 78%;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}

.character-arrow {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.character-arrow img {
    width: 32px;
    height: 32px;
}

.character-arrow:hover {
    transform: scale(1.05);
}

.character-preview-card {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-preview-frame {
    width: 50px;
    height: 240px;
    border-radius: 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow: visible;
    perspective: 1000px;
}

#character-preview-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6));
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, filter 0.4s ease;
    will-change: transform, opacity, filter;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

#character-spine-canvas {
    width: 200px;
    height: 240px;
    display: block;
    pointer-events: none;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6));
    opacity: 1;
    transform: translateX(0) scale(1);
    will-change: transform, opacity;
}

/* Transition out classes (sliding/fading away) */
#character-spine-canvas.transition-out-left {
    transform: translateX(-60px) scale(0.85);
    opacity: 0;
    transition: transform 0.15s ease-in, opacity 0.15s ease-in;
}

#character-spine-canvas.transition-out-right {
    transform: translateX(60px) scale(0.85);
    opacity: 0;
    transition: transform 0.15s ease-in, opacity 0.15s ease-in;
}

#character-spine-canvas.transition-out-scale {
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.15s ease-in, opacity 0.15s ease-in;
}

/* Transition in starting positions (instantly offset, transition disabled) */
#character-spine-canvas.transition-in-left {
    transform: translateX(-60px) scale(0.85);
    opacity: 0;
    transition: none !important;
}

#character-spine-canvas.transition-in-right {
    transform: translateX(60px) scale(0.85);
    opacity: 0;
    transition: none !important;
}

#character-spine-canvas.transition-in-scale {
    transform: scale(0.85);
    opacity: 0;
    transition: none !important;
}

/* Transition active styling (sliding into center) */
#character-spine-canvas.transition-active {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease-out !important;
}

/* Enhanced glow effect during animation */
.character-scale-in #character-preview-image {
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
    animation: glowPulse 0.4s ease-out;
}

@keyframes glowPulse {
    0% {
        filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 30px rgba(100, 150, 255, 0.6));
    }

    50% {
        filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 25px rgba(150, 200, 255, 0.8));
    }

    100% {
        filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
    }
}

/* Slide animations */
.character-slide-left {
    animation: slideOutLeft 0.2s ease-out forwards;
}

.character-slide-right {
    animation: slideOutRight 0.2s ease-out forwards;
}

/* Scale animations for frame */
.character-scale-out {
    animation: scaleOut 0.2s ease-out forwards;
}

.character-scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideOutLeft {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(-100px) scale(0.8);
        opacity: 0;
    }
}

@keyframes slideOutRight {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateX(100px) scale(0.8);
        opacity: 0;
    }
}

@keyframes scaleOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0.7) rotateY(-10deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.15) rotateY(5deg);
    }

    100% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
}

/* Enter animations - applied after image change */
.character-slide-left.character-enter {
    animation: slideInLeft 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.character-slide-right.character-enter {
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slideInLeft {
    0% {
        transform: translateX(120px) scale(0.7) rotateY(20deg);
        opacity: 0;
    }

    50% {
        transform: translateX(-15px) scale(1.1) rotateY(-5deg);
    }

    100% {
        transform: translateX(0) scale(1) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes slideInRight {
    0% {
        transform: translateX(-120px) scale(0.7) rotateY(-20deg);
        opacity: 0;
    }

    50% {
        transform: translateX(15px) scale(1.1) rotateY(5deg);
    }

    100% {
        transform: translateX(0) scale(1) rotateY(0deg);
        opacity: 1;
    }
}

.character-name-section {
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translateX(-50%);
    width: 74%;
}

.character-name-row {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
}

#character-name-input {
    width: 100%;
    flex: 1 1 auto;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    background: #c6bba6;
    color: #111;
    font-size: 1rem;
    font-weight: 600;
    transition: border 0.2s ease, background 0.2s ease;
}

#character-name-input:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.5);
    background: #c6bba6;
}

#character-name-input::placeholder {
    color: #555;
    font-weight: 500;
}

.character-error {
    margin-top: 0.5rem;
    min-height: 20px;
    color: #ff7b7b;
    font-size: 0.9rem;
}

.character-create-btn {
    width: auto;
    margin: 0;
    padding: 0;
    background: url('../assets/icon/taonhanvat/creatbutton.webp') center/contain no-repeat;
    border: none;
    width: 78px;
    height: 78px;
    color: transparent;
    font-size: 0;
    cursor: pointer;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.character-create-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.character-create-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    /* Trống để kế thừa hệ thống scale mới */
}

/* Màn hình ngang (landscape): Thu nhỏ character creation */
@media (max-width: 950px) and (orientation: landscape),
(max-height: 500px) and (orientation: landscape) {
    .character-creation-wrapper {
        padding: 0.5rem !important;
    }
}

/* Auth Screen */
.auth-container {
    background: transparent;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: none;
    width: 100%;
    max-width: 400px;
    border: none;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
    animation: logoFloat 3s ease-in-out infinite;
}

.auth-logo img {
    max-width: 300px;
    width: 80%;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    text-align: center;
    color: #cccccc;
    margin-bottom: 1.5rem;
}

.auth-form input {
    width: 100%;
    height: 50px;
    padding: 12px 15px;
    margin-bottom: 1rem;
    border: none;
    font-size: 16px;
    transition: all 0.3s ease;
    background: url('../assets/icon/ui/input.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    color: #ffffff;
    pointer-events: auto;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
    touch-action: manipulation;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    filter: brightness(0.7);
    opacity: 0.85;
}

.auth-form input:focus {
    outline: none;
    background: url('../assets/icon/ui/inputhover.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    filter: brightness(1);
    opacity: 1;
}

.server-selection {
    margin-bottom: 1rem;
}

.server-selection label {
    display: block;
    color: #cccccc;
    font-size: 14px;
    margin-bottom: 0.5rem;
    text-align: left;
}

/* Captcha trong form đăng ký */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
}

.captcha-row canvas {
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    width: 90px;
    height: 30px;
}

.captcha-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.captcha-row input {
    margin-bottom: 0;
    height: 30px;
    min-height: 30px;
    line-height: 30px;
    padding: 0 8px;
    box-sizing: border-box;
    background-size: 100% 100%;
}

.captcha-refresh-btn {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px;
    min-height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #e5e7eb;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.captcha-refresh-btn:hover {
    background: rgba(31, 41, 55, 0.9);
    transform: translateY(-1px);
}

.captcha-refresh-btn:active {
    transform: translateY(0);
}

.server-select {
    width: 100%;
    height: 50px;
    padding: 12px 15px;
    border: none;
    font-size: 16px;
    transition: all 0.3s ease;
    background: url('../assets/icon/ui/input.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    color: #ffffff;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    filter: brightness(0.7);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('../assets/icon/ui/input.webp'), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: center, right 15px center;
    background-size: 100% 100%, 12px 12px;
    padding-right: 40px;
}

.server-select:focus {
    outline: none;
    background: url('../assets/icon/ui/inputhover.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    filter: brightness(1);
    opacity: 1;
    background-image: url('../assets/icon/ui/inputhover.webp'), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: center, right 15px center;
    background-size: 100% 100%, 12px 12px;
}

.server-select option {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 10px;
}

.remember-me {
    margin-bottom: 1rem;
    text-align: left;
}

.remember-me label {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    color: #cccccc;
    font-size: 15px;
    line-height: 1;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    gap: 10px;
}

.remember-me input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    background-image: url('../assets/icon/ui/nocheck.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    border: none;
    transition: all 0.3s ease;
    pointer-events: auto;
    -webkit-user-select: auto;
    -moz-user-select: auto;
    user-select: auto;
    flex-shrink: 0;
    display: block;
}

.remember-me input[type="checkbox"]:checked {
    background-image: url('../assets/icon/ui/check.webp');
}

.remember-me span {
    color: #d4af37;
    font-weight: bold;
    line-height: 1;
    display: block;
}

.auth-form button {
    width: 100%;
    height: 50px;
    padding: 14px;
    background: url('../assets/icon/ui/button.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    color: white;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    letter-spacing: 1px;
}

.auth-form button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

.auth-form button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Override cho nút captcha bên trong auth-form để không bị ăn style nút chính */
.auth-form .captcha-refresh-btn {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    background: url('../assets/icon/ui/button.webp') no-repeat center !important;
    background-size: 100% 100% !important;
    box-shadow: none !important;
}

.auth-form p {
    text-align: center;
    margin-top: 1rem;
    color: #cccccc;
}

.auth-form a {
    color: #d4af37;
    text-decoration: none;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.3s ease;
}

.auth-form a:hover {
    color: #f0c747;
    text-decoration: underline;
}

/* Clear Data Button - Fixed corner icon (Capacitor Android WebView) */
.clear-data-corner {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.clear-data-msg {
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    /* Slide in/out từ phải sang trái */
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-width 0.35s ease, opacity 0.3s ease, padding 0.3s ease;
    padding-left: 0;
    padding-right: 0;
}

.clear-data-msg.visible {
    max-width: 200px;
    opacity: 1;
    padding: 5px 10px;
}

.clear-data-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.55) !important;
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
    transition: background 0.2s ease, transform 0.2s ease, filter 0.2s ease !important;
    text-shadow: none !important;
    letter-spacing: 0 !important;
    font-size: 0 !important;
    color: transparent !important;
}

.clear-data-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0.85);
    pointer-events: none;
}

.clear-data-btn:hover {
    background: rgba(180, 30, 30, 0.7) !important;
    transform: rotate(60deg) scale(1.1) !important;
    filter: brightness(1.2) !important;
    border-color: rgba(255, 100, 100, 0.5) !important;
}

.clear-data-btn:hover img {
    filter: brightness(1.3);
}

.clear-data-btn:active {
    transform: rotate(60deg) scale(0.95) !important;
}

.clear-data-btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}


/* Loading Screen */
/* Loading Screen */
.loading-embers {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(rgba(255, 180, 90, 0.28) 2px, transparent 3px),
        radial-gradient(rgba(255, 130, 60, 0.18) 1.5px, transparent 2.5px);
    background-size: 160px 160px, 200px 200px;
    background-position: 0 0, 80px 60px;
    animation: emberDrift 18s linear infinite;
    mix-blend-mode: screen;
    opacity: 0.65;
    z-index: 2;
    pointer-events: none;
}

.loading-frame {
    position: absolute;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    overflow: hidden;
}

.loading-brand {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    width: min(450px, 80vw);
    height: auto;
}

.loading-anvil {
    position: relative;
    width: 100%;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    isolation: isolate;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-logo-img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 20px rgba(255, 177, 85, 0.25));
    z-index: 2;
    animation: logoFloatX 4s ease-in-out infinite;
}

@keyframes logoFloatX {
    0%, 100% {
        transform: translateY(0) scale(1);
        filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.95)) drop-shadow(0 0 20px rgba(255, 177, 85, 0.25));
    }
    50% {
        transform: translateY(-8px) scale(1.02);
        filter: drop-shadow(0 25px 40px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 30px rgba(255, 177, 85, 0.35));
    }
}


/* Cinematic Bottom Console */
.loading-console {
    width: 100vw;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, 
        rgba(6, 5, 4, 0.96) 0%, 
        rgba(6, 5, 4, 0.85) 40%, 
        rgba(6, 5, 4, 0.45) 75%, 
        rgba(0, 0, 0, 0) 100%);
    padding: 60px 12vw 35px 12vw;
    box-shadow: none;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    z-index: 10;
}

.loading-status-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
}

.loading-status {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: #ffe49c;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(255, 180, 90, 0.4);
    animation: statusPulse 2.5s ease-in-out infinite;
    min-height: 22px;
}

.loading-percentage {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-size: 1.45rem;
    font-weight: 950;
    color: #ffb155;
    text-shadow: 0 0 10px rgba(255, 150, 50, 0.6);
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

.loading-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 180, 90, 0.15);
    box-shadow:
        0 0 8px rgba(0, 0, 0, 0.6),
        inset 0 1px 2px rgba(0, 0, 0, 0.8);
    position: relative;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
            #d35400 0%,
            #f39c12 25%,
            #ffe49c 50%,
            #f39c12 75%,
            #d35400 100%);
    background-size: 200% 100%;
    animation: loadingGradientX 2s linear infinite;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 3px;
    box-shadow:
        0 0 10px rgba(243, 156, 18, 0.7),
        0 0 20px rgba(211, 84, 0, 0.5);
    position: relative;
    z-index: 2;
}

/* Leading edge spark */
.loading-bar-fill::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 
        0 0 10px 2px #ffe49c, 
        0 0 20px 6px #ffb155,
        0 0 30px 10px #ff5e00;
    border-radius: 0 6px 6px 0;
    z-index: 3;
    animation: pulseSparkle 0.8s ease-in-out infinite alternate;
}

@keyframes pulseSparkle {
    0% {
        opacity: 0.85;
        box-shadow: 
            0 0 10px 2px #ffe49c, 
            0 0 16px 5px #ffb155,
            0 0 24px 8px #ff5e00;
    }
    100% {
        opacity: 1;
        box-shadow: 
            0 0 14px 4px #ffe49c, 
            0 0 24px 8px #ffb155,
            0 0 36px 12px #ff5e00;
    }
}

/* Shimmer overlay */
.loading-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.7) 50%,
            transparent 100%);
    transform: translateX(-100%) skewX(-15deg);
    animation: shimmerSlide 2s infinite;
}

@keyframes loadingGradientX {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes shimmerSlide {
    0% {
        transform: translateX(-100%) skewX(-15deg);
    }
    50%, 100% {
        transform: translateX(200%) skewX(-15deg);
    }
}

.loading-info-tips {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
}

.loading-tip-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.4;
}

.loading-tip-label {
    font-weight: 900;
    letter-spacing: 1px;
    font-size: 0.78rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.loading-tip-label.yellow-label {
    background: rgba(255, 85, 85, 0.2);
    color: #ff5555;
    border: 1px solid rgba(255, 85, 85, 0.4);
}

.loading-tip-label.orange-label {
    background: rgba(255, 177, 85, 0.15);
    color: #ffb155;
    border: 1px solid rgba(255, 177, 85, 0.3);
}

.loading-tip-text {
    color: #ffe49c;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.loading-tip-text.yellow-text {
    color: #ffb155;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(0.99);
    }
}

/* Weapon Selection Screen */
.weapon-selection-container {
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 600px;
    text-align: center;
    border: 1px solid #444;
}

.weapon-selection-container h1 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.weapon-selection-container p {
    color: #cccccc;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.weapon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.weapon-option {
    border: 3px solid #444;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #333;
    color: #ffffff;
}

.weapon-option:hover {
    border-color: #888;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(136, 136, 136, 0.3);
    background: #444;
}

.weapon-option.selected {
    border-color: #888;
    background: linear-gradient(135deg, #555 0%, #777 100%);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(136, 136, 136, 0.4);
}

.weapon-option img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.weapon-option h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.weapon-option p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
}

#confirm-weapon-btn {
    height: 50px;
    padding: 14px 30px;
    background: url('../assets/icon/ui/button.webp') no-repeat center;
    background-size: 100% 100%;
    background-color: transparent;
    color: white;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    letter-spacing: 1px;
}

#confirm-weapon-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

#confirm-weapon-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#confirm-weapon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

/* Dead Overlay - Blur game screen instead of full black screen */
.dead-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
}

.dead-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* Blur effect for game screen when dead */
.game-container.player-dead {
    filter: blur(8px) grayscale(0.5) brightness(0.6);
    pointer-events: none;
}

.minimap-container.player-dead {
    filter: blur(4px) grayscale(0.5) brightness(0.6);
    pointer-events: none;
}

.level-bar-container.player-dead,
.exp-bar-container.player-dead,
.bottom-actions.player-dead {
    filter: blur(4px) grayscale(0.5) brightness(0.6);
    pointer-events: none;
}

/* Death content container */
.death-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

/* Death image with pulse animation */
.death-image {
    width: 450px;
    height: 450px;
    object-fit: contain;
    animation: deathImagePulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.5));
}

@keyframes deathImagePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.8);
    }
}

/* Respawn countdown text */
.respawn-countdown {
    font-size: 3rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.8),
        0 0 20px rgba(255, 255, 255, 0.6),
        0 0 30px rgba(255, 0, 0, 0.5);
    letter-spacing: 4px;
    animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Server Selection UI */
#server-select-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: var(--real-100vh, 100vh);
    /* JS-computed actual height for iOS Safari */
    height: 100dvh;
    /* iOS fix: dynamic viewport height */
    z-index: 99999;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    /* iOS safe area - tránh bị che bởi home indicator */
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}

.server-modal-container {
    position: relative;
    background: url('../assets/icon/ui/bangserver.webp') center/100% 100% no-repeat;

    /* Safely calculate dimensions preserving 703:473 aspect ratio (~1.486) */
    --w-vw: 95vw;
    --w-px: 850px;
    --h-vh: 85vh;

    /* Lưu lại width thực tế vào một biến để dùng cho padding */
    --actual-w: min(var(--w-vw), var(--w-px), calc(var(--h-vh) * 1.486));

    width: var(--actual-w);
    height: min(calc(var(--w-vw) / 1.486), calc(var(--w-px) / 1.486), var(--h-vh));

    display: flex;
    flex-direction: column;

    /* Tính padding chuẩn xác dựa trên width của chính nó (không dùng % vì % tính theo cha là 100vw) */
    padding-top: calc(var(--actual-w) * 0.15);
    padding-bottom: calc(var(--actual-w) * 0.05);
    padding-left: calc(var(--actual-w) * 0.06);
    padding-right: calc(var(--actual-w) * 0.06);

    box-sizing: border-box;
}

.server-modal-close {
    position: absolute;
    top: 5%;
    right: 5%;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
    padding: 5px;
    opacity: 0;
    width: 6%;
    height: 9%;
}

.server-modal-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    margin-top: 2%;
    gap: 3%;
}

.server-tabs {
    width: 25%;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
    border-right: 2px solid rgba(200, 160, 80, 0.3);
    overflow-y: auto;
}

.server-tab-btn {
    background: url('../assets/icon/ui/button.webp') center/100% 100% no-repeat;
    color: #ccc;
    border: none;
    padding: 12px 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 2px 4px #000;
    text-align: center;
    transition: all 0.2s;
    width: 100%;
}

.server-tab-btn.active {
    filter: brightness(1.2);
    color: #ffd700;
}

.server-tab-btn:hover {
    color: #fff;
    filter: brightness(1.1);
}

.server-grid-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.server-grid {
    display: grid;
    /* PC Size */
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    align-content: start;
}

/* Ẩn thanh cuộn cho modal */
.server-grid-container::-webkit-scrollbar,
.server-tabs::-webkit-scrollbar {
    display: none;
}

.server-grid-container,
.server-tabs {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.server-card {
    background: rgba(20, 20, 20, 0.8);
    border: 2px solid #5a4b3c;
    border-radius: 8px;
    padding: 10px 5px;
    cursor: pointer;
    text-align: center;
    color: #ccc;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 60px;
}

.server-card:hover {
    border-color: #ffd700;
    background: rgba(50, 40, 10, 0.8);
}

.server-card.selected {
    border-color: #ffd700;
    background: rgba(80, 60, 10, 0.9);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.server-card.offline {
    filter: grayscale(1);
    opacity: 0.6;
    cursor: not-allowed;
}

.server-card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.server-card-name {
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px #000;
}

.server-card-badge {
    background: #e74c3c;
    color: white;
    font-size: 11px;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: bold;
    white-space: nowrap;
}

.server-card-status {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.server-card-status.online {
    color: #2ecc71;
    text-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
}

.server-card-status.offline {
    color: #e74c3c;
}

.server-modal-footer {
    display: flex;
    justify-content: center;
    margin-top: auto;
    padding-bottom: 2px;
}

.server-enter-btn {
    background: url('../assets/icon/ui/button.webp') center/100% 100% no-repeat;
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    transition: all 0.2s;
    min-width: 150px;
}

.server-enter-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
    color: #ffd700;
}

/* --- RESPONSIVE MOBILE & SMALL SCREENS --- */
@media (max-width: 1024px),
(max-height: 600px) {
    .server-grid {
        /* Giảm thẻ grid để hiển thị 3 cột trên điện thoại ngang */
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 8px;
    }

    .server-card {
        padding: 4px 2px;
        min-height: 40px;
        border-radius: 5px;
        border-width: 1px;
    }

    .server-card-name {
        font-size: 11px;
    }

    .server-card-badge {
        font-size: 8px;
        padding: 1px 3px;
    }

    .server-card-status {
        font-size: 9px;
    }

    .server-tab-btn {
        font-size: 12px;
        padding: 8px 5px;
    }

    .server-enter-btn {
        font-size: 14px;
        padding: 6px 25px;
        min-width: 120px;
    }
}

/* Mobile Portrait Layout */
@media (max-width: 500px) and (orientation: portrait) {
    .server-modal-container {
        /* Override aspect ratio to use more vertical space */
        --actual-w: 95vw;
        width: var(--actual-w);
        /* Giảm height để tránh bị khuất bởi browser chrome iPhone */
        height: min(72vh, 72dvh);
        background: url('../assets/icon/ui/bangserver.webp') center/100% 100% no-repeat;

        /* Vì ảnh nền bị kéo dãn, padding tính theo vh để khớp với hình ảnh */
        padding-top: 13vh;
        padding-bottom: max(5vh, env(safe-area-inset-bottom, 5vh));

        /* Padding ngang vẫn tính theo width */
        padding-left: calc(var(--actual-w) * 0.06);
        padding-right: calc(var(--actual-w) * 0.06);
    }

    .server-modal-layout {
        flex-direction: column;
        gap: 8px;
    }

    .server-tabs {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 2px solid rgba(200, 160, 80, 0.3);
        padding-right: 0;
        padding-bottom: 5px;
        overflow-x: auto;
    }

    .server-tab-btn {
        flex: 1;
        padding: 8px;
        font-size: 12px;
        min-width: 90px;
    }

    .server-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 6px;
    }

    .server-modal-footer {
        margin-top: 5px;
    }

    .server-enter-btn {
        padding: 10px 30px;
        font-size: 14px;
        min-width: 120px;
    }
}

/* Race Tabs & Gender Selector UI */
.character-preview-card {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.race-tabs {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    justify-content: center;
    gap: 6px;
    width: 90%;
    margin: 0 !important;
}

.race-tab-btn {
    background: url('../assets/icon/taonhanvat/buttonchontoc.webp') no-repeat center center;
    background-size: 100% 100%;
    border: none;
    color: #fbff00;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Outfit', sans-serif;
    opacity: 0.65;
    filter: brightness(0.85);
    flex: 1;
    text-align: center;
}

.race-tab-btn:hover {
    opacity: 0.85;
    filter: brightness(1);
    color: #ffffff;
}

.race-tab-btn.active {
    opacity: 1;
    filter: brightness(1.2) drop-shadow(0 0 4px rgba(0, 255, 204, 0.4));
    color: #ffffff;
}

.gender-selector {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 90%;
    margin: 0 !important;
}

.gender-btn {
    background: url('../assets/icon/taonhanvat/buttonchontoc.webp') no-repeat center center;
    background-size: 100% 100%;
    border: none;
    color: #000000;
    padding: 4px 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    opacity: 0.65;
    filter: brightness(0.85);
    width: 60px;
    text-align: center;
    font-family: 'Outfit', sans-serif;
}

.gender-btn:hover {
    opacity: 0.85;
    filter: brightness(1);
    color: #ffffff;
}

.gender-btn.active {
    opacity: 1;
    filter: brightness(1.2) drop-shadow(0 0 4px rgba(212, 175, 55, 0.4));
    color: #000000;
}

/* CSS Tùy Chỉnh Vị Trí Màn Tạo Nhân Vật */

.character-creation-panel {
    --panel-tx: 22px;
    --panel-ty: 126px;
    width: 360px !important;
    height: 600px !important;
    aspect-ratio: 3 / 5 !important;
}

.race-tabs {
    position: absolute;
    top: -50px;
    left: -75px;
    display: flex;
    flex-direction: column !important;
    gap: 4px;
    width: 70px;
    transform: scale(1.6) !important;
    transform-origin: top right;
    z-index: 10;
}

.gender-selector {
    position: absolute;
    top: -94px;
    left: 8px;
    transform: scale(2);
    transform-origin: center center;
    z-index: 10;
}

.character-preview-section {
    position: absolute;
    top: -8px;
    left: 43px;
    transform: scale(2);
    transform-origin: center center;
}

.character-name-section {
    position: absolute;
    top: -58px;
    left: 63px;
    transform: scale(1);
    transform-origin: center center;
}

/* Character Stats Panel (Blur, Slide out to the right) */
.character-stats-panel {
    position: absolute;
    top: -15px;
    left: 100%;
    transform: translateX(35px) scale(0.95);
    width: 220px;
    background: rgba(10, 10, 20, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 14px;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    z-index: 5;
    pointer-events: none;
}

.character-stats-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-15px) scale(1);
    pointer-events: auto;
}

.stats-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 4px;
}

.stats-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
    margin: 0 0 8px 0;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.character-stats-panel .stat-item {
    display: block !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.character-stats-panel .stat-item:last-child {
    margin-bottom: 0 !important;
}

.character-stats-panel .stat-bar-container {
    display: none !important;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.9);
}

.stat-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#statBarHp {
    background: linear-gradient(90deg, #ff4d4d, #ff8080);
    box-shadow: 0 0 6px rgba(255, 77, 77, 0.4);
}

#statBarAtk {
    background: linear-gradient(90deg, #ffaa00, #ffc83b);
    box-shadow: 0 0 6px rgba(255, 170, 0, 0.4);
}

#statBarDef {
    background: linear-gradient(90deg, #00b0ff, #80d8ff);
    box-shadow: 0 0 6px rgba(0, 176, 255, 0.4);
}

/* Style cho phần demo kỹ năng */
.skills-demo-section {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 8px;
}

.skills-demo-header {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.skills-demo-list {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.skill-demo-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    overflow: visible;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skill-demo-btn:hover {
    border-color: #f39c12;
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.6);
}

.skill-demo-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.skill-demo-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 20;
}

.skill-demo-btn:hover .skill-demo-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive adjustment for vertical / mobile screens */
@media (max-width: 768px) {
    .character-stats-panel {
        left: 50%;
        top: auto;
        bottom: -220px;
        /* Put it below the panel */
        transform: translateX(-50%) translateY(20px);
        width: min(340px, 90vw);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    }

    .character-stats-panel.active {
        transform: translateX(-50%) translateY(0);
        bottom: -205px;
    }
}