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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0f;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 119, 198, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(108, 99, 255, 0.08), transparent),
        radial-gradient(ellipse 50% 30% at 20% 80%, rgba(168, 85, 247, 0.06), transparent);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.search-section { margin: 60px 0 40px; }
.search-container {
    display: flex;
    gap: 12px;
    max-width: 650px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 18px 24px;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(15, 15, 25, 0.8);
    backdrop-filter: blur(20px);
    color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.search-input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.15),
                0 0 0 4px rgba(139, 92, 246, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}
.search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.search-button {
    padding: 18px 36px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 16px;
    color: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.search-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}
.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background-position: right center;
}
.search-button:hover::before {
    left: 100%;
}
.search-button:active {
    transform: translateY(0);
}
.search-button:disabled {
    background: linear-gradient(135deg, #2a2a3a 0%, #1a1a2a 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

.error-message {
    max-width: 600px;
    margin: 20px auto 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.1);
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 50px 0;
    flex-direction: column;
}
.loading-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.spinner {
    width: 50px;
    height: 50px;
    position: relative;
}
.spinner::before, .spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}
.spinner::before {
    border-top-color: #8b5cf6;
    border-right-color: rgba(139, 92, 246, 0.3);
    animation: spin 0.8s linear infinite;
}
.spinner::after {
    border-top-color: #a78bfa;
    border-right-color: rgba(167, 139, 250, 0.3);
    animation: spin 0.8s linear infinite reverse;
    inset: 6px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.results-section { margin: 50px 0; }
.results-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.results-header h2 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.results-count {
    padding: 6px 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(124, 58, 237, 0.15) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    color: #c4b5fd;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15);
}

.account-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 25px;
    align-items: start;
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.9) 0%, rgba(15, 15, 25, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

@media (max-width: 900px) {
    .account-card {
        grid-template-columns: 1fr;
    }
}
.account-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}
.account-name {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}
.account-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.meta-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-right: 4px;
}

.account-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.resources-sidebar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 15px;
    background: rgba(15, 15, 25, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 20px;
}

.resource-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.resource-icon-item:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: scale(1.05);
}

.resource-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.resource-count {
    font-size: 11px;
    font-weight: 600;
    color: #c4b5fd;
    text-align: center;
}

.resources-section {
    margin: 25px 0;
    padding: 24px;
    background: rgba(15, 15, 25, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.section-title {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}
.resource-item {
    padding: 16px;
    background: linear-gradient(145deg, rgba(26, 26, 46, 0.8) 0%, rgba(20, 20, 35, 0.9) 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.resource-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}
.resource-item:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.2);
}
.resource-item:hover::before {
    opacity: 1;
}
.resource-name {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: capitalize;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}
.resource-value {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, max-content));
    grid-auto-rows: 100px;
    row-gap: 8px;
    justify-items: center;
    align-items: start;
}
.character-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    background: transparent;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Rarity colors with glow effects */
.character-card.ancient .character-image {
    filter: drop-shadow(0 0 3px rgba(255, 51, 0, 0.5));
}
.character-card.legend .character-image {
    filter: drop-shadow(0 0 3px rgba(255, 204, 102, 0.5));
}
.character-card.mythic .character-image {
    filter: drop-shadow(0 0 3px rgba(255, 0, 255, 0.5));
}
.character-card.none .character-image {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.1));
}

.character-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border: none;
    border-radius: 0;
    background: transparent;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}
.character-card:hover .character-image {
    transform: scale(1.08);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.character-name {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.9);
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.character-card:hover .character-name {
    opacity: 1;
    bottom: calc(100% + 8px);
}

.character-type {
    display: none;
}

.no-results {
    text-align: center;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.4);
}
.no-results::before {
    content: '🔍';
    display: block;
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}
.hidden { display: none !important; }

@media (max-width: 768px) {
    body { padding: 15px; }
    .search-section { margin: 40px 0 30px; }
    .search-container {
        flex-direction: column;
        max-width: 100%;
    }
    .search-button {
        width: 100%;
        padding: 16px 24px;
    }
    .results-header h2 {
        font-size: 22px;
    }
    .account-name {
        font-size: 20px;
    }
    .account-card {
        padding: 20px;
    }
    .resources-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
    }
    .character-image {
        width: 60px;
        height: 60px;
        border-width: 1.5px;
    }
}

@media (max-width: 480px) {
    .resources-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .account-meta {
        flex-direction: column;
        gap: 8px;
    }
}
