/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
    background-color: #000000;
    color: rgba(255, 255, 255, 1);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    letter-spacing: 0.01em;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Logo */
.logo {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 100;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.2s forwards;
}

.logo img {
    height: 32px;
    width: auto;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.logo:hover img {
    opacity: 0.9;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    justify-content: center;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 6rem;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.4s forwards;
}

.title {
    font-size: 3.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 1);
    line-height: 1.1;
}

.subtitle {
    font-size: 0.75rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-top: 0.5rem;
}

/* Selection Grid - 5x2 Layout */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3rem 4rem;
    max-width: 1400px;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.6s forwards;
    padding: 0 2rem;
}

/* App Nodes */
.app-node {
    display: none; /* Hidden by default, shown by Firebase */
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
}

/* Animation delays removed - controlled by Firebase */

/* Node Core */
.node-core {
    position: relative;
    width: 90px;
    height: 90px;
    margin-bottom: 1.75rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Node Ring */
.node-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Node Avatar */
.node-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    overflow: hidden;
    border: 2.5px solid rgba(255, 255, 255, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.node-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    opacity: 0.85;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    filter: contrast(1.1) saturate(1.1);
}

/* Node Labels */
.node-label {
    text-align: center;
    transition: all 0.3s ease;
}

.app-name {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.25rem;
    letter-spacing: 0.02em;
}

.creator-name {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.05em;
}

/* Hover Effects */
.app-node:hover {
    transform: translateY(-4px);
}

.app-node:hover .node-core {
    transform: scale(1.08);
}

.app-node:hover .node-ring {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 4px 16px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.app-node:hover .node-avatar {
    border-color: rgba(255, 255, 255, 0.35);
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        0 0 0 4px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.app-node:hover .node-avatar img {
    opacity: 1;
    filter: contrast(1.2) saturate(1.2) brightness(1.1);
}

.app-node:hover .app-name {
    color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.app-node:hover .creator-name {
    color: rgba(255, 255, 255, 0.7);
    transform: translateY(-1px);
}

/* Active/Selected State */
.app-node.active .node-ring {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.app-node.active .node-avatar {
    border-color: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%) scale(1.1);
}

.app-node.active .node-avatar img {
    opacity: 1;
}


/* Credits */
.credits {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    opacity: 0;
    animation: fadeIn 0.8s ease 1.8s forwards;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.credits span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.1em;
}

.year {
    font-size: 0.65rem !important;
    color: rgba(255, 255, 255, 0.2) !important;
}

/* Profile Modal */
.profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.profile-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
}

.modal-content {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    max-width: 400px;
    width: 90%;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.profile-modal.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.close-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
}

.profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.profile-image img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.profile-image img:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.profile-description {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 1.5rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.profile-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.profile-link, .launch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 300;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
}

.profile-link {
    color: rgba(255, 255, 255, 0.7);
}

.profile-link:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.launch-btn {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    font-weight: 400;
}

.launch-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 15% 25%, rgba(255, 255, 255, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 85% 75%, rgba(255, 255, 255, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 10%, rgba(255, 255, 255, 0.015) 0%, transparent 70%),
        radial-gradient(ellipse at 30% 90%, rgba(255, 255, 255, 0.015) 0%, transparent 70%);
    z-index: 1;
    opacity: 0;
    animation: bgPulse 25s ease-in-out infinite;
}

/* Animations */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bgPulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1) rotate(0deg);
    }
    33% {
        opacity: 0.6;
        transform: scale(1.02) rotate(0.5deg);
    }
    66% {
        opacity: 0.8;
        transform: scale(0.98) rotate(-0.5deg);
    }
}

/* Loading State */
.loading {
    margin-top: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    animation: pulse 1.5s ease-in-out infinite;
    letter-spacing: 0.05em;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Selection States */
::selection {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Focus States for Accessibility */
.app-node:focus {
    outline: 2px solid rgba(255, 255, 255, 0.15);
    outline-offset: 8px;
    border-radius: 50%;
}

.app-node:focus:not(:focus-visible) {
    outline: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .selection-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.5rem 3rem;
        max-width: 1000px;
    }
}

@media (max-width: 900px) {
    .container {
        padding: 6rem 1.5rem 3rem;
    }
    
    .title {
        font-size: 2.8rem;
    }
    
    .selection-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem 3rem;
        max-width: 750px;
        padding: 0 1rem;
    }
    
    .node-core {
        width: 80px;
        height: 80px;
        margin-bottom: 1.5rem;
    }
    
    .node-avatar {
        width: 48px;
        height: 48px;
        border-width: 2px;
    }
    
    .modal-content {
        padding: 1.5rem;
        max-width: 350px;
    }
    
    .profile-image img {
        width: 70px;
        height: 70px;
    }
    
    .profile-name {
        font-size: 1.25rem;
    }
    
    .profile-links {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .profile-link, .launch-btn {
        padding: 0.65rem 1rem;
        font-size: 0.7rem;
    }
    
    .logo {
        top: 1.5rem;
        left: 1.5rem;
    }
    
    .logo img {
        height: 28px;
    }
    
    
    .credits {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

@media (max-width: 600px) {
    .selection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem 2.5rem;
        max-width: 450px;
        padding: 0 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 4rem 1rem 2rem;
    }
    
    .title {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 0.7rem;
    }
    
    .selection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.75rem 2rem;
        max-width: 350px;
        padding: 0;
    }
    
    .node-core {
        width: 70px;
        height: 70px;
        margin-bottom: 1.25rem;
    }
    
    .node-avatar {
        width: 42px;
        height: 42px;
        border-width: 2px;
    }
    
    .app-name {
        font-size: 0.7rem;
    }
    
    .creator-name {
        font-size: 0.6rem;
    }
    
    .modal-content {
        padding: 1.25rem;
        max-width: 320px;
    }
    
    .profile-image img {
        width: 60px;
        height: 60px;
    }
    
    .profile-name {
        font-size: 1.1rem;
    }
    
    .profile-links {
        gap: 0.5rem;
    }
    
    .profile-link, .launch-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.65rem;
    }
    
    .logo {
        top: 1rem;
        left: 1rem;
    }
    
    .logo img {
        height: 24px;
    }
    
    
    .credits {
        bottom: 1rem;
        right: 1rem;
    }
    
    .credits span {
        font-size: 0.65rem;
    }
    
    .year {
        font-size: 0.6rem !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .node-ring {
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .app-node:hover .node-ring {
        border-color: rgba(255, 255, 255, 0.4);
    }
    
    .app-name {
        color: rgba(255, 255, 255, 1);
    }
    
    .creator-name {
        color: rgba(255, 255, 255, 0.6);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .bg-animation {
        animation: none;
        opacity: 0.3;
    }
}