/* Vòng Quay Container - Similar to Shop and Battle Pass */
.vongquay-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    pointer-events: none;
    overflow: hidden !important;
    /* Không cho phép scroll */
    /* Ẩn scrollbar hoàn toàn */
    scrollbar-width: none !important;
    /* Firefox */
    -ms-overflow-style: none !important;
    /* IE and Edge */
}

.vongquay-container::-webkit-scrollbar {
    display: none !important;
    /* Chrome, Safari, Opera */
    width: 0 !important;
    height: 0 !important;
}

.vongquay-container.active {
    display: flex;
    pointer-events: auto;
}

/* Disable touch controls when vongquay is open */
.vongquay-container.active~.touch-controls,
.vongquay-container.active+* .touch-controls,
body .vongquay-container.active~.touch-controls {
    pointer-events: none !important;
    z-index: 100 !important;
    opacity: 0.3;
}

.vongquay-container.active * {
    pointer-events: auto;
}

/* Vòng Quay Panel */
.vongquay-panel {
    background: transparent;
    border: none;
    box-shadow: none;
    width: min(600px, 95vw, 75vh);
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    /* Không cho phép scroll */
    position: relative;
    /* Ẩn scrollbar hoàn toàn */
    scrollbar-width: none !important;
    /* Firefox */
    -ms-overflow-style: none !important;
    /* IE and Edge */
}

.vongquay-panel::-webkit-scrollbar {
    display: none !important;
    /* Chrome, Safari, Opera */
    width: 0 !important;
    height: 0 !important;
}

/* Vòng Quay Header - Hidden, chỉ giữ nút close */
.vongquay-header {
    display: none;
}

.vongquay-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.vongquay-close img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
}

.vongquay-close {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.vongquay-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Tabs - Nhỏ, gọn và sát phía trên */
.vongquay-tabs {
    position: relative;
    display: flex;
    gap: 3px;
    padding: 0 6px;
    padding-top: 22px;
    /* đẩy lên gần sát nút close hơn nữa */
    justify-content: center;
    background: transparent;
    border: none;
    z-index: 5;
}

.vongquay-tab {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 2px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.vongquay-tab:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
}

.vongquay-tab.active {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.18);
}

/* Tab Content */
.vongquay-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.vongquay-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Vòng Quay Content */
.vongquay-content {
    padding: 30px;
    padding-top: 50px;
    /* Thêm padding top để tránh nút close che mất content */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
    /* Không cho phép scroll */
    flex: 1;
    /* Ẩn scrollbar hoàn toàn */
    scrollbar-width: none !important;
    /* Firefox */
    -ms-overflow-style: none !important;
    /* IE and Edge */
}

.vongquay-content::-webkit-scrollbar {
    display: none !important;
    /* Chrome, Safari, Opera */
    width: 0 !important;
    height: 0 !important;
}

/* Vòng Quay Wheel Container */
.vongquay-wheel-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    transform-origin: center center;
}

.vongquay-wheel-wrapper {
    position: relative;
    width: 75%;
    max-width: 350px;
    aspect-ratio: 1;
    height: auto;
}

.vongquay-wheel {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center center;
    z-index: 1;
}

/* No transition when not spinning to allow instant reset */
.vongquay-wheel:not(.spinning) {
    transition: none;
}

.vongquay-wheel.spinning {
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.vongquay-pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 10;
    transform: translate(-50%, -50%);
    width: 16%;
    aspect-ratio: 1;
    height: auto;
    object-fit: contain;
    z-index: 10;
    pointer-events: none;
}

/* Vòng Quay Items */
.vongquay-items {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    transform-origin: center center;
}

/* No transition when not spinning to allow instant reset */
.vongquay-items:not(.spinning) {
    transition: none;
}

.vongquay-items.spinning {
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.vongquay-item {
    position: absolute;
    width: 12%;
    aspect-ratio: 1;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    border-radius: 4px;
    /* Giống inventory */
    overflow: hidden;
    /* Đảm bảo background image không tràn ra ngoài */
}

.vongquay-item-frame {
    display: none;
    /* Ẩn frame mặc định, dùng background image rarity thay thế */
}

/* Rarity borders for items - giống inventory, dùng background image */
.vongquay-item {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.vongquay-item.rarity-common {
    background-image: url('../assets/icon/uiinventory/common.webp');
}

.vongquay-item.rarity-uncommon {
    background-image: url('../assets/icon/uiinventory/uncommon.webp');
}

.vongquay-item.rarity-rare {
    background-image: url('../assets/icon/uiinventory/rare.webp');
}

.vongquay-item.rarity-epic {
    background-image: url('../assets/icon/uiinventory/epic.webp');
}

.vongquay-item.rarity-legendary {
    background-image: url('../assets/icon/uiinventory/legendary.webp');
}

.vongquay-item.rarity-mythic {
    background-image: url('../assets/icon/uiinventory/mythic.webp');
}

/* Highlight effect for winning item */
.vongquay-item.winning {
    animation: vongquay-item-pulse 1s ease-in-out infinite;
    z-index: 100;
}

@keyframes vongquay-item-pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        filter: brightness(1) drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        filter: brightness(1.8) drop-shadow(0 0 20px rgba(255, 255, 0, 1));
    }
}

.vongquay-item-icon {
    width: 75%;
    aspect-ratio: 1;
    height: auto;
    object-fit: contain;
    z-index: 3;
    position: relative;
}

.vongquay-item-quantity {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: clamp(8px, 1vw, 10px);
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    z-index: 3;
    text-align: center;
    line-height: 1;
}

/* Spin Button */
.vongquay-spin-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 35%;
    min-width: 80px;
    max-width: 150px;
    aspect-ratio: 150 / 50;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.vongquay-spin-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.vongquay-spin-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: clamp(10px, 1.8vh, 16px);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

.vongquay-spin-cost {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffd700;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

.vongquay-spin-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.vongquay-spin-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.vongquay-spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vongquay-spin-btn:disabled img {
    filter: grayscale(50%);
}

.vongquay-spin-btn:disabled .vongquay-spin-text {
    opacity: 0.7;
}

/* Loading State */
.vongquay-loading {
    text-align: center;
    color: #fff;
    font-size: 16px;
    padding: 20px;
}

/* Result Modal (if needed) */
.vongquay-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 30px;
    z-index: 1000;
    text-align: center;
    color: #fff;
    display: none;
}

.vongquay-result.show {
    display: block;
    animation: vongquay-result-pop 0.5s ease;
}

@keyframes vongquay-result-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.vongquay-result h4 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #667eea;
}

.vongquay-result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.vongquay-result-item-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.vongquay-result-item-name {
    font-size: 18px;
    font-weight: bold;
}

.vongquay-result-item-quantity {
    font-size: 16px;
    color: #aaa;
}

/* Responsive removed: Using min() constraints natively */
.vongquay2-card-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    transform-origin: center center;
}

.vongquay2-card-wrapper {
    position: relative;
    width: 60%;
    max-width: 300px;
    aspect-ratio: 1;
    height: auto;
    perspective: 1000px;
}

.vongquay2-card {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
    cursor: pointer;
}

.vongquay2-card.flipping {
    animation: vongquay2-card-flip 0.8s ease-in-out;
}

.vongquay2-card.flipping-rotate {
    animation: vongquay2-card-rotate 0.8s ease-in-out;
}

@keyframes vongquay2-card-flip {
    0% {
        transform: rotateY(0deg) scale(1);
    }

    50% {
        transform: rotateY(180deg) scale(1.1);
    }

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

@keyframes vongquay2-card-rotate {
    0% {
        transform: rotate(0deg) scale(1);
    }

    25% {
        transform: rotate(-15deg) scale(1.05);
    }

    50% {
        transform: rotate(15deg) scale(1.1);
    }

    75% {
        transform: rotate(-10deg) scale(1.05);
    }

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

.vongquay2-item-frame {
    position: absolute;
    top: 40%;
    /* lên trên chút nữa */
    left: 50%;
    /* lệch qua phải chút */
    transform: translate(-50%, -50%);
    width: 18%;
    aspect-ratio: 1;
    height: auto;
    z-index: 10;
    display: none;
    /* mặc định ẩn, chỉ hiện khi đã lật */
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.vongquay2-item-icon {
    width: 71%;
    aspect-ratio: 1;
    height: auto;
    object-fit: contain;
    z-index: 11;
}

/* Rarity frame giống inventory cho vongquay2 */
.vongquay2-item-frame.rarity-common {
    background-image: url('../assets/icon/uiinventory/common.webp');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.vongquay2-item-frame.rarity-uncommon {
    background-image: url('../assets/icon/uiinventory/uncommon.webp');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.vongquay2-item-frame.rarity-rare {
    background-image: url('../assets/icon/uiinventory/rare.webp');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.vongquay2-item-frame.rarity-epic {
    background-image: url('../assets/icon/uiinventory/epic.webp');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.vongquay2-item-frame.rarity-legendary {
    background-image: url('../assets/icon/uiinventory/legendary.webp');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.vongquay2-item-frame.rarity-mythic {
    background-image: url('../assets/icon/uiinventory/mythic.webp');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

/* Vongquay2 Buttons */
.vongquay2-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.vongquay2-spin-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 45%;
    min-width: 80px;
    max-width: 150px;
    aspect-ratio: 150 / 50;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.vongquay2-spin-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.vongquay2-spin-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: clamp(10px, 1.8vh, 16px);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

.vongquay2-spin-cost {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffd700;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

.vongquay2-spin-ruby .vongquay2-spin-cost {
    color: #ff6b9d;
}

.vongquay2-spin-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.vongquay2-spin-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.vongquay2-spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vongquay2-spin-btn:disabled img {
    filter: grayscale(50%);
}

.vongquay2-spin-btn:disabled .vongquay2-spin-text {
    opacity: 0.7;
}

/* Responsive adjusted */
@media (max-width: 480px) {
    .vongquay-tabs {
        padding: 5px;
        padding-top: 25px;
    }
    .vongquay-tab {
        padding: 4px 10px;
        font-size: 12px;
    }
}