/* Invite System */
.invite-controls {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.active-codes-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.code-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease-out;
}

.code-entry strong {
    color: var(--accent-light);
    letter-spacing: 1px;
    font-size: 1.1rem;
}

.code-entry span:last-child {
    font-size: 0.8rem;
    opacity: 0.7;
}

#btn-lobby-return {
    background: linear-gradient(135deg, #ff5f6d 0%, #ffc371 100%);
    color: white;
    margin-top: 10px;
}

#btn-lobby-return:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 95, 109, 0.4);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.active-codes-list::-webkit-scrollbar {
    width: 6px;
}

.active-codes-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ================== WIZARD CAROUSEL ================== */
.lobby-carousel-viewport {
    position: relative;
    width: 100%;
    max-width: 550px;
    height: clamp(350px, 75dvh, 900px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    perspective: 1500px;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
}


.stellar-carousel {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    -webkit-user-select: none;
    user-select: none;
}

#lobby-setup-carousel {
    transform: translateZ(-500px);
}

.lobby-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 8px;
    flex-shrink: 0;
    margin-top: 0.75rem;
    z-index: 20;
}

#lobby-setup-carousel .stellar-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-sizing: border-box;
    overflow-y: auto;
    text-align: center;
    transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.45s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    backface-visibility: hidden;
    will-change: transform, opacity;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y;
}



#lobby-setup-carousel .stellar-slide.active {
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    background: var(--bg-color); /* Ensure front panel is opaque to hide side panels */
    z-index: 50;
}

.stellar-slide::-webkit-scrollbar {
    width: 6px;
}

.stellar-slide::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.4);
    border-radius: 4px;
}

#lobby-setup-carousel .stellar-slide .input-group {
    width: 100%;
    margin-top: 1rem;
}

.setup-card h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 400;
}

/* Setup Roles */
.role-selection {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 5px;
    border-radius: 12px;
}

.dark-mode .role-selection,
.vibrant .role-selection {
    background: rgba(255, 255, 255, 0.05);
}

.role-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-color);
    font-weight: 600;
}

.role-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.role-panel {
    display: none;
    flex-direction: column;
    animation: fade-in 0.3s;
}

.role-panel.show {
    display: flex;
}

.host-id-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.05);
    padding: 10px 15px;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.dark-mode .host-id-box,
.vibrant .host-id-box {
    background: rgba(255, 255, 255, 0.05);
}

.small-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.id-display {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 2px;
}

#btn-force-start {
    margin-top: 5px;
    border-color: #e67e22;
    color: #e67e22;
}

/* ================== TEAM LOBBY SCREEN ================== */
.lobby-welcome {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.lobby-name-group {
    max-width: 250px;
    margin: 0 auto 2rem auto;
    text-align: center;
}

.lobby-card {
    max-height: 80vh;
}

.team-selection-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
    margin-top: 10px;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.team-selection-list::-webkit-scrollbar {
    width: 6px;
}

.team-selection-list::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.2);
    border-radius: 3px;
}

.team-item {
    background: rgba(0, 0, 0, 0.05);
    padding: 15px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.dark-mode .team-item,
.vibrant .team-item {
    background: rgba(255, 255, 255, 0.05);
}

.team-item.joined {
    border-color: var(--primary);
    background: rgba(216, 27, 96, 0.1);
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-name-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(128, 128, 128, 0.3);
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 2px 5px;
    width: 60%;
    font-family: inherit;
    outline: none;
}

.team-member-count {
    font-size: 0.85rem;
    opacity: 0.7;
}

.btn-join-team {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    font-size: 0.9rem;
}

.btn-join-team:disabled {
    background: rgba(128, 128, 128, 0.3);
    color: rgba(255, 255, 255, 0.5);
    cursor: default;
}

.btn-ready-team {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 0.9rem;
    transition: all 0.2s;
    width: 100%;
    margin-top: 5px;
}

.btn-ready-team.ready {
    background: #27ae60;
    border-color: #27ae60;
    color: white;
}

.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    margin-bottom: 10px;
}

/* ================== FRIENDS RADAR ================== */
#friends-radar-list::-webkit-scrollbar {
    width: 6px;
}

#friends-radar-list::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.4);
    border-radius: 4px;
}

.radar-item {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.dark-mode .radar-item,
.vibrant .radar-item {
    background: rgba(255, 255, 255, 0.05);
}

.radar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.radar-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.radar-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.radar-status.offline {
    background: rgba(128, 128, 128, 0.2);
    color: var(--text-color);
    opacity: 0.7;
}

.radar-status.online {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.radar-status.hosting {
    background: rgba(142, 68, 173, 0.2);
    color: #8e44ad;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.offline {
    background: gray;
}

.status-dot.online {
    background: #27ae60;
    box-shadow: 0 0 5px #27ae60;
}

.status-dot.hosting {
    background: #8e44ad;
    box-shadow: 0 0 5px #8e44ad;
}

/* ================== ABOUT MODAL ================== */
.about-modal-content {
    width: 95%;
    max-width: 850px;
    height: 85vh;
    max-height: 800px;
    padding: 28px 16px 24px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    align-self: center;
}

.about-close-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    color: var(--text-color);
    opacity: 0.6;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: opacity 0.2s;
}

.about-close-btn:hover {
    opacity: 1;
}

.about-header-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.about-header {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.about-logo-img {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.about-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.about-subtitle {
    font-size: 0.85rem;
    opacity: 0.65;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

#about-carousel-container {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    min-height: 0;
}

#about-stellar-carousel {
    position: relative;
    flex: 1;
    min-height: 280px;
    perspective: 900px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stellar-slide {
    position: absolute;
    width: clamp(260px, 65vw, 400px);
    height: 90%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.45s ease, box-shadow 0.3s ease;
    backface-visibility: hidden;
    will-change: transform, opacity;
    touch-action: pan-y;
    overflow-y: auto;
}

.stellar-slide.active {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    border-color: var(--primary);
    background: var(--bg-color); /* Solid background for active slide */
    z-index: 50;
}

.stellar-slide-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.stellar-slide-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
}

.stellar-slide-desc {
    font-size: 0.78rem;
    opacity: 0.75;
    line-height: 1.4;
}

/* Desktop Typography for Navigator Modals */
@media (min-width: 768px) and (min-height: 600px) {
    .about-title {
        font-size: 2rem;
    }
    .about-subtitle {
        font-size: 1rem;
    }
    .about-header-icon {
        font-size: 2rem;
    }
    .stellar-slide-icon {
        font-size: 3rem;
    }
    .stellar-slide-title {
        font-size: 1.3rem;
    }
    .stellar-slide-desc {
        font-size: 1.05rem;
        line-height: 1.5;
    }
}

#about-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.about-nav-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.about-nav-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

#about-dot-nav {
    display: flex;
    gap: 7px;
}

#lobby-dot-nav {
    display: flex;
    gap: 14px;
}

.stellar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}

#lobby-dot-nav .stellar-dot {
    width: 14px;
    height: 14px;
}

.stellar-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}

.about-dismiss-btn {
    width: 80%;
    max-width: 220px;
    margin-top: 4px;
    background: var(--primary);
    color: #fff;
    border-radius: 30px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: background 0.2s, transform 0.15s;
}

.about-dismiss-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ================== COMPACT LANDSCAPE ================== */
@media (max-height: 500px) {
    .app-header {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .about-modal-content {
        padding: 15px 10px 10px;
    }

    .about-logo-img {
        width: 50px;
        height: 50px;
        margin-bottom: 5px;
    }

    .about-title {
        font-size: 1.2rem;
    }

    .stellar-slide {
        padding: 10px;
    }

    #about-stellar-carousel {
        min-height: 120px;
    }
}
/* Re-enable selection for specific elements */
#lobby-player-name-input, #lobby-join-id-input, .id-display, .stellar-slide-desc a {
    -webkit-user-select: text;
    user-select: text;
}

/* ================== COMPACT LANDSCAPE ================== */
@media (max-height: 550px) {
    .lobby-carousel-viewport {
        height: 85dvh;
    }

    .lobby-carousel-controls {
        position: absolute;
        bottom: 25px;
        left: 20px;
        right: 20px;
        width: auto;
        margin-top: 0;
        pointer-events: none;
        z-index: 100;
        display: flex;
        justify-content: space-between;
    }

    .lobby-carousel-controls button {
        pointer-events: auto;
        background: rgba(128, 128, 128, 0.4);
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #lobby-dot-nav {
        display: none !important;
    }

    .app-header {
        margin-top: 0.2rem;
        margin-bottom: 0.2rem;
    }

    .app-header h1 {
        font-size: 1.3rem;
    }

    .stellar-slide {
        padding: 10px !important;
    }

    .input-group {
        margin-top: 0.4rem !important;
    }
    
    .role-selection {
        margin-bottom: 0.5rem !important;
    }
}
