* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-tertiary: #252b48;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success: #10b981;
    --error: #ef4444;
    --shadow: rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1e1b4b 50%, #0a0e27 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: glowPulse 8s ease-in-out infinite;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 50%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-shadow: 0 0 40px rgba(59, 130, 246, 0.3);
    animation: titleGlow 3s ease-in-out infinite;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.card {
    background: rgba(26, 31, 58, 0.6);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow);
    animation: fadeInUp 0.8s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 70px var(--shadow);
}

.card-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon {
    width: 24px;
    height: 24px;
    display: inline-block;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

input[type="text"] {
    flex: 1;
    padding: 1rem 1.5rem;
    background: rgba(37, 43, 72, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: rgba(37, 43, 72, 0.8);
}

input[type="text"]::placeholder {
    color: var(--text-secondary);
}

input[type="number"],
select {
    padding: 0.75rem 1rem;
    background: rgba(37, 43, 72, 0.6);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
    width: 100%;
}

input[type="number"]:focus,
select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: rgba(37, 43, 72, 0.8);
}

.filters-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(37, 43, 72, 0.3);
    border-radius: 16px;
    border: 1px solid rgba(51, 65, 85, 0.5);
}

.filters-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.recent-profiles {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(37, 43, 72, 0.3);
    border-radius: 16px;
    border: 1px solid rgba(51, 65, 85, 0.5);
}

.recent-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-profiles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.recent-profile-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(26, 31, 58, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recent-profile-item:hover {
    background: rgba(26, 31, 58, 0.8);
    border-color: var(--accent-blue);
    transform: translateX(2px);
}

.recent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    flex-shrink: 0;
}

.recent-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.recent-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-id {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-add-icon {
    width: 18px;
    height: 18px;
    color: var(--accent-cyan);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.recent-profile-item:hover .recent-add-icon {
    transform: rotate(90deg);
    color: var(--accent-blue);
}

button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before {
    width: 300px;
    height: 300px;
}

button span {
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-add {
    background: var(--accent-blue);
    color: white;
}

.btn-add:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.btn-remove {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    padding: 0.5rem 1rem;
}

.btn-remove:hover {
    background: var(--error);
}

.btn-large {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.125rem;
}

.profile-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(37, 43, 72, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    animation: slideIn 0.4s ease-out;
}

.profile-item:hover {
    border-color: var(--accent-blue);
    background: rgba(37, 43, 72, 0.8);
    transform: translateX(4px);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--accent-blue);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    animation: avatarPulse 2s ease-in-out infinite;
}

.profile-details h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.profile-details p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.private-badge {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.8;
    animation: lockPulse 2s ease-in-out infinite;
}

.private-profile {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.05);
}

.private-profile:hover {
    border-color: rgba(251, 191, 36, 0.5);
}

.private-profile .profile-avatar {
    border-color: rgba(251, 191, 36, 0.6);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 3rem;
    animation: fadeIn 0.3s ease-out;
}

.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(59, 130, 246, 0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 8px;
    left: 8px;
}

.spinner-outer {
    width: 80px;
    height: 80px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-bottom-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1.5s linear infinite reverse;
    position: absolute;
    top: 0;
    left: 0;
}

.spinner-dots {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: spin 2s linear infinite;
}

.spinner-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-cyan);
    border-radius: 50%;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: dotPulse 1.5s ease-in-out infinite;
}

.spinner-dot:nth-child(2) {
    animation-delay: 0.3s;
    transform: translateX(-50%) rotate(90deg);
    transform-origin: 0 40px;
}

.spinner-dot:nth-child(3) {
    animation-delay: 0.6s;
    transform: translateX(-50%) rotate(180deg);
    transform-origin: 0 40px;
}

.spinner-dot:nth-child(4) {
    animation-delay: 0.9s;
    transform: translateX(-50%) rotate(270deg);
    transform-origin: 0 40px;
}

.loading-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    animation: textPulse 2s ease-in-out infinite;
}

.loading-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    opacity: 0.7;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.results-header h2 {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-count {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.5rem 1.25rem;
    border-radius: 12px;
    animation: countPop 0.5s ease-out;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: rgba(37, 43, 72, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0;
    transition: all 0.3s ease;
    color: inherit;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
    overflow: hidden;
}

.game-card:nth-child(1) { animation-delay: 0.05s; }
.game-card:nth-child(2) { animation-delay: 0.1s; }
.game-card:nth-child(3) { animation-delay: 0.15s; }
.game-card:nth-child(4) { animation-delay: 0.2s; }
.game-card:nth-child(5) { animation-delay: 0.25s; }
.game-card:nth-child(6) { animation-delay: 0.3s; }

.game-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.2);
}

.game-link {
    text-decoration: none;
    color: inherit;
    display: block;
    padding: 1.25rem;
}

.game-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-image {
    width: 80px;
    height: auto;
    border-radius: 8px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.game-card:hover .game-image {
    transform: scale(1.05);
}

.game-info {
    flex: 1;
}

.game-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.game-card:hover .game-name {
    color: var(--accent-blue);
}

.game-id {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.external-icon {
    color: var(--text-secondary);
    font-size: 1rem;
    transition: transform 0.3s ease;
    width: 20px;
    height: 20px;
}

.game-card:hover .external-icon {
    transform: translate(2px, -2px);
}

.game-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(59, 130, 246, 0.05);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 100px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.stat-highlight {
    color: var(--accent-cyan);
}

.stat-divider {
    color: var(--text-secondary);
    opacity: 0.5;
    font-size: 0.875rem;
}

.player-playtimes {
    padding: 1rem 1.25rem;
    background: rgba(37, 43, 72, 0.4);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-playtime {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: rgba(26, 31, 58, 0.5);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.player-playtime:hover {
    background: rgba(26, 31, 58, 0.8);
}

.player-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.playtime-header {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.playtime-header:first-child {
    margin-top: 0;
}

.playtime-badge {
    font-size: 0.875rem;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
}

.playtime-badge-recent {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: shake 0.5s ease-out;
}

.error-icon {
    color: var(--error);
    font-size: 1.5rem;
}

.error-message {
    color: #fca5a5;
}

.hidden {
    display: none !important;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes titleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.5));
    }
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
    }
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 0.3;
        transform: translateX(-50%) scale(0.8);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.2);
    }
}

@keyframes textPulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

@keyframes countPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes lockPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .container {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
