@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:ital,wght@0,500;0,600;0,700;1,700&family=Oswald:wght@500;600;700&family=Rajdhani:wght@500;600;700&family=Teko:wght@400;600;700&display=swap');

:root {
    --neon-cyan: #00f3ff;
    --neon-red: #ff003c;
    --neon-gold: #f2c94c;
    --bg-dark: #030406;
    --panel-bg: rgba(10, 14, 23, 0.82);
    --font-heading: 'Oswald', 'Chakra Petch', sans-serif;
    --font-body: 'Chakra Petch', 'Rajdhani', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    background: var(--bg-dark); 
    background-image: 
        radial-gradient(circle at 50% 0%, #0d1e36 0%, transparent 70%),
        radial-gradient(circle at 85% 90%, rgba(255, 0, 60, 0.06) 0%, transparent 50%),
        linear-gradient(rgba(0, 243, 255, 0.02) 1px, transparent 1px), 
        linear-gradient(90deg, rgba(0, 243, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
    color: #e2e8f0; 
    font-family: var(--font-body); 
    padding: 2vh 10px; 
    user-select: none; 
    min-height: 100vh;
    overflow-x: hidden;
}

#game-container { 
    max-width: 1040px; 
    margin: 0 auto; 
    background: var(--panel-bg); 
    backdrop-filter: blur(14px); 
    -webkit-backdrop-filter: blur(14px);
    padding: 25px; 
    border: 1px solid rgba(0, 243, 255, 0.18);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), inset 0 0 25px rgba(0, 243, 255, 0.04); 
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 25px), calc(100% - 25px) 100%, 0 100%);
    position: relative;
}

/* Giải phóng 100% GPU Compositor & bật Direct-Flip Swapchain cho battleCanvas khi đang chiến đấu */
#game-container.in-battle {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(10, 14, 23, 0.96);
    clip-path: none;
    border-radius: 10px;
}

#game-container::before {
    content: "";
    position: absolute;
    top: 0; left: 15%; right: 15%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-red), transparent);
    box-shadow: 0 0 12px var(--neon-cyan);
}

.cyber-header { text-align: center; margin-bottom: 25px; position: relative; }
.glitch-title { 
    font-family: 'Teko', 'Oswald', sans-serif; 
    font-size: 52px; 
    color: #fff; 
    letter-spacing: 5px; 
    text-transform: uppercase;
    text-shadow: 3px 0px 0px rgba(255, 0, 60, 0.8), -3px 0px 0px rgba(0, 243, 255, 0.8); 
    line-height: 1;
    animation: titlePulse 4s infinite ease-in-out;
}
@keyframes titlePulse {
    0%, 100% { text-shadow: 3px 0px 0px rgba(255, 0, 60, 0.8), -3px 0px 0px rgba(0, 243, 255, 0.8); }
    50% { text-shadow: 4px 0px 8px rgba(255, 0, 60, 0.9), -4px 0px 8px rgba(0, 243, 255, 0.9); }
}

/* ================== LAYOUT CHÍNH ================== */
.main-selection-layout { 
    display: flex; 
    gap: 20px; 
    margin-bottom: 28px; 
    height: 500px; 
}

/* ================== CỘT TRÁI (BUỒNG HOLOGRAM NHÂN VẬT & THÔNG SỐ) ================== */
.left-side-column { flex: 0 0 285px; display: flex; }
.preview-box-small { 
    flex: 1; 
    background: radial-gradient(circle at 50% 82%, rgba(0, 243, 255, 0.14) 0%, rgba(16, 24, 39, 0.9) 45%, rgba(6, 9, 14, 0.98) 100%); 
    border: 1px solid rgba(0, 243, 255, 0.18); 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-end; 
    align-items: center; 
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.preview-box-small::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0, 243, 255, 0.06) 50%, transparent 60%);
    background-size: 100% 200%;
    animation: holoScan 3.5s linear infinite;
    pointer-events: none;
    z-index: 3;
}
@keyframes holoScan {
    0% { background-position: 0% -100%; }
    100% { background-position: 0% 200%; }
}

.pedestal-glow { 
    position: absolute; 
    bottom: 22px; 
    width: 155px; 
    height: 6px; 
    background: var(--neon-cyan); 
    box-shadow: 0 0 20px 6px rgba(0, 243, 255, 0.55), 0 0 40px 12px rgba(0, 243, 255, 0.25); 
    border-radius: 50%; 
    z-index: 1; 
    animation: pedestalPulse 2s infinite alternate ease-in-out;
}
@keyframes pedestalPulse {
    0% { transform: scaleX(0.92); opacity: 0.75; }
    100% { transform: scaleX(1.06); opacity: 1; }
}

#preview-canvas { 
    z-index: 2; 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: contain; 
    filter: drop-shadow(0 12px 16px rgba(0,0,0,0.85)); 
}

/* Bảng thông số nổi */
.floating-stats-container {
    position: absolute; 
    top: 12px; 
    left: 0; 
    width: 100%; 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 6px; 
    padding: 0 10px; 
    z-index: 10;
}
.floating-stats-container span {
    background: rgba(8, 12, 20, 0.85); 
    border: 1px solid rgba(0, 243, 255, 0.15); 
    backdrop-filter: blur(6px);
    padding: 3px 11px; 
    border-radius: 20px; 
    font-family: var(--font-heading); 
    font-size: 16px; 
    color: #cbd5e1;
    display: flex; 
    align-items: center; 
    gap: 5px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.6); 
    transition: all 0.2s ease;
}
.floating-stats-container span:hover { 
    background: rgba(20, 32, 50, 0.95); 
    border-color: var(--neon-cyan); 
    transform: translateY(-2px);
}
.floating-stats-container span strong { 
    color: #fff; 
    font-size: 18px; 
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.7); 
}

/* Tên tướng ở khung Preview: Hiển thị đủ 100%, không bao giờ bị cắt chữ */
.floating-stats-container span:first-child {
    width: 100%; 
    background: transparent; 
    border: none; 
    box-shadow: none; 
    backdrop-filter: none;
    color: var(--neon-cyan); 
    font-family: var(--font-heading);
    font-size: clamp(18px, 2vw, 25px); 
    font-weight: 700; 
    letter-spacing: 0.8px;
    line-height: 1.2;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 0 15px rgba(0, 243, 255, 0.65), 0 2px 4px rgba(0,0,0,0.9);
    justify-content: center; 
    margin-bottom: 2px; 
    padding: 2px 6px;
    white-space: normal;
    overflow: visible;
}

/* ================== CỘT PHẢI (LƯỚI NHÂN VẬT & Ô TÌM KIẾM) ================== */
.right-side-column { 
    flex: 1; 
    background: rgba(11, 15, 24, 0.65); 
    border: 1px solid rgba(255, 255, 255, 0.07); 
    display: flex; 
    flex-direction: column; 
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%); 
}
.roster-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: 10px;
    color: #94a3b8; 
    font-weight: 700; 
    letter-spacing: 2px; 
    font-size: 14px; 
    text-transform: uppercase; 
    padding: 12px 16px; 
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid rgba(0, 243, 255, 0.1); 
}

#char-search {
    background: rgba(6, 9, 15, 0.8); 
    border: 1px solid rgba(0, 243, 255, 0.35); 
    border-radius: 4px;
    color: #fff; 
    padding: 6px 12px; 
    font-family: var(--font-body); 
    font-size: 14px; 
    font-weight: 600;
    width: 145px; 
    outline: none; 
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1); 
    text-transform: uppercase;
}
#char-search::placeholder { color: #64748b; }
#char-search:focus {
    width: 200px; 
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.35), inset 0 0 8px rgba(0, 243, 255, 0.15); 
    background: rgba(15, 23, 42, 0.95);
}

.roster-grid { 
    flex: 1; 
    padding: 15px; 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); 
    gap: 12px; 
    overflow-y: auto; 
    align-content: start; 
}
.roster-grid::-webkit-scrollbar { width: 5px; }
.roster-grid::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
.roster-grid::-webkit-scrollbar-thumb { background: rgba(0, 243, 255, 0.5); border-radius: 4px; }
.roster-grid::-webkit-scrollbar-thumb:hover { background: var(--neon-cyan); }

.char-card { 
    background: rgba(20, 27, 42, 0.55); 
    border: 1px solid rgba(255, 255, 255, 0.06); 
    border-radius: 6px; 
    padding: 6px; 
    cursor: pointer; 
    text-align: center; 
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); 
    opacity: 0.78; 
    position: relative;
}
.char-card:hover { 
    opacity: 1; 
    transform: translateY(-4px); 
    background: rgba(30, 41, 59, 0.9); 
    border-color: rgba(0, 243, 255, 0.45); 
    box-shadow: 0 6px 15px rgba(0, 243, 255, 0.15);
}
.char-card.selected { 
    opacity: 1; 
    transform: translateY(-4px) scale(1.03); 
    border-color: var(--neon-red); 
    background: linear-gradient(180deg, rgba(255, 0, 60, 0.18) 0%, rgba(20, 26, 39, 0.9) 100%); 
    box-shadow: 0 6px 20px rgba(255, 0, 60, 0.3), inset 0 0 12px rgba(255, 0, 60, 0.2); 
}

.char-avatar img { 
    width: 100%; 
    aspect-ratio: 1/1; 
    object-fit: cover; 
    border-radius: 4px; 
    transition: 0.3s ease; 
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.char-card.selected .char-avatar img { 
    border-color: var(--neon-red);
    box-shadow: 0 0 12px rgba(255, 0, 60, 0.5); 
}
.char-name { 
    margin-top: 6px; 
    font-family: var(--font-heading); 
    font-weight: 600; 
    font-size: 13px; 
    letter-spacing: 0.3px; 
    color: #94a3b8; 
    line-height: 1.15; 
    text-transform: uppercase; 
    transition: 0.3s; 
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
}
.char-card:hover .char-name { color: #fff; }
.char-card.selected .char-name { 
    color: #fff; 
    text-shadow: 0 0 8px rgba(255, 0, 60, 0.8); 
}

/* ================== MENU DƯỚI CÙNG (CHUẨN 1 VS 1 CYBER ARENA) ================== */
.row-bottom-controls { 
    display: flex; 
    gap: 20px; 
    height: 62px; 
    align-items: stretch;
}

.mode-select-wrapper.arena-1v1-card { 
    flex: 0 0 285px; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 0 16px; 
    background: linear-gradient(135deg, rgba(10, 17, 30, 0.94) 0%, rgba(16, 26, 44, 0.88) 100%); 
    border: 1px solid rgba(0, 243, 255, 0.28); 
    clip-path: polygon(0 0, 100% 0, 100% 100%, 16px 100%, 0 calc(100% - 16px)); 
    box-shadow: inset 0 0 20px rgba(0, 243, 255, 0.06), 0 8px 20px rgba(0, 0, 0, 0.45);
    position: relative;
    overflow: hidden;
}
.mode-select-wrapper.arena-1v1-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--neon-cyan);
    box-shadow: 0 0 12px var(--neon-cyan);
}
.mode-emblem {
    background: rgba(0, 243, 255, 0.14);
    border: 1px solid rgba(0, 243, 255, 0.45);
    color: var(--neon-cyan);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 6px 11px;
    border-radius: 6px;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.55);
}
.mode-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.mode-label {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    line-height: 1.1;
}
.mode-value {
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 3px;
    white-space: nowrap;
}

.btn-ultimate-start { 
    flex: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: linear-gradient(95deg, #c9002b 0%, #ff0044 48%, #ff2e63 100%); 
    color: white; 
    border: 1px solid rgba(255, 110, 145, 0.45); 
    cursor: pointer; 
    font-family: var(--font-heading); 
    font-size: 26px; 
    font-weight: 700; 
    letter-spacing: 2.5px; 
    text-transform: uppercase;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); 
    clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
    box-shadow: 0 8px 25px rgba(255, 0, 60, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    position: relative;
    overflow: hidden;
}
.btn-ultimate-start::after {
    content: "";
    position: absolute;
    top: 0; left: -120%; width: 65%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
    transform: skewX(-25deg);
    animation: btnShineSweep 3.4s infinite ease-in-out;
    pointer-events: none;
}
@keyframes btnShineSweep {
    0% { left: -120%; }
    45%, 100% { left: 160%; }
}
.btn-start-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}
.btn-start-text {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.btn-start-badge {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    background: rgba(0, 0, 0, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffeb3b;
    padding: 4px 10px;
    border-radius: 999px;
}
.btn-ultimate-start:hover { 
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(255, 0, 60, 0.65), 0 0 18px rgba(0, 243, 255, 0.25); 
    filter: brightness(1.08);
}
.btn-ultimate-start:active { transform: scale(0.98); }

.btn-studio {
    flex: 1; 
    background: linear-gradient(90deg, #00c6ff 0%, #0072ff 50%, #ff0050 100%); 
    color: white; 
    border: none; 
    cursor: pointer;
    font-family: var(--font-heading); 
    font-size: 21px; 
    font-weight: 700; 
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: all 0.25s ease; 
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
}
.btn-studio:hover { 
    transform: translateY(-2px);
    box-shadow: 0 0 22px rgba(0, 243, 255, 0.5); 
    filter: brightness(1.1);
}
.btn-studio:active { transform: scale(0.97); }

/* ================== IN-GAME HUD (HIỂN THỊ ĐỦ 100% TÊN DÀI, KHÔNG BỊ CHE) ================== */
.hud-container { 
    display: flex !important; 
    justify-content: space-between; 
    align-items: flex-end; 
    padding: 14px 20px; 
    margin-bottom: 18px; 
    position: relative; 
    z-index: 10; 
    background: linear-gradient(90deg, rgba(8, 12, 20, 0.95), rgba(15, 23, 42, 0.8), rgba(8, 12, 20, 0.95)); 
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 2px solid rgba(0, 243, 255, 0.2); 
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 15px 100%, 0 calc(100% - 15px)); 
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    contain: layout style paint;
}

.player-hud { 
    width: 45%; 
    min-width: 0;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}
.right-hud { text-align: right; }

/* Đảm bảo cả .fighter-name và #name-display-red/blue đều căn hàng ngang chuẩn xác, không bị cắt dấu */
.fighter-name,
#name-display-red,
#name-display-blue { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    min-height: 40px;
    font-family: var(--font-heading); 
    font-size: clamp(16px, 1.9vw, 22px); 
    font-weight: 700; 
    color: #fff; 
    letter-spacing: 0.6px; 
    line-height: 1.25;
    text-transform: uppercase;
    overflow: visible;
}
.fighter-name { margin-bottom: 8px; width: 100%; }
.right-hud .fighter-name,
.right-hud #name-display-blue { justify-content: flex-end; }

.fighter-name span {
    display: inline-block;
    white-space: nowrap;
    overflow: visible;
    line-height: 1.25;
    padding: 2px 0;
    transform-origin: left center;
}
.right-hud .fighter-name span,
.right-hud #name-display-blue span {
    transform-origin: right center;
}

.hud-avatar-img { 
    width: 38px; 
    height: 38px; 
    flex-shrink: 0; 
    border-radius: 6px; 
    object-fit: cover; 
    border: 2px solid rgba(255,255,255,0.2); 
}
.player-hud #name-display-red .hud-avatar-img,
.player-hud .hud-avatar-img { 
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.45); 
    border-color: var(--neon-cyan); 
}
.right-hud #name-display-blue .hud-avatar-img,
.right-hud .hud-avatar-img { 
    box-shadow: 0 0 12px rgba(255, 0, 60, 0.45); 
    border-color: var(--neon-red); 
}

.bar-bg { 
    width: 100%; 
    height: 18px; 
    background: rgba(0, 0, 0, 0.72); 
    margin-bottom: 6px; 
    position: relative; 
    border: 1px solid rgba(255, 255, 255, 0.16); 
    transform: skewX(-15deg) translateZ(0); 
    overflow: hidden;
    contain: layout style paint;
}
.mini-bar { height: 7px; }
.bar-fill, .bar-trail {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: left center;
    transform: scaleX(1) translateZ(0);
    will-change: transform;
}
.right-hud .bar-fill, .right-hud .bar-trail {
    left: auto;
    right: 0;
    transform-origin: right center;
}
.bar-trail { background: #ffffff; opacity: 0.85; transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1); }
.bar-fill { transition: transform 0.08s linear; }
.hp-fill { 
    background: linear-gradient(90deg, #0083b0, #00b4db, #00f3ff); 
}
.right-hud .hp-fill { 
    background: linear-gradient(-90deg, #93291e, #ed213a, #ff003c); 
}
.stamina-fill { background: linear-gradient(90deg, #f2994a, #f2c94c); transform: scaleX(0) translateZ(0); }
#stun-red, #stun-blue, .stun-fill { 
    background: linear-gradient(90deg, #ec4899, #a855f7, #fbbf24); 
    transform: scaleX(0) translateZ(0);
}

.vs-badge { 
    background: transparent; 
    color: #fff; 
    font-family: 'Teko', 'Oswald', sans-serif; 
    font-size: 36px; 
    font-weight: 700; 
    font-style: italic;
    flex-shrink: 0;
    padding: 0 6px 4px 6px;
    text-shadow: 2px 2px 0px var(--neon-red), -2px -2px 0px var(--neon-cyan), 0 0 15px rgba(255,255,255,0.6); 
}

/* Canvas Game & REC Indicator */
.canvas-wrapper { 
    overflow: hidden; 
    border: 1px solid rgba(0, 243, 255, 0.2); 
    background: #05070a; 
    border-radius: 6px; 
    position: relative; 
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
    contain: layout style paint;
}
#battleCanvas { display: block; width: 100%; height: auto; transform: translateZ(0); }

.rec-blinker { 
    position: absolute; 
    top: 14px; 
    right: 14px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    color: #fff; 
    font-family: var(--font-body); 
    font-size: 14px; 
    font-weight: 700; 
    letter-spacing: 2px; 
    background: rgba(15, 23, 42, 0.94); 
    padding: 5px 14px; 
    border-radius: 20px; 
    border: 1px solid rgba(255, 0, 60, 0.55); 
    box-shadow: 0 0 15px rgba(255, 0, 60, 0.25);
    pointer-events: none;
    z-index: 20; 
}
.rec-dot { 
    width: 10px; 
    height: 10px; 
    background: var(--neon-red); 
    border-radius: 50%; 
    box-shadow: 0 0 10px var(--neon-red); 
    will-change: opacity;
    animation: recBlink 1s infinite; 
}
@keyframes recBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Nút In-game */
.control-btns { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 20px; gap: 14px; }
.game-btn, .skill-btn { 
    padding: 7px 26px; 
    font-family: var(--font-heading); 
    font-size: 20px; 
    font-weight: 600; 
    letter-spacing: 1px;
    cursor: pointer; 
    color: #e2e8f0; 
    background: rgba(20, 28, 44, 0.85); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    transition: all 0.25s ease; 
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); 
}
.game-btn:hover, .skill-btn:hover { 
    color: #fff; 
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.95); 
    border-color: rgba(0, 243, 255, 0.4); 
}
.btn-rematch {
    color: #00f3ff;
    border-color: rgba(0, 243, 255, 0.4);
    background: rgba(0, 243, 255, 0.08);
}
.btn-rematch:hover {
    color: #fff;
    background: rgba(0, 243, 255, 0.25);
    border-color: #00f3ff;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
}
.btn-change-fighter {
    color: #f1c40f;
    border-color: rgba(241, 196, 15, 0.4);
    background: rgba(241, 196, 15, 0.08);
}
.btn-change-fighter:hover {
    color: #fff;
    background: rgba(241, 196, 15, 0.25);
    border-color: #f1c40f;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
}
.btn-download-video {
    color: #2ecc71;
    border-color: rgba(46, 204, 113, 0.4);
    background: rgba(46, 204, 113, 0.08);
}
.btn-download-video:hover {
    color: #fff;
    background: rgba(46, 204, 113, 0.25);
    border-color: #2ecc71;
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
}
.block-btn { color: var(--neon-cyan); border-color: rgba(0, 243, 255, 0.2); } 
.block-btn:hover { background: rgba(0, 243, 255, 0.15); box-shadow: 0 0 20px rgba(0, 243, 255, 0.25); }
.dodge-btn { color: var(--neon-gold); border-color: rgba(242, 201, 76, 0.2); } 
.dodge-btn:hover { background: rgba(242, 201, 76, 0.15); box-shadow: 0 0 20px rgba(242, 201, 76, 0.25); }
.btn-ult {
    color: #ff0055;
    border-color: rgba(255, 0, 85, 0.4);
    background: rgba(255, 0, 85, 0.08);
    position: relative;
    overflow: hidden;
    font-weight: 800;
}
.btn-ult:hover {
    background: rgba(255, 0, 85, 0.25);
    border-color: #ff0055;
    box-shadow: 0 0 25px rgba(255, 0, 85, 0.5);
    color: #fff;
}
.btn-ult.ready, .btn-ult.ult-glowing {
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 0, 85, 0.85), rgba(255, 120, 0, 0.85));
    border-color: #ffeb3b;
    box-shadow: 0 0 20px #ff0055, 0 0 35px rgba(255, 235, 59, 0.6);
    animation: ultGlowPulse 1.2s infinite alternate ease-in-out;
    transform: scale(1.05);
}
@keyframes ultGlowPulse {
    0% {
        box-shadow: 0 0 15px #ff0055, 0 0 25px rgba(255, 120, 0, 0.5);
        border-color: #ff7800;
    }
    100% {
        box-shadow: 0 0 25px #ff0055, 0 0 45px rgba(255, 235, 59, 0.9), inset 0 0 15px rgba(255, 255, 255, 0.6);
        border-color: #ffff00;
        transform: scale(1.08);
    }
}

/* ================== MOBILE CHUẨN ĐỐI KHÁNG ================== */
@media (max-width: 820px) {
    #game-container { padding: 15px; }
    .glitch-title { font-size: 38px; }
    .main-selection-layout { flex-direction: column; height: auto; }
    .left-side-column { flex: auto; }
    .preview-box-small { height: 340px; } 
    .roster-grid { max-height: 290px; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; }
    
    .row-bottom-controls { flex-direction: column; height: auto; gap: 10px; }
    .mode-select-wrapper.arena-1v1-card, .btn-ultimate-start { flex: auto; height: 52px; font-size: 20px; }
    
    #char-search { width: 110px; font-size: 12px; padding: 5px 8px; }
    #char-search:focus { width: 145px; }

    .hud-container { padding: 10px 10px; gap: 4px; clip-path: none; border-radius: 8px; }
    .player-hud { width: 45%; min-width: 0; }
    .fighter-name, #name-display-red, #name-display-blue { font-size: 14px; min-height: 30px; gap: 6px; margin-bottom: 4px; }
    .hud-avatar-img { width: 28px; height: 28px; }
    .bar-bg { height: 12px; transform: skewX(-10deg) translateZ(0); }
    .mini-bar { height: 5px; }
    .vs-badge { font-size: 20px; display: block; padding: 0 2px 2px 2px; }
}

/* ================== MÀN HÌNH CHỜ TẢI TÀI NGUYÊN (LOADING SCREEN) ================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #0a0f1d 0%, #030712 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}
.loading-card {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 20px;
    padding: 36px 30px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.25), 0 25px 50px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}
.loading-emblem {
    font-size: 42px;
    margin-bottom: 10px;
    animation: emblemPulse 1.5s infinite alternate ease-in-out;
}
@keyframes emblemPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(0,243,255,0.4)); }
    100% { transform: scale(1.15); filter: drop-shadow(0 0 25px rgba(0,243,255,0.9)); }
}
.loading-title {
    margin: 0;
    font-family: var(--font-heading, 'Arial Black', sans-serif);
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #00f3ff;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.6);
    text-transform: uppercase;
}
.loading-subtitle {
    margin: 8px 0 22px 0;
    font-size: 13.5px;
    color: #94a3b8;
    line-height: 1.5;
}
.loading-bar-track {
    width: 100%;
    height: 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00f3ff, #0984e3, #ff0055);
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.8);
    animation: loadingBarShimmer 2s infinite linear;
}
@keyframes loadingBarShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.loading-status-text {
    font-size: 13px;
    font-weight: 700;
    color: #38bdf8;
    letter-spacing: 0.5px;
}

/* ================== THANH HƯỚNG DẪN PHÍM BẤM DESKTOP ================== */
.desktop-keybindings-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px auto 0 auto;
    padding: 7px 18px;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: 20px;
    color: #cbd5e1;
    font-family: var(--font-body, 'Segoe UI', Arial, sans-serif);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    max-width: 660px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 100;
}
.desktop-keybindings-bar .key-badge {
    color: #00f3ff;
    font-weight: 800;
    background: rgba(0, 243, 255, 0.12);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(0, 243, 255, 0.3);
}
.desktop-keybindings-bar .key-sep {
    color: #475569;
    margin: 0 4px;
}
@media (max-width: 820px), (pointer: coarse) {
    .desktop-keybindings-bar {
        display: none !important;
    }
}

/* ================== HỘP THOẠI HỒI KẾT TRẬN ĐẤU (VICTORY MODAL) ================== */
.victory-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.88);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.victory-modal-overlay.modal-active {
    opacity: 1;
    pointer-events: auto;
}
.victory-modal-card {
    background: linear-gradient(145deg, #0d1527, #1e293b);
    border: 2px solid rgba(0, 243, 255, 0.6);
    border-radius: 20px;
    width: 90%;
    max-width: 460px;
    padding: 28px 24px;
    text-align: center;
    box-shadow: 0 0 45px rgba(0, 243, 255, 0.3), 0 20px 40px rgba(0, 0, 0, 0.8);
    position: relative;
    animation: victoryModalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes victoryModalPop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.victory-trophy {
    font-size: 38px;
    margin-bottom: 6px;
    animation: trophyFloat 2s infinite ease-in-out;
}
@keyframes trophyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.victory-title {
    margin: 0;
    font-family: var(--font-heading, 'Arial Black', sans-serif);
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #00f3ff;
    text-shadow: 0 0 25px rgba(0, 243, 255, 0.8);
    text-transform: uppercase;
}
.victory-subtitle {
    margin: 6px 0 0 0;
    color: #94a3b8;
    font-size: 13.5px;
}
.victory-winner-box {
    margin: 16px 0 22px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.victory-avatar-wrapper {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid #00f3ff;
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.5);
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.victory-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.victory-winner-name {
    font-family: var(--font-heading, 'Arial Black', sans-serif);
    font-size: 22px;
    font-weight: 900;
    color: #f1c40f;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.6);
}
.victory-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.victory-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-heading, 'Arial Black', sans-serif);
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.victory-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.btn-rematch {
    background: linear-gradient(135deg, #00f3ff, #0984e3);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
}
.btn-rematch:hover {
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.7);
}
.btn-change-fighter {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-change-fighter:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(0, 243, 255, 0.5);
    color: #fff;
}
.btn-download-video {
    background: linear-gradient(135deg, #ff0055, #ff7eb3);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
}
.btn-download-video:hover {
    box-shadow: 0 0 30px rgba(255, 0, 85, 0.7);
}
