.chaotic-container {
    margin-top: 20px;
    padding: 20px;
}

.chaotic-header {
    background: url('../assets/images/ranking_bg.jpg') no-repeat center center;
    background-size: cover;
    text-align: center;
    border-radius: 10px;
    border: 2px solid rgba(255, 215, 0, 0.8);
    box-shadow: 0px 4px 15px rgba(255, 215, 0, 0.3);
    padding: 30px 20px;
    margin-bottom: 30px;
}

.chaotic-header h2 {
    font-size: 32px;
    color: #ffd700;
    text-transform: uppercase;
    text-shadow: 0px 0px 10px rgba(255, 215, 0, 1);
    margin-bottom: 10px;
}

.chaotic-content {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

.items-selector {
    flex: 1;
    background: linear-gradient(145deg, rgba(20, 20, 40, 0.95), rgba(10, 10, 30, 0.95));
    border-radius: 15px;
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
    padding: 25px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 2px rgba(255, 215, 0, 0.1);
}

.items-selector::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        #ffd700, 
        #ff6b35, 
        #f7931e, 
        #ffd700
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    z-index: -1;
    border-radius: 15px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.items-selector-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.items-selector-header h3 {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin: 0;
}

.items-selector-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin: 8px 0 0 0;
    font-style: italic;
}

.fragment-details {
    flex: 1;
    background: linear-gradient(145deg, rgba(20, 20, 40, 0.95), rgba(10, 10, 30, 0.95));
    border-radius: 15px;
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
    transition: opacity 0.2s ease;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 2px rgba(255, 215, 0, 0.1);
}

.fragment-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        #ffd700, 
        #ff6b35, 
        #f7931e, 
        #ffd700
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    z-index: -1;
    border-radius: 15px;
}

.fragment-details.loading {
    opacity: 0.7;
}

.fragment-details-header {
    text-align: center;
    padding: 25px 25px 20px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    background: rgba(0, 0, 0, 0.3);
    margin: 0;
}

.fragment-details-header h3 {
    color: #ffd700;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin: 0 0 8px 0;
}

.fragment-details-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin: 0;
    font-style: italic;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 15px;
    max-height: 520px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.items-grid::-webkit-scrollbar {
    width: 12px;
}

.items-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.items-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffd700, #ff8c00);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.items-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ffed4e, #ffa500);
}

.item-slot {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, rgba(30, 30, 50, 0.9), rgba(10, 10, 20, 0.9));
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.item-slot::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transform: rotate(45deg);
    transition: transform 0.6s ease;
    opacity: 0;
}

.item-slot:hover::before {
    transform: rotate(45deg) translateX(100%);
    opacity: 1;
}

.item-slot:hover {
    border-color: #ffd700;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 40px rgba(255, 215, 0, 0.3),
        inset 0 1px 2px rgba(255, 215, 0, 0.2);
    transform: translateY(-3px) scale(1.05);
    background: linear-gradient(145deg, rgba(40, 40, 60, 0.9), rgba(20, 20, 30, 0.9));
}

.item-slot.selected {
    border: 3px solid #00ff88;
    box-shadow: 
        0 0 25px rgba(0, 255, 136, 0.8),
        0 0 50px rgba(0, 255, 136, 0.4),
        inset 0 0 20px rgba(0, 255, 136, 0.1);
    background: linear-gradient(145deg, rgba(0, 60, 40, 0.9), rgba(0, 40, 20, 0.9));
    transform: translateY(-5px) scale(1.1);
    animation: selectedPulse 2s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 
            0 0 25px rgba(0, 255, 136, 0.8),
            0 0 50px rgba(0, 255, 136, 0.4);
    }
    50% {
        box-shadow: 
            0 0 35px rgba(0, 255, 136, 1),
            0 0 70px rgba(0, 255, 136, 0.6);
    }
}

.item-slot.selected:hover {
    border-color: #00ffaa;
    box-shadow: 
        0 0 30px rgba(0, 255, 170, 0.9),
        0 0 60px rgba(0, 255, 170, 0.5);
}

.item-slot img {
    max-width: 55px;
    max-height: 55px;
    border-radius: 8px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
}

.item-slot:hover img {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8)) brightness(1.2);
    transform: scale(1.05);
}

.item-slot.selected img {
    filter: drop-shadow(0 0 15px rgba(0, 255, 136, 0.8)) brightness(1.3);
}

.fragment-table {
    width: 100%;
    color: #fff;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.fragment-table thead th {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 140, 0, 0.8));
    color: #000;
    padding: 18px 12px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid rgba(255, 215, 0, 0.6);
    position: relative;
}

.fragment-table thead th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.fragment-table tbody tr {
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.fragment-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

.fragment-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.1));
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.fragment-table td {
    padding: 15px 12px;
    text-align: center;
    vertical-align: middle;
    position: relative;
}

.fragment-table td:first-child {
    border-left: 3px solid transparent;
    transition: border-color 0.3s ease;
}

.fragment-table tbody tr:hover td:first-child {
    border-left-color: #ffd700;
}

.fragment-item {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.fragment-item img {
    max-width: 40px;
    max-height: 40px;
    border: 2px solid #ffd700;
    border-radius: 8px;
    margin-right: 8px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.4));
}

.fragment-item:hover img {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    border-color: #ffed4e;
}

.drop-rate {
    color: #00ff88;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.5);
    padding: 4px 8px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 5px;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.source-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

.source-item img {
    max-width: 45px;
    max-height: 45px;
    border: 2px solid #ffd700;
    border-radius: 8px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.4));
}

.source-item:hover img {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

.scrollable-content {
    max-height: 790px;
    overflow-y: auto;
    padding: 0 25px 25px;
}

.scrollable-content::-webkit-scrollbar {
    width: 12px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin: 10px 0;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffd700, #ff8c00);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.scrollable-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ffed4e, #ffa500);
}

.empty-state {
    text-align: center;
    padding: 80px 30px;
    color: #888;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin: 20px;
    border: 1px solid rgba(255, 215, 0, 0.1);
}

.empty-state i {
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.empty-state h4 {
    margin: 20px 0 15px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.empty-state p {
    font-size: 16px;
    line-height: 1.5;
}

.empty-state small {
    font-size: 13px;
    opacity: 0.8;
}

.fragment-loading-state {
    text-align: center;
    padding: 80px 30px;
    background: rgba(15, 15, 25, 0.8);
    border-radius: 15px;
    margin: 20px;
    border: 1px solid rgba(100, 100, 120, 0.3);
    position: relative;
    overflow: hidden;
}

.fragment-loading-state::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(150, 120, 80, 0.15), transparent);
    animation: shimmerSweep 2s linear infinite;
}

@keyframes shimmerSweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

.loading-orb {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-core {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #c8a882, #a68660);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(200, 168, 130, 0.6);
    animation: orbPulse 1.5s ease-in-out infinite alternate;
    z-index: 3;
}

.orb-ring {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 2px solid rgba(150, 130, 100, 0.4);
    border-top-color: rgba(180, 150, 120, 0.7);
    border-radius: 50%;
    animation: orbRotate 2s linear infinite;
    z-index: 2;
}

.orb-ring-2 {
    position: absolute;
    width: 70px;
    height: 70px;
    border: 1px solid rgba(120, 100, 80, 0.3);
    border-right-color: rgba(160, 140, 110, 0.6);
    border-radius: 50%;
    animation: orbRotate 3s linear infinite reverse;
    z-index: 1;
}

@keyframes orbPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(200, 168, 130, 0.6);
    }
    100% {
        transform: scale(1.2);
        box-shadow: 0 0 20px rgba(200, 168, 130, 0.8);
    }
}

@keyframes orbRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text h4 {
    color: #c8a882;
    font-size: 22px;
    margin: 0 0 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(200, 168, 130, 0.4);
    font-weight: bold;
}

.loading-text p {
    color: rgba(180, 180, 200, 0.8);
    font-size: 15px;
    margin: 0 0 20px;
    font-style: italic;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #a68660;
    border-radius: 50%;
    animation: dotBounce 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(166, 134, 96, 0.5);
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes dotBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-15px);
        opacity: 0.9;
        box-shadow: 0 0 12px rgba(166, 134, 96, 0.8);
    }
}

@media (max-width: 768px) {
    .chaotic-content {
        flex-direction: column;
    }
    
    .items-selector-header h3,
    .fragment-details-header h3 {
        font-size: 20px;
    }
    
    .items-selector-header,
    .fragment-details-header {
        padding: 20px 15px 15px;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 12px;
        max-height: 400px;
    }
    
    .item-slot {
        width: 60px;
        height: 60px;
    }
    
    .item-slot img {
        max-width: 45px;
        max-height: 45px;
    }
    
    .items-selector {
        margin-bottom: 20px;
    }
    
    .fragment-table thead th {
        padding: 12px 6px;
        font-size: 11px;
    }
    
    .fragment-table td {
        padding: 10px 6px;
    }
    
    .fragment-item img,
    .source-item img {
        max-width: 30px;
        max-height: 30px;
    }
    
    .drop-rate {
        font-size: 14px;
        padding: 3px 6px;
    }
    
    .scrollable-content {
        padding: 0 15px 20px;
    }
}

.items-grid-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.item-group {
    background: rgba(15, 15, 35, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.item-group:hover {
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}

.group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: bold;
    font-size: 14px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.group-header:hover {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.08) 100%);
}

.group-header .toggle-icon {
    margin-left: 5px;
    transition: transform 0.3s ease;
    font-size: 12px;
    opacity: 0.5;
}

.item-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.group-header i {
    font-size: 16px;
    animation: groupIconPulse 2s ease-in-out infinite;
}

@keyframes groupIconPulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 3px currentColor);
    }
    50% { 
        transform: scale(1.1);
        filter: drop-shadow(0 0 8px currentColor);
    }
}

.group-count {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.6;
    font-weight: normal;
}

.item-group .items-grid {
    padding: 15px;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    display: grid;
    transition: all 0.3s ease;
    max-height: 2000px;
    overflow: hidden;
}

.item-group.collapsed .items-grid {
    max-height: 0;
    padding: 0 15px;
    opacity: 0;
}

.item-group.collapsed {
    border-bottom-width: 0;
}

.item-slot[data-group="fragments"]:hover {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.item-slot[data-group="dark_fragments"]:hover {
    border-color: #8b00ff;
    box-shadow: 0 0 15px rgba(139, 0, 255, 0.5);
}

.item-slot[data-group="gems"]:hover {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

.item-slot[data-group="chests"]:hover {
    border-color: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
}

.item-slot[data-group="special_chests"]:hover {
    border-color: #9d4edd;
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.5);
}

.item-slot[data-group="fragments"].selected {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), inset 0 0 20px rgba(255, 215, 0, 0.2);
}

.item-slot[data-group="dark_fragments"].selected {
    border-color: #8b00ff;
    box-shadow: 0 0 20px rgba(139, 0, 255, 0.8), inset 0 0 20px rgba(139, 0, 255, 0.2);
}

.item-slot[data-group="gems"].selected {
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.8), inset 0 0 20px rgba(0, 212, 255, 0.2);
}

.item-slot[data-group="chests"].selected {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.8), inset 0 0 20px rgba(255, 107, 107, 0.2);
}

.item-slot[data-group="special_chests"].selected {
    border-color: #9d4edd;
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.8), inset 0 0 20px rgba(157, 78, 221, 0.2);
}

@media (max-width: 768px) {
    .item-group .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
        padding: 12px;
    }
    
    .group-header {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .group-header i {
        font-size: 14px;
    }
}

.item-tooltip {
    position: fixed;
    background: linear-gradient(135deg, 
        rgba(30, 25, 50, 0.98) 0%, 
        rgba(20, 15, 40, 0.98) 50%, 
        rgba(15, 10, 35, 0.98) 100%);
    color: #ffd700;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.3),
        0 0 60px rgba(255, 215, 0, 0.15),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        inset 0 -1px 1px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.8px;
    display: none;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(10px);
}

.item-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.item-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(255, 215, 0, 0.4);
}

.item-tooltip.bottom::after {
    top: -6px;
    bottom: auto;
    border-top: none;
    border-bottom: 6px solid rgba(255, 215, 0, 0.4);
}

.item-tooltip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 215, 0, 0.05) 50%,
        transparent 100%
    );
    border-radius: 10px;
    animation: tooltipShine 3s ease-in-out infinite;
}

@keyframes tooltipShine {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}