/* public/banca/css/style.css */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: #030712;
    color: #F3F4F6;
    font-family: 'Montserrat', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    max-width: 100dvw;
    max-height: 100vh;
    max-height: 100dvh;
    aspect-ratio: 16 / 9;
    background: #04101E url('../assets/images/game_bg_2_hd.jpg') no-repeat center center / cover;
    overflow: hidden;
    touch-action: none;
}


#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    touch-action: none;
}

#game-container.dragon-bonus-focus #game-header,
#game-container.dragon-bonus-focus .seat-panel,
#game-container.dragon-bonus-focus #player-controls,
#game-container.dragon-bonus-focus .special-weapon-dock,
#game-container.dragon-bonus-focus #toast-banner {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, visibility 0.12s ease;
}

#game-container.dragon-bonus-focus .boss-alert,
#game-container.dragon-bonus-focus .big-win-banner {
    opacity: 0;
    pointer-events: none;
}


/* ─── DRAGON WHEEL MINIGAME MODAL ─── */
#dragon-wheel-modal {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.dragon-modal-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.dragon-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 8, 20, 0.94);
}

.dragon-modal-content {
    position: relative;
    z-index: 2;
    width: 540px;
    background: radial-gradient(circle at top, #1e1b4b 0%, #0f172a 100%);
    border: 3px solid #f59e0b;
    border-radius: 28px;
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.45), inset 0 0 30px rgba(245, 158, 11, 0.2);
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.dragon-modal-header {
    text-align: center;
    margin-bottom: 12px;
}

.dragon-modal-sub {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #fde047;
    text-transform: uppercase;
}

.dragon-modal-title {
    font-size: 26px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 15px #ea580c, 0 0 30px #f59e0b;
    letter-spacing: 1px;
}

.dragon-wheel-container {
    position: relative;
    width: 360px;
    height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0 18px;
}

.dragon-wheel-glow {
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, transparent 70%);
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 1; }
}

#dragon-wheel-canvas {
    width: 360px;
    height: 360px;
    border-radius: 50%;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);
}

.dragon-wheel-pointer {
    position: absolute;
    top: -14px;
    font-size: 32px;
    color: #ef4444;
    text-shadow: 0 0 12px #f87171, 0 4px 6px rgba(0,0,0,0.8);
    z-index: 10;
    pointer-events: none;
    transform: translateY(0);
    animation: bouncePointer 0.8s infinite alternate ease-in-out;
}

@keyframes bouncePointer {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

.dragon-wheel-center-orb {
    position: absolute;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: radial-gradient(circle, #f59e0b 0%, #b45309 80%, #451a03 100%);
    border: 3px solid #fef08a;
    box-shadow: 0 0 20px #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

#dragon-wheel-round-badge {
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    letter-spacing: 0.5px;
}

.dragon-modal-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dragon-reward-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.7);
    padding: 8px 18px;
    border-radius: 14px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 14px;
}

.info-label, .info-mult-label {
    color: #94a3b8;
    font-weight: 600;
}

.info-val {
    color: #38bdf8;
    font-weight: 800;
}

.info-mult-val {
    color: #fde047;
    font-weight: 900;
    font-size: 17px;
}

.dragon-spin-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1.5px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.5);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.dragon-spin-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.15);
}

.dragon-spin-btn:active {
    transform: translateY(1px);
}

.dragon-spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

/* VICTORY OVERLAY */
#dragon-victory-banner {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 50;
    animation: victoryIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.victory-hidden {
    display: none !important;
}

@keyframes victoryIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.vic-sparkles {
    font-size: 28px;
}

.vic-title {
    font-size: 28px;
    font-weight: 900;
    color: #fde047;
    text-shadow: 0 0 20px #ea580c;
    letter-spacing: 1px;
}

.vic-coins {
    font-size: 34px;
    font-weight: 900;
    color: #38bdf8;
    text-shadow: 0 0 25px rgba(56, 189, 248, 0.6);
}

.dragon-collect-btn {
    margin-top: 10px;
    padding: 12px 36px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
    transition: transform 0.15s ease;
}

.dragon-collect-btn:hover {
    transform: scale(1.05);
}

/* ─── Top Header ─── */
#game-header {
    position: absolute;
    top: 16px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.logo-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(0, 206, 209, 0.4);
    padding: 8px 16px;
    border-radius: 9999px;
    max-width: min(620px, calc(100vw - 150px));
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background-color: #10B981;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

.logo-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0;
    color: #38BDF8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-info {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 215, 0, 0.4);
    padding: 8px 20px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    color: #FCD34D;
}

.header-tools {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.icon-btn {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #FFF;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    border-color: #38BDF8;
    transform: scale(1.1);
}

/* ─── 4 Góc Vị Trí Ghế Ngồi ─── */
.seat-panel {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 15, 30, 0.94);
    border: 1px solid rgba(0, 206, 209, 0.3);
    padding: 8px 14px;
    border-radius: 16px;
    z-index: 10;
    pointer-events: none;
    transition: all 0.3s ease;
}

.seat-panel.my-seat {
    border-color: #F59E0B;
}

.player-avatar-wrap img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #38BDF8;
    object-fit: cover;
}

.player-name {
    font-size: 13px;
    font-weight: 700;
    color: #E2E8F0;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-balance-tag {
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: #FBBF24;
    display: flex;
    align-items: center;
    gap: 4px;
}

.text-right {
    text-align: right;
}

/* Định vị 4 góc */
.seat-bottom-left { bottom: 16px; left: 16px; }
.seat-bottom-right { bottom: 16px; right: 16px; }
.seat-top-left { top: 70px; left: 16px; }
.seat-top-right { top: 70px; right: 16px; }

/* ─── Thanh Điều Khiển Trung Tâm (Player Controls) ─── */
#player-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 15;
    pointer-events: auto;
}

.cannon-selector {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.92);
    border: 2px solid #00CED1;
    border-radius: 18px;
    padding: 6px 10px;
    box-shadow: 0 0 25px rgba(0, 206, 209, 0.35);
    backdrop-filter: blur(10px);
}

.ctrl-btn {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0284C7, #0369A1);
    border: none;
    color: #FFF;
    font-size: 22px;
    font-weight: 900;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ctrl-btn:hover {
    background: linear-gradient(135deg, #38BDF8, #0284C7);
    transform: scale(1.08);
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.cannon-display {
    padding: 0 16px;
    text-align: center;
    min-width: 150px;
    max-width: 240px;
}

.c-title {
    font-size: 13px;
    font-weight: 700;
    color: #38BDF8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.c-cost {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #FCD34D;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.special-weapon-dock {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(96px, calc(env(safe-area-inset-bottom) + 84px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 24;
    pointer-events: auto;
}

.special-weapon-btn {
    position: relative;
    width: 58px;
    height: 58px;
    border: 2px solid rgba(248, 250, 252, 0.38);
    border-radius: 50%;
    color: #FFFFFF;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.38), inset 0 0 18px rgba(255, 255, 255, 0.12);
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    will-change: transform;
}

.special-weapon-btn:hover {
    transform: scale(1.08);
    border-color: #FFFFFF;
}

.special-weapon-btn:active {
    transform: scale(0.94);
}

.special-weapon-btn.active {
    border-color: #FDE047;
    box-shadow: 0 0 28px rgba(250, 204, 21, 0.62), 0 0 18px rgba(236, 72, 153, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.18);
}

.purple-shot {
    background: radial-gradient(circle at 35% 28%, #F5D0FE 0%, #A855F7 34%, #4C1D95 72%, #111827 100%);
}

.laser-shot {
    background: radial-gradient(circle at 35% 28%, #FCE7F3 0%, #EC4899 30%, #7E22CE 70%, #111827 100%);
}

.special-icon {
    display: block;
    font-size: 24px;
    line-height: 42px;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.9);
}

.special-cost {
    position: absolute;
    right: -5px;
    bottom: -5px;
    min-width: 28px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(250, 204, 21, 0.75);
    color: #FDE047;
    font-size: 10px;
    line-height: 17px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #CBD5E1;
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.toggle-btn:hover {
    border-color: #38BDF8;
    color: #FFF;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #10B981, #059669);
    border-color: #34D399;
    color: #FFF;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* ─── Toast Notifications ─── */
#toast-banner {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #38BDF8;
    padding: 10px 24px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 14px;
    color: #FFF;
    z-index: 100;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast-hidden {
    opacity: 0;
    transform: translate(-50%, -20px) !important;
}

/* ─── Player Controls Bar (Center Bottom) ─── */
#player-controls {
    position: absolute;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 100;
    pointer-events: auto;
    max-width: min(920px, calc(100vw - 20px));
    flex-wrap: wrap;
}

.cannon-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(8, 20, 36, 0.94);
    border: 1.5px solid rgba(14, 165, 233, 0.4);
    border-radius: 30px;
    padding: 4px 12px;
}

.ctrl-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border: 1.5px solid #38bdf8;
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.1s ease;
    user-select: none;
}

.ctrl-btn:active {
    transform: scale(0.92);
    filter: brightness(1.2);
}

.cannon-display {
    text-align: center;
    min-width: 130px;
    padding: 0 4px;
}

.c-title {
    font-size: 11px;
    font-weight: 800;
    color: #fde047;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.c-cost {
    font-size: 12px;
    font-weight: 900;
    color: #38bdf8;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-btn {
    padding: 7px 14px;
    background: rgba(8, 20, 36, 0.94);
    border: 1.5px solid rgba(14, 165, 233, 0.35);
    border-radius: 24px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
}

.toggle-btn.btn-active {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-color: #34d399;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.5);
}

/* ─── Boss Alert Banner ─── */

#boss-alert {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 50;
    pointer-events: none;
    animation: bossPulse 1s infinite alternate;
}

.boss-alert-hidden {
    display: none !important;
}

.boss-warning-glow {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: #EF4444;
    letter-spacing: 3px;
    text-shadow: 0 0 20px #EF4444;
}

.boss-title {
    font-size: 36px;
    font-weight: 900;
    color: #FCD34D;
    text-shadow: 0 0 30px #F59E0B;
    margin-top: 4px;
}

@keyframes bossPulse {
    from { transform: translate(-50%, -50%) scale(0.95); }
    to { transform: translate(-50%, -50%) scale(1.05); }
}

/* ─── PORTRAIT ORIENTATION WARNING OVERLAY (MOBILE RESPONSIVE) ─── */
#portrait-warning-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

@media (orientation: portrait), (max-aspect-ratio: 1/1) {
    #portrait-warning-overlay {
        display: flex;
    }
}

.portrait-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 380px;
}

.rotate-phone-anim {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-symbol {
    font-size: 54px;
    animation: rotatePhone 2.2s infinite ease-in-out;
}

.rotate-symbol {
    position: absolute;
    bottom: -6px;
    right: -6px;
    font-size: 26px;
    animation: spinClockwise 2.2s infinite linear;
}

@keyframes rotatePhone {
    0%, 20% { transform: rotate(0deg); }
    50%, 80% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
}

@keyframes spinClockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.portrait-title {
    font-size: 20px;
    font-weight: 900;
    color: #f59e0b;
    text-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
    letter-spacing: 1px;
}

.portrait-sub {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
    font-weight: 500;
}

/* Tối ưu hóa Touch trên Mobile ở chế độ ngang (Landscape) */
@media (max-height: 640px) {
    #game-header {
        top: max(4px, env(safe-area-inset-top));
        left: max(8px, env(safe-area-inset-left));
        right: max(8px, env(safe-area-inset-right));
        padding: 0 8px;
    }
    .logo-badge {
        padding: 3px 8px;
        gap: 6px;
        max-width: calc(100vw - 104px);
    }
    .logo-text {
        font-size: 10px;
    }
    .room-info {
        padding: 3px 8px;
        font-size: 10px;
    }
    .icon-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* Ghế ngồi thu gọn vừa vặn chống đè */
    .seat-panel {
        padding: 3px 6px;
        gap: 5px;
        border-radius: 10px;
    }
    .player-avatar-wrap img {
        width: 28px;
        height: 28px;
    }
    .player-name {
        font-size: 10px;
        max-width: 70px;
    }
    .player-balance-tag {
        font-size: 11px;
    }
    .seat-top-left {
        top: max(32px, calc(env(safe-area-inset-top) + 28px));
        left: max(6px, env(safe-area-inset-left));
    }
    .seat-top-right {
        top: max(32px, calc(env(safe-area-inset-top) + 28px));
        right: max(6px, env(safe-area-inset-right));
    }
    .seat-bottom-left {
        bottom: max(4px, env(safe-area-inset-bottom));
        left: max(6px, env(safe-area-inset-left));
    }
    .seat-bottom-right {
        bottom: max(4px, env(safe-area-inset-bottom));
        right: max(6px, env(safe-area-inset-right));
    }

    #player-controls {
        bottom: max(4px, env(safe-area-inset-bottom));
        gap: 6px;
    }
    .special-weapon-dock {
        right: max(8px, env(safe-area-inset-right));
        bottom: max(64px, calc(env(safe-area-inset-bottom) + 58px));
        gap: 6px;
    }
    .special-weapon-btn {
        width: 44px;
        height: 44px;
    }
    .special-icon {
        font-size: 18px;
        line-height: 32px;
    }
    .special-cost {
        min-width: 24px;
        height: 16px;
        font-size: 9px;
        line-height: 15px;
    }
    .cannon-selector {
        padding: 2px 8px;
    }
    .cannon-display {
        min-width: 112px;
        max-width: 138px;
        padding: 0 8px;
    }
    .ctrl-btn {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }
    .c-title {
        font-size: 10px;
    }
    .c-cost {
        font-size: 9px;
        white-space: normal;
        line-height: 1.15;
    }
    .toggle-btn {
        padding: 4px 8px;
        font-size: 9px;
    }
}
